/* =====================================================================
   Solar CRM v2 – app theme. Mobile = native-app feel, desktop = clean panel.
   Themes: <html data-theme="green|solar|ocean|royal|dark">
   ===================================================================== */
:root, [data-theme="green"] {
  --brand: #00a884; --brand-dark: #008069; --brand-deep: #075e54; --brand-ink: #fff;
  --brand-soft: #e6f6f1; --brand-line: #b9e6d8;
  --grad: linear-gradient(135deg, #075e54 0%, #008069 48%, #00a884 100%);
  --bg: #f0f2f5; --card: #ffffff; --card-2: #f7f8fa; --ink: #111b21; --ink-2: #3b4a54; --muted: #667781; --line: #e9edef;
  --side: #ffffff; --side-ink: #3b4a54;
  --ok: #0f9d58; --ok-soft: #e3f6ea; --warn: #e37400; --warn-soft: #fff3e0; --bad: #d93025; --bad-soft: #fdecea; --info: #1a73e8; --info-soft: #e8f0fe;
  --r: 18px; --r-sm: 12px;
  --sh: 0 1px 2px rgba(11,20,26,.05), 0 6px 20px rgba(11,20,26,.05);
  --sh-lg: 0 10px 40px rgba(11,20,26,.14);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}
[data-theme="solar"] { --brand:#f76707; --brand-dark:#e8590c; --brand-deep:#c2410c; --brand-soft:#fff4e6; --brand-line:#ffd8a8; --grad:linear-gradient(135deg,#c2410c 0%,#e8590c 50%,#fd7e14 100%); }
[data-theme="ocean"] { --brand:#1c7ed6; --brand-dark:#1971c2; --brand-deep:#0b4f8a; --brand-soft:#e7f5ff; --brand-line:#a5d8ff; --grad:linear-gradient(135deg,#0b3d6b 0%,#1971c2 50%,#339af0 100%); }
[data-theme="royal"] { --brand:#7048e8; --brand-dark:#6741d9; --brand-deep:#4c2a9e; --brand-soft:#f3f0ff; --brand-line:#d0bfff; --grad:linear-gradient(135deg,#3b1f80 0%,#6741d9 50%,#845ef7 100%); }
[data-theme="dark"] {
  --brand:#00a884; --brand-dark:#00a884; --brand-deep:#005c4b; --brand-ink:#fff; --brand-soft:#0d2e27; --brand-line:#1f4d43;
  --grad:linear-gradient(135deg,#0b141a 0%,#103529 55%,#005c4b 100%);
  --bg:#0b141a; --card:#111b21; --card-2:#17232b; --ink:#e9edef; --ink-2:#c3cdd3; --muted:#8696a0; --line:#222e35;
  --side:#111b21; --side-ink:#c3cdd3;
  --ok-soft:#0f2e1e; --warn-soft:#33240d; --bad-soft:#3a1714; --info-soft:#12263f;
  --sh: 0 1px 2px rgba(0,0,0,.4); --sh-lg: 0 10px 40px rgba(0,0,0,.6);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; overflow-x: hidden; max-width: 100%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { font: 15px/1.5 var(--font); background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
a { color: var(--brand-dark); text-decoration: none; }
[data-theme="dark"] a { color: var(--brand); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.01em; }
h2 { font-size: 17px; font-weight: 700; } h3 { font-size: 15px; font-weight: 700; }
small, .muted { color: var(--muted); }
img { max-width: 100%; }
.ti { font-size: 1.25em; vertical-align: -0.15em; }
code { background: var(--card-2); padding: 1px 6px; border-radius: 6px; font-size: .9em; }
pre { background: var(--card-2); padding: 12px; border-radius: 12px; white-space: pre-wrap; word-break: break-all; }
.hide { display: none !important; }

/* ---------------- layout ---------------- */
.app { display: flex; min-height: 100vh; width: 100%; max-width: 100vw; overflow-x: hidden; }
.sidebar { width: 260px; background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; flex-shrink: 0; z-index: 40; }
.side-brand { display: flex; align-items: center; gap: 12px; padding: 18px 18px 14px; }
.side-brand .logo { width: 42px; height: 42px; border-radius: 14px; background: var(--grad); color: #fff; display: grid; place-items: center; font-size: 22px; box-shadow: 0 6px 16px rgba(0,128,105,.3); flex-shrink: 0; overflow: hidden; }
.side-brand .logo img { width: 100%; height: 100%; object-fit: cover; }
.side-brand b { display: block; font-size: 15px; line-height: 1.2; color: var(--ink); }
.side-brand small { font-size: 12px; }
.sidebar nav { flex: 1; overflow-y: auto; padding: 4px 12px 12px; }
.nav-sep { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; padding: 16px 10px 6px; color: var(--muted); }
.sidebar nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 12px; color: var(--side-ink); margin-bottom: 2px; font-weight: 500; font-size: 14.5px; }
.sidebar nav a .ti { font-size: 20px; color: var(--muted); }
.sidebar nav a:hover { background: var(--card-2); }
.sidebar nav a.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; }
.sidebar nav a.active .ti { color: var(--brand-dark); }
[data-theme="dark"] .sidebar nav a.active, [data-theme="dark"] .sidebar nav a.active .ti { color: var(--brand); }
.side-user { padding: 12px 14px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.side-user .who { flex: 1; min-width: 0; }
.side-user b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user small { font-size: 12px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark); display: grid; place-items: center; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.avatar.lg { width: 56px; height: 56px; font-size: 20px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.appbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; padding: 12px 24px; background: rgba(255,255,255,.88); backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px); border-bottom: 1px solid var(--line); }
[data-theme="dark"] .appbar { background: rgba(17,27,33,.9); }
.appbar .titles { flex-shrink: 0; min-width: 0; }
.appbar h1 { font-size: 19px; margin: 0; font-weight: 800; }
.appbar .sub { font-size: 12.5px; color: var(--muted); }
.appbar .search { flex: 1; display: flex; justify-content: flex-end; }
.appbar .search label { position: relative; width: 100%; max-width: 380px; margin: 0; }
.appbar .search .ti { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.appbar .search input { padding-left: 38px; border-radius: 24px; background: var(--card-2); border-color: transparent; }
.icon-btn { position: relative; background: none; border: 0; color: var(--ink); width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; font-size: 22px; flex-shrink: 0; }
.icon-btn:hover { background: var(--card-2); }
.badge-dot { position: absolute; top: 4px; right: 3px; background: var(--bad); color: #fff; font-size: 10px; font-weight: 700; border-radius: 10px; padding: 0 5px; line-height: 16px; border: 2px solid var(--card); }
.content { padding: 22px 24px 40px; max-width: 1320px; width: 100%; margin: 0 auto; }
.imp-bar { background: #fab005; color: #1a1a1a; text-align: center; padding: 7px 10px; font-size: 14px; position: relative; z-index: 60; }
.imp-bar a { color: #1a1a1a; text-decoration: underline; font-weight: 700; }
.bottom-nav, .mobile-only, .sheet, .overlay { display: none; }

/* ---------------- hero (dashboard) ---------------- */
.hero { background: var(--grad); color: #fff; border-radius: 24px; padding: 24px; margin-bottom: 18px; position: relative; overflow: hidden; box-shadow: 0 12px 30px rgba(7,94,84,.25); }
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: rgba(255,255,255,.08); }
.hero::before { content: ""; position: absolute; right: 60px; bottom: -90px; width: 180px; height: 180px; border-radius: 50%; background: rgba(255,255,255,.06); }
.hero .hi { font-size: 14px; opacity: .85; }
.hero h2 { font-size: 24px; font-weight: 800; margin: 2px 0 14px; color: #fff; }
.hero .hero-stats { display: flex; gap: 10px; flex-wrap: wrap; position: relative; z-index: 1; }
.hero .hs { background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.18); border-radius: 16px; padding: 10px 14px; min-width: 120px; color: #fff; }
.hero .hs b { display: block; font-size: 20px; font-weight: 800; }
.hero .hs span { font-size: 12.5px; opacity: .9; }
.hero a.hs:hover { background: rgba(255,255,255,.22); }
.hero .hs.red { background: rgba(255,80,60,.35); border-color: rgba(255,255,255,.3); }

/* quick actions grid */
.qa { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin-bottom: 18px; }
.qa a { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 6px 12px; background: var(--card); border-radius: var(--r); color: var(--ink); font-size: 12.5px; font-weight: 600; text-align: center; box-shadow: var(--sh); line-height: 1.25; }
.qa a:active { transform: scale(.97); }
.tile-ic { width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; font-size: 24px; }
.c-green .tile-ic, .tile-ic.c-green { background: #e3f6ea; color: #0f9d58; }
.c-blue .tile-ic, .tile-ic.c-blue { background: #e8f0fe; color: #1a73e8; }
.c-orange .tile-ic, .tile-ic.c-orange { background: #fff1e6; color: #f76707; }
.c-teal .tile-ic, .tile-ic.c-teal { background: #e3fafc; color: #0c8599; }
.c-pink .tile-ic, .tile-ic.c-pink { background: #fff0f6; color: #d6336c; }
.c-red .tile-ic, .tile-ic.c-red { background: #fdecea; color: #d93025; }
.c-indigo .tile-ic, .tile-ic.c-indigo { background: #edf2ff; color: #4263eb; }
.c-amber .tile-ic, .tile-ic.c-amber { background: #fff9db; color: #e67700; }
.c-purple .tile-ic, .tile-ic.c-purple { background: #f3f0ff; color: #7048e8; }
.c-slate .tile-ic, .tile-ic.c-slate { background: #f1f3f5; color: #495057; }
[data-theme="dark"] .tile-ic { background: var(--card-2) !important; }

/* ---------------- cards ---------------- */
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--sh); padding: 20px; margin-bottom: 18px; border: 1px solid transparent; }
[data-theme="dark"] .card { border-color: var(--line); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.card-head .sub { font-size: 13px; color: var(--muted); }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--card); border-radius: var(--r); padding: 16px; box-shadow: var(--sh); display: block; color: var(--ink); position: relative; border: 1px solid transparent; }
[data-theme="dark"] .stat { border-color: var(--line); }
.stat .n { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.stat .l { font-size: 13px; color: var(--muted); font-weight: 500; }
.stat .ti.st-ic { position: absolute; right: 14px; top: 14px; font-size: 22px; color: var(--brand); opacity: .9; }
.stat.red { background: var(--bad-soft); } .stat.red .n, .stat.red .ti { color: var(--bad); }
.stat.green .n { color: var(--ok); }
a.stat:hover { box-shadow: var(--sh-lg); }

/* ---------------- forms ---------------- */
label { display: block; font-size: 13px; font-weight: 600; margin: 0 0 6px; color: var(--ink-2); }
input, select, textarea { width: 100%; padding: 11px 13px; border: 1.5px solid var(--line); border-radius: 12px; font: inherit; background: var(--card); color: var(--ink); transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--brand); vertical-align: -3px; margin-right: 6px; }
input[type=file] { padding: 9px; background: var(--card-2); border-style: dashed; }
input[readonly] { background: var(--card-2); }
.field { margin-bottom: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 16px; }
.span-all { grid-column: 1 / -1; }
.req::after { content: " *"; color: var(--bad); }
fieldset { border: 0; background: var(--card-2); border-radius: var(--r); padding: 16px 16px 2px; margin: 0 0 16px; }
legend { font-weight: 800; padding: 0; float: left; width: 100%; margin-bottom: 12px; color: var(--ink); font-size: 15px; }
legend + * { clear: both; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline > * { width: auto; }
.chip-radio { display: flex; gap: 8px; flex-wrap: wrap; }
.chip-radio label { display: inline-flex; align-items: center; gap: 4px; margin: 0; padding: 9px 16px; border-radius: 24px; border: 1.5px solid var(--line); background: var(--card); cursor: pointer; font-weight: 600; }
.chip-radio input { display: none; }
.chip-radio label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; margin-bottom: 12px; }

/* ---------------- buttons ---------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 11px 18px; border-radius: 12px; border: 1.5px solid transparent; background: var(--brand-dark); color: var(--brand-ink); font: inherit; font-weight: 700; cursor: pointer; white-space: nowrap; transition: transform .08s, filter .15s; text-decoration: none; }
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(.98); }
.btn .ti { font-size: 18px; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn-ghost { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn-soft { background: var(--brand-soft); color: var(--brand-dark); }
.btn-ok { background: var(--ok); color: #fff; }
.btn-bad { background: var(--bad); color: #fff; }
.btn-warn { background: var(--warn); color: #fff; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.sticky-actions { position: sticky; bottom: 0; background: var(--card); padding: 12px 0 0; margin-top: 8px; z-index: 5; }

/* ---------------- tables ---------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--r-sm); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; background: var(--card-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--card-2); }
tr.sla-red td { background: var(--bad-soft) !important; }
tr.sla-orange td { background: var(--warn-soft) !important; }
td.num, th.num { text-align: right; white-space: nowrap; }
tfoot td { font-weight: 800; background: var(--card-2); }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-word; font-weight: 500; }

/* ---------------- badges / alerts ---------------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; background: var(--card-2); color: var(--ink-2); white-space: nowrap; }
.b-ok { background: var(--ok-soft); color: var(--ok); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-bad { background: var(--bad-soft); color: var(--bad); }
.b-info { background: var(--info-soft); color: var(--info); }
.b-brand { background: var(--brand-soft); color: var(--brand-dark); }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: 14px; margin-bottom: 14px; font-size: 14px; font-weight: 500; }
.alert::before { font-family: "tabler-icons" !important; font-size: 20px; line-height: 1.1; }
.alert-success { background: var(--ok-soft); color: var(--ok); } .alert-success::before { content: "\ea67"; }
.alert-error { background: var(--bad-soft); color: var(--bad); } .alert-error::before { content: "\ea05"; }
.alert-info { background: var(--info-soft); color: var(--info); } .alert-info::before { content: "\eac5"; }
.alert-warn { background: var(--warn-soft); color: var(--warn); } .alert-warn::before { content: "\ea06"; }

/* ---------------- tabs / chips ---------------- */
.tabs { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 16px; padding-bottom: 4px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 8px 15px; border-radius: 22px; background: var(--card); color: var(--ink-2); white-space: nowrap; font-size: 14px; font-weight: 600; box-shadow: var(--sh); display: inline-flex; align-items: center; gap: 6px; }
.tabs a.active { background: var(--brand-dark); color: #fff; }
.tabs .count { font-weight: 800; background: rgba(0,0,0,.07); padding: 0 7px; border-radius: 10px; font-size: 12px; }
.tabs a.active .count { background: rgba(255,255,255,.22); }

/* ---------------- timeline ---------------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 24px; border-left: 2px solid var(--line); margin-left: 7px; }
.timeline li:last-child { border-left-color: transparent; }
.timeline li::before { content: ""; position: absolute; left: -8px; top: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--card); border: 3px solid var(--brand); }
.timeline .t-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.timeline .t-note { white-space: pre-wrap; color: var(--ink-2); font-size: 14px; }

/* progress tracker (file stages) */
.tracker { display: flex; gap: 0; overflow-x: auto; padding: 4px 0 6px; scrollbar-width: none; }
.tracker::-webkit-scrollbar { display: none; }
.tracker .st { flex: 1; min-width: 78px; text-align: center; position: relative; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.tracker .st::before { content: ""; position: absolute; top: 15px; left: -50%; right: 50%; height: 3px; background: var(--line); z-index: 0; }
.tracker .st:first-child::before { display: none; }
.tracker .dot { width: 32px; height: 32px; border-radius: 50%; background: var(--card-2); border: 2px solid var(--line); display: grid; place-items: center; margin: 0 auto 6px; position: relative; z-index: 1; font-size: 16px; }
.tracker .st.done { color: var(--ink-2); } .tracker .st.done .dot { background: var(--ok); border-color: var(--ok); color: #fff; } .tracker .st.done::before { background: var(--ok); }
.tracker .st.now { color: var(--brand-dark); } .tracker .st.now .dot { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); box-shadow: 0 0 0 4px var(--brand-soft); }
.tracker .st.late .dot { border-color: var(--bad); color: var(--bad); background: var(--bad-soft); box-shadow: 0 0 0 4px var(--bad-soft); }

/* ---------------- documents ---------------- */
.docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.doc { border-radius: 14px; padding: 8px; font-size: 12.5px; background: var(--card-2); color: var(--ink); display: block; }
.doc .thumb { height: 92px; border-radius: 10px; background: var(--card) center/cover no-repeat; display: grid; place-items: center; font-weight: 800; color: var(--bad); margin-bottom: 6px; font-size: 13px; }
.doc .thumb .ti { font-size: 34px; }
.doc b { display: block; font-size: 13px; }
.doc small { font-size: 11.5px; }

/* ---------------- action panel ---------------- */
.action-panel { border: 2px solid var(--brand) !important; }
.action-panel > .card-head { border-bottom: 1px dashed var(--line); padding-bottom: 12px; }
details.box { border-radius: 14px; padding: 0 16px; margin-bottom: 10px; background: var(--card-2); }
details.box > summary { cursor: pointer; padding: 13px 0; font-weight: 700; list-style: none; display: flex; align-items: center; gap: 8px; }
details.box > summary::-webkit-details-marker { display: none; }
details.box > summary::after { content: "\ea5f"; font-family: "tabler-icons" !important; margin-left: auto; color: var(--muted); transition: transform .2s; }
details.box[open] > summary::after { transform: rotate(180deg); }
details.box[open] > summary { margin-bottom: 8px; }
details.box[open] { padding-bottom: 8px; }

.progress { height: 8px; background: var(--line); border-radius: 8px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--ok); border-radius: 8px; }
.progress.brand > span { background: var(--brand); }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state .ti { font-size: 56px; color: var(--brand); }

/* list rows (used everywhere on mobile, and for compact lists on desktop) */
.list-cards { display: none; }
.rows .row-item { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); color: var(--ink); }
.rows .row-item:last-child { border-bottom: 0; }
.rows .row-item .grow { flex: 1; min-width: 0; }
.rows .row-item .t { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rows .row-item .s { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row { display: grid; grid-template-columns: 1fr 50px auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.bar-row:last-child { border-bottom: 0; }
.ann { background: linear-gradient(135deg, #fff9db, #fff3bf); border-radius: var(--r); padding: 14px 16px; margin-bottom: 12px; color: #5c3c00; }
[data-theme="dark"] .ann { background: #33290d; color: #ffe8a1; }
.ann b { display: block; }

/* ---------------- login ---------------- */
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; background: var(--grad); position: relative; overflow: hidden; }
.auth::before { content: ""; position: absolute; width: 420px; height: 420px; border-radius: 50%; background: rgba(255,255,255,.07); top: -140px; right: -120px; }
.auth::after { content: ""; position: absolute; width: 300px; height: 300px; border-radius: 50%; background: rgba(255,255,255,.06); bottom: -100px; left: -80px; }
.auth .auth-brand { color: #fff; text-align: center; margin-bottom: 20px; position: relative; z-index: 1; }
.auth .auth-brand .logo { width: 68px; height: 68px; border-radius: 22px; background: rgba(255,255,255,.18); display: grid; place-items: center; font-size: 36px; margin: 0 auto 10px; border: 1px solid rgba(255,255,255,.25); overflow: hidden; }
.auth .auth-brand .logo img { width: 100%; height: 100%; object-fit: cover; }
.auth .auth-brand h1 { font-size: 24px; margin: 0; font-weight: 800; }
.auth .auth-brand p { margin: 2px 0 0; opacity: .85; }
.auth .card { width: 100%; max-width: 410px; padding: 26px; border-radius: 26px; position: relative; z-index: 1; box-shadow: var(--sh-lg); }
.seg { display: flex; background: var(--card-2); border-radius: 14px; padding: 4px; margin-bottom: 18px; }
.seg a { flex: 1; text-align: center; padding: 9px; border-radius: 11px; color: var(--muted); font-weight: 700; }
.seg a.active { background: var(--card); color: var(--ink); box-shadow: var(--sh); }

/* scanner overlay */
#scanner-box { position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 200; display: none; flex-direction: column; align-items: center; justify-content: center; padding: 16px; gap: 12px; }
#scanner-box.show { display: flex; }
#scanner-view { width: 100%; max-width: 420px; background: #000; border-radius: 16px; overflow: hidden; }

/* item rows editor (purchase / invoice) */
.lines .line { display: grid; grid-template-columns: 2.4fr .8fr 1fr .7fr 1fr 40px; gap: 8px; align-items: end; padding: 10px; background: var(--card-2); border-radius: 14px; margin-bottom: 8px; }
.lines .line label { font-size: 11.5px; margin-bottom: 3px; }
.lines .line .amt { font-weight: 800; padding: 11px 0; text-align: right; }
.lines .line .serials { grid-column: 1 / -1; }
.totals { margin-left: auto; max-width: 340px; }
.totals div { display: flex; justify-content: space-between; padding: 5px 0; }
.totals .grand { font-size: 19px; font-weight: 800; border-top: 2px solid var(--line); padding-top: 8px; margin-top: 4px; }

/* attendance */
.punch { text-align: center; padding: 28px 16px; }
.punch .clock { font-size: 40px; font-weight: 800; letter-spacing: -.02em; }
.punch .ring { width: 150px; height: 150px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; margin: 18px auto; font-size: 18px; font-weight: 800; border: 0; cursor: pointer; box-shadow: 0 12px 30px rgba(0,128,105,.35); }
.punch .ring .ti { font-size: 40px; display: block; margin: 0 auto 4px; }
.punch .ring.out { background: linear-gradient(135deg, #c92a2a, #f03e3e); box-shadow: 0 12px 30px rgba(201,42,42,.35); }
.att-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.att-grid div { aspect-ratio: 1; border-radius: 10px; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--card-2); }
.att-P { background: var(--ok-soft) !important; color: var(--ok); } .att-A { background: var(--bad-soft) !important; color: var(--bad); }
.att-H { background: var(--warn-soft) !important; color: var(--warn); } .att-L { background: var(--info-soft) !important; color: var(--info); } .att-W { color: var(--muted); }

/* ---------------- desktop & tablet ---------------- */
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0,1fr)); } }

/* ---------------- phone: native app feel ---------------- */
@media (max-width: 760px) {
  body { font-size: 15px; background: var(--bg); }
  .sidebar { display: none; }
  .appbar { background: var(--grad) !important; color: #fff; border: 0; padding: 10px 8px 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); backdrop-filter: none; box-shadow: 0 2px 10px rgba(0,0,0,.12); }
  .appbar .icon-btn { color: #fff; }
  .appbar .icon-btn:hover { background: rgba(255,255,255,.12); }
  .appbar .titles { flex: 1; }
  .appbar h1 { font-size: 18px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .appbar .sub { color: rgba(255,255,255,.85); }
  .appbar .search { display: none; }
  .appbar .badge-dot { border-color: var(--brand-dark); }
  .mobile-only { display: grid; }
  body.home .appbar { box-shadow: none; }
  body.home .hero { border-radius: 0 0 28px 28px; margin: -14px -14px 16px; padding: 4px 18px 22px; box-shadow: none; }
  body.home .hero .hi, body.home .hero h2 { display: none; }
  .hero .hero-stats { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -18px; padding: 0 18px; }
  .hero .hero-stats::-webkit-scrollbar { display: none; }
  .hero .hs { min-width: 128px; flex-shrink: 0; }
  .content { padding: 14px 14px calc(96px + env(safe-area-inset-bottom)); }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat { padding: 14px; } .stat .n { font-size: 19px; }
  .qa { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .qa a { padding: 10px 2px; box-shadow: none; background: transparent; font-size: 11.5px; font-weight: 600; }
  .qa .tile-ic { width: 54px; height: 54px; border-radius: 18px; font-size: 26px; box-shadow: var(--sh); background-color: var(--card); }
  .qa-card { background: var(--card); border-radius: var(--r); padding: 8px; box-shadow: var(--sh); margin-bottom: 16px; }
  .qa-card .qa { margin: 0; }
  .card { padding: 16px; margin-bottom: 14px; }
  .kv { grid-template-columns: 112px 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .lines .line { grid-template-columns: 1fr 1fr 1fr; }
  .lines .line .item-sel { grid-column: 1 / -1; }
  /* tables become cards */
  .table-wrap.cards table, .table-wrap.cards thead { display: none; }
  .table-wrap.cards .list-cards { display: block; }
  .lc { display: block; background: var(--card); border-radius: 16px; padding: 14px; margin-bottom: 10px; color: var(--ink); box-shadow: var(--sh); border-left: 4px solid var(--brand); }
  .card .lc { box-shadow: none; background: var(--card-2); }
  .lc.sla-red { border-left-color: var(--bad); background: var(--bad-soft); }
  .lc.sla-orange { border-left-color: var(--warn); background: var(--warn-soft); }
  .lc .top { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; align-items: center; }
  .lc .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
  /* bottom tab bar with centre button */
  .bottom-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 50; background: var(--card); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 20px rgba(11,20,26,.08); border-radius: 22px 22px 0 0; }
  .bottom-nav a, .bottom-nav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 4px 2px; color: var(--muted); font-size: 11px; font-weight: 600; background: none; border: 0; font-family: inherit; position: relative; }
  .bottom-nav .ti { font-size: 24px; }
  .bottom-nav .active { color: var(--brand-dark); }
  [data-theme="dark"] .bottom-nav .active { color: var(--brand); }
  .bottom-nav .active .ti { background: var(--brand-soft); border-radius: 14px; padding: 2px 16px; }
  .bottom-nav .fab { flex: 0 0 72px; }
  .bottom-nav .fab span.f { width: 56px; height: 56px; border-radius: 20px; background: var(--grad); color: #fff; display: grid; place-items: center; margin-top: -26px; box-shadow: 0 8px 22px rgba(0,128,105,.45); border: 4px solid var(--bg); }
  .bottom-nav .fab .ti { font-size: 28px; }
  .bottom-nav .badge-dot { top: 0; right: 22%; border-color: var(--card); }
  /* sheets */
  .overlay { position: fixed; inset: 0; background: rgba(11,20,26,.45); z-index: 80; opacity: 0; pointer-events: none; transition: opacity .2s; display: block; }
  body.sheet-open .overlay { opacity: 1; pointer-events: auto; }
  .sheet { display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 90; background: var(--bg); border-radius: 26px 26px 0 0; max-height: 86vh; overflow-y: auto; transform: translateY(105%); visibility: hidden; transition: transform .25s cubic-bezier(.2,.8,.2,1), visibility 0s .25s; padding: 8px 14px calc(18px + env(safe-area-inset-bottom)); }
  .sheet.open { transform: none; visibility: visible; transition: transform .25s cubic-bezier(.2,.8,.2,1); }
  .sheet .grab { width: 44px; height: 5px; border-radius: 4px; background: var(--line); margin: 4px auto 12px; }
  .sheet h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 4px 8px; }
  .sheet .qa { grid-template-columns: repeat(4, 1fr); background: var(--card); border-radius: var(--r); padding: 6px; margin-bottom: 4px; }
  .sheet .me { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: var(--r); padding: 14px; }
  .sheet .me .who { flex: 1; }
  .actions .btn { flex: 1 1 auto; }
  .tracker .st { min-width: 70px; }
  .lines .line { grid-template-columns: repeat(2, 1fr); }
  .lines .line .amt { text-align: left; }
}

@media print {
  .sidebar, .appbar, .bottom-nav, .no-print, .imp-bar, .sheet, .overlay { display: none !important; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 0; padding: 0; }
  body { background: #fff; }
}
