/* ==========================================================================
   Nagoh Service Desk — theme
   Dark, rounded, fluid UI system. Component classes are referenced directly
   by app.js — keep class names stable even if visual values change.
   ========================================================================== */

:root {
  --bg: #0a0d15;
  --bg-soft: #0d1119;
  --surface: #12172380;
  --surface-solid: #131826;
  --surface-2: #1a2032;
  --surface-hover: #1e2538;
  --border: #232a3d;
  --border-soft: #1b2233;
  --text: #eef1f8;
  --text-dim: #9aa4bc;
  --text-faint: #6b7590;

  --accent: #6d6bf7;
  --accent-2: #8b7bf6;
  --accent-hover: #7d7bff;
  --accent-soft: rgba(109, 107, 247, .16);
  --accent-ring: rgba(109, 107, 247, .35);

  --blue: #4b9bff;
  --blue-soft: rgba(75, 155, 255, .15);
  --amber: #f5a524;
  --amber-soft: rgba(245, 165, 36, .16);
  --red: #f3596b;
  --red-soft: rgba(243, 89, 107, .16);
  --green: #35d391;
  --green-soft: rgba(53, 211, 145, .16);
  --purple: #c084fc;
  --purple-soft: rgba(192, 132, 252, .16);
  --slate: #94a3b8;
  --slate-soft: rgba(148, 163, 184, .14);

  --radius-xl: 22px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 9px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.35);
  --shadow-md: 0 8px 24px -8px rgba(0,0,0,.5), 0 2px 6px rgba(0,0,0,.3);
  --shadow-lg: 0 24px 60px -16px rgba(0,0,0,.6), 0 4px 16px rgba(0,0,0,.35);

  --ease: cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  /* Tells the browser to draw native form chrome (date/time picker icon,
     the little calendar/clock popup itself, spin buttons, etc.) in a
     dark-appropriate palette. Without this, Chrome renders the calendar
     icon in its light-mode color — a dark icon on our dark input fields,
     which is functionally invisible even though it's still clickable. */
  color-scheme: dark;
}

body { margin: 0; }

::selection { background: var(--accent-soft); color: var(--text); }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: #2a3247 transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: #262e44; border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #323c56; background-clip: content-box; }

code { font-family: 'SFMono-Regular', Menlo, Consolas, monospace; }

.hidden { display: none !important; }

/* ==========================================================================
   Login screen
   ========================================================================== */
.login-screen {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(60% 50% at 15% 10%, rgba(109,107,247,.16), transparent 60%),
    radial-gradient(50% 45% at 85% 90%, rgba(75,155,255,.10), transparent 60%),
    var(--bg);
}
.login-card-wrap { animation: rise .5s var(--ease); }
.login-card {
  width: 360px; max-width: 92vw;
  background: var(--surface-solid); border: 1px solid var(--border);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
  padding: 2rem 1.9rem;
}
.login-brand { display: flex; align-items: center; gap: .65rem; margin-bottom: 1.1rem; }
.login-brand-mark {
  width: 38px; height: 38px; border-radius: var(--radius-md); flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--blue));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: #fff; font-size: 1.05rem;
  box-shadow: 0 6px 16px -4px rgba(109,107,247,.55);
}
.login-brand-name { font-size: 1.05rem; font-weight: 700; color: var(--text); line-height: 1.25; }
.login-brand-name span { display: block; font-size: .74rem; font-weight: 500; color: var(--text-faint); }
.login-hint { font-size: .78rem; color: var(--text-dim); margin: 0 0 1.15rem; line-height: 1.5; }
.field-label { display: block; font-size: .72rem; font-weight: 600; color: var(--text-dim); margin: 0 0 .3rem; }
.field-input {
  width: 100%; background: var(--bg-soft); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--radius-md); padding: .62rem .8rem;
  font-size: .85rem; font-family: inherit; margin-bottom: .9rem; transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.field-input::placeholder { color: var(--text-faint); }
.field-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.login-error { font-size: .75rem; color: var(--red); margin-top: .85rem; }

/* ==========================================================================
   Buttons / inputs (shared)
   ========================================================================== */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-size: .82rem; font-weight: 600; border: none;
  padding: .55rem 1.05rem; border-radius: var(--radius-pill); cursor: pointer;
  box-shadow: 0 6px 18px -6px rgba(109,107,247,.55);
  transition: transform .15s var(--ease), box-shadow .15s var(--ease), filter .15s var(--ease);
  white-space: nowrap;
}
.btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 10px 24px -6px rgba(109,107,247,.6); }
.btn-primary:active { transform: translateY(0); }
.btn-block { width: 100%; margin-top: .3rem; }

.icon-btn {
  position: relative; width: 38px; height: 38px; border-radius: var(--radius-pill);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  transition: all .15s var(--ease); flex-shrink: 0;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--surface-hover); color: var(--text); border-color: var(--border-soft); }
.icon-btn-dot {
  position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; border-radius: 999px;
  background: var(--red); border: 1.5px solid var(--surface-solid); display: none;
}
.icon-btn-dot.show { display: block; }

.select-input {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-md); padding: .5rem .75rem; font-size: .8rem; font-family: inherit;
  cursor: pointer; transition: border-color .15s var(--ease);
}
.select-input:focus { outline: none; border-color: var(--accent); }

.modal-input, .modal-notes-textarea {
  width: 100%; background: var(--bg-soft); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); padding: .5rem .65rem; font-size: .82rem; font-family: inherit;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.modal-input::placeholder, .modal-notes-textarea::placeholder { color: var(--text-faint); }
.modal-input:focus, .modal-notes-textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.modal-notes-textarea { min-height: 90px; resize: vertical; }

/* Give the native date/time picker icon a bigger, obviously-clickable
   target and a hover state — the default is a tiny icon flush with the
   input's edge. Applies to .modal-input (ticket scheduling) and
   .select-input (the Dispatch timeline date picker). */
.modal-input::-webkit-calendar-picker-indicator,
.select-input::-webkit-calendar-picker-indicator {
  cursor: pointer; border-radius: 5px; padding: 3px; margin-right: -2px;
  transition: background .12s var(--ease);
}
.modal-input::-webkit-calendar-picker-indicator:hover,
.select-input::-webkit-calendar-picker-indicator:hover { background: var(--surface-hover); }

.modal-save-btn {
  background: var(--accent); color: #fff; font-size: .78rem; font-weight: 600; padding: .5rem 1rem;
  border-radius: var(--radius-pill); margin-top: .6rem; border: none; cursor: pointer;
  transition: filter .15s var(--ease), transform .15s var(--ease);
}
.modal-save-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }

/* ==========================================================================
   App shell
   ========================================================================== */
.app-shell { display: flex; height: 100vh; overflow: hidden; }

/* Sidebar */
.sidebar {
  width: 236px; flex-shrink: 0; background: var(--bg-soft);
  border-right: 1px solid var(--border-soft);
  display: flex; flex-direction: column;
}
.sidebar-brand {
  display: flex; align-items: center; gap: .65rem;
  padding: 1.25rem 1.1rem 1.1rem;
}
.brand-mark {
  width: 34px; height: 34px; border-radius: var(--radius-md); flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--blue));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: #fff; font-size: .95rem;
  box-shadow: 0 6px 14px -4px rgba(109,107,247,.5);
}
.brand-name { font-size: .86rem; font-weight: 700; color: var(--text); line-height: 1.3; }
.brand-name span { font-size: .68rem; font-weight: 500; color: var(--text-faint); }

.sidebar-nav { flex: 1; padding: .5rem .7rem; display: flex; flex-direction: column; gap: .15rem; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: .7rem; width: 100%; text-align: left;
  padding: .58rem .75rem; font-size: .82rem; font-weight: 500; color: var(--text-dim);
  background: transparent; border: none; border-radius: var(--radius-md); cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.nav-icon { display: flex; flex-shrink: 0; width: 18px; height: 18px; opacity: .85; }
.nav-icon svg { width: 100%; height: 100%; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active {
  background: var(--accent-soft); color: #cfcdff;
  box-shadow: inset 0 0 0 1px rgba(109,107,247,.35);
}
.nav-item.active .nav-icon { opacity: 1; color: #a5a3ff; }

.sidebar-footer {
  display: flex; align-items: center; gap: .5rem;
  padding: .9rem 1.1rem; border-top: 1px solid var(--border-soft);
  font-size: .72rem; color: var(--text-faint);
}
.conn-dot { width: 7px; height: 7px; border-radius: 999px; background: var(--green); flex-shrink: 0; box-shadow: 0 0 0 3px var(--green-soft); }
#connStatus { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout-btn {
  background: none; border: none; color: var(--text-faint); cursor: pointer; padding: .2rem;
  display: flex; border-radius: var(--radius-sm); transition: color .15s var(--ease), background .15s var(--ease);
}
.logout-btn svg { width: 16px; height: 16px; }
.logout-btn:hover { color: var(--text); background: var(--surface-2); }

/* Main column */
.main-col { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

.topbar {
  height: 68px; flex-shrink: 0; display: flex; align-items: center; gap: .7rem;
  padding: 0 1.5rem; border-bottom: 1px solid var(--border-soft);
}
.search-wrap { position: relative; width: 380px; max-width: 40vw; }
.search-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-faint); pointer-events: none; }
.search-input {
  width: 100%; background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-pill); padding: .58rem .9rem .58rem 2.35rem; font-size: .82rem; font-family: inherit;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background .15s var(--ease);
}
.search-input::placeholder { color: var(--text-faint); }
.search-input:focus { outline: none; border-color: var(--accent); background: var(--surface-hover); box-shadow: 0 0 0 3px var(--accent-ring); }

.loading-pill {
  font-size: .72rem; color: var(--text-dim); background: var(--surface-2);
  padding: .3rem .65rem; border-radius: var(--radius-pill); border: 1px solid var(--border);
}
.topbar-spacer { flex: 1; }

.user-chip { display: flex; align-items: center; }
.user-avatar {
  width: 38px; height: 38px; border-radius: 999px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--blue));
  color: #fff; font-weight: 700; font-size: .8rem;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px var(--surface-solid), 0 0 0 3px var(--border);
}

.notif-banner {
  margin: 1rem 1.5rem 0; padding: .7rem 1rem; border-radius: var(--radius-md);
  background: var(--green-soft); border: 1px solid rgba(53,211,145,.3); color: #8beebf;
  font-size: .8rem; font-weight: 500; display: flex; align-items: center; gap: .55rem;
  animation: rise .35s var(--ease);
}
.notif-banner.warn { background: var(--amber-soft); border-color: rgba(245,165,36,.35); color: #fbcd82; }
.notif-banner-icon { width: 16px; height: 16px; flex-shrink: 0; }

.viewport { flex: 1; overflow: auto; padding: 1.5rem; }

/* ==========================================================================
   Stat cards / panels
   ========================================================================== */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
@media (max-width: 1100px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }

.stat-card {
  background: var(--surface-solid); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.15rem 1.25rem;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s var(--ease);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-soft); }
.stat-icon {
  width: 34px; height: 34px; border-radius: var(--radius-sm); margin-bottom: .8rem;
  display: flex; align-items: center; justify-content: center;
}
.stat-icon svg { width: 18px; height: 18px; }
.stat-icon-blue { background: var(--blue-soft); color: var(--blue); }
.stat-icon-amber { background: var(--amber-soft); color: var(--amber); }
.stat-icon-red { background: var(--red-soft); color: var(--red); }
.stat-icon-purple { background: var(--purple-soft); color: var(--purple); }
.stat-label { font-size: .72rem; color: var(--text-dim); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 1.9rem; font-weight: 800; color: var(--text); margin-top: .3rem; letter-spacing: -.02em; }
.stat-sub { font-size: .72rem; color: var(--text-faint); margin-top: .25rem; }

.panel {
  background: var(--surface-solid); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
}
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border-soft);
}
.panel-title { font-size: .88rem; font-weight: 700; color: var(--text); }

.view-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.1rem; gap: .75rem; flex-wrap: wrap; }

.toggle-group { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 3px; gap: 2px; }
.toggle-btn {
  font-size: .78rem; font-weight: 600; padding: .4rem .95rem; border: none; background: transparent;
  color: var(--text-dim); border-radius: var(--radius-pill); cursor: pointer; transition: all .15s var(--ease);
}
.toggle-btn:hover { color: var(--text); }
.toggle-btn.active { background: var(--accent); color: #fff; box-shadow: 0 2px 8px -2px rgba(109,107,247,.6); }

/* ==========================================================================
   Tables
   ========================================================================== */
.section-heading { font-size: .78rem; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; margin: 0 0 .8rem .2rem; }

.table-card { background: var(--surface-solid); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
table.data-table { width: 100%; font-size: .82rem; border-collapse: collapse; }
table.data-table th {
  text-align: left; padding: .8rem 1rem; background: var(--surface-2);
  border-bottom: 1px solid var(--border); color: var(--text-dim);
  font-weight: 600; font-size: .72rem; text-transform: uppercase; letter-spacing: .03em;
}
table.data-table td { padding: .75rem 1rem; border-bottom: 1px solid var(--border-soft); color: var(--text); }
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tr.ticket-clickable-row,
table.data-table tr.invoice-clickable-row { cursor: pointer; transition: background .12s var(--ease); }
table.data-table tr.ticket-clickable-row:hover td,
table.data-table tr.invoice-clickable-row:hover td { background: var(--surface-hover); }

.assignee-chip { display: inline-flex; align-items: center; gap: .45rem; color: var(--text); }
.assignee-avatar {
  width: 22px; height: 22px; border-radius: 999px; color: #fff; font-size: .62rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.assignee-unassigned { color: var(--text-faint); }

/* Pagination bar — sits as a footer inside .table-card, below the table */
.pagination-bar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .75rem;
  padding: .75rem 1rem; border-top: 1px solid var(--border-soft); background: var(--surface-2);
}
.pagination-info { font-size: .74rem; color: var(--text-faint); }
.pagination-controls { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.pagination-size-label {
  display: flex; align-items: center; gap: .45rem; font-size: .72rem; color: var(--text-faint);
  font-weight: 500; white-space: nowrap;
}
.pagination-size { padding: .3rem .55rem; font-size: .76rem; }
.pagination-nav { display: flex; align-items: center; gap: .3rem; }
.pagination-btn {
  width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-solid); border: 1px solid var(--border); color: var(--text-dim);
  border-radius: var(--radius-sm); font-size: .8rem; cursor: pointer; transition: all .15s var(--ease);
}
.pagination-btn:hover:not(:disabled) { background: var(--surface-hover); color: var(--text); border-color: var(--border-soft); }
.pagination-btn:disabled { opacity: .35; cursor: not-allowed; }
.pagination-page { font-size: .74rem; color: var(--text-dim); padding: 0 .3rem; white-space: nowrap; }

/* ==========================================================================
   Badges / pills
   ========================================================================== */
.badge { font-size: .68rem; padding: .22rem .62rem; border-radius: var(--radius-pill); font-weight: 700; letter-spacing: .01em; display: inline-block; }
.badge-New { background: var(--accent-soft); color: #b7b5ff; }
.badge-Assigned { background: var(--blue-soft); color: #8fc3ff; }
.badge-InProgress { background: var(--amber-soft); color: #ffc266; }
.badge-OnHold { background: var(--slate-soft); color: var(--slate); }
.badge-PendingBilling { background: var(--purple-soft); color: #d9adff; }
.badge-Closed { background: var(--green-soft); color: #77e8b5; }

.badge-Low { background: var(--slate-soft); color: var(--slate); }
.badge-Medium { background: var(--blue-soft); color: #8fc3ff; }
.badge-High { background: var(--amber-soft); color: #ffc266; }
.badge-Emergency { background: var(--red-soft); color: #ff97a4; }

/* ==========================================================================
   Kanban
   ========================================================================== */
.kanban-lane { background: var(--surface-solid); border: 1px solid var(--border); border-radius: var(--radius-lg); min-height: 60vh; padding: .65rem; transition: outline-color .15s var(--ease); }
.kanban-lane h3 { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--text-dim); padding: .5rem .45rem .7rem; margin: 0; }
.kanban-card {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: .7rem .8rem; margin-bottom: .55rem; font-size: .78rem; color: var(--text);
  cursor: grab; box-shadow: var(--shadow-sm); transition: transform .12s var(--ease), box-shadow .12s var(--ease), border-color .12s var(--ease);
}
.kanban-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-soft); }
.kanban-card .text-slate-500 { color: var(--text-dim) !important; margin: .2rem 0 .4rem; }
.kanban-card.dragging { opacity: .4; }
.kanban-lane.drop-target { outline: 2px dashed var(--accent); outline-offset: -2px; }

.sla-bar { height: 4px; border-radius: 2px; background: var(--border); overflow: hidden; margin-top: .4rem; }
.sla-bar > div { height: 100%; border-radius: 2px; }

/* ==========================================================================
   Dispatch board
   ========================================================================== */
.dispatch-section-header { display: flex; align-items: baseline; gap: .6rem; margin-bottom: .85rem; }
.dispatch-section-title { font-size: .95rem; font-weight: 700; color: var(--text); }
.dispatch-section-time { font-size: .74rem; color: var(--text-faint); }
.dispatch-section-count {
  font-size: .68rem; font-weight: 700; color: #b7b5ff; background: var(--accent-soft);
  padding: .18rem .6rem; border-radius: var(--radius-pill); margin-left: auto;
}

.dispatch-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .9rem; }
.dispatch-block { margin-bottom: 1.5rem; }
.dispatch-block-lg { margin-bottom: 2rem; }

.kanban-board { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .75rem; }
@media (max-width: 1300px) { .kanban-board { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .kanban-board { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.tech-lane {
  background: var(--surface-solid); border: 1px solid var(--border); border-radius: var(--radius-lg);
  min-height: 150px; display: flex; flex-direction: column; overflow: hidden;
  transition: border-color .15s var(--ease), outline-color .15s var(--ease);
}
.tech-lane-header {
  display: flex; align-items: center; gap: .55rem; padding: .75rem .85rem;
  border-bottom: 1px solid var(--border-soft); background: var(--surface-2);
}
.tech-avatar {
  width: 30px; height: 30px; border-radius: 999px; color: #fff;
  font-size: .68rem; font-weight: 700; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; box-shadow: 0 0 0 2px rgba(255,255,255,.06);
}
.tech-lane-name { font-size: .82rem; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tech-lane-count {
  font-size: .68rem; font-weight: 700; color: var(--text-dim); margin-left: auto; background: var(--surface-hover);
  min-width: 20px; height: 20px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; padding: 0 .3rem;
}
.oncall-tag {
  font-size: .6rem; font-weight: 700; letter-spacing: .02em; text-transform: uppercase;
  background: var(--amber-soft); color: var(--amber); padding: .15rem .4rem; border-radius: var(--radius-sm);
}
.tech-lane-body { padding: .7rem; flex: 1; min-height: 96px; }
.tech-lane-empty {
  height: 100%; min-height: 84px; display: flex; align-items: center; justify-content: center;
  border: 1.5px dashed var(--border); border-radius: var(--radius-md); color: var(--text-faint); font-size: .74rem; text-align: center; padding: .5rem;
}
.tech-lane.drop-target { outline: 2px dashed var(--accent); outline-offset: -2px; }

.dispatch-ticket-card {
  background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--slate);
  border-radius: var(--radius-md); padding: .55rem .65rem; margin-bottom: .5rem; font-size: .76rem;
  cursor: grab; box-shadow: var(--shadow-sm); transition: transform .12s var(--ease), box-shadow .12s var(--ease);
}
.dispatch-ticket-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.dispatch-ticket-card:last-child { margin-bottom: 0; }
.dispatch-ticket-card.dragging { opacity: .4; }
.dispatch-ticket-card.priority-Emergency { border-left-color: var(--red); }
.dispatch-ticket-card.priority-High { border-left-color: var(--amber); }
.dispatch-ticket-card.priority-Medium { border-left-color: var(--blue); }
.dispatch-ticket-card.priority-Low { border-left-color: var(--slate); }
.dispatch-ticket-id { font-weight: 700; color: var(--text); }
.dispatch-ticket-customer { color: var(--text-dim); margin-top: .12rem; }
.dispatch-ticket-category { color: var(--text-faint); font-size: .68rem; margin-top: .12rem; }

.unassigned-tray {
  background: var(--amber-soft); border: 1px solid rgba(245,165,36,.3); border-radius: var(--radius-lg); padding: 1rem;
}
.unassigned-tray-header { display: flex; align-items: center; gap: .5rem; margin-bottom: .7rem; }
.unassigned-tray-title { font-size: .84rem; font-weight: 700; color: #ffcf85; }
.unassigned-tray-cards { display: flex; flex-wrap: wrap; gap: .55rem; }
.unassigned-tray .dispatch-ticket-card { width: 210px; margin-bottom: 0; background: var(--surface-solid); }
.unassigned-tray-empty { font-size: .78rem; color: #f0c380; }

/* ==========================================================================
   Modals
   ========================================================================== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(6,8,14,.65); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; z-index: 100;
  animation: fadeIn .18s var(--ease);
}
.modal-overlay.hidden { display: none; }
.modal-panel {
  background: var(--surface-solid); border: 1px solid var(--border); border-radius: var(--radius-xl);
  width: 640px; max-width: 92vw; max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow-lg);
  animation: rise .22s var(--ease);
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--border-soft);
  position: sticky; top: 0; background: var(--surface-solid); z-index: 1; border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}
.modal-ticket-id { font-size: 1.08rem; font-weight: 700; color: var(--text); margin-right: .6rem; }
.modal-close {
  font-size: 1.4rem; line-height: 1; color: var(--text-faint); background: var(--surface-2); border: 1px solid var(--border);
  width: 32px; height: 32px; border-radius: 999px; cursor: pointer; transition: all .15s var(--ease);
}
.modal-close:hover { color: var(--text); background: var(--surface-hover); }
.modal-body { padding: 1.25rem 1.4rem 1.6rem; font-size: .85rem; }
.modal-section {
  margin-bottom: 1.1rem; padding: 1rem 1.1rem; background: var(--bg-soft);
  border: 1px solid var(--border-soft); border-radius: var(--radius-md);
}
.modal-section:last-child { margin-bottom: 0; }
.modal-section-title {
  font-size: .68rem; font-weight: 700; text-transform: uppercase; color: var(--text-faint);
  letter-spacing: .05em; margin-bottom: .65rem;
}
.modal-field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem 1.3rem; }
.modal-field-label { color: var(--text-faint); font-size: .7rem; margin-bottom: .15rem; }
.modal-field-value { color: var(--text); line-height: 1.45; }

/* ==========================================================================
   Map view
   ========================================================================== */
.map-container { width: 100%; height: 70vh; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface-2); }
.map-status { font-size: .75rem; color: var(--text-faint); margin-top: .7rem; }

.map-legend { display: flex; align-items: center; gap: 1.2rem; margin-bottom: .85rem; font-size: .78rem; color: var(--text-dim); }
.map-legend-item { display: flex; align-items: center; gap: .4rem; }
.legend-dot { width: 10px; height: 10px; border-radius: 999px; display: inline-block; flex-shrink: 0; }

.map-pin { display: flex; align-items: center; gap: .4rem; cursor: pointer; transform: translateY(-6px); }
.map-pin-dot { width: 14px; height: 14px; border-radius: 999px; border: 2px solid #10141f; flex-shrink: 0; box-shadow: 0 1px 6px rgba(0,0,0,.5); }
.map-pin-label {
  background: var(--surface-solid); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .3rem .6rem;
  font-size: .68rem; line-height: 1.35; white-space: nowrap; box-shadow: var(--shadow-md); color: var(--text);
}
.map-pin-ticket { font-weight: 700; color: var(--text); }
.map-pin-customer { color: var(--text-dim); }
.map-pin-tech { color: var(--purple); font-weight: 600; }

/* ==========================================================================
   Dispatch timeline
   ========================================================================== */
.timeline-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-solid); }
.timeline-header-row { display: flex; border-bottom: 1px solid var(--border); }
.timeline-tech-col-spacer { width: 150px; flex-shrink: 0; border-right: 1px solid var(--border); position: sticky; left: 0; background: var(--surface-solid); z-index: 2; }
.timeline-hour-label { flex-shrink: 0; font-size: .66rem; color: var(--text-faint); text-align: center; padding: .6rem 0; border-right: 1px solid var(--border-soft); }
.timeline-row { display: flex; border-bottom: 1px solid var(--border-soft); }
.timeline-tech-col {
  width: 150px; flex-shrink: 0; display: flex; align-items: center; gap: .55rem;
  padding: .55rem .8rem; border-right: 1px solid var(--border); background: var(--surface-2);
  position: sticky; left: 0; z-index: 1; font-size: .8rem; font-weight: 600; color: var(--text);
}
.timeline-track {
  position: relative; height: 56px;
  background-image: repeating-linear-gradient(to right, var(--border-soft) 0, var(--border-soft) 1px, transparent 1px, transparent 64px);
}
.timeline-business-band { position: absolute; top: 0; bottom: 0; background: var(--accent-soft); z-index: 0; }
.timeline-now-line { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--red); z-index: 2; box-shadow: 0 0 8px rgba(243,89,107,.7); }
.timeline-block {
  position: absolute; top: 8px; height: 40px; border-radius: var(--radius-sm); overflow: hidden;
  display: flex; align-items: center; padding: 0 .5rem; cursor: pointer;
  font-size: .68rem; color: var(--text); z-index: 1; transition: transform .12s var(--ease);
}
.timeline-block:hover { transform: translateY(-1px); }
.timeline-block-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ==========================================================================
   Time & Material / Invoice UI
   ========================================================================== */
.tm-log-row { display: flex; justify-content: space-between; font-size: .8rem; padding: .45rem 0; border-bottom: 1px solid var(--border-soft); color: var(--text); }
.tm-log-row:last-child { border-bottom: none; }
.tm-add-row { display: flex; gap: .5rem; margin-top: .75rem; align-items: center; flex-wrap: wrap; }

/* ==========================================================================
   Settings
   ========================================================================== */
.settings-panel { padding: 1.4rem 1.5rem; font-size: .85rem; color: var(--text-dim); line-height: 1.6; }
.settings-panel p { margin: 0 0 .8rem; }
.settings-code {
  font-family: 'SFMono-Regular', Menlo, Consolas, monospace; font-size: .78rem; color: var(--text);
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .6rem .75rem;
}

/* ==========================================================================
   Misc utility overrides (kept for template class compatibility)
   ========================================================================== */
.text-red-600, .text-red-400 { color: var(--red) !important; }
.text-amber-600 { color: var(--amber) !important; }
.text-slate-400, .text-slate-500 { color: var(--text-faint) !important; }

/* ==========================================================================
   Motion
   ========================================================================== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

.viewport > * { animation: rise .28s var(--ease); }

/* ==========================================================================
   Loading skeleton — shown while the first bootstrap fetch is in flight
   ========================================================================== */
@keyframes shimmer { 0% { background-position: -240px 0; } 100% { background-position: 240px 0; } }
.skel-line {
  height: .68rem; border-radius: var(--radius-sm); margin-top: .5rem; width: 45%;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-hover) 37%, var(--surface-2) 63%);
  background-size: 480px 100%; animation: shimmer 1.4s linear infinite;
}
.skel-line:first-child { margin-top: 0; }
.skel-icon { width: 34px; height: 34px; border-radius: var(--radius-sm); margin-bottom: .4rem; }
.skel-card { pointer-events: none; }
.skel-row { display: flex; align-items: center; gap: 2rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border-soft); }
.skel-row:last-child { border-bottom: none; }
.skel-row .skel-line { margin-top: 0; height: .72rem; }
