:root {
  --ink: #161B22;
  --ink-2: #212832;
  --ink-3: #2B333F;
  --panel: #FFFFFF;
  --canvas: #F1F4F8;
  --line: #E1E5EA;
  --muted: #4B5563;
  --soft: #64748B;
  --text: #161B22;
  --cyan: #0891B2;
  --cyan-dark: #0E7490;
  --cyan-soft: #E0F5F8;
  --green: #15803D;
  --green-soft: #DCFCE7;
  --amber: #B45309;
  --amber-soft: #FEF3C7;
  --red: #B91C1C;
  --red-soft: #FEE2E2;
  --sky: #2B6CB0;
  --sky-soft: #E7F3FB;
  --orange: #C05621;
  --orange-soft: #FFF1E6;
  --shadow: 0 10px 30px rgba(22, 27, 34, 0.08);
  --radius: 14px;
  --font: "DM Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--canvas);
}

a { color: inherit; text-decoration: none; }

.app-body { background: var(--canvas); }

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, var(--ink) 0%, #12171d 100%);
  color: #F1F4F8;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  border-right: 1px solid rgba(255,255,255,0.04);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px;
}

.brand-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.3;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.topbar-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px 14px;
  margin-left: auto;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 6px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #F8FAFB;
  box-shadow: 0 1px 2px rgba(22, 27, 34, 0.04);
}

.header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--cyan), var(--cyan-dark));
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 10px rgba(8, 145, 178, 0.28);
}

.header-user-meta {
  display: grid;
  gap: 0;
  min-width: 0;
  padding-right: 4px;
}

.header-user-hello {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-2);
  line-height: 1.2;
}

.header-user-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-user-role {
  font-size: 11px;
  font-weight: 700;
  color: var(--cyan-dark);
  line-height: 1.2;
}

.header-logout-form {
  margin: 0;
  padding-left: 4px;
  border-left: 1px solid var(--line);
}

.btn-header-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}

.btn-header-logout-icon {
  font-size: 13px;
  line-height: 1;
  opacity: 0.85;
}

.btn-header-logout:hover {
  background: #FEE2E2;
  color: #B91C1C;
}

.nav-section { display: grid; gap: 6px; }

.nav-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #8B94A3;
  padding: 0 10px 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 10px;
  color: #DDE3EA;
  transition: background .2s ease, color .2s ease, transform .2s ease;
}

.nav-link:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
  transform: translateX(2px);
}

.nav-link.active {
  background: rgba(8, 145, 178, 0.18);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(8, 145, 178, 0.35);
}

.nav-icon { width: 18px; opacity: 0.85; }

.sidebar-head { display: contents; }
.sidebar-close, .menu-toggle, .sidebar-backdrop { display: none; }

.main-area {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 12;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 72px;
  padding: 14px 28px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7), 0 8px 24px rgba(22, 27, 34, 0.04);
}

.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 2px;
}

.page-title {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.content {
  padding: 14px 28px 16px;
  display: grid;
  gap: 14px;
  flex: 1;
  align-content: start;
  align-items: start;
  justify-items: stretch;
}

.content > .panel {
  width: 100%;
}

.app-footer {
  margin-top: auto;
  padding: 12px 28px 16px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.stat-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 56px;
  min-height: 56px;
  max-height: 56px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(22, 27, 34, 0.04), 0 6px 14px rgba(22, 27, 34, 0.04);
  position: relative;
  overflow: hidden;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  box-sizing: border-box;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.stat-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #CBD5E1;
}

.stat-card.amber::before { background: #F59E0B; }
.stat-card.green::before { background: #22C55E; }
.stat-card.accent::before,
.stat-card:not(.amber):not(.green)::before { background: var(--cyan); }

.stat-card:hover {
  border-color: #B8C2CE;
  background: #F8FAFB;
  box-shadow: 0 1px 2px rgba(22, 27, 34, 0.04), 0 6px 14px rgba(22, 27, 34, 0.04);
}

.stat-card.amber:hover {
  border-color: #FDBA74;
  background: #FFFBF5;
}

.stat-card.green:hover {
  border-color: #86EFAC;
  background: #F7FDF9;
}

.stat-card.accent:hover,
.stat-card:not(.amber):not(.green):hover {
  border-color: #7DD3E8;
  background: #F5FBFC;
}

.stat-card:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px rgba(8, 145, 178, 0.35), 0 1px 2px rgba(22, 27, 34, 0.04), 0 6px 14px rgba(22, 27, 34, 0.04);
}

.stat-card.is-active {
  border-color: var(--cyan);
  background: #F0FBFD;
  box-shadow: inset 0 0 0 1px rgba(8, 145, 178, 0.35), 0 1px 2px rgba(22, 27, 34, 0.04), 0 6px 14px rgba(22, 27, 34, 0.04);
}

.stat-card.amber.is-active {
  border-color: #D97706;
  background: #FFF7ED;
  box-shadow: inset 0 0 0 1px rgba(217, 119, 6, 0.35), 0 1px 2px rgba(22, 27, 34, 0.04), 0 6px 14px rgba(22, 27, 34, 0.04);
}

.stat-card.green.is-active {
  border-color: #16A34A;
  background: #ECFDF5;
  box-shadow: inset 0 0 0 1px rgba(22, 163, 74, 0.35), 0 1px 2px rgba(22, 27, 34, 0.04), 0 6px 14px rgba(22, 27, 34, 0.04);
}

.stat-card.accent.is-active {
  border-color: var(--cyan);
  background: #E8F9FC;
  box-shadow: inset 0 0 0 1px rgba(8, 145, 178, 0.35), 0 1px 2px rgba(22, 27, 34, 0.04), 0 6px 14px rgba(22, 27, 34, 0.04);
}

.stat-icon {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: #E0F5F8;
  color: var(--cyan-dark);
  font-size: 13px;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(8, 145, 178, 0.08);
}

.stat-card.amber .stat-icon {
  background: #FFF7ED;
  color: #C2410C;
  box-shadow: inset 0 0 0 1px rgba(217, 119, 6, 0.1);
}

.stat-card.green .stat-icon {
  background: #ECFDF5;
  color: #15803D;
  box-shadow: inset 0 0 0 1px rgba(22, 163, 74, 0.1);
}

.stat-card.accent .stat-icon {
  background: #E0F5F8;
  color: var(--cyan-dark);
  box-shadow: inset 0 0 0 1px rgba(8, 145, 178, 0.08);
}

.stat-body {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "label value"
    "meta value";
  column-gap: 10px;
  row-gap: 2px;
  align-items: center;
  min-width: 0;
  flex: 1;
}

.stat-label {
  grid-area: label;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink-2);
  line-height: 1.15;
}

.stat-value {
  grid-area: value;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  align-self: center;
}

.stat-card.amber .stat-value { color: #C2410C; }
.stat-card.green .stat-value { color: #15803D; }
.stat-card.accent .stat-value,
.stat-card:not(.amber):not(.green) .stat-value { color: #0E7490; }

.stat-meta {
  grid-area: meta;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.15;
}

.stat-value.role-value { font-size: 18px; }

.stat-top,
.stat-dot,
.stat-copy {
  display: none;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  animation: rise .5s ease both;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.panel-head p {
  margin: 4px 0 0;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
}

.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.data-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-2);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 12px;
  border-bottom: 1px solid #EEF1F4;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background .15s ease;
}

.data-table tbody tr:hover {
  background: #FAFBFC;
}

.mono {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.02em;
}

.work-order-link {
  display: inline-block;
  color: var(--cyan-dark);
  text-decoration: none;
  border-bottom: 1px dashed rgba(14, 116, 144, 0.45);
  padding: 1px 4px;
  border-radius: 4px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.work-order-link:hover {
  background: var(--cyan-soft);
  color: #0E7490;
  border-bottom-color: var(--cyan);
  text-decoration: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.badge-cyan { background: var(--cyan-soft); color: var(--cyan-dark); }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-muted { background: #EEF2F6; color: #5B6472; }

.badge-pending { background: var(--red-soft); color: var(--red); }
.badge-scheduled { background: var(--sky-soft); color: var(--sky); }
.badge-completed { background: var(--green-soft); color: var(--green); }
.badge-rescheduled { background: var(--orange-soft); color: var(--orange); }

.assign-form {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 220px;
}

.assign-current {
  font-size: 12px;
  font-weight: 600;
  color: var(--sky);
  margin-bottom: 6px;
  white-space: nowrap;
}

.assign-hint {
  font-size: 12px;
  font-weight: 600;
  color: var(--soft);
}

.muted, .empty-cell {
  color: var(--muted);
  text-align: center;
  padding: 28px 12px !important;
}

.btn-primary-app,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 10px;
  padding: 10px 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.btn-primary-app {
  background: linear-gradient(135deg, var(--cyan), var(--cyan-dark));
  color: #fff;
  box-shadow: 0 8px 18px rgba(8, 145, 178, 0.28);
}

.btn-primary-app:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(8, 145, 178, 0.35);
  color: #fff;
}

.btn-ghost {
  background: #fff;
  border-color: var(--line);
  color: var(--text);
}

.btn-ghost:hover {
  background: #FAFBFC;
  color: var(--text);
}

.btn-block { width: 100%; }

.link-action,
.link-danger {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--cyan-dark);
}

.link-danger { color: var(--red); }

.actions-cell {
  width: 1%;
  white-space: nowrap;
  text-align: right;
  vertical-align: middle;
}

.actions-cell .inline-form {
  display: inline;
}

.actions-row {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.data-table th.actions-col,
table.dataTable thead th.actions-col {
  text-align: right;
}

.actions-cell .btn-reset-password {
  font: inherit;
}

.btn-user-edit,
.btn-user-reset,
.btn-user-deactivate,
.btn-user-activate {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  min-height: 32px;
  margin: 0;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: none;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.btn-user-edit {
  background: var(--cyan);
  border-color: var(--cyan-dark);
  color: #fff !important;
}

.btn-user-edit:hover {
  background: var(--cyan-dark);
  border-color: var(--cyan-dark);
  color: #fff !important;
}

.btn-user-reset {
  background: #FFF7ED;
  border-color: #FDBA74;
  color: #C2410C !important;
}

.btn-user-reset:hover {
  background: #FFEDD5;
  border-color: #FB923C;
  color: #9A3412 !important;
}

.btn-user-deactivate {
  background: #FEF2F2;
  border-color: #FCA5A5;
  color: #B91C1C !important;
}

.btn-user-deactivate:hover {
  background: #FEE2E2;
  border-color: #F87171;
  color: #991B1B !important;
}

.btn-user-activate {
  background: #ECFDF5;
  border-color: #6EE7B7;
  color: #047857 !important;
}

.btn-user-activate:hover {
  background: #D1FAE5;
  border-color: #34D399;
  color: #065F46 !important;
}

.btn-job-update,
.btn-return-admin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: 8px;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
}

.btn-job-update {
  background: linear-gradient(135deg, var(--cyan), var(--cyan-dark));
  color: #fff !important;
  box-shadow: 0 4px 10px rgba(8, 145, 178, 0.25);
}

.btn-job-update:hover {
  transform: translateY(-1px);
  color: #fff !important;
  box-shadow: 0 6px 14px rgba(8, 145, 178, 0.32);
}

.btn-return-admin {
  background: #FFF7ED;
  border-color: #FDBA74;
  color: #C2410C !important;
}

.btn-return-admin:hover {
  background: #FFEDD5;
  border-color: #FB923C;
  color: #9A3412 !important;
}

.btn-job-view {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  background: #F0F9FF;
  border: 1px solid #7DD3FC;
  color: #0369A1 !important;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.btn-job-view:hover {
  background: #E0F2FE;
  border-color: #38BDF8;
  color: #075985 !important;
}

td.text-end {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.readonly-box {
  background: #F8FAFB;
  min-height: 42px;
  display: flex;
  align-items: center;
}

.job-detail-grid {
  margin-top: 4px;
}

.job-view-panel {
  padding: 0;
  overflow: hidden;
}

.job-view-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 22px 24px;
  background:
    linear-gradient(135deg, rgba(8, 145, 178, 0.08), rgba(8, 145, 178, 0.02)),
    #F8FBFC;
  border-bottom: 1px solid var(--line);
}

.job-view-eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.job-view-title {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
  color: var(--ink);
}

.job-view-sub {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.job-view-sections {
  display: grid;
  gap: 0;
}

.job-view-section {
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}

.job-view-section:last-child {
  border-bottom: 0;
}

.job-view-section h3 {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--cyan-dark);
}

.job-view-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 24px;
}

.job-view-item {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.job-view-item-wide {
  grid-column: 1 / -1;
}

.job-view-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.job-view-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
  word-break: break-word;
}

.job-view-remarks {
  margin: 0;
  padding: 14px 16px;
  border-radius: 12px;
  background: #F8FAFB;
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.55;
}

.job-update-action {
  background:
    linear-gradient(180deg, rgba(8, 145, 178, 0.04), transparent 48%),
    #fff;
}

.job-update-hint {
  margin: -4px 0 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.job-update-form {
  display: grid;
  gap: 16px;
}

.job-update-textarea {
  min-height: 120px;
  resize: vertical;
}

@media (max-width: 720px) {
  .job-view-grid {
    grid-template-columns: 1fr;
  }

  .job-view-hero {
    flex-direction: column;
  }

  .job-view-title {
    font-size: 22px;
  }
}

.history-timeline {
  display: grid;
  gap: 14px;
  position: relative;
  padding-left: 18px;
}

.history-timeline::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--line);
}

.history-item {
  position: relative;
}

.history-dot {
  position: absolute;
  left: -18px;
  top: 14px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0 3px rgba(14, 124, 148, 0.15);
}

.history-card {
  background: #F8FAFB;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
}

.history-card p {
  margin: 6px 0;
}

.history-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.history-meta span {
  color: var(--muted);
  font-size: 13px;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.inline-form { display: inline; }

.search-bar {
  display: flex;
  gap: 8px;
  min-width: 320px;
}

.jobs-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin: 0 0 16px;
  padding: 14px 16px;
  background: #F7F9FC;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.jobs-filter-field {
  display: grid;
  gap: 6px;
  min-width: 150px;
  flex: 1 1 150px;
}

.jobs-filter-search {
  flex: 2 1 240px;
  min-width: 220px;
}

.jobs-filter-field label {
  font-size: 12px;
  font-weight: 700;
  color: var(--soft);
}

.jobs-filter-search-wrap {
  position: relative;
}

.jobs-filter-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--soft);
  font-size: 16px;
  pointer-events: none;
  line-height: 1;
}

.jobs-filter-search-wrap .form-control-app {
  padding-left: 34px;
}

.jobs-filter-actions {
  display: flex;
  align-items: end;
  padding-bottom: 1px;
}

.jobs-filter-clear {
  height: 42px;
  white-space: nowrap;
  padding: 0 14px;
  gap: 6px;
}

.form-control-app {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 11px 12px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.form-control-app:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.15);
}

.app-form { display: grid; gap: 18px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field { display: grid; gap: 7px; }
.field-span { grid-column: 1 / -1; }

.field label {
  font-size: 13px;
  font-weight: 600;
  color: #5B6472;
}

.field-required label::after {
  content: " *";
  color: var(--red);
}

.table-subtext {
  margin-top: 2px;
  font-size: 12px;
  font-weight: 500;
  color: var(--soft);
}

.field-check {
  display: flex;
  align-items: end;
}

.check-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text);
}

.form-actions {
  display: flex;
  gap: 10px;
  padding-top: 4px;
}

.form-error,
.field-error {
  color: var(--red);
  font-size: 13px;
}

.alert-banner {
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  animation: rise .35s ease both;
}

.alert-banner.success {
  background: var(--green-soft);
  color: var(--green);
  border: 1px solid #BBF7D0;
}

.alert-banner.error {
  background: var(--red-soft);
  color: var(--red);
  border: 1px solid #FECACA;
}

.narrow-panel { max-width: 520px; }

/* Login — admin auth template */
.login-body {
  min-height: 100vh;
  background: #EEF2F6;
}

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(380px, 44%) 1fr;
}

.login-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 18% 20%, rgba(8, 145, 178, 0.35), transparent 42%),
    radial-gradient(circle at 85% 75%, rgba(14, 116, 144, 0.28), transparent 40%),
    linear-gradient(160deg, #0F1720 0%, #15202B 48%, #0B4A5A 100%);
}

.login-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.07;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.4) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.4) 1px, transparent 1px);
  background-size: 40px 40px;
}

.login-hero-inner {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 36px clamp(28px, 4vw, 56px) 24px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--cyan), var(--cyan-dark));
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(8, 145, 178, 0.3);
}

.login-brand .brand-name,
.login-mobile-brand .brand-name {
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
}

.login-brand-tag {
  margin-top: 2px;
  font-size: 12px;
  font-weight: 600;
  color: #94A3B8;
}

.login-hero-content {
  width: min(520px, 100%);
  margin: auto 0;
  padding: 48px 0 36px;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(8, 145, 178, 0.16);
  border: 1px solid rgba(125, 211, 227, 0.22);
  color: #A5E8F3;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.hero-kicker span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22D3EE;
  box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.14);
}

.login-hero h1 {
  margin: 18px 0 14px;
  font-size: clamp(32px, 3.6vw, 46px);
  line-height: 1.12;
  letter-spacing: -0.035em;
  font-weight: 700;
}

.login-hero-content > p {
  max-width: 460px;
  margin: 0;
  color: #CBD5E1;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.65;
}

.login-kpi-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 28px;
}

.login-kpi {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
}

.login-kpi-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94A3B8;
}

.login-kpi-value {
  font-size: 18px;
  font-weight: 700;
  color: #E0F5F8;
}

.hero-features {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.hero-feature {
  display: flex;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: rgba(15, 23, 32, 0.35);
}

.feature-icon {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(8, 145, 178, 0.24);
  color: #7DD3E3;
  font: 700 11px var(--mono);
}

.hero-feature strong,
.hero-feature small { display: block; }

.hero-feature strong {
  font-size: 13px;
  margin-bottom: 3px;
  color: #F8FAFC;
}

.hero-feature small {
  color: #94A3B8;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.45;
}

.login-copyright {
  margin-top: auto;
  padding-top: 18px;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.login-copyright-light {
  color: #94A3B8;
  text-align: left;
}

.login-panel {
  min-width: 0;
  display: grid;
  place-items: center;
  padding: clamp(24px, 5vw, 56px);
  background:
    radial-gradient(circle at 90% 10%, rgba(8, 145, 178, 0.08), transparent 34%),
    #EEF2F6;
}

.login-panel-inner {
  width: min(460px, 100%);
  display: grid;
  gap: 18px;
}

.login-mobile-brand {
  display: none;
  align-items: center;
  gap: 10px;
  justify-content: center;
}

.login-mobile-brand .brand-name {
  color: var(--ink);
}

.login-card {
  width: 100%;
  padding: 28px 28px 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(22, 27, 34, 0.04), 0 18px 40px rgba(22, 27, 34, 0.08);
}

.login-card-head {
  margin-bottom: 22px;
}

.login-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--cyan-dark);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.login-status span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.12);
}

.login-card h2 {
  margin: 0 0 8px;
  font-size: 30px;
  letter-spacing: -0.03em;
  font-weight: 700;
  color: var(--ink);
}

.login-help {
  margin: 0;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
}

.login-form { display: grid; gap: 16px; }
.login-field { display: grid; gap: 7px; }

.login-field label {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
}

.input-with-icon { position: relative; }

.input-with-icon .form-control-app {
  min-height: 48px;
  padding-left: 42px;
  padding-right: 62px;
  border-color: #D5DEE7;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  background: #F8FAFB;
}

.input-with-icon .form-control-app:focus {
  background: #fff;
}

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  color: #64748B;
  font: 700 14px var(--mono);
  pointer-events: none;
}

.lock-icon { font-size: 8px; }

.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  padding: 6px;
  color: var(--cyan-dark);
  font: 700 12px var(--font);
  cursor: pointer;
}

.login-submit {
  min-height: 48px;
  margin-top: 2px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
}

.login-submit span {
  margin-left: auto;
  font-size: 18px;
  line-height: 1;
}

.login-support {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  text-align: center;
  font-size: 12px;
  font-weight: 600;
}

.validation-summary:empty { display: none; }
.validation-summary ul { margin: 0; padding-left: 18px; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 20;
    width: min(300px, 86vw);
    flex-direction: column;
    align-items: stretch;
    gap: 28px;
    transform: translateX(-105%);
    transition: transform .25s ease;
    box-shadow: 24px 0 60px rgba(0,0,0,.28);
    overflow-y: auto;
  }
  body.sidebar-open { overflow: hidden; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-head { display: flex; align-items: center; justify-content: space-between; }
  .sidebar-close {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 9px;
    background: rgba(255,255,255,.04);
    color: #fff;
    font-size: 24px;
    cursor: pointer;
  }
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 19;
    background: rgba(10,15,20,.55);
    backdrop-filter: blur(2px);
  }
  body.sidebar-open .sidebar-backdrop { display: block; }
  .menu-toggle {
    display: inline-flex;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    padding: 11px;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
  }
  .menu-toggle span { display: block; height: 2px; border-radius: 2px; background: var(--ink-2); }
  .nav-section { display: grid; gap: 6px; }
  .nav-label { display: block; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login-page { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .login-panel {
    min-height: 100vh;
    place-items: center;
  }
  .login-mobile-brand {
    display: flex;
  }
  .topbar, .content, .app-footer { padding-left: 18px; padding-right: 18px; }
  .topbar { align-items: center; }
  .search-bar { min-width: 0; width: 100%; }
  .jobs-filter-bar { padding: 12px; }
  .jobs-filter-field,
  .jobs-filter-search,
  .jobs-filter-actions { flex: 1 1 100%; min-width: 0; }
  .jobs-filter-clear { width: 100%; }
  .panel-head { flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
  .field-span { grid-column: auto; }
}

@media (max-width: 640px) {
  .topbar {
    flex-wrap: wrap;
    padding: 12px;
    min-height: 0;
  }
  .topbar-left,
  .topbar-title { min-width: 0; }
  .topbar-right {
    width: 100%;
    justify-content: flex-end;
  }
  .header-user {
    width: 100%;
    justify-content: space-between;
    border-radius: 14px;
    padding: 8px;
  }
  .header-user-name { max-width: none; }
  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .topbar-actions .btn-primary-app { padding: 10px 12px; white-space: nowrap; }
  .eyebrow { display: none; }
  .stat-grid,
  .stat-grid-3 { grid-template-columns: 1fr; }
  .page-title { font-size: 22px; }
  .content { padding: 8px 12px 12px; gap: 12px; }
  .app-footer { padding: 10px 12px 14px; font-size: 11px; }
  .panel { padding: 14px; border-radius: 12px; }
  .panel-head { margin-bottom: 12px; }
  .form-actions { flex-direction: column; }
  .form-actions > * { width: 100%; }
  .search-bar { flex-direction: column; }
  .search-bar .btn-ghost { width: 100%; }
  .table-wrap {
    margin-left: -14px;
    margin-right: -14px;
    padding: 0 14px 4px;
    -webkit-overflow-scrolling: touch;
  }
  .data-table { min-width: 680px; }
  .data-table th, .data-table td { padding: 12px 10px; }
  .login-panel { padding: 20px 16px; }
  .login-card { padding: 22px 18px 18px; }
  .login-card h2 { font-size: 26px; }
  .login-kpi-row,
  .hero-features { grid-template-columns: 1fr; }
}

/* Weekly Schedule board */
.schedule-panel {
  overflow: hidden;
}

.week-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.week-nav-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.week-nav-arrow {
  box-sizing: border-box;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #D5DEE7;
  border-radius: 8px;
  background: #fff;
  color: #6B7280;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.week-nav-arrow:hover {
  background: #F8FAFB;
  border-color: #C5CED8;
  color: var(--ink);
}

.week-nav-range {
  min-width: 168px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: #4B5563;
  white-space: nowrap;
}

.week-nav-today {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 14px;
  border: 1px solid #D5DEE7;
  border-radius: 8px;
  background: #fff;
  color: #4B5563;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.week-nav-today:hover {
  background: #F8FAFB;
  border-color: #C5CED8;
  color: var(--ink);
}

.week-nav-today.is-current {
  background: #F8FAFB;
  color: var(--muted);
  pointer-events: none;
}

.schedule-scroll {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.schedule-scroll-bar {
  display: none;
  overflow-x: auto;
  overflow-y: hidden;
}

.schedule-scroll-bar.is-visible {
  display: block;
}

.schedule-scroll-spacer {
  height: 1px;
}

.schedule-board {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
}

.schedule-board.is-scrollable {
  padding-bottom: 6px;
}

.schedule-day {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #F8FAFB;
  display: flex;
  flex-direction: column;
  min-height: 320px;
}

.schedule-day-head {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "name count"
    "date count";
  gap: 2px 6px;
  align-items: center;
  padding: 8px 8px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  border-radius: 12px 12px 0 0;
}

.schedule-day-name {
  grid-area: name;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.schedule-day-date {
  grid-area: date;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.schedule-day-count {
  grid-area: count;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #E0F5F8;
  color: var(--cyan-dark);
  font-size: 12px;
  font-weight: 700;
}

.schedule-day-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  flex: 1;
  min-width: 0;
}

.schedule-empty {
  margin: auto 0;
  text-align: center;
  color: var(--soft);
  font-size: 12px;
  font-weight: 600;
  padding: 18px 8px;
}

.schedule-card {
  display: block;
  min-width: 0;
  border: 1px solid #C5CED8;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.schedule-card:hover {
  border-color: #94A3B8;
  box-shadow: 0 6px 14px rgba(22, 27, 34, 0.08);
  transform: translateY(-1px);
  color: inherit;
}

.schedule-card-type,
.schedule-card-status {
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.2;
}

.schedule-card-type.is-ready {
  background: #F5C518;
  color: #1F2937;
}

.schedule-card-type.is-callup {
  background: #FB923C;
  color: #1F2937;
}

.schedule-card-type.is-appointment {
  background: #7DD3FC;
  color: #0C4A6E;
}

.schedule-card-type.is-other {
  background: #E5E7EB;
  color: #374151;
}

.schedule-card-status.is-completed {
  background: #22C55E;
  color: #fff;
}

.schedule-card-status.is-pending {
  background: #DC2626;
  color: #fff;
}

.schedule-card-status.is-assigned {
  background: #0EA5E9;
  color: #fff;
}

.schedule-card-status.is-rescheduled {
  background: #F97316;
  color: #fff;
}

.schedule-card-body {
  display: grid;
  gap: 3px;
  padding: 8px 8px 10px;
  text-align: center;
}

.schedule-card-ids {
  font-size: 11px;
  font-weight: 700;
  color: #0369A1;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.schedule-card-builder {
  font-size: 13px;
  font-weight: 800;
  color: #075985;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.schedule-card-address,
.schedule-card-suburb {
  font-size: 11px;
  font-weight: 500;
  color: #0369A1;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.schedule-card-supervisor {
  margin-top: 2px;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.schedule-card-phone {
  font-size: 12px;
  font-weight: 500;
  color: #64748B;
}

.schedule-card-tech {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 600;
  color: #94A3B8;
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 900px) {
  .schedule-board {
    grid-template-columns: repeat(7, minmax(132px, 1fr));
  }

  .schedule-day {
    min-width: 132px;
  }
}

@media (max-width: 640px) {
  .week-nav {
    width: 100%;
    justify-content: space-between;
  }

  .week-nav-range {
    min-width: 0;
    flex: 1;
  }
}

/* DataTables — keep look close to app tables */
.dataTables_wrapper {
  margin-top: 4px;
}

.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_length {
  margin-bottom: 14px;
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 14px;
  background: #fff;
}

.dataTables_wrapper .dataTables_filter input {
  margin-left: 8px;
  min-width: 220px;
}

.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  margin-top: 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: 8px !important;
  padding: 4px 10px !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--cyan) !important;
  border-color: var(--cyan) !important;
  color: #fff !important;
}

table.dataTable.no-footer {
  border-bottom: 1px solid var(--line) !important;
}

table.dataTable.data-table {
  border-collapse: collapse !important;
}

table.dataTable thead th {
  border-bottom: 1px solid var(--line) !important;
}

table.dataTable tbody td {
  border-bottom: 1px solid #EEF1F4 !important;
  vertical-align: middle;
}

.export-modal {
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.export-modal .modal-header {
  border-bottom: 1px solid var(--line);
  padding: 18px 20px 14px;
  align-items: flex-start;
}

.export-modal .modal-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  color: var(--ink);
}

.export-modal-sub {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.export-modal .modal-body {
  padding: 18px 20px;
}

.export-modal .modal-footer {
  border-top: 1px solid var(--line);
  padding: 14px 20px;
  gap: 10px;
}

.export-filter-grid {
  margin: 0;
}

.export-filter-grid .field {
  margin: 0;
}
