/* ==========================================================================
   MT Ops Dashboard — Sundays design language
   See docs/design-language.md for tokens & rationale.
   ========================================================================== */

:root{
  color-scheme: light;

  /* Surfaces */
  --frame:         #E4DBF5;
  --surface:       #FFFFFF;
  --surface-alt:   #F7F6FA;
  --border:        #EDECEF;
  --border-strong: #DCDBE0;
  --page:          #F7F6FA;   /* legacy alias */

  /* Text */
  --ink:            #141414;
  --ink-soft:       #4C4C55;
  --ink-muted:      #9A9AA3;
  --ink-faint:      #C4C4CA;
  --text-primary:   var(--ink);        /* legacy alias */
  --text-secondary: var(--ink-soft);   /* legacy alias */
  --text-muted:     var(--ink-muted);  /* legacy alias */

  /* Accent (soft lilac) */
  --accent:         #7C5CFF;
  --accent-tint:    #EDE9FF;
  --accent-tint-2:  #DAD1FF;
  --brand:          var(--accent);         /* legacy alias */
  --brand-dark:     #5A3EDB;
  --brand-bg:       var(--accent-tint);    /* legacy alias */

  /* Category / stat tints (paired with saturated icon color) */
  --tile-yellow-bg: #FFF3D6; --tile-yellow: #E4A73E;
  --tile-orange-bg: #FCE3D6; --tile-orange: #DE7A2C;
  --tile-red-bg:    #FBE6DB; --tile-red:    #C55A2B;
  --tile-pink-bg:   #FBE1EE; --tile-pink:   #D14A8F;
  --tile-purple-bg: #EDE9FF; --tile-purple: #6E4CE0;
  --tile-blue-bg:   #E1EAFB; --tile-blue:   #3D6DD9;
  --tile-green-bg:  #DFF0E4; --tile-green:  #2F9553;
  --tile-teal-bg:   #DDEBF9; --tile-teal:   #2F82C2;

  /* Legacy semantic aliases so pages.js keeps working */
  --aqua:      var(--tile-teal);    --aqua-bg:    var(--tile-teal-bg);
  --violet:    var(--tile-purple);  --violet-bg:  var(--tile-purple-bg);
  --orange:    var(--tile-orange);  --orange-bg:  var(--tile-orange-bg);

  /* Status */
  --good:      #2F9553;   --good-bg:     #DFF0E4;
  --success:   var(--good);
  --warning:   #E4A73E;   --warning-bg:  #FCE0CB;
  --critical:  #D14760;   --critical-bg: #FBD3DB;
  --info:      #3D6DD9;   --info-bg:     #E1EAFB;

  /* Pastel status pill palette (from § 1.5 of design-language.md) */
  --pill-progress-bg: #E5DBFB; --pill-progress: #4A2AA0;
  --pill-review-bg:   #FCE0CB; --pill-review:   #8A3F14;
  --pill-drafts-bg:   #EBDEF9; --pill-drafts:   #5A2E9C;
  --pill-high-bg:     #EEE7FE; --pill-high:     #5539B6;
  --pill-medium-bg:   #FDD8B9; --pill-medium:   #8A3F14;
  --pill-mid-bg:      #FBD3DB; --pill-mid:      #8C2A44;

  /* Radii */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 20px; --r-pill: 999px;
  --radius: var(--r-lg);       /* legacy */
  --radius-sm: var(--r-md);    /* legacy */

  /* Shadows — near flat */
  --shadow-xs: 0 1px 2px rgba(20,20,20,.04);
  --shadow-sm: 0 4px 14px rgba(20,20,20,.06);
  --shadow-md: 0 10px 28px rgba(20,20,20,.10);
  --shadow:    var(--shadow-xs);  /* legacy */

  /* Layout */
  --sidebar-w: 260px;

  /* Fonts */
  --font-sans:  "Inter", "General Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*,*::before,*::after{ box-sizing:border-box; }
html,body{ height:100%; }
svg{ width:16px; height:16px; flex-shrink:0; display:block; }
.login-logo svg{ width:28px; height:28px; }
.sidebar-brand .logo svg{ width:22px; height:22px; }
.confirm-icon svg{ width:22px; height:22px; }
.total-km-box .ic svg{ width:20px; height:20px; }
body{
  margin:0;
  background:var(--frame);
  color:var(--ink);
  font-family: var(--font-sans);
  font-size: 14.5px;
  line-height: 1.45;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
}
img{ max-width:100%; }
button, input, select, textarea{ font:inherit; color:inherit; }
button{ cursor:pointer; }
a{ color:var(--accent); text-decoration:none; font-weight:500; }
a:hover{ text-decoration:underline; }
[hidden]{ display:none !important; }

:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; border-radius:6px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible{ outline:none; }

::selection{ background:var(--accent-tint); color:var(--ink); }

@media (prefers-reduced-motion: reduce){
  *, *::before, *::after{ animation-duration:.01ms !important; transition-duration:.01ms !important; }
}
.tabular{ font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- login ---------- */
#login-screen, #app-shell{ min-height:100vh; }

.login-wrap{
  min-height:100vh; display:flex; align-items:center; justify-content:center;
  padding: 24px;
  background:
    radial-gradient(1000px 500px at 8% -8%, #F4E1F5 0%, transparent 55%),
    radial-gradient(900px 480px at 108% 8%, #E4D4FB 0%, transparent 55%),
    var(--frame);
}
.login-card{
  width:100%; max-width:400px; background:var(--surface);
  border:1px solid var(--border); border-radius:var(--r-xl);
  box-shadow:var(--shadow-sm);
  padding:36px 32px; animation:riseIn .3s ease-out;
}
@keyframes riseIn{ from{ opacity:0; transform:translateY(10px); } to{ opacity:1; transform:none; } }
.login-logo{
  width:56px; height:56px; border-radius:14px;
  background:var(--accent-tint); color:var(--accent);
  display:flex; align-items:center; justify-content:center; margin:0 auto 18px;
}
.login-card h1{
  text-align:center; margin:0 0 4px;
  font-family: var(--font-sans); font-weight:700; font-size:28px; line-height:1.15;
  color:var(--ink); letter-spacing:-.02em;
}
.login-card .sub{ text-align:center; color:var(--ink-soft); margin:0 0 26px; font-size:13.5px;}
.login-card .hint{ text-align:center; color:var(--ink-muted); font-size:12.5px; margin-top:18px; }
.field{ margin-bottom:14px; }
.field label{
  display:block; font-size:12.5px; font-weight:500; margin-bottom:6px;
  color:var(--ink-soft);
}
.input-icon{ position:relative; }
.input-icon svg{ position:absolute; left:14px; top:50%; transform:translateY(-50%); color:var(--ink-muted); }

/* ---------- form controls ---------- */
input[type=text], input[type=password], input[type=number], input[type=date],
input[type=time], input[type=search], input[type=file], select, textarea{
  width:100%; padding:10px 14px; border:1px solid var(--border-strong);
  border-radius:var(--r-md); background:#fff; color:var(--ink); outline:none;
  transition:border-color .12s ease-out, box-shadow .12s ease-out;
}
.input-icon input{ padding-left:40px; }
textarea{ resize:vertical; min-height:64px; }
input::placeholder, textarea::placeholder{ color:var(--ink-faint); }
input:focus, select:focus, textarea:focus{
  border-color:var(--accent);
  box-shadow:0 0 0 3px rgba(124,92,255,.15);
}
input.invalid, select.invalid{
  border-color:var(--critical);
  box-shadow:0 0 0 3px rgba(209,71,96,.15);
}
.error-text{ color:var(--critical); font-size:12.5px; margin-top:4px; font-weight:500; }
.form-row{ display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.form-row.cols-3{ grid-template-columns:1fr 1fr 1fr; }
@media (max-width:640px){ .form-row, .form-row.cols-3{ grid-template-columns:1fr; } }

/* ---------- buttons ---------- */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  padding:11px 18px; border-radius:var(--r-pill); border:1px solid transparent;
  font-family:var(--font-sans); font-weight:600; font-size:13.5px; white-space:nowrap;
  transition:background-color .12s ease-out, border-color .12s ease-out, color .12s ease-out, box-shadow .12s ease-out, transform .08s;
}
.btn:active:not(:disabled){ transform:translateY(1px); }
.btn-primary{ background:var(--ink); color:#fff; }
.btn-primary:hover{ background:#2A2A2A; }
.btn-primary:active{ background:#000; }
.btn-block{ width:100%; }
.btn-outline{
  background:#fff; border-color:var(--border-strong); color:var(--ink);
  border-radius:var(--r-md);
}
.btn-outline:hover{ background:var(--surface-alt); border-color:var(--ink-muted); }
.btn-danger{
  background:#fff; border-color:var(--critical); color:var(--critical);
  border-radius:var(--r-md);
}
.btn-danger:hover{ background:var(--critical-bg); }
.btn-sm{ padding:8px 12px; font-size:12.5px; border-radius:var(--r-md); }
.btn:disabled{ opacity:.5; cursor:not-allowed; }
.btn svg{ width:16px; height:16px; flex:none; }

/* ---------- app shell ---------- */
#app-shell{ display:flex; background:var(--frame); }
.sidebar{
  width:var(--sidebar-w); flex:none; background:var(--surface);
  border-right:1px solid var(--border);
  min-height:100vh; position:sticky; top:0; align-self:flex-start;
  display:flex; flex-direction:column;
  padding:24px 16px 16px;
}
.sidebar-brand{ display:flex; align-items:center; gap:10px; padding:0 8px 24px; }
.sidebar-brand .logo{
  width:36px; height:36px; border-radius:10px;
  background:var(--accent-tint); color:var(--accent);
  display:flex; align-items:center; justify-content:center;
}
.sidebar-brand .name{
  font-family:var(--font-sans); font-weight:700; font-size:18px; line-height:1;
  color:var(--ink); letter-spacing:-.01em;
}

.nav{ padding:4px 4px; display:flex; flex-direction:column; gap:2px; flex:1; }
.nav::before{
  content:'MENU'; font-size:11px; font-weight:600; color:var(--ink-muted);
  text-transform:uppercase; letter-spacing:.08em; padding:6px 10px 10px;
}
.nav-item{
  display:flex; align-items:center; gap:12px; padding:10px 12px;
  border-radius:var(--r-md);
  color:var(--ink-soft); font-weight:500; font-size:13.5px;
  transition:background-color .12s ease-out, color .12s ease-out;
}
.nav-item svg{ width:18px; height:18px; flex:none; color:var(--ink-muted); }
.nav-item:hover{ background:var(--surface-alt); text-decoration:none; color:var(--ink); }
.nav-item:hover svg{ color:var(--ink-soft); }
.nav-item.active{
  background:var(--accent-tint); color:var(--ink); font-weight:600;
}
.nav-item.active svg{ color:var(--ink); }

.sidebar-foot{
  padding:14px 10px 4px; border-top:1px solid var(--border);
  font-size:11.5px; color:var(--ink-muted); line-height:1.4;
}

.main{ flex:1; min-width:0; background:var(--surface-alt); }
.topbar{
  position:sticky; top:0; z-index:20;
  background:rgba(247,246,250,.94); backdrop-filter:blur(8px);
  border-bottom:1px solid var(--border);
  display:flex; align-items:center; justify-content:space-between;
  padding:18px 28px; gap:12px;
}
.topbar h1{
  font-size:22px; font-weight:600; margin:0; color:var(--ink); letter-spacing:-.01em;
}
.topbar-right{ display:flex; align-items:center; gap:14px; }
.hamburger{ display:none; }
.today-chip{
  display:flex; align-items:center; gap:6px; color:var(--ink-soft); font-size:13px;
  padding:6px 10px; border-radius:var(--r-md);
  background:var(--surface); border:1px solid var(--border);
}
.today-chip svg{ color:var(--ink-muted); }
.user-menu{ position:relative; }
.avatar{
  width:38px; height:38px; border-radius:50%;
  background:var(--accent); color:#fff; font-weight:600;
  display:flex; align-items:center; justify-content:center; font-size:13px;
  box-shadow:0 0 0 2px #fff;
  transition:box-shadow .13s ease-out;
}
.user-btn{ display:flex; align-items:center; gap:8px; background:transparent; border:none; padding:2px; }
.user-btn:hover .avatar{ box-shadow:0 0 0 2px #fff, 0 0 0 4px var(--accent-tint); }
.user-dropdown{
  position:absolute; right:0; top:48px; background:#fff;
  border:1px solid var(--border); border-radius:var(--r-md);
  box-shadow:var(--shadow-sm); min-width:200px; padding:6px; display:none; z-index:30;
}
.user-dropdown.open{ display:block; animation:riseIn .12s ease-out; }
.user-dropdown .who{ padding:10px 12px; border-bottom:1px solid var(--border); margin-bottom:4px; }
.user-dropdown .who .name{ font-weight:600; font-size:13.5px; }
.user-dropdown .who .role{ font-size:11.5px; color:var(--ink-muted); }
.user-dropdown button{
  width:100%; text-align:left; background:none; border:none;
  padding:9px 12px; border-radius:var(--r-sm); font-size:13.5px;
  display:flex; align-items:center; gap:10px; color:var(--ink);
}
.user-dropdown button:hover{ background:var(--surface-alt); }
.user-dropdown button svg{ color:var(--ink-muted); }

.page{ padding:24px 28px 72px; max-width:1400px; animation:pageIn .18s ease-out; }
@keyframes pageIn{ from{ opacity:0; transform:translateY(4px); } to{ opacity:1; transform:none; } }

/* ---------- cards ---------- */
.card{
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--r-lg);
  box-shadow:none;
}
.card-pad{ padding:22px 24px; }
.card-head{
  display:flex; align-items:center; justify-content:space-between;
  padding:18px 22px; border-bottom:1px solid var(--border); gap:12px;
}
.card-head h2{
  font-size:18px; font-weight:600; margin:0; color:var(--ink); letter-spacing:-.005em;
}
.card-head .link{ font-size:13px; font-weight:500; color:var(--accent); }

.filter-bar{
  display:flex; flex-wrap:wrap; align-items:end; gap:12px; margin-bottom:18px;
}
.filter-bar .field{ margin:0; min-width:150px; }
.filter-bar .field.grow{ flex:1; min-width:200px; }
.filter-bar .actions{ display:flex; gap:8px; }

/* ---------- stat cards ---------- */
.stat-grid{ display:grid; grid-template-columns:repeat(4,1fr); gap:16px; margin-bottom:18px; }
@media (max-width:1000px){ .stat-grid{ grid-template-columns:repeat(2,1fr); } }
@media (max-width:520px){ .stat-grid{ grid-template-columns:1fr; } }
.stat-card{
  display:flex; align-items:flex-start; gap:14px;
  padding:20px 22px;
  transition:box-shadow .15s ease-out, transform .15s ease-out;
}
.stat-card:hover{ box-shadow:var(--shadow-xs); transform:translateY(-1px); }
.stat-icon{
  width:44px; height:44px; border-radius:12px;
  display:flex; align-items:center; justify-content:center; flex:none;
}
.stat-icon svg{ width:22px; height:22px; }
.stat-label{ font-size:12.5px; color:var(--ink-soft); font-weight:500; }
.stat-value{
  font-size:26px; font-weight:600; margin:4px 0; color:var(--ink); letter-spacing:-.02em;
}
.stat-sub{ font-size:12px; color:var(--ink-muted); }

.dash-grid{ display:grid; grid-template-columns:1.5fr 1fr; gap:16px; }
@media (max-width:980px){ .dash-grid{ grid-template-columns:1fr; } }

/* ---------- chart ---------- */
.chart-wrap{ padding:20px 24px 12px; }
.viz-root{
  --surface-1:#FCFCFB; --text-primary:#141414; --text-secondary:#4C4C55;
  --muted:#9A9AA3; --grid:#EDECEF; --series-1:#141414;
}
.bar-tooltip{
  position:absolute; background:var(--ink); color:#fff; font-size:12px;
  padding:7px 10px; border-radius:8px; pointer-events:none;
  transform:translate(-50%,-110%); white-space:nowrap; box-shadow:var(--shadow-sm);
  z-index:5; opacity:0; transition:opacity .1s;
}
.bar-tooltip.show{ opacity:1; }
.chart-bar{ transition:fill .12s; cursor:pointer; }
.chart-bar:hover{ fill:var(--accent); }

/* top vehicles list */
.rank-row{
  display:flex; align-items:center; gap:12px;
  padding:12px 0; border-bottom:1px solid var(--border);
}
.rank-row:last-child{ border-bottom:none; }
.rank-name{
  font-size:13.5px; font-weight:600; width:150px; flex:none;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.rank-bar-track{
  flex:1; height:8px; border-radius:4px;
  background:var(--surface-alt); overflow:hidden;
}
.rank-bar-fill{ height:100%; border-radius:4px; background:var(--ink); }
.rank-value{ font-size:13px; font-weight:600; width:64px; text-align:right; flex:none; }

/* ---------- table ---------- */
.table-wrap{
  overflow-x:auto; border:1px solid var(--border);
  border-radius:var(--r-md); background:#fff;
}
.table-wrap::-webkit-scrollbar{ height:8px; }
.table-wrap::-webkit-scrollbar-thumb{ background:var(--border-strong); border-radius:4px; }
.table-wrap::-webkit-scrollbar-track{ background:transparent; }
table.data-table{ width:100%; border-collapse:collapse; min-width:640px; }
.data-table tbody tr:last-child td{ border-bottom:none; }
.data-table th{
  text-align:left; font-size:11px; text-transform:uppercase;
  letter-spacing:.08em; color:var(--ink-muted); font-weight:600;
  padding:12px 16px; border-bottom:1px solid var(--border);
  white-space:nowrap; background:var(--surface-alt);
}
.data-table td{
  padding:14px 16px; border-bottom:1px solid var(--border);
  font-size:13.5px; vertical-align:middle; color:var(--ink);
}
.data-table tbody tr:hover{ background:var(--surface-alt); }
.data-table tfoot td{ font-weight:600; background:var(--surface-alt); color:var(--ink); }

.report-table th, .report-table td{ white-space:nowrap; vertical-align:middle; }
.report-table th.wrap, .report-table td.wrap{
  max-width:220px; overflow:hidden; text-overflow:ellipsis;
}
.report-table td.wrap{ cursor:help; }
.report-table th.sortable{ cursor:pointer; user-select:none; }
.report-table th.sortable:hover{ color:var(--ink); background:var(--accent-tint); }
.report-table th.sortable.active{ color:var(--accent); }

/* Compact report header — title + summary chip on the left, exports on the right */
.card-head.report-head{ padding:14px 22px; gap:14px; align-items:center; flex-wrap:wrap; }
.report-head-title{ min-width:0; flex:1; }
.report-head-title h2{ font-size:16px; margin:0; line-height:1.3; letter-spacing:-.005em; }
.rp-summary{ font-size:12.5px; color:var(--ink-muted); margin-top:2px; font-weight:500; }
.rp-summary strong{ color:var(--ink); font-weight:600; }
.card-head.report-head .actions{ gap:8px; flex-wrap:wrap; }
@media (max-width:640px){
  .card-head.report-head{
    padding:12px 14px;
    flex-direction:column; align-items:stretch;
  }
  .report-head-title h2{ font-size:15px; }
  .card-head.report-head .actions{ width:100%; }
  .card-head.report-head .actions .btn{ flex:1; min-width:0; }
}

.active-filter-chip{
  display:inline-flex; align-items:center; gap:8px;
  background:var(--accent-tint); color:var(--ink);
  padding:6px 8px 6px 14px; border-radius:var(--r-pill);
  font-size:13px; margin:0 0 14px;
}
.active-filter-chip strong{ color:var(--ink); font-weight:600; }
.active-filter-chip .chip-x{
  background:transparent; border:none; color:var(--ink-soft);
  font-size:18px; line-height:1; cursor:pointer;
  padding:0 8px; border-radius:var(--r-pill);
}
.active-filter-chip .chip-x:hover{ background:rgba(20,20,20,.06); color:var(--ink); }

.cell-muted{ color:var(--ink-muted); }
.row-actions{ display:flex; gap:4px; }
.icon-btn{
  width:34px; height:34px; display:inline-flex; align-items:center; justify-content:center;
  border-radius:var(--r-md); border:1px solid transparent;
  background:transparent; color:var(--ink-soft);
  transition:background-color .12s ease-out, color .12s ease-out;
}
.icon-btn svg{ width:16px; height:16px; }
.icon-btn:hover{ background:var(--surface-alt); color:var(--ink); }
.icon-btn.danger:hover{ background:var(--critical-bg); color:var(--critical); }

/* ---------- badges (status pills) ---------- */
.badge{
  display:inline-flex; align-items:center; gap:5px;
  padding:4px 12px; border-radius:var(--r-pill);
  font-size:12px; font-weight:500;
}
.badge-good{      background:var(--good-bg);     color:var(--good); }
.badge-muted{     background:var(--surface-alt); color:var(--ink-soft); }
.badge-brand{     background:var(--accent-tint); color:var(--accent); }
.badge-critical{  background:var(--pill-mid-bg); color:var(--pill-mid); }
.badge-warning{   background:var(--pill-review-bg); color:var(--pill-review); }
.badge-progress{  background:var(--pill-progress-bg); color:var(--pill-progress); }
.badge-drafts{    background:var(--pill-drafts-bg); color:var(--pill-drafts); }

/* ---------- searchable dropdown ---------- */
.ss-wrap{ position:relative; }
.ss-input{ width:100%; }
.ss-list{
  position:absolute; top:calc(100% + 4px); left:0; right:0; z-index:50;
  background:#fff; border:1px solid var(--border-strong);
  border-radius:var(--r-md); box-shadow:var(--shadow-sm);
  max-height:240px; overflow-y:auto; padding:4px; list-style:none; margin:0;
}
.ss-list li{
  padding:9px 12px; font-size:13.5px; cursor:pointer;
  border-radius:var(--r-sm); color:var(--ink);
}
.ss-list li:hover, .ss-list li.ss-focus{ background:var(--surface-alt); }
.ss-list li.ss-selected{ background:var(--accent-tint); color:var(--ink); font-weight:600; }
.ss-list li.ss-selected.ss-focus{ background:var(--accent-tint-2); }
@media (max-width:640px){ .ss-list li{ font-size:16px; padding:12px; } }

/* ---------- movement share card (captured by html2canvas) ---------- */
/* ---------- shared share-card frame (movement / report / dashboard) ---------- */
.share-card{
  background:#fff; color:#141414; box-sizing:border-box;
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
  border:1px solid #DCDBE0; border-radius:16px; overflow:hidden;
}
.share-card *{ box-sizing:border-box; }
.share-card .sc-head{
  background:#fff; color:#141414; padding:22px 28px;
  border-bottom:1px solid #DCDBE0;
}
.share-card .sc-unit{
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
  font-size:20px; font-weight:700; letter-spacing:-.01em; line-height:1.2;
}
.share-card .sc-sub{
  font-size:11px; color:#4C4C55; margin-top:6px;
  letter-spacing:.1em; text-transform:uppercase; font-weight:500;
}

/* ---------- report share card (full-data capture) ---------- */
.report-share-card{ width:1200px; padding:0 0 24px; }
.report-share-card .rsc-meta{
  display:flex; flex-wrap:wrap; gap:32px;
  padding:20px 28px; border-bottom:1px solid #EDECEF;
}
.report-share-card .rsc-meta > div{ display:flex; flex-direction:column; gap:4px; }
.report-share-card .rsc-meta span{
  font-size:10.5px; color:#9A9AA3; font-weight:500;
  text-transform:uppercase; letter-spacing:.08em;
}
.report-share-card .rsc-meta strong{ font-size:15px; color:#141414; font-weight:600; }
.report-share-card .rsc-table{
  width:100%; border-collapse:collapse; font-size:11.5px;
  margin:0; table-layout:auto;
}
.report-share-card .rsc-table th{
  background:#F7F6FA; color:#4C4C55;
  font-size:10px; font-weight:600; text-transform:uppercase; letter-spacing:.08em;
  padding:11px 10px; text-align:left; border-bottom:1px solid #DCDBE0; white-space:nowrap;
}
.report-share-card .rsc-table td{
  padding:10px; border-bottom:1px solid #EDECEF;
  vertical-align:top; color:#141414; font-size:11.5px; line-height:1.4;
  white-space:nowrap;
}
.report-share-card .rsc-table td.rsc-num{
  font-variant-numeric:tabular-nums;
}
.report-share-card .rsc-table td.rsc-wrap{
  white-space:normal; word-break:break-word; max-width:180px;
}
.report-share-card .rsc-table tfoot td{
  background:#F7F6FA; font-weight:600; padding:11px 10px;
  border-bottom:none; border-top:1px solid #DCDBE0;
}
.report-share-card .rsc-status{
  display:inline-block; padding:3px 10px; border-radius:999px;
  font-size:10.5px; font-weight:600; line-height:1;
}
.report-share-card .rsc-status-ok{  background:#DFF0E4; color:#2F9553; }
.report-share-card .rsc-status-wip{ background:#FBD3DB; color:#8C2A44; }
.report-share-card .rsc-foot{
  font-size:11.5px; color:#9A9AA3; text-align:right;
  padding:14px 28px 4px;
}

/* ---------- dashboard share card ---------- */
.dashboard-share-card{ width:1100px; padding:0 0 24px; }
.dashboard-share-card .rsc-meta{
  display:flex; flex-wrap:wrap; gap:32px;
  padding:20px 28px; border-bottom:1px solid #EDECEF;
}
.dashboard-share-card .rsc-meta > div{ display:flex; flex-direction:column; gap:4px; }
.dashboard-share-card .rsc-meta span{
  font-size:10.5px; color:#9A9AA3; font-weight:500;
  text-transform:uppercase; letter-spacing:.08em;
}
.dashboard-share-card .rsc-meta strong{ font-size:15px; color:#141414; font-weight:600; }
.dashboard-share-card .dsc-kpis{
  display:grid; grid-template-columns:repeat(4, 1fr); gap:14px;
  padding:24px 28px;
}
.dashboard-share-card .dsc-kpi{
  background:#F7F6FA; border-radius:14px; padding:18px 20px;
}
.dashboard-share-card .dsc-kpi-lbl{ font-size:12px; color:#4C4C55; font-weight:500; }
.dashboard-share-card .dsc-kpi-val{
  font-size:28px; font-weight:600; color:#141414;
  margin:4px 0; letter-spacing:-.02em; font-variant-numeric:tabular-nums;
}
.dashboard-share-card .dsc-kpi-sub{ font-size:11px; color:#9A9AA3; }
.dashboard-share-card .dsc-cols{
  display:grid; grid-template-columns:1.6fr 1fr; gap:20px;
  padding:0 28px 20px;
}
.dashboard-share-card .dsc-section{
  background:#fff; border:1px solid #EDECEF; border-radius:14px; padding:22px 24px;
}
.dashboard-share-card .dsc-section-title{
  font-size:14px; font-weight:600; color:#141414; margin-bottom:20px; letter-spacing:-.005em;
}
.dashboard-share-card .dsc-bar-wrap{
  display:flex; align-items:flex-end; justify-content:space-between;
  gap:10px; height:180px; padding-top:24px;
}
.dashboard-share-card .dsc-bar-col{
  flex:1; display:flex; flex-direction:column; align-items:center; gap:6px;
  font-size:10.5px; color:#9A9AA3; min-width:0;
}
.dashboard-share-card .dsc-bar{
  width:100%; max-width:36px; background:#7C5CFF; border-radius:6px 6px 0 0;
}
.dashboard-share-card .dsc-bar-val{
  font-size:10px; color:#4C4C55; font-weight:600; margin-bottom:2px;
  font-variant-numeric:tabular-nums;
}
.dashboard-share-card .dsc-bar-lbl{ font-size:10.5px; color:#9A9AA3; font-weight:500; }
.dashboard-share-card .dsc-rank-wrap{ display:flex; flex-direction:column; gap:12px; }
.dashboard-share-card .dsc-rank{
  display:grid; grid-template-columns:130px 1fr auto; gap:12px; align-items:center;
  font-size:12px;
}
.dashboard-share-card .dsc-rank-name{
  display:flex; flex-direction:column; gap:2px; min-width:0;
}
.dashboard-share-card .dsc-rank-name strong{
  font-size:12.5px; font-weight:600; color:#141414;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.dashboard-share-card .dsc-rank-name span{ font-size:10.5px; color:#9A9AA3; }
.dashboard-share-card .dsc-rank-track{ height:8px; background:#F7F6FA; border-radius:4px; overflow:hidden; }
.dashboard-share-card .dsc-rank-fill{ height:100%; background:#7C5CFF; border-radius:4px; }
.dashboard-share-card .dsc-rank-val{
  font-size:12px; font-weight:600; color:#141414; font-variant-numeric:tabular-nums;
}
.dashboard-share-card .dsc-empty{ color:#9A9AA3; text-align:center; padding:24px; }
.dashboard-share-card .rsc-foot{
  font-size:11.5px; color:#9A9AA3; text-align:right;
  padding:0 28px;
}

.mv-share-card{
  position:absolute; left:-9999px; top:0;
  width:460px; background:#fff;
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
  color: #141414;
  border:1px solid #DCDBE0; border-radius:16px; overflow:hidden;
  box-sizing:border-box;
}
.mv-share-card *{ box-sizing:border-box; }
.mv-share-card .sc-head{
  background:#fff; color:#141414;
  padding:20px 22px; border-bottom:1px solid #DCDBE0;
}
.mv-share-card .sc-unit{
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
  font-size:18px; font-weight:700; letter-spacing:-.01em; line-height:1.2;
}
.mv-share-card .sc-sub{
  font-size:11px; color:#4C4C55; margin-top:6px;
  letter-spacing:.1em; text-transform:uppercase; font-weight:500;
}
.mv-share-card .sc-table{ width:100%; border-collapse:collapse; font-size:13.5px; table-layout:fixed; }
.mv-share-card .sc-table tr{ border-bottom:1px solid #EDECEF; }
.mv-share-card .sc-table tr:last-child{ border-bottom:none; }
.mv-share-card .sk{
  padding:12px 22px; color:#9A9AA3; font-weight:500; font-size:11px;
  width:130px; white-space:nowrap; text-transform:uppercase; letter-spacing:.08em;
  vertical-align:middle;
}
.mv-share-card .sv{
  padding:12px 22px 12px 0; color:#141414; font-weight:500;
  word-break:break-word; vertical-align:middle;
}
.mv-share-card .sc-status-ok{
  color:#2F9553; font-weight:600; font-size:12px;
  background:#DFF0E4; border-radius:999px; padding:4px 12px;
  display:inline-block; line-height:1;
}
.mv-share-card .sc-status-wip{
  color:#8C2A44; font-weight:600; font-size:12px;
  background:#FBD3DB; border-radius:999px; padding:4px 12px;
  display:inline-block; line-height:1;
}

/* operator landing: open movement rows */
.open-mv-row{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding:14px 4px; border-bottom:1px solid var(--border); flex-wrap:wrap;
}
.open-mv-row:last-child{ border-bottom:none; }
.open-mv-row .meta{ font-size:12.5px; color:var(--ink-muted); margin-top:3px; }
.open-mv-row .acts{ display:flex; gap:6px; align-items:center; }
@media (max-width:640px){
  .open-mv-row .acts{ width:100%; justify-content:flex-end; }
}

.empty-state{ text-align:center; padding:56px 20px; color:var(--ink-muted); }
.empty-state svg{ width:44px; height:44px; margin-bottom:10px; opacity:.6; }

/* ---------- pagination ---------- */
.pagination{
  display:flex; align-items:center; justify-content:space-between;
  padding:18px 4px 4px; flex-wrap:wrap; gap:10px;
}
.pagination .info{ font-size:12.5px; color:var(--ink-muted); }
.pagination .pages{ display:flex; gap:4px; }
.page-btn{
  min-width:34px; height:34px; padding:0 8px;
  border-radius:var(--r-md); border:1px solid var(--border-strong);
  background:#fff; font-size:13px; font-weight:500; color:var(--ink-soft);
  transition:background-color .12s, color .12s;
}
.page-btn:hover:not(:disabled){ background:var(--surface-alt); color:var(--ink); }
.page-btn.active{ background:var(--ink); border-color:var(--ink); color:#fff; }
.page-btn:disabled{ opacity:.4; }

/* ---------- modal ---------- */
.modal-backdrop{
  position:fixed; inset:0; background:rgba(20,20,20,.35);
  display:flex; align-items:center; justify-content:center;
  padding:20px; z-index:100;
  animation:fadeIn .12s ease-out;
}
@keyframes fadeIn{ from{ opacity:0; } to{ opacity:1; } }
.modal{
  background:#fff; border-radius:var(--r-lg);
  width:100%; max-width:520px; max-height:90vh; overflow:auto;
  box-shadow:var(--shadow-md);
  animation:riseIn .16s ease-out;
}
.modal.modal-lg{ max-width:780px; }
.modal-head{
  display:flex; align-items:center; justify-content:space-between;
  padding:20px 24px; border-bottom:1px solid var(--border);
}
.modal-head h3{
  margin:0; font-size:17px; font-weight:600; color:var(--ink);
  overflow-wrap:anywhere; line-height:1.3; min-width:0;
}
.modal-body{ padding:22px 24px; }
.modal-foot{
  display:flex; justify-content:flex-end; gap:10px;
  flex-wrap:wrap; align-items:center;
  padding:18px 24px; border-top:1px solid var(--border);
  background:var(--surface-alt);
  border-bottom-left-radius:var(--r-lg); border-bottom-right-radius:var(--r-lg);
}
.modal-foot .btn{ min-height:36px; }
.share-wa-btn{
  background:#25D366; color:#fff; border:none;
}
.share-wa-btn:hover{ background:#1EBE59; }

/* ---------- share movement modal grid ---------- */
.share-grid{
  display:grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap:20px; align-items:start;
}
.share-preview{
  background:var(--surface-alt); border:1px solid var(--border);
  border-radius:var(--r-md); padding:14px;
  display:flex; align-items:center; justify-content:center;
}
.share-preview img{
  display:block; width:100%; height:auto;
  border-radius:var(--r-md);
  box-shadow: var(--shadow-xs);
}
.share-message textarea{
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size:13px; line-height:1.5;
  min-height:220px; resize:vertical;
}
@media (max-width:720px){
  .share-grid{ grid-template-columns: 1fr; gap:16px; }
}

.confirm-icon{
  width:44px; height:44px; border-radius:12px;
  display:flex; align-items:center; justify-content:center; margin-bottom:12px;
}

/* ---------- toasts ---------- */
#toast-stack{
  position:fixed; bottom:20px; right:20px;
  display:flex; flex-direction:column; gap:10px; z-index:200;
}
.toast{
  display:flex; align-items:flex-start; gap:12px;
  background:#fff; border:1px solid var(--border); border-radius:var(--r-md);
  box-shadow:var(--shadow-sm); padding:14px 16px;
  min-width:260px; max-width:360px; animation:toastIn .15s ease-out;
}
@keyframes toastIn{ from{ opacity:0; transform:translateY(6px);} to{opacity:1; transform:none;} }
.toast svg{ width:18px; height:18px; flex:none; margin-top:1px; }
.toast.success svg{ color:var(--good); }
.toast.error   svg{ color:var(--critical); }
.toast.info    svg{ color:var(--accent); }
.toast .msg{ font-size:13.5px; }
.toast .msg .t{ font-weight:600; display:block; margin-bottom:2px; }

/* ---------- misc ---------- */
.total-km-box{
  display:flex; align-items:center; gap:14px;
  background:var(--accent-tint); border-radius:var(--r-lg);
  padding:16px 20px; margin-top:6px;
}
.total-km-box .ic{
  width:40px; height:40px; border-radius:var(--r-md);
  background:#fff; color:var(--accent);
  display:flex; align-items:center; justify-content:center;
}
.total-km-box .num{ font-size:22px; font-weight:600; color:var(--ink); letter-spacing:-.01em; }
.total-km-box .lbl{ font-size:12px; color:var(--ink-soft); font-weight:500; }

.section-title{
  font-size:11px; font-weight:600; color:var(--ink-muted);
  text-transform:uppercase; letter-spacing:.08em; margin:24px 0 12px;
}
.helper-text{ font-size:12.5px; color:var(--ink-muted); margin-top:6px; }
.divider{ height:1px; background:var(--border); margin:20px 0; }
.kv-row{
  display:flex; justify-content:space-between; align-items:baseline; gap:14px;
  padding:11px 0; border-bottom:1px solid var(--border); font-size:13.5px;
}
.kv-row:last-child{ border-bottom:none; }
.kv-row .k{ color:var(--ink-soft); font-weight:500; }
.kv-row .v{ font-weight:500; color:var(--ink); }
.two-col{ display:grid; grid-template-columns:1fr 1fr; gap:20px; }
@media (max-width:860px){ .two-col{ grid-template-columns:1fr; } }

.history-item{ padding:11px 0; border-bottom:1px dashed var(--border); font-size:12.5px; color:var(--ink-soft); }
.history-item:last-child{ border-bottom:none; }
.history-item .meta{ color:var(--ink-muted); font-size:11.5px; margin-top:2px; }

/* ---------- spinner ---------- */
.spinner{
  width:16px; height:16px;
  border:2px solid rgba(255,255,255,.35); border-top-color:#fff; border-radius:50%;
  animation:spin .6s linear infinite; display:inline-block;
}
.spinner.dark{ border-color:rgba(20,20,20,.15); border-top-color:var(--ink); }
@keyframes spin{ to{ transform:rotate(360deg); } }

.loading-overlay{
  position:fixed; inset:0; background:rgba(247,246,250,.85);
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:14px;
  z-index:500; color:var(--ink-soft); font-weight:500;
}

/* ---------- responsive nav ---------- */
@media (max-width:900px){
  .sidebar{
    position:fixed; left:0; top:0; height:100vh;
    transform:translateX(-100%); transition:transform .18s ease; z-index:60;
    box-shadow:0 0 0 100vw rgba(0,0,0,0);
  }
  .sidebar.open{ transform:translateX(0); box-shadow:0 0 0 100vw rgba(20,20,20,.35); }
  .hamburger{ display:inline-flex; }
  .page{ padding:16px 14px 60px; }
  .topbar{ padding:14px 16px; }
  .rank-name{ width:110px; }
}
@media (max-width:480px){
  .topbar h1{ font-size:18px; }
  .today-chip span.long{ display:none; }
}

/* ---------- phone layout ---------- */
@media (max-width:640px){
  /* 16px inputs stop iOS Safari from auto-zooming on focus */
  input[type=text], input[type=password], input[type=number], input[type=date],
  input[type=time], input[type=search], select, textarea{ font-size:16px; }

  .btn{ padding:12px 18px; }
  .icon-btn{ width:40px; height:40px; }
  .page-btn{ min-width:38px; height:38px; }
  .user-dropdown button{ padding:12px 10px; }
  .nav-item{ padding:12px 14px; }

  .page{ padding:14px 12px 56px; }
  .card-pad{ padding:16px; }
  .card-head{ padding:14px 16px; flex-wrap:wrap; row-gap:10px; }
  .card-head h2{ font-size:16px; }
  .login-card{ padding:28px 22px; }

  /* denser report table so more columns visible before scroll */
  .report-table th, .report-table td{ padding:10px 12px; font-size:12.5px; }
  .report-table td.wrap{ max-width:150px; }
  .report-table th{ letter-spacing:.06em; }
  .table-wrap{ border-radius:var(--r-md); }

  /* modal head: allow long titles to wrap cleanly */
  .modal-head{ padding:16px 18px; flex-wrap:wrap; row-gap:6px; }
  .modal-body{ padding:18px; }
  .modal-foot{ padding:14px 18px; }

  /* filters: two-up grid, full-width search + action buttons */
  .filter-bar{ display:grid; grid-template-columns:1fr 1fr; gap:10px; align-items:end; }
  .filter-bar .field, .filter-bar .field.grow{ min-width:0; }
  .filter-bar .field.grow, .filter-bar .actions{ grid-column:1 / -1; }
  .filter-bar .actions .btn{ flex:1; }

  /* full-width toasts above the thumb zone */
  #toast-stack{ left:10px; right:10px; bottom:10px; }
  .toast{ min-width:0; max-width:none; width:100%; }

  .modal-backdrop{ padding:10px; }
  .modal{ max-height:94vh; }

  /* tables opted in via .cards-sm collapse into stacked cards */
  .cards-sm{ border:none; border-radius:0; overflow:visible; background:transparent; }
  .cards-sm table.data-table{ min-width:0; }
  .cards-sm thead{ display:none; }
  .cards-sm tbody{ display:block; }
  .cards-sm tbody tr{
    display:block; background:var(--surface);
    border:1px solid var(--border); border-radius:var(--r-lg);
    box-shadow:none; margin-bottom:12px; padding:6px 16px;
  }
  .cards-sm tbody tr:hover{ background:var(--surface); }
  .cards-sm td{
    display:flex; justify-content:space-between; align-items:center; gap:14px;
    border-bottom:1px dashed var(--border); padding:10px 0;
    font-size:13.5px; text-align:right;
  }
  .cards-sm td:last-child{ border-bottom:none; }
  .cards-sm td::before{
    content:attr(data-label); font-weight:600; color:var(--ink-muted);
    font-size:11px; text-transform:uppercase; letter-spacing:.08em;
    text-align:left; flex:none;
  }
  .cards-sm td[data-label='']::before, .cards-sm td:not([data-label])::before{ content:none; }
  .cards-sm td.row-actions{ justify-content:flex-end; }
  .cards-sm tfoot{ display:block; }
  .cards-sm tfoot tr{
    display:flex; justify-content:space-between;
    background:var(--surface-alt); border-radius:var(--r-md); padding:12px 16px;
  }
  .cards-sm tfoot td{ border:none; padding:0; background:none; }
}

/* ---------- Backup & Restore review / confirm modals ---------- */
.backup-review-grid th,
.backup-review-grid td{ white-space:nowrap; }
.backup-review-grid .tabular{ text-align:right; font-variant-numeric:tabular-nums; }
.backup-warning{
  border-radius:12px; padding:12px 14px; display:flex; flex-direction:column;
  border:1px solid transparent;
}
.backup-warning svg{ width:18px; height:18px; vertical-align:-3px; margin-right:4px; }
.backup-warning-yellow{
  background:var(--warning-bg); border-color:var(--warning); color:#7A4A0A;
}
.backup-warning-red{
  background:var(--critical-bg); border-color:var(--critical); color:#7A1B2A;
}
.backup-checkbox input[type="checkbox"]{ transform:scale(1.15); accent-color:var(--critical); }
