/* =====================================================================
   Rebel Republic - Work and billing  (v3)
   Print-shop identity: ink navy, with cyan / magenta / yellow accents
   (the colour bar printers put on a proof sheet). Phone first.
   ===================================================================== */

:root {
  --ink: #0E1726;
  --ink-2: #172238;
  --ink-3: #26344D;
  --paper: #F3F5F8;
  --card: #FFFFFF;
  --card-2: #F8F9FB;
  --line: #DFE4EC;
  --line-2: #ECEFF4;
  --field: #FFFFFF;
  --field-line: #A9B2C1;
  --text: #121A29;
  --muted: #5A6577;
  --mag: #C8115C;
  --mag-d: #A00D4A;
  --mag-tint: #FDEAF2;
  --cyan: #0A9BC0;
  --yel: #FFC83D;
  --ok: #17803D;
  --ok-bg: #E4F5EA;
  --ok-line: #8CCBA0;
  --warn: #8A5300;
  --warn-bg: #FFF3D6;
  --warn-line: #E8C777;
  --bad: #B3261E;
  --bad-bg: #FCECEA;
  --bad-line: #E9B4AF;
  --info: #0F3A57;
  --info-bg: #E8F2FA;
  --info-line: #B9D6EC;
  --blue: #1D5FB8;
  --blue-bg: #E7EFFB;
  --bubble-in: #FFFFFF;
  --bubble-out: #DCF5E6;
  --shadow: 0 1px 2px rgba(14,23,38,.06), 0 6px 20px rgba(14,23,38,.07);
  --r: 14px;
  --r-sm: 10px;
  --side: 252px;
  --tabbar: 64px;
  --f-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --f-body: "Instrument Sans", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0B111C;
    --card: #141C2B;
    --card-2: #182234;
    --line: #26324A;
    --line-2: #1E283B;
    --field: #0F1725;
    --field-line: #3A4864;
    --text: #E7EBF2;
    --muted: #9AA6BA;
    --mag: #E2427F;
    --mag-d: #F0649A;
    --mag-tint: #3A1426;
    --cyan: #3CC1E3;
    --ok: #5BD08A;
    --ok-bg: #12301F;
    --ok-line: #2A6B44;
    --warn: #F0B35A;
    --warn-bg: #33270F;
    --warn-line: #6E5320;
    --bad: #F2867E;
    --bad-bg: #3A1716;
    --bad-line: #7A2E2A;
    --info: #BFDDF3;
    --info-bg: #102638;
    --info-line: #24506F;
    --blue: #8DB4F2;
    --blue-bg: #15253F;
    --bubble-in: #1B2538;
    --bubble-out: #143426;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { font-family: var(--f-display); letter-spacing: -0.015em; line-height: 1.2; }
a { color: var(--mag-d); text-underline-offset: 2px; }
a:hover { color: var(--mag); }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; padding: 10px 14px; background: var(--ink); color: #fff; border-radius: 8px; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); }
.small { font-size: 0.86rem; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-line; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------------------------------------------------------------
   Sign-in and setup
   --------------------------------------------------------------------- */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-brand { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 56px; color: #fff; background: var(--ink); }
.reg { position: absolute; right: -70px; top: -70px; width: 300px; height: 300px; border: 2px solid rgba(255,255,255,.16); border-radius: 50%; }
.reg::before { content: ""; position: absolute; inset: 62px; border: 2px solid rgba(255,255,255,.16); border-radius: 50%; }
.reg::after { content: ""; position: absolute; inset: -26px;
  background: linear-gradient(rgba(255,255,255,.16), rgba(255,255,255,.16)) center / 2px 100% no-repeat,
              linear-gradient(rgba(255,255,255,.16), rgba(255,255,255,.16)) center / 100% 2px no-repeat; }
.brand-name { position: relative; margin: 0; font-family: var(--f-display); font-size: 1.15rem; font-weight: 600; }
.brand-line { position: relative; margin: 0; max-width: 13ch; font-family: var(--f-display); font-size: clamp(2.1rem, 3.6vw, 3.4rem); font-weight: 700; line-height: 1.06; letter-spacing: -0.025em; }
.swatches { position: relative; display: flex; gap: 10px; }
.swatches i { width: 44px; height: 44px; border-radius: 50%; border: 2px solid rgba(255,255,255,.22); }
.swatches i:nth-child(1) { background: #0A9BC0; } .swatches i:nth-child(2) { background: #C8115C; }
.swatches i:nth-child(3) { background: #FFC83D; } .swatches i:nth-child(4) { background: var(--ink-3); }
.auth-panel { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 420px; padding: 32px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; }
.auth-card h1 { margin: 0; font-size: 1.7rem; }
.auth-card .sub { margin: 6px 0 22px; color: var(--muted); }
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .auth-brand { flex-direction: row; align-items: center; padding: 18px 20px; }
  .brand-line, .reg { display: none; }
  .swatches i { width: 18px; height: 18px; border-width: 1px; }
  .swatches { gap: 6px; }
  .auth-panel { align-items: start; padding: 28px 16px; }
  .auth-card { padding: 24px 20px; }
}

/* ---------------------------------------------------------------------
   App shell: sidebar on desktop; top bar + bottom tabs on phones
   --------------------------------------------------------------------- */
.shell { min-height: 100vh; }
.side { position: fixed; inset: 0 auto 0 0; z-index: 40; width: var(--side); display: flex; flex-direction: column; background: var(--ink); color: #C9D1DE; overflow-y: auto; }
.cmyk { display: flex; height: 5px; flex: none; }
.cmyk i { flex: 1; }
.cmyk i:nth-child(1), .mbar-logo i:nth-child(1) { background: #0A9BC0; }
.cmyk i:nth-child(2), .mbar-logo i:nth-child(2) { background: #C8115C; }
.cmyk i:nth-child(3), .mbar-logo i:nth-child(3) { background: #FFC83D; }
.cmyk i:nth-child(4) { background: #000; }
.side-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 22px 20px 14px; }
.logo { display: block; font-family: var(--f-display); font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; color: #fff; }
.tag { display: block; margin-top: 1px; font-size: 0.82rem; color: #8E9AB0; }
.side-close { display: none; }
.nav { display: flex; flex-direction: column; gap: 2px; padding: 6px 12px; flex: 1; }
.nav-group { margin: 16px 10px 6px; font-size: 0.8rem; font-weight: 600; color: #7F8CA3; }
.nav a { position: relative; display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 9px 12px; color: #C9D1DE; text-decoration: none; border-radius: 10px; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: rgba(255,255,255,.1); color: #fff; font-weight: 600; }
.nav a.active::before { content: ""; position: absolute; left: -12px; top: 10px; bottom: 10px; width: 4px; background: var(--yel); border-radius: 0 4px 4px 0; }
.nav a .count { margin-left: auto; }
.count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; font-size: .74rem; font-weight: 700; line-height: 1; color: #fff; background: var(--mag); border-radius: 999px; }
.side-foot { padding: 14px 12px 16px; border-top: 1px solid rgba(255,255,255,.1); }
.me { display: flex; align-items: center; gap: 10px; padding: 4px 6px 12px; }
.av { display: grid; place-items: center; width: 38px; height: 38px; flex: none; font-weight: 700; font-size: 0.9rem; color: var(--ink); background: var(--yel); border-radius: 50%; }
.me-t { min-width: 0; line-height: 1.25; }
.me-t b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #fff; font-weight: 600; }
.me-t small { color: #8E9AB0; font-size: 0.82rem; }
.side-foot form { margin: 0; }
.btn-out { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 10px 12px; font: inherit; color: #C9D1DE; background: transparent; border: 1px solid rgba(255,255,255,.16); border-radius: 10px; cursor: pointer; }
.btn-out:hover { background: rgba(255,255,255,.08); color: #fff; }

.main { margin-left: var(--side); min-width: 0; }
.mbar, .scrim, .tabbar { display: none; }
.container { max-width: 1180px; margin: 0 auto; padding: 32px 32px 72px; }

@media (max-width: 960px) {
  .side { transform: translateX(-100%); transition: transform .22s ease; width: min(300px, 86vw); }
  .nav-open .side { transform: none; box-shadow: 8px 0 40px rgba(0,0,0,.35); }
  .side-close { display: grid; place-items: center; width: 40px; height: 40px; color: #C9D1DE; background: transparent; border: 0; border-radius: 10px; cursor: pointer; }
  .scrim { position: fixed; inset: 0; z-index: 30; background: rgba(14,23,38,.5); }
  .nav-open .scrim { display: block; }
  .nav-open { overflow: hidden; }
  .main { margin-left: 0; }
  .mbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 6px; height: 54px; padding: 0 6px; padding-top: env(safe-area-inset-top); box-sizing: content-box;
    color: #fff; background: var(--ink); }
  .mbar a { display: grid; place-items: center; width: 44px; height: 44px; color: #fff; border-radius: 10px; }
  .mbar a:hover { background: rgba(255,255,255,.1); color: #fff; }
  .mbar-logo { display: flex; gap: 3px; width: 44px; justify-content: center; }
  .mbar-logo i { width: 7px; height: 18px; border-radius: 2px; }
  .mbar-title { flex: 1; font-family: var(--f-display); font-weight: 600; font-size: 1.1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .container { padding: 16px 14px calc(var(--tabbar) + 28px + env(safe-area-inset-bottom)); }
  .tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -4px 18px rgba(14,23,38,.06); }
  .tabbar a, .tabbar button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    font: inherit; font-size: .72rem; font-weight: 600; color: var(--muted); text-decoration: none; background: none; border: 0; cursor: pointer; }
  .tabbar .ic { width: 23px; height: 23px; }
  .tabbar .active { color: var(--mag); }
  .tabbar .active::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; background: var(--mag); border-radius: 0 0 3px 3px; }
  .tabbar .count { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; font-size: .68rem; }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } * { scroll-behavior: auto !important; animation: none !important; } }

/* ---------------------------------------------------------------------
   Page structure
   --------------------------------------------------------------------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; margin-bottom: 18px; }
.page-title { margin: 0; font-size: 1.85rem; }
.page-sub { margin: 4px 0 0; color: var(--muted); }
.container > h1.page-title { margin-bottom: 18px; }
.actions-row { display: flex; flex-wrap: wrap; gap: 8px; }
.actions-row.tight { margin-bottom: 14px; }
.panel { padding: 22px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
.panel + .panel, .panel.gap { margin-top: 18px; }
.panel h2 { margin: 0 0 14px; font-size: 1.15rem; }
.panel h3 { margin: 0 0 10px; font-size: 1rem; }
.panel > p { margin: 0 0 12px; max-width: 64ch; color: var(--muted); }
.panel.narrow { max-width: 520px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 22px 0 10px; font-size: 1.05rem; }
@media (max-width: 720px) {
  .page-title { font-size: 1.5rem; }
  .panel { padding: 16px; }
  .page-head .page-title { display: none; }
  .page-head .page-sub { margin: 0; }
}

/* ---------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px;
  font: inherit; font-weight: 600; text-align: center; text-decoration: none; color: #fff; background: var(--mag);
  border: 1px solid var(--mag); border-radius: 10px; cursor: pointer; transition: background .15s, border-color .15s; }
.btn:hover { color: #fff; background: var(--mag-d); border-color: var(--mag-d); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn-auto { width: auto; }
.btn-quiet { color: var(--text); background: var(--card); border-color: var(--field-line); }
.btn-quiet:hover { color: var(--text); background: var(--paper); border-color: var(--muted); }
.btn-ghost { color: var(--text); background: transparent; border-color: transparent; }
.btn-ghost:hover { color: var(--text); background: var(--line-2); border-color: transparent; }
.btn-ok { background: var(--ok); border-color: var(--ok); }
.btn-ok:hover { background: #126632; border-color: #126632; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .9rem; border-radius: 9px; }
.btn-link { width: 100%; }
.auth-card .btn { width: 100%; margin-top: 22px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.fab { display: none; }
@media (max-width: 720px) {
  .actions .btn, .actions form { flex: 1 1 100%; }
  .actions form .btn { width: 100%; }
  .fab { position: fixed; right: 16px; bottom: calc(var(--tabbar) + 14px + env(safe-area-inset-bottom)); z-index: 24; display: grid; place-items: center;
    width: 56px; height: 56px; color: #fff; background: var(--mag); border-radius: 18px; box-shadow: 0 8px 22px rgba(200,17,92,.35); }
  .fab:hover { color: #fff; background: var(--mag-d); }
  .fab .ic { width: 26px; height: 26px; }
  .actions-row .hm { display: none; }
}

/* ---------------------------------------------------------------------
   Forms
   --------------------------------------------------------------------- */
label { display: block; margin: 18px 0 6px; font-size: 0.9rem; font-weight: 600; }
.grid2 label, .grid3 label { margin-top: 0; }
input[type="text"], input[type="password"], input[type="email"], input[type="number"], input[type="date"], input[type="time"], input[type="datetime-local"], input[type="month"], input[type="search"], input[type="url"], input[type="file"], select, textarea {
  display: block; width: 100%; min-height: 46px; padding: 10px 14px; font: inherit; font-size: 16px; color: var(--text);
  background: var(--field); border: 1px solid var(--field-line); border-radius: 10px; }
input[type="file"] { padding: 9px 10px; }
textarea { min-height: 96px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #7B8596; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(10,155,192,.35); outline-offset: 0; border-color: var(--cyan); }
select { appearance: none; padding-right: 40px; cursor: pointer;
  background: var(--field) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%237B8596' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 14px center; }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; accent-color: var(--mag); cursor: pointer; }
.check { display: flex; align-items: center; gap: 10px; margin: 6px 0; font-weight: 400; cursor: pointer; }
input.short { width: 150px; min-height: 40px; padding: 8px 10px; }
input.sm { width: 112px; min-height: 40px; padding: 7px 10px; text-align: right; }
input.need { border-color: var(--bad); background: var(--bad-bg); }
.hint { margin: 6px 0 0; font-size: .86rem; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 18px; }
.grid2 > div, .grid3 > div { min-width: 0; }
.grid2 .full, .grid3 .full { grid-column: 1 / -1; }
.grid2 .actions { margin-top: 4px; }
@media (max-width: 720px) { .grid2, .grid3 { grid-template-columns: 1fr; gap: 14px; } }
.pw { position: relative; }
.pw input { padding-right: 74px; }
.pw-toggle { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); min-height: 36px; padding: 6px 12px; font: inherit; font-size: 0.88rem; font-weight: 600; color: var(--muted); background: transparent; border: 0; border-radius: 8px; cursor: pointer; }
.pw-toggle:hover { background: var(--paper); color: var(--text); }
.mrow { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.mrow input[name="contact_name[]"] { flex: 1 1 38%; }
.mrow input[name="mobile[]"] { flex: 1 1 32%; }
.pfx { padding: 0 2px; color: var(--muted); font-weight: 600; }
@media (max-width: 720px) {
  .mrow { flex-wrap: wrap; padding: 12px; background: var(--paper); border-radius: 10px; }
  .mrow input[name="contact_name[]"] { flex: 1 1 100%; }
  .mrow .pfx { flex: none; }
  .mrow input[name="mobile[]"] { flex: 1 1 0; }
  .mrow .btn { flex: 1 1 100%; }
}
.searchbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.searchbar input { flex: 1 1 240px; max-width: 460px; }

/* ---------------------------------------------------------------------
   Alerts, badges, toast
   --------------------------------------------------------------------- */
.alert { display: block; margin: 0 0 16px; padding: 12px 16px; font-size: 0.97rem; border: 1px solid; border-left-width: 5px; border-radius: 10px; }
.alert-error { color: var(--bad); background: var(--bad-bg); border-color: var(--bad-line); border-left-color: var(--bad); }
.alert-info { color: var(--info); background: var(--info-bg); border-color: var(--info-line); border-left-color: var(--cyan); }
.alert-warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-line); border-left-color: var(--warn); }
.alert ul { margin: 0; padding-left: 18px; }
.alert a { color: inherit; font-weight: 600; }
.auth-card .alert { margin: 0 0 4px; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; font-size: 0.8rem; font-weight: 600; white-space: nowrap; color: var(--text); background: var(--line-2); border: 1px solid var(--line); border-radius: 999px; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .75; }
.badge.plain::before { content: none; }
.badge-new { color: var(--muted); background: var(--line-2); }
.badge-prog { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-line); }
.badge-ready { color: var(--blue); background: var(--blue-bg); border-color: color-mix(in srgb, var(--blue) 35%, transparent); }
.badge-done { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-line); }
.badge-warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-line); }
.badge-bad { color: var(--bad); background: var(--bad-bg); border-color: var(--bad-line); }
.badge-off { color: var(--muted); background: var(--card); }
.badge-ai { color: var(--info); background: var(--info-bg); border-color: var(--info-line); }
.tick { display: inline-grid; place-items: center; width: 24px; height: 24px; color: #fff; background: var(--ok); border-radius: 50%; font-size: .85rem; font-weight: 700; }

.toast { position: fixed; left: 50%; bottom: 24px; z-index: 60; transform: translate(-50%, 12px); max-width: calc(100% - 32px);
  padding: 11px 16px; font-size: .95rem; color: #fff; background: var(--ink); border-radius: 12px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 960px) { .toast { bottom: calc(var(--tabbar) + 14px + env(safe-area-inset-bottom)); } }

/* ---------------------------------------------------------------------
   Tables (cards on phones)
   --------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; margin: 0 -8px; padding: 0 8px; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
table.data th, table.data td { padding: 12px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line-2); }
table.data thead th { position: sticky; top: 0; font-size: 0.82rem; font-weight: 600; white-space: nowrap; color: var(--muted); background: var(--card-2); border-bottom: 1px solid var(--line); }
table.data thead th:first-child { border-top-left-radius: 8px; }
table.data thead th:last-child { border-top-right-radius: 8px; }
table.data tbody tr:hover td { background: var(--card-2); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data .num { text-align: right; white-space: nowrap; }
table.data td.pre { min-width: 200px; }
table.kv th { width: 300px; color: var(--text); font-weight: 600; background: transparent; position: static; font-size: 0.95rem; }
.row-open td:first-child { box-shadow: inset 4px 0 0 var(--mag); }
.row-billed td { color: var(--muted); background: var(--card-2); }
form.inline { display: inline-flex; align-items: center; gap: 8px; margin: 2px 8px 2px 0; }
.sel-sm { width: auto; min-height: 36px; padding: 4px 34px 4px 10px; font-size: 0.9rem; font-weight: 600; border-radius: 999px; background-position: right 10px center; }
select.badge-prog { background-color: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
select.badge-done { background-color: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
select.badge-ready { background-color: var(--blue-bg); color: var(--blue); }
select.badge-new { background-color: var(--line-2); color: var(--text); }
select.badge-off { color: var(--muted); }
.pager { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 16px; }
.steps { margin: 0; padding-left: 22px; line-height: 1.9; }
code { padding: 2px 6px; font-size: 0.9em; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; word-break: break-all; }

@media (max-width: 720px) {
  .panel:has(table.data:not(.kv)) { padding: 0; background: transparent; border: 0; }
  .panel:has(table.data:not(.kv)) > h2, .panel:has(table.data:not(.kv)) > p { padding: 0 2px; }
  .table-wrap { overflow: visible; margin: 0; padding: 0; }
  table.data:not(.kv), table.data:not(.kv) tbody { display: block; }
  table.data:not(.kv) thead { display: none; }
  table.data:not(.kv) tr { display: flex; flex-direction: column; margin: 0 0 12px; padding: 4px 16px 8px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
  table.data:not(.kv) tr.row-open { border-left: 5px solid var(--mag); padding-left: 12px; }
  table.data:not(.kv) tr.row-billed { background: var(--card-2); }
  table.data:not(.kv) tbody tr:hover td { background: transparent; }
  table.data:not(.kv) td { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 9px 0; text-align: right;
    border-bottom: 1px dashed var(--line-2); background: transparent !important; box-shadow: none !important; word-break: break-word; }
  table.data:not(.kv) td:last-child { border-bottom: 0; }
  table.data:not(.kv) td::before { content: attr(data-label); flex: 0 0 34%; max-width: 40%; text-align: left; font-size: 0.84rem; color: var(--muted); }
  table.data:not(.kv) td.nolabel::before { content: none; }
  table.data:not(.kv) td.title { order: -1; display: block; padding: 12px 0 10px; font-family: var(--f-display); font-size: 1.1rem; font-weight: 600; text-align: left; border-bottom: 1px solid var(--line); }
  table.data:not(.kv) td.hm { display: none; }
  table.data:not(.kv) td.pre { max-width: none; }
  table.data:not(.kv) td .muted.pre { display: block; }
  input.sm, input.short { width: 130px; }
  table.kv th, table.kv td { display: block; width: auto; padding: 6px 0; }
  table.kv tr { display: block; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
}

/* ---------------------------------------------------------------------
   Month bar, filters, stats
   --------------------------------------------------------------------- */
.monthbar { display: flex; gap: 6px; margin: 0 0 16px; padding: 2px 0 6px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; }
.monthbar::-webkit-scrollbar { display: none; }
.monthbar a { flex: 0 0 auto; display: grid; place-items: center; min-width: 52px; min-height: 42px; padding: 8px 14px; scroll-snap-align: center;
  color: var(--text); font-weight: 600; text-decoration: none; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.monthbar a:hover { color: var(--text); border-color: var(--muted); }
.monthbar a.active { color: #fff; background: var(--ink); border-color: var(--ink); }
.monthbar a:last-child { margin-left: 6px; }
.filterbox { margin: 0 0 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
.filterbox > summary { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 10px 16px; font-weight: 600; list-style: none; cursor: pointer; }
.filterbox > summary::-webkit-details-marker { display: none; }
.filterbox > summary::after { content: ""; margin-left: auto; width: 10px; height: 10px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; }
.filterbox[open] > summary::after { transform: rotate(-135deg); }
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; padding: 4px 16px 18px; }
.filters > div { min-width: 0; }
.filters label { margin: 0 0 5px; font-size: 0.82rem; color: var(--muted); }
.filters select, .filters input[type="text"], .filters input[type="search"] { min-height: 42px; width: auto; min-width: 130px; }
.filters .grow { flex: 1 1 170px; }
.filters .grow select, .filters .grow input { width: 100%; }
.filters .fbtn { display: flex; align-items: center; gap: 14px; }
form.filters:not(.in-box) { margin-bottom: 16px; padding: 0; }
@media (max-width: 720px) {
  .filters > div { flex: 1 1 calc(50% - 7px); }
  .filters .grow, .filters .fbtn { flex: 1 1 100%; }
  .filters select, .filters input[type="text"], .filters input[type="search"] { width: 100%; }
}
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0 0 16px; }
.stat { padding: 12px 16px; background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--ink-3); border-radius: var(--r); }
.stat b { display: block; font-family: var(--f-display); font-size: 1.7rem; line-height: 1.1; }
.stat span { font-size: 0.88rem; color: var(--muted); }
.stat.ok { border-left-color: var(--ok); }
.stat.open { border-left-color: var(--mag); }
@media (max-width: 520px) { .stat { padding: 10px 12px; } .stat b { font-size: 1.35rem; } .stat span { font-size: .8rem; } }

/* ---------------------------------------------------------------------
   Billing preview
   --------------------------------------------------------------------- */
.totals { max-width: 340px; margin: 18px 0 10px auto; padding: 14px 18px; background: var(--card-2); border: 1px dashed var(--field-line); border-radius: var(--r); }
.totals div { display: flex; justify-content: space-between; gap: 16px; padding: 6px 0; }
.totals .grand { margin-top: 6px; padding-top: 10px; font-size: 1.2rem; border-top: 2px solid var(--text); }
.totals .grand b { font-family: var(--f-display); }
@media (max-width: 720px) { .totals { max-width: none; } }

/* =====================================================================
   WORK DESK
   ===================================================================== */

/* The due-date chip: the one loud element. Coloured like a proof-sheet swatch. */
.due { display: grid; justify-items: center; align-content: center; width: 64px; height: 64px; flex: none; line-height: 1; text-align: center;
  color: var(--muted); background: var(--line-2); border-radius: 12px; font-family: var(--f-display); }
.due b { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; }
.due small { font-size: .78rem; font-weight: 600; margin-top: 1px; }
.due i { font-style: normal; font-family: var(--f-body); font-size: .66rem; font-weight: 700; margin-top: 4px; letter-spacing: .01em; }
.due-overdue { color: #fff; background: var(--bad); }
.due-today { color: #3B2600; background: var(--yel); }
.due-tomorrow { color: var(--blue); background: var(--blue-bg); }
.due-later { color: var(--text); background: var(--line-2); }
.due-none b { font-size: 1.2rem; }
.due.lg { width: 76px; height: 76px; }
.due.lg b { font-size: 2rem; }

/* Quick filter strip */
.strip { display: flex; gap: 8px; margin: 0 0 14px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.strip::-webkit-scrollbar { display: none; }
.strip a { flex: 0 0 auto; display: flex; flex-direction: column; min-width: 104px; padding: 10px 14px; color: var(--text); text-decoration: none;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.strip a b { font-family: var(--f-display); font-size: 1.6rem; line-height: 1.05; }
.strip a span { font-size: .8rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.strip a:hover { border-color: var(--muted); color: var(--text); }
.strip a.on { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.strip a.k-overdue b { color: var(--bad); }
.strip a.k-today b { color: #A66F00; }
.strip a.k-tomorrow b { color: var(--blue); }
.strip a.k-unhappy b { color: var(--mag); }
.strip a.zero b { color: var(--muted); opacity: .6; }
@media (prefers-color-scheme: dark) { .strip a.k-today b { color: var(--yel); } }

.chips { display: flex; gap: 8px; margin: 0 0 14px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips a, .chips button { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 7px 14px; font: inherit; font-size: .9rem; font-weight: 600;
  color: var(--text); text-decoration: none; background: var(--card); border: 1px solid var(--line); border-radius: 999px; cursor: pointer; }
.chips a.on, .chips button.on { color: #fff; background: var(--ink); border-color: var(--ink); }
@media (prefers-color-scheme: dark) { .chips a.on, .chips button.on { color: var(--ink); background: var(--text); border-color: var(--text); } }
.chips .count { margin-left: 2px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.toolbar input[type="search"] { flex: 1 1 220px; min-height: 42px; }
.toolbar select { width: auto; min-height: 42px; flex: 0 0 auto; }
@media (max-width: 720px) { .toolbar select { flex: 1 1 calc(50% - 4px); } }

/* Work list */
.wlist { display: grid; gap: 10px; }
.wcard { position: relative; display: flex; gap: 14px; align-items: flex-start; padding: 12px 14px; color: var(--text); text-decoration: none;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
.wcard:hover { color: var(--text); border-color: var(--muted); }
.wcard.is-done { opacity: .62; }
.wcard .wmain { flex: 1; min-width: 0; }
.wcard .wcust { display: flex; align-items: center; gap: 6px; font-size: .84rem; font-weight: 600; color: var(--muted); }
.wcard .wtitle { display: block; margin-top: 1px; font-weight: 600; font-size: 1.02rem; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.wcard .wmeta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-top: 7px; font-size: .84rem; color: var(--muted); }
.wcard .wside { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.who { display: inline-flex; align-items: center; gap: 6px; font-size: .84rem; font-weight: 600; color: var(--text); white-space: nowrap; }
.who .av { width: 24px; height: 24px; font-size: .68rem; }
.who.none { color: var(--muted); font-weight: 500; }
.flag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; font-size: .76rem; font-weight: 700; border-radius: 999px; white-space: nowrap; }
.flag .ic { width: 14px; height: 14px; }
.flag-unhappy { color: #fff; background: var(--mag); }
.flag-promise { color: var(--warn); background: var(--warn-bg); }
.flag-urgent { color: var(--bad); background: var(--bad-bg); }
.flag-high { color: var(--warn); background: var(--warn-bg); }
.flag-need { color: var(--info); background: var(--info-bg); }
.flag-wa { color: var(--ok); background: var(--ok-bg); }
@media (max-width: 560px) {
  .wcard { gap: 12px; padding: 12px; }
  .wcard .wside { display: none; }
  .due { width: 56px; height: 58px; }
  .due b { font-size: 1.4rem; }
}
.empty { padding: 40px 20px; text-align: center; color: var(--muted); background: var(--card); border: 1px dashed var(--line); border-radius: var(--r); }
.empty strong { display: block; margin-bottom: 4px; color: var(--text); font-size: 1.05rem; }

/* Work detail */
.whead { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 16px; }
.whead .wh { flex: 1; min-width: 0; }
.whead .wcust { font-weight: 600; color: var(--muted); }
.whead h1 { margin: 2px 0 6px; font-size: 1.6rem; }
.whead .wmeta { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 720px) { .whead h1 { font-size: 1.3rem; } }
.wgrid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 18px; align-items: start; }
.wgrid > div { display: grid; gap: 18px; min-width: 0; }
@media (max-width: 960px) { .wgrid { grid-template-columns: 1fr; } }
.quick { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.quick > div { min-width: 0; }
.quick label { margin: 0 0 5px; font-size: .82rem; color: var(--muted); }
.quick select, .quick input { min-height: 44px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 0; }
.facts dt { color: var(--muted); font-size: .9rem; }
.facts dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; }
.banner .ic { margin-top: 2px; }
.banner-unhappy { color: var(--text); background: var(--mag-tint); border: 1px solid color-mix(in srgb, var(--mag) 35%, transparent); }
.banner-unhappy > .ic { color: var(--mag); }
.banner-need { background: var(--info-bg); border: 1px solid var(--info-line); }
.banner p { margin: 0; }
.banner .grow { flex: 1; }

.plist { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.plist li { display: flex; gap: 10px; align-items: center; padding: 10px 12px; background: var(--card-2); border: 1px solid var(--line-2); border-radius: 10px; }
.plist li .grow { flex: 1; min-width: 0; }
.plist li.late { border-color: var(--warn-line); background: var(--warn-bg); }
.plist small { display: block; color: var(--muted); }

.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.files a { display: flex; flex-direction: column; gap: 6px; padding: 8px; color: var(--text); text-decoration: none; background: var(--card-2); border: 1px solid var(--line-2); border-radius: 10px; font-size: .82rem; overflow: hidden; }
.files a:hover { border-color: var(--muted); color: var(--text); }
.files img { width: 100%; height: 90px; object-fit: cover; border-radius: 6px; background: var(--line-2); }
.files .fic { display: grid; place-items: center; height: 90px; border-radius: 6px; background: var(--line-2); color: var(--muted); font-weight: 700; }
.files span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropzone { display: grid; place-items: center; gap: 4px; margin-top: 10px; padding: 16px; text-align: center; color: var(--muted); border: 2px dashed var(--line); border-radius: 12px; cursor: pointer; }
.dropzone.over { border-color: var(--cyan); background: var(--info-bg); }
.dropzone input { display: none; }

/* Timeline: system lines + WhatsApp-style bubbles */
.timeline { display: grid; gap: 10px; }
.tl-day { justify-self: center; padding: 2px 10px; font-size: .76rem; font-weight: 700; color: var(--muted); background: var(--line-2); border-radius: 999px; }
.tl-ev { display: flex; gap: 10px; font-size: .9rem; color: var(--muted); }
.tl-ev .dot { flex: none; width: 10px; height: 10px; margin-top: 6px; border-radius: 50%; background: var(--field-line); }
.tl-ev.t-created .dot { background: var(--mag); }
.tl-ev.t-change .dot, .tl-ev.t-due .dot { background: #E0A100; }
.tl-ev.t-complaint .dot { background: var(--bad); }
.tl-ev.t-followup .dot, .tl-ev.t-followup_due .dot { background: var(--warn); }
.tl-ev.t-followup_done .dot, .tl-ev.t-resolved .dot, .tl-ev.t-status .dot { background: var(--ok); }
.tl-ev.t-note .dot { background: var(--cyan); }
.tl-ev .tx { flex: 1; min-width: 0; overflow-wrap: anywhere; white-space: pre-line; }
.tl-ev .tx b { color: var(--text); font-weight: 600; }
.tl-ev time { flex: none; font-size: .78rem; }
.tl-ev.t-note .tx { color: var(--text); background: var(--info-bg); padding: 8px 12px; border-radius: 4px 12px 12px 12px; }
.bubble { max-width: min(560px, 92%); padding: 7px 11px 6px; background: var(--bubble-in); border: 1px solid var(--line); border-radius: 4px 14px 14px 14px; box-shadow: 0 1px 1px rgba(0,0,0,.04); }
.bubble.out { justify-self: end; background: var(--bubble-out); border-color: transparent; border-radius: 14px 4px 14px 14px; }
.bubble .bw { display: block; font-size: .78rem; font-weight: 700; color: var(--mag-d); }
.bubble.out .bw { color: var(--ok); }
.bubble .bq { display: block; margin: 2px 0 4px; padding: 4px 8px; font-size: .84rem; color: var(--muted); background: rgba(0,0,0,.04); border-left: 3px solid var(--cyan); border-radius: 4px; }
.bubble .bt { white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble .bm { display: inline-flex; align-items: center; gap: 4px; font-size: .84rem; color: var(--muted); }
.bubble .bm .ic { width: 15px; height: 15px; }
.bubble time { display: block; margin-top: 2px; text-align: right; font-size: .72rem; color: var(--muted); }
.bubble img { display: block; max-width: 100%; max-height: 260px; margin: 4px 0; border-radius: 8px; }
.composer { display: flex; gap: 8px; margin-top: 14px; }
.composer input { flex: 1; }

/* By employee board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(270px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 8px; min-height: 120px; padding: 10px; background: var(--line-2); border: 1px solid var(--line); border-radius: var(--r); }
.col.over { outline: 3px dashed var(--cyan); outline-offset: -3px; }
.col-head { display: flex; align-items: center; gap: 10px; padding: 4px 4px 6px; }
.col-head .av { width: 34px; height: 34px; }
.col-head b { display: block; line-height: 1.2; }
.col-head small { color: var(--muted); font-size: .8rem; }
.col-nums { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 4px 4px; }
.col-nums span { padding: 1px 8px; font-size: .76rem; font-weight: 700; border-radius: 999px; background: var(--card); color: var(--muted); }
.col-nums .n-overdue { color: var(--bad); background: var(--bad-bg); }
.col-nums .n-today { color: #6B4700; background: #FFE6A6; }
.kcard { display: block; padding: 10px 12px; color: var(--text); text-decoration: none; background: var(--card); border: 1px solid var(--line); border-radius: 12px; cursor: grab; }
.kcard:hover { color: var(--text); border-color: var(--muted); }
.kcard.dragging { opacity: .45; }
.kcard .kt { display: flex; justify-content: space-between; gap: 8px; font-size: .78rem; font-weight: 700; color: var(--muted); }
.kcard .kd.d-overdue { color: var(--bad); }
.kcard .kd.d-today { color: #A66F00; }
.kcard .kd.d-tomorrow { color: var(--blue); }
.kcard .kn { display: block; margin: 2px 0 6px; font-weight: 600; line-height: 1.3; }
.kcard .km { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.kcard .move { margin-top: 8px; display: none; }
.kcard .move select { min-height: 38px; font-size: .9rem; }
.col-empty { padding: 18px 8px; text-align: center; color: var(--muted); font-size: .9rem; }
.people { display: none; }
@media (max-width: 720px) {
  .board { grid-auto-flow: row; grid-auto-columns: auto; overflow: visible; }
  .board .col { display: none; background: transparent; border: 0; padding: 0; }
  .board .col.show { display: flex; }
  .board .col-head { display: none; }
  .people { display: flex; gap: 8px; margin: 0 0 12px; overflow-x: auto; scrollbar-width: none; }
  .people::-webkit-scrollbar { display: none; }
  .people button { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; min-height: 46px; padding: 6px 14px 6px 6px; font: inherit; font-weight: 600; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 999px; cursor: pointer; }
  .people button .av { width: 32px; height: 32px; font-size: .74rem; }
  .people button.on { color: #fff; background: var(--ink); border-color: var(--ink); }
  .people button em { font-style: normal; font-size: .76rem; padding: 0 7px; border-radius: 999px; background: var(--bad); color: #fff; }
  .kcard { cursor: default; }
  .kcard .move { display: block; }
}
.report { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.rcard { padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
.rcard h3 { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; font-size: 1rem; }
.rcard .av { width: 30px; height: 30px; font-size: .72rem; }
.rcard dl { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 0; font-size: .92rem; }
.rcard dt { color: var(--muted); }
.rcard dd { margin: 0; font-weight: 700; text-align: right; }
.bar { height: 8px; margin-top: 10px; overflow: hidden; background: var(--bad-bg); border-radius: 999px; }
.bar i { display: block; height: 100%; background: var(--ok); border-radius: 999px; }

/* Ask AI chat */
.chat { display: flex; flex-direction: column; gap: 12px; min-height: 40vh; }
.chat .q, .chat .a { max-width: min(680px, 92%); padding: 10px 14px; border-radius: 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat .q { align-self: flex-end; color: #fff; background: var(--ink); border-bottom-right-radius: 4px; }
@media (prefers-color-scheme: dark) { .chat .q { background: var(--ink-3); } }
.chat .a { align-self: flex-start; background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chat .a.err { color: var(--bad); background: var(--bad-bg); border-color: var(--bad-line); }
.chat .a a { font-weight: 600; }
.chat .typing { align-self: flex-start; display: flex; gap: 4px; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.chat .typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.chat .typing i:nth-child(2) { animation-delay: .2s; } .chat .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.ask-bar { position: sticky; bottom: 0; display: flex; gap: 8px; margin-top: 16px; padding: 12px 0; background: var(--paper); }
.ask-bar textarea { flex: 1; min-height: 50px; max-height: 160px; resize: none; border-radius: 14px; }
.ask-bar .btn { align-self: flex-end; min-width: 52px; min-height: 50px; border-radius: 14px; }
@media (max-width: 960px) { .ask-bar { bottom: calc(var(--tabbar) + env(safe-area-inset-bottom)); } }
.suggest { display: flex; flex-wrap: wrap; gap: 8px; }
.suggest button { padding: 8px 14px; font: inherit; font-size: .92rem; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 999px; cursor: pointer; text-align: left; }
.suggest button:hover { border-color: var(--muted); }
.ask-mini { display: flex; gap: 8px; }
.ask-mini input { flex: 1; }
.ask-out { margin-top: 10px; padding: 10px 12px; white-space: pre-wrap; background: var(--card-2); border-radius: 10px; font-size: .94rem; }
.ask-out:empty { display: none; }

/* Inbox / messages */
.mlist { display: grid; gap: 10px; }
.mcard { padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
.mcard .mtop { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: .86rem; color: var(--muted); }
.mcard .mtop b { color: var(--text); }
.mcard .mtext { margin: 6px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.mcard .mai { padding: 6px 10px; font-size: .86rem; color: var(--muted); background: var(--card-2); border-radius: 8px; }
.mcard .mact { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.mcard .mact select { width: auto; min-height: 36px; font-size: .9rem; padding: 4px 34px 4px 10px; }

/* Settings blocks */
.setrow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 8px 24px; padding: 16px 0; border-top: 1px solid var(--line-2); }
.setrow:first-of-type { border-top: 0; padding-top: 0; }
.setrow label { margin: 0; }
.setrow .hint { margin-top: 2px; }
@media (max-width: 720px) { .setrow { grid-template-columns: 1fr; } }
.kpi { display: flex; flex-wrap: wrap; gap: 20px; }
.kpi div b { display: block; font-family: var(--f-display); font-size: 1.5rem; }
.kpi div span { color: var(--muted); font-size: .86rem; }

.wmeta .show-sm { display: none; }
@media (max-width: 560px) { .wmeta .show-sm { display: inline-flex; } }

[hidden] { display: none !important; }
.wcard .wtitle { color: var(--text); text-decoration: none; }
.wcard .wtitle::after { content: ""; position: absolute; inset: 0; border-radius: var(--r); }
.wcard .wtitle:focus-visible { outline: none; }
.wcard .wtitle:focus-visible::after { outline: 3px solid var(--cyan); outline-offset: 2px; }
.wcard:hover .wtitle { color: var(--mag-d); }
.wcard .wside, .wcard .flag, .wcard .badge { position: relative; z-index: 1; }
@media (max-width: 720px) {
  .page-sub .hm { display: none; }
  .hide-sm { display: none !important; }
  table.data:not(.kv) td { flex-wrap: wrap; }
  table.data:not(.kv) td form.inline { flex-wrap: wrap; justify-content: flex-end; margin-right: 0; }
}
