/* ============================================================
   QuarterMaster design system — "supply depot" theme
   olive drab surfaces · stencil signage · amber crate stamps
   ============================================================ */
@font-face {
  font-family: 'Saira Stencil One';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/saira-stencil-one.woff2') format('woff2');
}
:root {
  --bg: #14170f;
  --bg-2: #0e1009;
  --panel: #1c2016;
  --panel-2: #242919;
  --panel-3: #2d3320;
  --border: #363d29;
  --border-2: #47503a;
  --text: #edeee2;
  --muted: #a7ad90;
  --faint: #7d8469;
  --accent: #a8b96c;
  --accent-2: #c6d48f;
  --accent-soft: rgba(var(--accent-rgb), 0.14);
  --accent-rgb: 168, 185, 108;
  --stencil: #f0b23c;
  --stencil-rgb: 240, 178, 60;
  --teal: #2dd4bf;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #f87171;
  --purple: #a78bfa;
  --green-rgb: 52, 211, 153;
  --amber-rgb: 251, 191, 36;
  --red-rgb: 248, 113, 113;
  --purple-rgb: 167, 139, 250;
  --on-accent: #171b0e;
  --topbar-bg: rgba(20, 23, 15, 0.88);
  --bottomnav-bg: rgba(14, 16, 9, 0.97);
  --scrim: rgba(5, 8, 12, 0.68);
  --soft: rgba(36, 41, 25, 0.45);
  --rule: rgba(38, 49, 63, 0.6);
  --danger-soft: rgba(var(--red-rgb), 0.1);
  --danger-line: rgba(var(--red-rgb), 0.35);
  --danger-text: #ffb4b4;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  --sidebar-w: 232px;
  --topbar-h: 56px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-stencil: 'Saira Stencil One', 'Arial Black', Impact, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --hazard: repeating-linear-gradient(-45deg, var(--stencil) 0 7px, var(--bg-2) 7px 14px);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 21px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0 0 10px; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
::selection { background: var(--accent-soft); }

/* ---------- boot ---------- */
.boot {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px;
}
.boot-logo { font-size: 28px; font-weight: 400; font-family: var(--font-stencil); text-transform: uppercase; letter-spacing: 0.06em; color: var(--stencil); }
.boot-sub { color: var(--faint); font-size: 13px; }

/* ---------- layout ---------- */
.app { min-height: 100vh; }
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  padding: 14px 10px;
  display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 10px 14px; font-family: var(--font-stencil); font-weight: 400;
  font-size: 15.5px; text-transform: uppercase; letter-spacing: 0.05em;
}
.brand-badge {
  width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--stencil)); font-size: 14px;
  font-family: var(--font); font-weight: 700; text-transform: none; letter-spacing: 0;
}
.nav-group-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--faint); padding: 12px 10px 5px; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--muted); font-weight: 500; cursor: pointer; user-select: none;
  border: 1px solid transparent;
}
.nav-item:hover { background: var(--panel); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: var(--accent-2); border-color: rgba(var(--accent-rgb),.3); }
.nav-item .ico { width: 17px; text-align: center; font-size: 14px; }
.nav-item .count {
  margin-left: auto; font-size: 11px; background: var(--panel-3);
  padding: 1px 6px; border-radius: 20px; color: var(--muted);
}
.sidebar-foot { margin-top: auto; padding: 10px; font-size: 11.5px; color: var(--faint); }

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: var(--topbar-h); display: flex; align-items: center; gap: 12px;
  padding: 0 18px; border-bottom: 2px solid transparent;
  border-image: var(--hazard) 2;
  background: var(--topbar-bg); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 30;
}
.topbar h1 { font-family: var(--font-stencil); font-weight: 400; font-size: 15px; text-transform: uppercase; letter-spacing: 0.06em; }
.topbar .spacer { flex: 1; }
.hamburger { display: none; }

.sync-pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px;
  color: var(--muted); background: var(--panel); border: 1px solid var(--border);
  padding: 4px 9px; border-radius: 20px; white-space: nowrap;
}
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(var(--green-rgb),.15); }
.sync-pill.busy .sync-dot { background: var(--amber); box-shadow: 0 0 0 3px rgba(var(--amber-rgb),.15); }
.sync-pill.offline .sync-dot { background: var(--red); box-shadow: 0 0 0 3px rgba(var(--red-rgb),.15); }

.icon-btn {
  position: relative; width: 34px; height: 34px; border-radius: 9px;
  background: var(--panel); border: 1px solid var(--border); cursor: pointer;
  display: grid; place-items: center; font-size: 15px; color: var(--muted);
}
.icon-btn:hover { color: var(--text); border-color: var(--border-2); }
.icon-btn .badge {
  position: absolute; top: -5px; right: -5px; min-width: 16px; height: 16px;
  border-radius: 10px; background: var(--red); color: #fff; font-size: 10px;
  display: grid; place-items: center; padding: 0 4px; font-weight: 700;
}

.avatar {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font-size: 11.5px; font-weight: 700; color: #0b0f15; flex: none; letter-spacing: -0.02em;
}
.avatar.lg { width: 44px; height: 44px; font-size: 16px; }
.avatar.xl { width: 60px; height: 60px; font-size: 21px; }

.content { padding: 20px; max-width: 1240px; width: 100%; margin: 0 auto; flex: 1; padding-bottom: 60px; }

/* ---------- page header ---------- */
.page-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--font-stencil); font-weight: 400; text-transform: uppercase; letter-spacing: 0.05em; font-size: 22px; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- cards / grid ---------- */
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
}
.card + .card { margin-top: 14px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h2 { font-size: 14.5px; }
.card-head h2::before {
  content: ''; display: inline-block; width: 4px; height: 13px;
  background: var(--stencil); margin-right: 8px; vertical-align: -1px; border-radius: 1px;
  box-shadow: 0 0 6px rgba(var(--stencil-rgb),.35);
}
.card-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }

.stat { display: flex; flex-direction: column; gap: 3px; }
.stat .label { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.stat .value { font-size: 25px; font-weight: 400; font-family: var(--font-stencil); letter-spacing: 0.01em; font-variant-numeric: tabular-nums; }
.stat .delta { font-size: 12.5px; color: var(--faint); }
.stat .value.pos { color: var(--green); }
.stat .value.neg { color: var(--red); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  background: var(--panel-2); border: 1px solid var(--border-2); color: var(--text);
  padding: 7px 13px; border-radius: 6px; cursor: pointer; font-weight: 550;
  font-size: 13.5px; white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--panel-3); border-color: rgba(var(--accent-rgb), .5); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 650; }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.ghost { background: transparent; border-color: var(--border); color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--panel); }
.btn.danger { background: rgba(var(--red-rgb),.12); border-color: rgba(var(--red-rgb),.4); color: var(--red); }
.btn.danger:hover { background: rgba(var(--red-rgb),.2); }
.btn.sm { padding: 4px 9px; font-size: 12.5px; border-radius: 7px; }
.btn.block { width: 100%; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 13px; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.field .help { font-size: 11.5px; color: var(--faint); }
.field .err { font-size: 12px; color: var(--red); }
input[type=text], input[type=password], input[type=number], input[type=date],
input[type=time], input[type=email], input[type=search], input:not([type]), select, textarea {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 6px;
  padding: 8px 11px; width: 100%; outline: none; transition: border-color .12s, box-shadow .12s;
}
textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb),.18);
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:disabled, select:disabled, textarea:disabled { opacity: .6; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }
.check { display: flex; align-items: center; gap: 9px; font-size: 13.5px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.form-error {
  background: rgba(var(--red-rgb),.1); border: 1px solid rgba(var(--red-rgb),.35);
  color: var(--danger-text); padding: 9px 12px; border-radius: 9px; font-size: 13px; margin-bottom: 12px;
}

/* ---------- toolbar / filters ---------- */
.toolbar { display: flex; gap: 9px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.toolbar input[type=search] { max-width: 260px; }
.toolbar input[type=date] { max-width: 165px; width: auto; }
.toolbar select { max-width: 190px; width: auto; }
.toolbar .grow { flex: 1; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tab {
  padding: 8px 13px; font-size: 13.5px; font-weight: 550; color: var(--muted);
  cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; user-select: none;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent-2); border-bottom-color: var(--accent); }

.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  font-size: 11.5px; padding: 2.5px 9px; border-radius: 20px;
  background: var(--panel-3); color: var(--muted); border: 1px solid var(--border);
}
.pill.accent { background: var(--accent-soft); color: var(--accent-2); border-color: rgba(var(--accent-rgb),.3); }
.pill.green { background: rgba(var(--green-rgb),.13); color: var(--green); border-color: rgba(var(--green-rgb),.3); }
.pill.amber { background: rgba(var(--amber-rgb),.13); color: var(--amber); border-color: rgba(var(--amber-rgb),.3); }
.pill.red { background: rgba(var(--red-rgb),.13); color: var(--red); border-color: rgba(var(--red-rgb),.3); }
.pill.purple { background: rgba(var(--purple-rgb),.13); color: var(--purple); border-color: rgba(var(--purple-rgb),.3); }

.cat-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); background: var(--panel); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--faint); font-weight: 650; padding: 10px 13px; background: var(--panel-2);
  border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0;
}
tbody td { padding: 10px 13px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover td { background: rgba(var(--accent-rgb),.07); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.mono { font-family: var(--mono); font-size: 12.5px; }
.cell-title { font-weight: 600; }
.cell-sub { font-size: 12px; color: var(--faint); margin-top: 1px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.pos { color: var(--green); }
.neg { color: var(--red); }
.nowrap { white-space: nowrap; }

/* ---------- empty ---------- */
.empty {
  text-align: center; padding: 34px 18px; color: var(--faint);
  border: 1px dashed var(--border-2); border-radius: var(--radius); background: var(--soft);
}
.empty .big { font-size: 26px; margin-bottom: 7px; }
.empty .title { font-weight: 600; color: var(--muted); margin-bottom: 4px; }

/* ---------- alerts ---------- */
.alert-list { display: flex; flex-direction: column; gap: 8px; }
.alert-item {
  display: flex; gap: 11px; align-items: flex-start; padding: 10px 12px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px;
  cursor: pointer;
}
.alert-item:hover { border-color: var(--border-2); text-decoration: none; }
.alert-item .sev { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: none; }
.sev.high { background: var(--red); }
.sev.medium { background: var(--amber); }
.sev.info { background: var(--accent); }
.alert-item .t { font-weight: 600; font-size: 13.5px; color: var(--text); }
.alert-item .d { font-size: 12.5px; color: var(--muted); }

/* ---------- messages ---------- */
.msg { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
.msg + .msg { margin-top: 11px; }
.msg.pinned { border-color: rgba(var(--amber-rgb),.4); background: rgba(var(--amber-rgb),.05); }
.msg-head { display: flex; align-items: center; gap: 9px; margin-bottom: 7px; flex-wrap: wrap; }
.msg-head .who { font-weight: 650; font-size: 13.5px; }
.msg-head .when { font-size: 12px; color: var(--faint); }
.msg-head .ops { margin-left: auto; display: flex; gap: 6px; }
.msg-subject { font-weight: 650; font-size: 14.5px; margin-bottom: 4px; }
.msg-body { white-space: pre-wrap; color: var(--text); font-size: 14px; }
.revision-note {
  margin-top: 9px; font-size: 12px; color: var(--faint); background: var(--bg-2);
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px;
}

/* ---------- timeline ---------- */
.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 11px; padding: 9px 0; border-bottom: 1px solid var(--rule); }
.tl-item:last-child { border-bottom: none; }
.tl-item .when { font-size: 11.5px; color: var(--faint); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tl-item .what { font-size: 13.5px; }
.tl-item .what b { font-weight: 650; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: var(--scrim); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 18px;
  animation: fade .12s ease;
}
.modal {
  background: var(--panel); border: 1px solid var(--border-2); border-radius: 10px;
  width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow); animation: pop .14s ease;
}
.modal.wide { max-width: 760px; }
.modal-head { padding: 16px 18px 0; display: flex; align-items: center; gap: 10px; }
.modal-head h2 { font-size: 16px; }
.modal-head .x { margin-left: auto; }
.modal-body { padding: 15px 18px 4px; }
.modal-foot { padding: 12px 18px 18px; display: flex; gap: 9px; justify-content: flex-end; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.985); } }

/* ---------- toast ---------- */
.toasts {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; z-index: 200; align-items: center;
  pointer-events: none; width: min(440px, calc(100vw - 32px));
}
.toast {
  background: var(--panel-3); border: 1px solid var(--border-2); color: var(--text);
  padding: 10px 15px; border-radius: 10px; box-shadow: var(--shadow);
  font-size: 13.5px; animation: pop .15s ease; text-align: center; max-width: 100%;
}
.toast.error { border-color: rgba(var(--red-rgb),.5); background: var(--panel-2); color: var(--red); }
.toast.ok { border-color: rgba(var(--green-rgb),.45); }

/* ---------- auth screen ---------- */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px; background:
    radial-gradient(1000px 500px at 20% -10%, rgba(var(--accent-rgb),.13), transparent 60%),
    radial-gradient(800px 400px at 90% 110%, rgba(var(--stencil-rgb),.10), transparent 60%),
    var(--bg);
}
.auth-card { width: 100%; max-width: 420px; position: relative; overflow: hidden; padding-top: 18px; }
.auth-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 7px;
  background: var(--hazard);
}
.auth-brand { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 6px; font-size: 24px; font-family: var(--font-stencil); font-weight: 400; text-transform: uppercase; letter-spacing: 0.06em; }
.auth-tag { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.auth-switch { text-align: center; font-size: 13px; color: var(--muted); margin-top: 14px; }
.auth-rules {
  margin-top: 16px; font-size: 12.5px; color: var(--faint);
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 11px 13px;
}
.auth-rules b { color: var(--muted); }

/* ---------- progress bars ---------- */
.bar { height: 7px; background: var(--bg-2); border-radius: 20px; overflow: hidden; border: 1px solid var(--border); }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 20px; transition: width .3s; }
.bar > i.ok { background: var(--green); }
.bar > i.warn { background: var(--amber); }
.bar > i.over { background: var(--red); }

/* ---------- rules page ---------- */
.rule {
  display: flex; gap: 13px; padding: 14px 16px; background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.rule + .rule { margin-top: 11px; }
.rule .n {
  width: 26px; height: 26px; border-radius: 8px; background: var(--accent-soft);
  color: var(--accent-2); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none;
}
.rule h3 { margin-bottom: 3px; }
.rule p { color: var(--muted); font-size: 13.5px; margin: 0; }

/* ---------- mobile nav ---------- */
.bottom-nav { display: none; }
.scrim { display: none; }

@media (max-width: 980px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 780px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w);
    transform: translateX(-102%); transition: transform .2s ease; z-index: 60; height: 100dvh;
  }
  .sidebar.open { transform: none; box-shadow: var(--shadow); }
  .scrim.show { display: block; position: fixed; inset: 0; background: var(--scrim); z-index: 55; }
  .hamburger { display: grid; }
  .content { padding: 15px 13px 84px; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .page-head .actions { width: 100%; margin-left: 0; }
  .page-head .actions .btn { flex: 1; }
  .toolbar input[type=search] { max-width: none; width: 100%; }
  .toolbar input[type=date] { max-width: none; width: 100%; }
  .toolbar select { flex: 1; max-width: none; }
  .stat .value { font-size: 22px; }
  .topbar h1 { font-size: 15px; }
  .sync-pill .txt { display: none; }

  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    background: var(--bottomnav-bg); backdrop-filter: blur(10px);
    border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    font-size: 10.5px; color: var(--faint); padding: 4px 2px; border-radius: 8px;
  }
  .bottom-nav a .ico { font-size: 17px; }
  .bottom-nav a.active { color: var(--accent-2); }
  .modal { max-width: 100%; align-self: flex-end; border-radius: 16px 16px 0 0; max-height: 92vh; }
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal-foot .btn { flex: 1; }
  td, th { padding: 9px 10px; }
}

@media (max-width: 420px) {
  body { font-size: 14px; }
  .stat .value { font-size: 20px; }
}

/* ============================================================
   Activity dots — "where is the action?" deep-link indicators
   ============================================================ */
.nav-dot {
  margin-left: auto; flex: none;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--stencil);
  box-shadow: 0 0 6px rgba(var(--stencil-rgb), .55);
  animation: dotPulse 2.2s ease-in-out infinite;
}
.nav-dot.red { background: var(--red); box-shadow: 0 0 6px rgba(var(--red-rgb), .55); }
.nav-dot.count {
  width: auto; min-width: 17px; height: 17px; padding: 0 5px;
  border-radius: 9px; font-size: 10.5px; font-weight: 700;
  display: inline-grid; place-items: center;
  background: var(--red); color: #2b0f0f;
  box-shadow: none; animation: none; margin-left: auto;
}
.nav-dot[hidden] { display: none !important; }
.tab { display: inline-flex; align-items: center; }
.tab .nav-dot { margin-left: 7px; animation-duration: 1.7s; }
.tab .nav-dot.count { margin-left: 7px; }
@keyframes dotPulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }

/* Deep-link flash: the row/card a dot led you to */
@keyframes flashTarget {
  0%, 45% { box-shadow: 0 0 0 3px rgba(var(--stencil-rgb), .6); background-color: rgba(var(--stencil-rgb), .14); }
  100% { box-shadow: none; background-color: transparent; }
}
.flash-target { animation: flashTarget 2.6s ease-out; }
.msg.flash-target { border-color: var(--stencil) !important; }
tr.fresh td { background: rgba(var(--stencil-rgb), .07); }
tr.fresh td:first-child { box-shadow: inset 3px 0 0 var(--stencil); }

/* ============================================================
   Cleaning schedule — week grid of morning/evening shift cards
   ============================================================ */
.clean-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 1180px) { .clean-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 680px)  { .clean-grid { grid-template-columns: 1fr; } }
.clean-day {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px; min-width: 0;
}
.clean-day.today { border-color: rgba(var(--stencil-rgb), .55); box-shadow: 0 0 0 1px rgba(var(--stencil-rgb), .22); }
.clean-day.has-mine { border-color: rgba(var(--accent-rgb), .4); }
.clean-date {
  display: flex; justify-content: space-between; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 650; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); margin-bottom: 9px;
}
.clean-date .dow { color: var(--faint); font-weight: 500; font-size: 10.5px; }
.clean-date .today-tag { color: var(--stencil); font-size: 10px; letter-spacing: .08em; }
.clean-slot { border-top: 1px dashed var(--border); padding-top: 9px; margin-top: 9px; }
.clean-slot.first { border-top: 0; padding-top: 0; margin-top: 0; }
.clean-slot .slot-name {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--faint); display: flex; align-items: center; gap: 6px; margin-bottom: 7px;
}
.clean-who { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; min-width: 0; }
.clean-who .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clean-who .unassigned { color: var(--faint); font-weight: 500; font-style: italic; }
.clean-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.clean-actions { display: flex; gap: 6px; margin-top: 9px; flex-wrap: wrap; }
.clean-actions .btn { flex: 1; min-width: 0; padding: 5px 8px; font-size: 12.5px; }
.clean-note { font-size: 11.5px; color: var(--faint); margin-top: 6px; font-style: italic; }

/* Bottom-nav dots pin next to the icon (column layout) */
@media (max-width: 780px) {
  .bottom-nav a { position: relative; }
  .bottom-nav a .nav-dot { position: absolute; top: 1px; left: calc(50% + 9px); margin: 0; }
  .bottom-nav a .nav-dot.count { top: -3px; left: calc(50% + 5px); }
}

/* ============================================================
   Per-user themes — set via <html data-theme="…"> (account → Appearance)
   ============================================================ */
[data-theme="midnight"] {
  --bg: #0d1020; --bg-2: #090b17; --panel: #141830; --panel-2: #1a1f3d; --panel-3: #222850;
  --border: #2a3155; --border-2: #39417a; --text: #e8eaf6; --muted: #9aa2c7; --faint: #6f77a3;
  --accent: #7c9cff; --accent-2: #a5bcff; --accent-soft: rgba(124, 156, 255, 0.14); --accent-rgb: 124, 156, 255;
  --stencil: #ffd166; --stencil-rgb: 255, 209, 102; --on-accent: #0b1020;
  --topbar-bg: rgba(13, 16, 32, 0.88); --bottomnav-bg: rgba(9, 11, 23, 0.97);
  --soft: rgba(26, 31, 61, 0.45); --rule: rgba(42, 49, 85, 0.6);
}
[data-theme="ocean"] {
  --bg: #08131a; --bg-2: #050d12; --panel: #0e1d26; --panel-2: #122631; --panel-3: #17303d;
  --border: #1d3a4a; --border-2: #275063; --text: #e3f4fa; --muted: #8fb6c6; --faint: #62889a;
  --accent: #2dd4bf; --accent-2: #68e6d6; --accent-soft: rgba(45, 212, 191, 0.14); --accent-rgb: 45, 212, 191;
  --stencil: #38bdf8; --stencil-rgb: 56, 189, 248; --on-accent: #04121a;
  --topbar-bg: rgba(8, 19, 26, 0.88); --bottomnav-bg: rgba(5, 13, 18, 0.97);
  --soft: rgba(18, 38, 49, 0.45); --rule: rgba(29, 58, 74, 0.6);
}
[data-theme="forest"] {
  --bg: #0c140e; --bg-2: #080f0a; --panel: #131f16; --panel-2: #18281c; --panel-3: #1f3225;
  --border: #26402e; --border-2: #33553e; --text: #e7f2e9; --muted: #9dbca6; --faint: #6f8f78;
  --accent: #4ade80; --accent-2: #86efac; --accent-soft: rgba(74, 222, 128, 0.14); --accent-rgb: 74, 222, 128;
  --stencil: #facc15; --stencil-rgb: 250, 204, 21; --on-accent: #07130b;
  --topbar-bg: rgba(12, 20, 14, 0.88); --bottomnav-bg: rgba(8, 15, 10, 0.97);
  --soft: rgba(24, 40, 28, 0.45); --rule: rgba(38, 64, 46, 0.6);
}
[data-theme="amethyst"] {
  --bg: #12101a; --bg-2: #0d0b14; --panel: #1a1727; --panel-2: #221e33; --panel-3: #2b2642;
  --border: #362f52; --border-2: #473d6b; --text: #efeaff; --muted: #b0a7cf; --faint: #837aa5;
  --accent: #a78bfa; --accent-2: #c4b5fd; --accent-soft: rgba(167, 139, 250, 0.14); --accent-rgb: 167, 139, 250;
  --stencil: #f0abfc; --stencil-rgb: 240, 171, 252; --on-accent: #120e1f;
  --topbar-bg: rgba(18, 16, 26, 0.88); --bottomnav-bg: rgba(13, 11, 20, 0.97);
  --soft: rgba(34, 30, 51, 0.45); --rule: rgba(54, 47, 82, 0.6);
}
[data-theme="rose"] {
  --bg: #1a1014; --bg-2: #140b0f; --panel: #24161c; --panel-2: #2e1c24; --panel-3: #3a242e;
  --border: #4a2f3b; --border-2: #61404f; --text: #f9eaef; --muted: #cba3b2; --faint: #a07b8a;
  --accent: #fb7185; --accent-2: #fda4af; --accent-soft: rgba(251, 113, 133, 0.14); --accent-rgb: 251, 113, 133;
  --stencil: #ff8fa3; --stencil-rgb: 255, 143, 163; --on-accent: #20090f;
  --topbar-bg: rgba(26, 16, 20, 0.88); --bottomnav-bg: rgba(20, 11, 15, 0.97);
  --soft: rgba(46, 28, 36, 0.45); --rule: rgba(74, 47, 59, 0.6);
}
[data-theme="crimson"] {
  --bg: #170f0f; --bg-2: #100a0a; --panel: #1f1616; --panel-2: #291c1c; --panel-3: #352323;
  --border: #472d2d; --border-2: #5e3b3b; --text: #f4e9e9; --muted: #c0a3a3; --faint: #967878;
  --accent: #f87171; --accent-2: #fca5a5; --accent-soft: rgba(248, 113, 113, 0.14); --accent-rgb: 248, 113, 113;
  --stencil: #fb923c; --stencil-rgb: 251, 146, 60; --on-accent: #1d0808;
  --topbar-bg: rgba(23, 15, 15, 0.88); --bottomnav-bg: rgba(16, 10, 10, 0.97);
  --soft: rgba(41, 28, 28, 0.45); --rule: rgba(71, 45, 45, 0.6);
}
[data-theme="solar"] {
  --bg: #17130b; --bg-2: #100d07; --panel: #221c10; --panel-2: #2c2414; --panel-3: #382e1a;
  --border: #4a3d22; --border-2: #63512c; --text: #f5efe2; --muted: #c4b795; --faint: #998c6b;
  --accent: #fbbf24; --accent-2: #fcd34d; --accent-soft: rgba(251, 191, 36, 0.14); --accent-rgb: 251, 191, 36;
  --stencil: #fb923c; --stencil-rgb: 251, 146, 60; --on-accent: #1a1204;
  --topbar-bg: rgba(23, 19, 11, 0.88); --bottomnav-bg: rgba(16, 13, 7, 0.97);
  --soft: rgba(44, 36, 20, 0.45); --rule: rgba(74, 61, 34, 0.6);
}
[data-theme="daylight"] {
  --bg: #f4f5ef; --bg-2: #e9ebe0; --panel: #ffffff; --panel-2: #f1f3ea; --panel-3: #e6e9dc;
  --border: #d5d9c8; --border-2: #bfc5ae; --text: #23271c; --muted: #5c6350; --faint: #838b73;
  --accent: #3f5c22; --accent-2: #55792e; --accent-soft: rgba(63, 92, 34, 0.12); --accent-rgb: 63, 92, 34;
  --stencil: #a16207; --stencil-rgb: 161, 98, 7; --on-accent: #ffffff;
  --teal: #0f766e; --green: #15803d; --amber: #b45309; --red: #d33f3f; --purple: #7c3aed;
  --green-rgb: 21, 128, 61; --amber-rgb: 180, 83, 9; --red-rgb: 211, 63, 63; --purple-rgb: 124, 58, 237;
  --topbar-bg: rgba(244, 245, 239, 0.9); --bottomnav-bg: rgba(244, 245, 239, 0.97);
  --scrim: rgba(30, 34, 24, 0.45); --soft: rgba(255, 255, 255, 0.7); --rule: rgba(0, 0, 0, 0.09);
  --danger-soft: rgba(211, 63, 63, 0.08); --danger-line: rgba(211, 63, 63, 0.35); --danger-text: #b91c1c;
  --shadow: 0 8px 30px rgba(40, 46, 30, 0.16);
}

/* ============================================================
   Auth — sign in / sign up switch
   ============================================================ */
.auth-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 9px; padding: 4px; margin-bottom: 16px;
}
.auth-tab {
  border: 0; background: transparent; color: var(--muted); font-weight: 650;
  padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 13.5px;
  transition: background .12s, color .12s;
}
.auth-tab:hover { color: var(--text); }
.auth-tab.active { background: var(--accent-soft); color: var(--accent-2); box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .35); }

/* ============================================================
   Tutorial tips — non-intrusive, dismissible
   ============================================================ */
.qm-tip {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--accent-soft); border: 1px solid rgba(var(--accent-rgb), .38);
  border-radius: var(--radius); padding: 11px 13px; margin-bottom: 14px;
  animation: tipIn .22s ease;
}
@keyframes tipIn { from { opacity: 0; transform: translateY(-6px); } }
.qm-tip-ico { font-size: 17px; line-height: 1.3; }
.qm-tip-body { display: flex; flex-direction: column; gap: 3px; font-size: 13px; min-width: 0; }
.qm-tip-body b { font-size: 13.5px; color: var(--accent-2); }
.qm-tip-body span { color: var(--muted); }
.qm-tip-ops { margin-left: auto; display: flex; gap: 12px; align-items: center; white-space: nowrap; font-size: 12.5px; }
.qm-tip-ops a { color: var(--accent-2); }
@media (max-width: 680px) { .qm-tip { flex-wrap: wrap; } .qm-tip-ops { margin-left: 26px; } }

.form-tip {
  display: flex; gap: 9px; align-items: flex-start;
  background: var(--accent-soft); border: 1px solid rgba(var(--accent-rgb), .32);
  color: var(--muted); border-radius: 8px; padding: 8px 11px;
  font-size: 12.5px; margin-bottom: 12px;
}
.form-tip .tip-x {
  margin-left: auto; background: none; border: 0; color: var(--faint);
  cursor: pointer; font-size: 12px; padding: 0 2px;
}
.form-tip .tip-x:hover { color: var(--text); }

/* ============================================================
   Category dropdowns — "＋ new" inline creation
   ============================================================ */
.select-add { display: flex; gap: 7px; align-items: center; }
.select-add select { flex: 1; min-width: 0; }
.link-add {
  flex: none; background: transparent; border: 1px dashed rgba(var(--accent-rgb), .55);
  color: var(--accent-2); border-radius: 6px; padding: 7px 9px; cursor: pointer;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.link-add:hover { background: var(--accent-soft); border-style: solid; }

/* ============================================================
   Account menu actions + notification settings
   ============================================================ */
.acct-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.acct-actions .btn { flex-direction: column; gap: 4px; padding: 10px 6px; font-size: 12px; }
@media (max-width: 480px) { .acct-actions { grid-template-columns: 1fr; } }
.notif-list { margin: 4px 0 0; padding-left: 18px; color: var(--muted); font-size: 13px; }
.notif-list li { margin-bottom: 6px; }

/* ============================================================
   Theme gallery
   ============================================================ */
.theme-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
@media (max-width: 560px) { .theme-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.theme-card {
  display: flex; flex-direction: column; gap: 4px; align-items: stretch;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 9px;
  padding: 8px; cursor: pointer; text-align: left; color: var(--text);
  transition: border-color .12s, transform .12s;
}
.theme-card:hover { border-color: var(--border-2); transform: translateY(-1px); }
.theme-card.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(var(--accent-rgb), .3); }
.theme-card .t-name { font-weight: 650; font-size: 12.5px; }
.theme-card .t-desc { font-size: 11px; color: var(--faint); }
.swatch { height: 34px; border-radius: 6px; border: 1px solid rgba(0,0,0,.25); }
.sw-depot      { background: linear-gradient(135deg, #14170f 0 46%, #a8b96c 46% 74%, #f0b23c 74%); }
.sw-midnight   { background: linear-gradient(135deg, #0d1020 0 46%, #7c9cff 46% 74%, #ffd166 74%); }
.sw-ocean      { background: linear-gradient(135deg, #08131a 0 46%, #2dd4bf 46% 74%, #38bdf8 74%); }
.sw-forest     { background: linear-gradient(135deg, #0c140e 0 46%, #4ade80 46% 74%, #facc15 74%); }
.sw-amethyst   { background: linear-gradient(135deg, #12101a 0 46%, #a78bfa 46% 74%, #f0abfc 74%); }
.sw-rose       { background: linear-gradient(135deg, #1a1014 0 46%, #fb7185 46% 74%, #ff8fa3 74%); }
.sw-crimson    { background: linear-gradient(135deg, #170f0f 0 46%, #f87171 46% 74%, #fb923c 74%); }
.sw-solar      { background: linear-gradient(135deg, #17130b 0 46%, #fbbf24 46% 74%, #fb923c 74%); }
.sw-daylight   { background: linear-gradient(135deg, #f4f5ef 0 46%, #3f5c22 46% 74%, #a16207 74%); }

/* ============================================================
   Help guide (full manual)
   ============================================================ */
.guide-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 640px) { .guide-grid { grid-template-columns: 1fr; } }
.guide-sec { background: var(--panel-2); border: 1px solid var(--border); border-radius: 9px; padding: 12px 14px; }
.guide-sec h3 { font-size: 13.5px; margin-bottom: 7px; color: var(--accent-2); }
.guide-sec ul { margin: 0; padding-left: 17px; }
.guide-sec li { font-size: 12.8px; color: var(--muted); margin-bottom: 6px; line-height: 1.45; }
.guide-sec li b { color: var(--text); }
.guide-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

/* ============================================================
   Finance depth — 6-month trend + category breakdown
   ============================================================ */
.trend { display: flex; gap: 10px; align-items: flex-end; height: 130px; }
.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; min-width: 0; }
.trend-bars { flex: 1; display: flex; gap: 4px; align-items: flex-end; width: 100%; justify-content: center; }
.trend-bars i { display: block; width: 34%; max-width: 16px; border-radius: 3px 3px 0 0; min-height: 2px; }
.trend-bars i.in { background: var(--green); }
.trend-bars i.out { background: var(--red); }
.trend-label { font-size: 10.5px; color: var(--faint); font-variant-numeric: tabular-nums; }

.catbreak { display: flex; flex-direction: column; gap: 9px; }
.catbreak-row { display: flex; align-items: center; gap: 11px; font-size: 13px; }
.catbreak-row .name { width: 150px; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.catbreak-row .amt { width: 92px; flex: none; text-align: right; font-variant-numeric: tabular-nums; }
.catbreak-row .pct { width: 44px; flex: none; text-align: right; font-size: 12px; }
@media (max-width: 640px) { .catbreak-row .name { width: 90px; } }
