/* RMC Mining – management dashboard. Aglink theme: deep navy surfaces, lime accent, Montserrat. */
@font-face {
  font-family: "Montserrat";
  src: url("../fonts/montserrat-latin.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}

:root {
  --bg: #0b111a;
  --bg-2: #0f1620;
  --surface: #162130;
  --surface-2: #1c2935;
  --surface-3: #22303f;
  --line: #2a3645;
  --line-soft: rgba(255, 255, 255, .06);
  --text: #e8ecf0;
  --muted: #a8b2bd;
  --faint: #6f7d8c;
  --accent: #8ec63f;
  --accent-2: #b7dd6e;
  --accent-ink: #0b111a;
  --good: #8ec63f;
  --warn: #f2b53a;
  --bad: #ef5b5b;
  --info: #4fb3d9;
  --violet: #9b8cff;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --sidebar: 232px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 14px/1.5 "Montserrat", "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(142, 198, 63, .10), transparent 60%),
    radial-gradient(900px 400px at -10% 110%, rgba(79, 179, 217, .06), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { color: var(--accent); }
button, input, select { font: inherit; color: inherit; }
::selection { background: rgba(142, 198, 63, .35); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2a3645; border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- shell ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 30;
  display: flex; flex-direction: column; gap: 6px; padding: 22px 14px;
  background: linear-gradient(180deg, #0d1520 0%, #0a1018 100%);
  border-right: 1px solid var(--line-soft);
}
.logo { display: flex; align-items: center; gap: 12px; padding: 4px 10px 22px; }
.logo-mark {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent) 0%, #5f9a1f 100%); color: var(--accent-ink);
  font-weight: 800; letter-spacing: -.5px; box-shadow: 0 6px 18px rgba(142, 198, 63, .35);
}
.logo-text { line-height: 1.15; }
.logo-text b { display: block; font-size: 15px; letter-spacing: .5px; }
.logo-text span { font-size: 11px; color: var(--muted); letter-spacing: 1.5px; text-transform: uppercase; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; margin: 2px 0;
  border-radius: 10px; color: var(--muted); font-weight: 500; transition: background .15s, color .15s;
}
.nav a svg { width: 19px; height: 19px; flex: none; }
.nav a:hover { background: rgba(255, 255, 255, .04); color: var(--text); }
.nav a.active {
  color: var(--accent-ink); font-weight: 600;
  background: linear-gradient(90deg, var(--accent) 0%, #a8d55c 100%);
  box-shadow: 0 6px 18px rgba(142, 198, 63, .25);
}
.nav .kbd { margin-left: auto; font-size: 10px; opacity: .6; border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; }
.sidebar-foot { margin-top: auto; padding: 12px; font-size: 11px; color: var(--faint); border-top: 1px solid var(--line-soft); }
.user-box { margin: -4px 0 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line-soft); }
.user-box .who { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.user-box .who b { display: block; font-size: 12.5px; color: var(--text); }
.user-box .who span { font-size: 11px; color: var(--muted); }
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.user-links { display: flex; flex-direction: column; gap: 2px; }
.user-links a { display: flex; align-items: center; gap: 8px; padding: 6px 6px; border-radius: 8px; color: var(--muted); font-size: 12px; font-weight: 600; }
.user-links a svg { width: 15px; height: 15px; }
.user-links a:hover, .user-links a.on { background: rgba(255, 255, 255, .05); color: var(--accent-2); }
.sidebar-foot .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--good); margin-right: 6px; box-shadow: 0 0 0 3px rgba(142, 198, 63, .2); }

.main { margin-left: var(--sidebar); min-height: 100%; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 16px 28px; background: rgba(11, 17, 26, .78); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar h1 { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: -.2px; }
.topbar .sub { color: var(--muted); font-size: 12px; }
.topbar .spacer { flex: 1; }
.content { padding: 24px 28px 48px; max-width: 1680px; }

/* date range bar */
.rangebar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 11px; background: var(--surface); border: 1px solid var(--line); }
.seg button {
  border: 0; background: transparent; padding: 6px 11px; border-radius: 8px; cursor: pointer;
  color: var(--muted); font-size: 12.5px; font-weight: 600; transition: all .15s;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.dates { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.dates input {
  background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 5px 8px;
  color-scheme: dark; font-size: 12.5px;
}

/* ---------- building blocks ---------- */
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); margin-bottom: 16px; }
.row-2-1 { grid-template-columns: 2fr 1fr; }
.row-1-1 { grid-template-columns: 1fr 1fr; }
.row-1-1-1 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1200px) { .row-2-1, .row-1-1-1 { grid-template-columns: 1fr 1fr; } }
/* Tablet: icon rail instead of the full sidebar */
@media (max-width: 1024px) and (min-width: 761px) {
  :root { --sidebar: 72px; }
  .logo { justify-content: center; padding: 4px 0 18px; }
  .logo-text, .nav a span, .nav .kbd, .user-box .t, .sidebar-foot > span:not(.dot), .sidebar-foot > br { display: none; }
  .sidebar { padding: 18px 10px; }
  .nav a { justify-content: center; padding: 12px 0; }
  .sidebar-foot { padding: 8px 0; text-align: center; font-size: 0; }
  .user-box .who { justify-content: center; }
  .user-links a { justify-content: center; font-size: 0; gap: 0; padding: 8px 0; }
  .user-links a svg { width: 17px; height: 17px; }
  .row-2-1, .row-1-1, .row-1-1-1 { grid-template-columns: 1fr; }
  .content, .topbar { padding-left: 18px; padding-right: 18px; }
}
}

.card {
  background: linear-gradient(180deg, var(--surface) 0%, #131d2a 100%);
  border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 18px 18px 16px;
  box-shadow: var(--shadow); min-width: 0; position: relative;
}
.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-h h3 { margin: 0; font-size: 14.5px; font-weight: 600; }
.card-h .hint { color: var(--faint); font-size: 11.5px; }
.card-h .more { margin-left: auto; font-size: 12px; font-weight: 600; display: inline-flex; gap: 4px; align-items: center; }
.chart { width: 100%; height: 320px; }
.chart.sm { height: 240px; }
.chart.lg { height: 380px; }

/* KPI tile */
.kpi {
  display: block; color: inherit; padding: 16px 16px 14px; border-radius: var(--radius);
  background: linear-gradient(160deg, var(--surface-2) 0%, var(--surface) 100%);
  border: 1px solid var(--line-soft); position: relative; overflow: hidden;
  transition: transform .18s var(--ease), border-color .18s, box-shadow .18s;
  animation: rise .45s var(--ease) both;
}
a.kpi:hover { transform: translateY(-2px); border-color: rgba(142, 198, 63, .45); box-shadow: 0 12px 30px rgba(0, 0, 0, .4); color: inherit; }
.kpi::after {
  content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle, var(--glow, rgba(142, 198, 63, .16)) 0%, transparent 70%);
}
.kpi .k-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 500; }
.kpi .k-label svg { width: 16px; height: 16px; color: var(--ic, var(--accent)); }
.kpi .k-value { font-size: 28px; font-weight: 700; letter-spacing: -.5px; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.kpi .k-value small { font-size: 14px; font-weight: 600; color: var(--muted); margin-left: 3px; }
.kpi .k-foot { font-size: 11.5px; color: var(--faint); display: flex; gap: 8px; align-items: center; min-height: 18px; }
.delta { font-weight: 700; font-size: 11.5px; padding: 1px 6px; border-radius: 20px; }
.delta.up { color: var(--good); background: rgba(142, 198, 63, .12); }
.delta.down { color: var(--bad); background: rgba(239, 91, 91, .12); }
.delta.flat { color: var(--muted); background: rgba(255, 255, 255, .06); }
.kpi.bad { --glow: rgba(239, 91, 91, .2); --ic: var(--bad); }
.kpi.warn { --glow: rgba(242, 181, 58, .2); --ic: var(--warn); }
.kpi.info { --glow: rgba(79, 179, 217, .2); --ic: var(--info); }
.kpi.violet { --glow: rgba(155, 140, 255, .2); --ic: var(--violet); }
@keyframes rise { from { transform: translateY(8px); } to { transform: none; } }

/* tabs */
.tabs { display: flex; gap: 4px; margin: -6px 0 18px; border-bottom: 1px solid var(--line); }
.tabs a {
  padding: 10px 16px; color: var(--muted); font-weight: 600; font-size: 13.5px;
  border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 8px; align-items: center;
}
.tabs a:hover { color: var(--text); }
.tabs a.on { color: var(--accent); border-bottom-color: var(--accent); }
.tabs .count { font-size: 11px; background: var(--surface-3); color: var(--muted); padding: 0 7px; border-radius: 10px; }
.tab-panel[hidden] { display: none; }

/* tables */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.search {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; min-width: 240px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px;
}
.search svg { width: 15px; height: 15px; color: var(--faint); }
.search input { border: 0; outline: 0; background: transparent; width: 100%; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface-2);
  padding: 7px 12px; border-radius: 10px; cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--text);
}
.btn:hover { border-color: var(--accent); color: var(--accent-2); }
.btn svg { width: 14px; height: 14px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--bg-2); color: var(--muted); padding: 5px 11px; border-radius: 20px;
  font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.chip:hover { color: var(--text); }
.chip.on { background: rgba(142, 198, 63, .14); border-color: rgba(142, 198, 63, .6); color: var(--accent-2); }
.chip .n { opacity: .65; margin-left: 4px; font-weight: 500; }

.table-wrap { overflow: auto; border-radius: var(--radius-sm); border: 1px solid var(--line-soft); max-height: 640px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 12px; text-align: left; white-space: nowrap; }
th {
  position: sticky; top: 0; z-index: 1; background: #142030; color: var(--muted);
  font-size: 11px; text-transform: uppercase; letter-spacing: .6px; font-weight: 600; cursor: pointer; user-select: none;
}
th.sorted { color: var(--accent-2); }
th.sorted::after { content: " ▾"; }
th.sorted.asc::after { content: " ▴"; }
td { border-top: 1px solid var(--line-soft); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.wrap { white-space: normal; min-width: 220px; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: rgba(142, 198, 63, .06); }
tbody tr.click { cursor: pointer; }
tr.group td { background: rgba(255, 255, 255, .03); font-weight: 700; color: var(--accent-2); font-size: 12px; letter-spacing: .4px; text-transform: uppercase; }
tr.total td { font-weight: 700; background: rgba(142, 198, 63, .07); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.empty { color: var(--faint); text-align: center; padding: 28px; }

/* badges & bars */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-good { color: var(--good); background: rgba(142, 198, 63, .12); }
.b-warn { color: var(--warn); background: rgba(242, 181, 58, .12); }
.b-bad { color: var(--bad); background: rgba(239, 91, 91, .12); }
.b-info { color: var(--info); background: rgba(79, 179, 217, .12); }
.b-mute { color: var(--muted); background: rgba(255, 255, 255, .06); }
.bar { height: 7px; border-radius: 7px; background: rgba(255, 255, 255, .07); overflow: hidden; min-width: 90px; }
.bar > i { display: block; height: 100%; border-radius: 7px; background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 100%); }
.bar.warn > i { background: linear-gradient(90deg, #d99a1e, var(--warn)); }
.bar.bad > i { background: linear-gradient(90deg, #c94040, var(--bad)); }
.stackbar { display: flex; height: 10px; border-radius: 10px; overflow: hidden; background: rgba(255, 255, 255, .06); }
.stackbar i { display: block; height: 100%; }

/* lists */
.list { display: flex; flex-direction: column; }
.li {
  display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-top: 1px solid var(--line-soft); color: inherit;
}
.li:first-child { border-top: 0; }
a.li:hover { background: rgba(255, 255, 255, .03); color: inherit; border-radius: 8px; }
.li .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--surface-3); color: var(--accent); }
.li .ic svg { width: 17px; height: 17px; }
.li .ic.bad { color: var(--bad); background: rgba(239, 91, 91, .12); }
.li .ic.warn { color: var(--warn); background: rgba(242, 181, 58, .12); }
.li .ic.info { color: var(--info); background: rgba(79, 179, 217, .12); }
.li .t { flex: 1; min-width: 0; }
.li .t b { display: block; font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .t span { font-size: 11.5px; color: var(--faint); }
.li .v { font-weight: 700; font-variant-numeric: tabular-nums; }
.date-tile {
  width: 44px; flex: none; text-align: center; border-radius: 10px; background: var(--surface-3); padding: 4px 0;
  font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px;
}
.date-tile b { display: block; font-size: 17px; color: var(--text); letter-spacing: 0; }

/* ring */
.ring { position: relative; width: 168px; height: 168px; margin: 4px auto; }
.ring svg { transform: rotate(-90deg); }
.ring .lbl { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring .lbl b { font-size: 34px; font-weight: 700; letter-spacing: -1px; display: block; }
.ring .lbl span { font-size: 11px; color: var(--muted); }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin-top: 12px; font-size: 12.5px; }
.legend div { display: flex; align-items: center; gap: 8px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend b { margin-left: auto; font-variant-numeric: tabular-nums; }

/* people cards */
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.pcard {
  display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: var(--radius-sm); cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--line-soft); transition: border-color .15s, transform .15s;
}
.pcard:hover { border-color: rgba(142, 198, 63, .5); transform: translateY(-1px); }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700;
  background: linear-gradient(135deg, #2b3a4c, #1e2a38); color: var(--accent-2); font-size: 14px; border: 2px solid var(--line);
  object-fit: cover;
}
.pcard .t { flex: 1; min-width: 0; }
.pcard .t b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard .t span { font-size: 11.5px; color: var(--faint); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard .pct { font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }

/* drawer */
.scrim { position: fixed; inset: 0; background: rgba(4, 8, 12, .62); z-index: 40; opacity: 0; pointer-events: none; transition: opacity .2s; }
.scrim.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 96vw); z-index: 50;
  background: linear-gradient(180deg, #121c28 0%, #0e1621 100%); border-left: 1px solid var(--line);
  box-shadow: -20px 0 50px rgba(0, 0, 0, .5); transform: translateX(102%); transition: transform .28s var(--ease);
  display: flex; flex-direction: column;
}
.drawer.open { transform: none; }
.drawer-h { display: flex; align-items: center; gap: 14px; padding: 20px 24px; border-bottom: 1px solid var(--line-soft); }
.drawer-h h2 { margin: 0; font-size: 19px; }
.drawer-h .sub { color: var(--muted); font-size: 12.5px; }
.drawer-h .x { margin-left: auto; border: 0; background: var(--surface-3); width: 34px; height: 34px; border-radius: 10px; cursor: pointer; color: var(--muted); font-size: 18px; }
.drawer-h .x:hover { color: var(--text); }
.drawer-b { padding: 20px 24px 40px; overflow: auto; flex: 1; }
.drawer-b section { margin-bottom: 22px; }
.drawer-b h4 { margin: 0 0 10px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.fact { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; border: 1px solid var(--line-soft); }
.fact span { display: block; font-size: 11px; color: var(--faint); }
.fact b { font-size: 14px; font-variant-numeric: tabular-nums; }
.photo { width: 76px; height: 76px; border-radius: 16px; object-fit: cover; border: 2px solid var(--line); }

/* skeleton / misc */
.skeleton { border-radius: var(--radius); background: linear-gradient(90deg, #162130 25%, #1d2a3a 50%, #162130 75%); background-size: 200% 100%; animation: sk 1.2s infinite; min-height: 110px; }
@keyframes sk { to { background-position: -200% 0; } }
.note { font-size: 11.5px; color: var(--faint); margin-top: 8px; }
.error-box { padding: 16px; border-radius: var(--radius-sm); background: rgba(239, 91, 91, .1); color: #ffb3b3; border: 1px solid rgba(239, 91, 91, .3); }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: rot .7s linear infinite; vertical-align: -2px; }
@keyframes rot { to { transform: rotate(360deg); } }
.toast { position: fixed; bottom: 18px; right: 18px; background: var(--surface-3); border: 1px solid var(--line); padding: 10px 14px; border-radius: 10px; z-index: 60; box-shadow: var(--shadow); }


/* ======================================================================== Phone (<= 760 px)
   Bottom tab bar instead of the sidebar, compact top bar, swipeable chips/tabs, 2-up KPI tiles,
   full-screen detail panels and tables with a pinned first column. */
.bottom-nav, .me-btn, .me-menu, .seg .custom-btn { display: none; }
@media (max-width: 760px) {
  :root { --sidebar: 0px; --navh: 62px; }
  html, body { overflow-x: hidden; }
  body { background-attachment: scroll; -webkit-tap-highlight-color: transparent; }
  .sidebar { display: none; }
  .main { margin-left: 0; padding-bottom: calc(var(--navh) + env(safe-area-inset-bottom) + 8px); }

  /* bottom tab bar */
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 35;
    height: calc(var(--navh) + env(safe-area-inset-bottom)); padding: 6px 4px env(safe-area-inset-bottom);
    background: rgba(10, 16, 24, .95); backdrop-filter: blur(14px); border-top: 1px solid var(--line-soft);
  }
  .bottom-nav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: var(--faint); font-size: 10.5px; font-weight: 600; border-radius: 12px; min-width: 0;
  }
  .bottom-nav a svg { width: 22px; height: 22px; }
  .bottom-nav a.active { color: var(--accent); }
  .bottom-nav a.active svg { filter: drop-shadow(0 0 8px rgba(142, 198, 63, .5)); }

  /* compact top bar */
  .topbar { padding: 10px 14px; gap: 8px 10px; padding-top: calc(10px + env(safe-area-inset-top)); flex-wrap: wrap; }
  .topbar > div:first-child { flex: 1; min-width: 0; }
  .topbar h1 { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar .sub { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar .spacer { display: none; }
  .me-btn {
    display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; flex: none; cursor: pointer; padding: 0;
    border: 2px solid var(--line); background: linear-gradient(135deg, #2b3a4c, #1e2a38); color: var(--accent-2); font-weight: 700; font-size: 12px;
  }
  .me-menu {
    position: fixed; top: calc(56px + env(safe-area-inset-top)); right: 10px; z-index: 45; min-width: 220px;
    background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 8px;
  }
  .me-menu.open { display: block; }
  .me-menu .who { padding: 6px 8px 10px; border-bottom: 1px solid var(--line-soft); margin-bottom: 6px; }
  .me-menu .who b { display: block; font-size: 13px; }
  .me-menu .who span { font-size: 11px; color: var(--muted); }
  .me-menu a { display: flex; align-items: center; gap: 10px; padding: 11px 8px; border-radius: 9px; color: var(--text); font-size: 13.5px; font-weight: 600; }
  .me-menu a svg { width: 17px; height: 17px; color: var(--muted); }
  .me-menu a:active { background: rgba(255, 255, 255, .06); }

  /* date range: one swipeable row; custom dates on demand */
  .rangebar { width: 100%; order: 3; flex-wrap: nowrap; }
  .seg { overflow-x: auto; scrollbar-width: none; max-width: 100%; flex-wrap: nowrap; }
  .seg::-webkit-scrollbar { display: none; }
  .seg button { white-space: nowrap; padding: 7px 11px; }
  .seg .custom-btn { display: inline-block; }
  .dates { display: none; }
  .rangebar.show-dates { flex-wrap: wrap; }
  .rangebar.show-dates .dates { display: flex; width: 100%; }
  .dates input { flex: 1; min-width: 0; font-size: 16px; }

  /* layout */
  .content { padding: 12px 12px 24px; }
  .grid { gap: 10px; }
  .row-2-1, .row-1-1, .row-1-1-1, .review { grid-template-columns: minmax(0, 1fr) !important; }
  .card { padding: 14px 12px 12px; border-radius: 12px; }
  .card-h { flex-wrap: wrap; gap: 4px 10px; }
  .card-h .hint { flex-basis: 100%; order: 3; }
  .chart { height: 260px; }
  .chart.sm { height: 220px; }
  .chart.lg { height: 340px; }

  /* KPI tiles two per row */
  .kpis { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important; gap: 8px; margin-bottom: 10px; }
  .kpi { padding: 11px 11px 10px; border-radius: 12px; min-width: 0; }
  .kpi .k-label { font-size: 11px; gap: 6px; }
  .kpi .k-label svg { width: 14px; height: 14px; flex: none; }
  .kpi .k-value { font-size: 21px; margin: 4px 0 1px; }
  .kpi .k-value small { font-size: 11.5px; }
  .kpi .k-foot { font-size: 10.5px; flex-wrap: wrap; gap: 4px; line-height: 1.3; }
  .kpi::after { width: 70px; height: 70px; right: -20px; top: -20px; }

  /* tabs and chips scroll sideways instead of wrapping */
  .tabs { overflow-x: auto; scrollbar-width: none; margin: -2px -12px 12px; padding: 0 12px; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a { white-space: nowrap; padding: 10px 12px; font-size: 13px; }
  .toolbar { gap: 8px; }
  .search { min-width: 0; width: 100%; }
  input, select, textarea, .search input { font-size: 16px !important; }   /* 16 px stops iOS zooming into the field */
  .toolbar .chips, #types, #jcCat, #dueFilter, #docFilter, #logTypes { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; width: 100%; padding-bottom: 2px; }
  .toolbar .chips::-webkit-scrollbar, #types::-webkit-scrollbar, #jcCat::-webkit-scrollbar { display: none; }
  .toolbar [style*="margin-left:auto"] { margin-left: 0 !important; }

  /* tables: smaller, pinned first column */
  .table-wrap { max-height: 70vh !important; border-radius: 10px; }
  table { font-size: 12.5px; }
  th, td { padding: 8px 9px; }
  td.wrap { min-width: 180px; }
  th:first-child, td:first-child { position: sticky; left: 0; z-index: 1; background: #142030; }
  th:first-child { z-index: 2; }
  tbody tr:hover { background: transparent; }
  tr.group td:first-child { background: #1a2532; }
  tr.total td:first-child { background: #1d2b22; }

  /* lists, people */
  .people-grid { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .pcard { min-width: 0; }
  .pcard .pct { flex: none; }
  .pcard { padding: 11px; }
  .li { padding: 9px 2px; }

  /* detail panel = full-screen sheet */
  .drawer { width: 100vw; border-left: 0; }
  .drawer-h { padding: 12px 14px; padding-top: calc(12px + env(safe-area-inset-top)); gap: 10px; }
  .drawer-h h2 { font-size: 17px; }
  .drawer-h .x { width: 40px; height: 40px; font-size: 22px; flex: none; }
  .drawer-b { padding: 14px 12px calc(30px + env(safe-area-inset-bottom)); }
  .facts { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
  .fact { padding: 8px 10px; min-width: 0; overflow-wrap: anywhere; }
  .photo { width: 60px; height: 60px; }

  /* maintenance */
  .cal { grid-template-columns: 130px repeat(14, 104px) !important; }
  .review { grid-template-columns: 1fr !important; }
  .review > .card:first-child { padding: 10px; }
  .mlist { display: flex; gap: 6px; overflow-x: auto; max-height: none; margin-top: 8px; padding-bottom: 4px; scrollbar-width: none; }
  .mlist::-webkit-scrollbar { display: none; }
  .mitem { flex: 0 0 auto; min-width: 150px; background: var(--bg-2); border: 1px solid var(--line-soft); }
  .svc-card { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

  .toast { left: 12px; right: 12px; bottom: calc(var(--navh) + 12px); }
}
