/* Al Bustan ERP - design system. Light/dark aware, mobile friendly, print friendly. */
:root {
  --bg: #f2f6fc; --surface: #ffffff; --surface-2: #f7f9fd; --border: #dbe4f1; --text: #14213a; --muted: #587092;
  --brand: #1b56aa; --brand-2: #2f7bd6; --brand-ink: #ffffff; --accent: #4ba2ff;
  --green: #1f8a4c; --green-bg: #e4f4ea; --blue: #2563a8; --blue-bg: #e5eef9; --amber: #b7791f; --amber-bg: #fdf1d8;
  --red: #c0392b; --red-bg: #fbe6e3; --grey: #6b7a72; --grey-bg: #eceff0;
  --side: #0b2750; --side-text: #cfdcf2; --side-active: #1b56aa; --shadow: 0 1px 3px rgba(14,36,80,.08), 0 4px 14px rgba(14,36,80,.05);
  --radius: 10px; --font: "Noto Sans Bengali", "Nirmala UI", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a1222; --surface: #111b30; --surface-2: #16233d; --border: #24344f; --text: #e4ecf8; --muted: #93a6c4;
    --green-bg: #17382a; --blue-bg: #17283d; --amber-bg: #3a2f14; --red-bg: #3d1d19; --grey-bg: #1c2a44;
    --side: #060d1b; --shadow: 0 1px 3px rgba(0,0,0,.4);
  }
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.5; }
a { color: var(--brand-2); text-decoration: none; } a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; } h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .right { text-align: right; } .center { text-align: center; }
.nowrap { white-space: nowrap; } .mono { font-variant-numeric: tabular-nums; }
.grow { flex: 1; } .row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; } .gap { gap: 1rem; }
.mt { margin-top: 1rem; } .mb { margin-bottom: 1rem; } .hide { display: none !important; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { background: var(--side); color: var(--side-text); position: sticky; top: 0; height: 100vh; overflow-y: auto; padding-bottom: 2rem; }
.brand { display: flex; gap: .6rem; align-items: center; padding: 1rem 1rem .75rem; color: #fff; font-weight: 700; }
.brand img { width: 36px; height: 36px; border-radius: 8px; background: #fff; object-fit: contain; }
.brand .logo-fallback { width: 36px; height: 36px; border-radius: 8px; background: var(--accent); color: #0b2750; display: grid; place-items: center; font-weight: 800; }
.brand small { display: block; font-weight: 400; opacity: .7; font-size: .72rem; }
.side-link, .side-title { display: block; padding: .5rem 1rem; color: var(--side-text); }
.side-link:hover { background: rgba(255,255,255,.07); text-decoration: none; }
.side-link.active { background: var(--side-active); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.side-mod { margin-top: .6rem; padding: .35rem 1rem; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; opacity: .6; }
.side-grp { padding: .5rem 1rem .1rem; font-size: .78rem; opacity: .85; font-weight: 600; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: .75rem; padding: .6rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.topbar form.search { flex: 1; max-width: 420px; }
.topbar input[type=search] { width: 100%; }
.content { padding: 1.25rem; max-width: 1500px; width: 100%; margin: 0 auto; }
.menu-btn { display: none; background: none; border: 0; font-size: 1.4rem; color: var(--text); cursor: pointer; }
.pill { padding: .15rem .6rem; border: 1px solid var(--border); border-radius: 999px; font-size: .8rem; background: var(--surface-2); color: var(--text); }
.pill:hover { text-decoration: none; background: var(--grey-bg); }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 25% 0 0; z-index: 50; transform: translateX(-100%); transition: transform .2s; height: 100vh; }
  .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .menu-btn { display: block; }
  .content { padding: .8rem; }
}

/* ---------- components ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem; }
.card + .card { margin-top: 1rem; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .75rem; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { margin: 0; } .crumbs { font-size: .82rem; color: var(--muted); }
.grid { display: grid; gap: 1rem; } .g2 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: repeat(3, 1fr); } .g4 { grid-template-columns: repeat(4, 1fr); }
.g-auto { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
@media (max-width: 900px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }
.kpi { display: block; padding: .9rem 1rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); border-left: 5px solid var(--grey); color: var(--text); }
.kpi:hover { text-decoration: none; box-shadow: var(--shadow); }
.kpi .v { font-size: 1.45rem; font-weight: 700; } .kpi .l { color: var(--muted); font-size: .85rem; }
.kpi.green { border-left-color: var(--green); } .kpi.blue { border-left-color: var(--blue); } .kpi.amber { border-left-color: var(--amber); } .kpi.red { border-left-color: var(--red); }

.btn { display: inline-flex; align-items: center; gap: .35rem; padding: .45rem .9rem; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.btn:hover { background: var(--grey-bg); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); } .btn.primary:hover { background: var(--brand-2); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; } .btn.ghost { background: transparent; }
.btn.sm { padding: .2rem .55rem; font-size: .85rem; } .btn[disabled] { opacity: .5; cursor: not-allowed; }
.badge { display: inline-block; padding: .08rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--grey-bg); color: var(--grey); white-space: nowrap; }
.badge.green { background: var(--green-bg); color: var(--green); } .badge.blue { background: var(--blue-bg); color: var(--blue); }
.badge.amber { background: var(--amber-bg); color: var(--amber); } .badge.red { background: var(--red-bg); color: var(--red); }

.flash { padding: .65rem .9rem; border-radius: 8px; margin-bottom: .75rem; border: 1px solid var(--border); background: var(--surface); }
.flash.success { background: var(--green-bg); border-color: var(--green); } .flash.danger { background: var(--red-bg); border-color: var(--red); }
.flash.warning { background: var(--amber-bg); border-color: var(--amber); } .flash.info { background: var(--blue-bg); border-color: var(--blue); }

/* ---------- forms ---------- */
label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .2rem; }
input[type=text], input[type=search], input[type=password], input[type=email], input[type=number], input[type=date], input[type=tel], input[type=url],
select, textarea { width: 100%; padding: .45rem .6rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-2); outline-offset: 0; border-color: var(--brand-2); }
textarea { min-height: 80px; resize: vertical; } input[type=checkbox], input[type=radio] { width: auto; margin-right: .35rem; }
.field { margin-bottom: .8rem; } .field .hint { color: var(--muted); font-size: .78rem; } .req::after { content: " *"; color: var(--red); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .2rem 1rem; }
.form-actions { display: flex; gap: .6rem; margin-top: 1rem; flex-wrap: wrap; }
.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 1rem; } .filters > div { min-width: 150px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table.t { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.t th { background: var(--surface-2); text-align: left; padding: .55rem .7rem; border-bottom: 1px solid var(--border); font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; position: sticky; top: 0; white-space: nowrap; }
table.t td { padding: .5rem .7rem; border-bottom: 1px solid var(--border); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; } table.t tbody tr:hover { background: var(--surface-2); }
table.t th.r, table.t td.r { text-align: right; } table.t tfoot td { font-weight: 700; background: var(--surface-2); border-top: 2px solid var(--border); }
table.t th[data-sort] { cursor: pointer; } table.t th[data-sort]:hover { color: var(--text); }
.empty { padding: 2rem; text-align: center; color: var(--muted); }
.progress { background: var(--grey-bg); border-radius: 999px; height: 8px; overflow: hidden; } .progress > span { display: block; height: 100%; background: var(--green); }
.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; flex-wrap: wrap; }
.tabs a { padding: .5rem .9rem; border-radius: 8px 8px 0 0; color: var(--muted); } .tabs a.active { background: var(--surface); border: 1px solid var(--border); border-bottom-color: var(--surface); color: var(--text); font-weight: 600; margin-bottom: -1px; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; margin: 0; } dl.kv dt { color: var(--muted); } dl.kv dd { margin: 0; font-weight: 500; }
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: none; align-items: center; justify-content: center; z-index: 100; padding: 1rem; }
.modal-back.open { display: flex; } .modal { background: var(--surface); border-radius: var(--radius); padding: 1.2rem; width: min(640px, 100%); max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow); }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #0b2750, #2f7bd6); padding: 1rem; }
.login-card { background: var(--surface); border-radius: 14px; padding: 2rem; width: min(400px, 100%); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.login-card h1 { text-align: center; font-size: 1.3rem; } .login-card .sub { text-align: center; color: var(--muted); margin-bottom: 1.2rem; }

/* ---------- charts ---------- */
.chart { width: 100%; } .chart svg { width: 100%; height: auto; display: block; }
.bar-row { display: grid; grid-template-columns: 140px 1fr 110px; gap: .6rem; align-items: center; margin: .35rem 0; font-size: .88rem; }
.bar-row .bar { background: var(--grey-bg); border-radius: 6px; height: 14px; overflow: hidden; } .bar-row .bar > span { display: block; height: 100%; background: var(--brand-2); }

/* ---------- print ---------- */
.print-only { display: none; }
@media print {
  .sidebar, .topbar, .no-print, .btn, .filters, .tabs, .flash { display: none !important; }
  .shell { display: block; } body { background: #fff; color: #000; } .content { padding: 0; max-width: none; }
  .card, .table-wrap { border: 0; box-shadow: none; padding: 0; } .print-only { display: block; }
  table.t th { position: static; color: #000; background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { color: #000; }
}
.doc { max-width: 820px; margin: 0 auto; background: #fff; color: #111; padding: 1.6rem 2rem; border: 1px solid #ccc; }
.doc h1 { font-size: 1.3rem; text-align: center; margin: 0; } .doc .center-sub { text-align: center; color: #444; font-size: .85rem; }
.doc table { width: 100%; border-collapse: collapse; } .doc th, .doc td { border: 1px solid #999; padding: .35rem .5rem; font-size: .9rem; }
.doc .sign { display: flex; justify-content: space-between; margin-top: 3.5rem; } .doc .sign div { width: 30%; border-top: 1px solid #333; text-align: center; padding-top: .25rem; font-size: .85rem; }

/* ---------- polish: icon, hero, tiles, login ---------- */
.brand .brand-icon { width: 40px; height: 40px; border-radius: 10px; background: transparent; box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.login-wrap { background: radial-gradient(1200px 600px at 15% 10%, #2f7bd6 0%, transparent 60%), radial-gradient(900px 500px at 90% 90%, #4ba2ff 0%, transparent 55%), linear-gradient(135deg, #071a38, #1b56aa); }
.login-card { border-top: 5px solid var(--accent); }
.login-logo { display: block; width: 84px; height: 84px; margin: -.2rem auto .6rem; border-radius: 20px; box-shadow: 0 8px 24px rgba(14,52,120,.35); }
.demo-hint { background: var(--amber-bg); border: 1px dashed var(--accent); border-radius: 8px; padding: .55rem .75rem; margin-bottom: 1rem; font-size: .88rem; text-align: center; }
.demo-hint code { background: rgba(0,0,0,.07); padding: .05rem .4rem; border-radius: 5px; font-weight: 700; user-select: all; }
.hero { display: flex; align-items: center; gap: 1rem; padding: 1.1rem 1.3rem; margin-bottom: 1.1rem; border-radius: 14px; color: #fff;
  background: radial-gradient(500px 220px at 95% 0%, rgba(75,162,255,.55), transparent 70%), linear-gradient(120deg, #0d3470, #2f7bd6); box-shadow: var(--shadow); }
.hero img { width: 64px; height: 64px; border-radius: 16px; box-shadow: 0 4px 14px rgba(0,0,0,.3); }
.hero-t { font-size: 1.45rem; font-weight: 800; } .hero-s { opacity: .85; font-size: .9rem; }
.kpi { border: 1px solid var(--border); border-left-width: 5px; background: linear-gradient(180deg, var(--surface), var(--surface-2)); transition: transform .12s, box-shadow .12s; }
a.kpi:hover { transform: translateY(-2px); }
.kpi .v { font-size: 1.7rem; font-weight: 800; letter-spacing: -.01em; }
.kpi.green .v { color: var(--green); } .kpi.blue .v { color: var(--blue); } .kpi.amber .v { color: var(--amber); } .kpi.red .v { color: var(--red); }
.modcard { border-top: 4px solid var(--brand-2); transition: transform .12s, box-shadow .12s; }
.modcard:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(14,36,80,.14); }
.modcard.m2 { border-top-color: var(--amber); } .modcard.m3 { border-top-color: var(--blue); }
.modhead { display: flex; align-items: center; gap: .6rem; margin-bottom: .5rem; } .modhead h3 { margin: 0; font-size: 1.1rem; }
.modicon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--green-bg); font-size: 1.35rem; }
.modcard.m2 .modicon { background: var(--amber-bg); } .modcard.m3 .modicon { background: var(--blue-bg); }
.modcard a { display: block; padding: .18rem 0; }
.side-link { border-radius: 0 20px 20px 0; margin-right: .6rem; transition: background .12s, padding-left .12s; } .side-link:hover { padding-left: 1.25rem; }
.btn { transition: filter .12s, transform .12s; } .btn:hover { filter: brightness(1.07); }

/* ---------- sidebar icons ---------- */
.side-link::before { content: "•"; display: inline-block; width: 1.5em; opacity: .6; }
.side-link[href="/hr/me"]::before { content: "🙋"; opacity: 1; }
.side-link[href="/acc/cash-flow"]::before { content: "🌊"; opacity: 1; }
.side-link[href="/hr/attendance/monthly"]::before { content: "🗓️"; opacity: 1; }
.side-link[href="/hr/leave/balances"]::before { content: "🧳"; opacity: 1; }
.side-link[href="/acc/party-ledger"]::before { content: "👤"; opacity: 1; }
.side-link[href="/re/agents"]::before { content: "🤝"; opacity: 1; }
.side-link[href="/acc/"]::before { content: "📊"; opacity: 1; }
.side-link[href="/admin/company"]::before { content: "🏢"; opacity: 1; }
.side-link[href="/hr/"]::before { content: "📊"; opacity: 1; }
.side-link[href="/re/bookings"]::before { content: "📝"; opacity: 1; }
.side-link[href="/acc/vouchers/new/receipt"]::before { content: "💰"; opacity: 1; }
.side-link[href="/acc/budget"]::before { content: "🎚️"; opacity: 1; }
.side-link[href="/hr/recruitment"]::before { content: "🔎"; opacity: 1; }
.side-link[href="/acc/cost-centers"]::before { content: "🧩"; opacity: 1; }
.side-link[href="/hr/appraisals"]::before { content: "⭐"; opacity: 1; }
.side-link[href="/admin/backup"]::before { content: "💾"; opacity: 1; }
.side-link[href="/hr/adjustments"]::before { content: "🛠️"; opacity: 1; }
.side-link[href="/acc/project-pl"]::before { content: "🏗️"; opacity: 1; }
.side-link[href="/re/land"]::before { content: "🗺️"; opacity: 1; }
.side-link[href="/hr/settings"]::before { content: "⚙️"; opacity: 1; }
.side-link[href="/re/leads"]::before { content: "🎯"; opacity: 1; }
.side-link[href="/admin/users"]::before { content: "🔐"; opacity: 1; }
.side-link[href="/acc/bank-recon"]::before { content: "🔍"; opacity: 1; }
.side-link[href="/acc/balance-sheet"]::before { content: "🧮"; opacity: 1; }
.side-link[href="/re/cancellations"]::before { content: "↩️"; opacity: 1; }
.side-link[href="/re/customers"]::before { content: "👥"; opacity: 1; }
.side-link[href="/acc/approvals"]::before { content: "✅"; opacity: 1; }
.side-link[href="/acc/vouchers"]::before { content: "🧾"; opacity: 1; }
.side-link[href="/acc/ledger"]::before { content: "📒"; opacity: 1; }
.side-link[href="/hr/separations"]::before { content: "🚪"; opacity: 1; }
.side-link[href="/re/settings"]::before { content: "⚙️"; opacity: 1; }
.side-link[href="/re/units"]::before { content: "🏘️"; opacity: 1; }
.side-link[href="/re/reports"]::before { content: "📈"; opacity: 1; }
.side-link[href="/acc/assets"]::before { content: "🏢"; opacity: 1; }
.side-link[href="/acc/chart"]::before { content: "🌳"; opacity: 1; }
.side-link[href="/acc/vat-tax"]::before { content: "🏛️"; opacity: 1; }
.side-link[href="/re/dues"]::before { content: "⏰"; opacity: 1; }
.side-link[href="/acc/fiscal"]::before { content: "🗓️"; opacity: 1; }
.side-link[href="/acc/suppliers"]::before { content: "🚚"; opacity: 1; }
.side-link[href="/acc/cash-book"]::before { content: "🏦"; opacity: 1; }
.side-link[href="/re/payments"]::before { content: "💵"; opacity: 1; }
.side-link[href="/hr/bonus"]::before { content: "🎁"; opacity: 1; }
.side-link[href="/hr/employees"]::before { content: "👔"; opacity: 1; }
.side-link[href="/acc/day-book"]::before { content: "📅"; opacity: 1; }
.side-link[href="/hr/payroll"]::before { content: "💳"; opacity: 1; }
.side-link[href="/acc/vouchers/new/journal"]::before { content: "🔁"; opacity: 1; }
.side-link[href="/admin/audit"]::before { content: "🕵️"; opacity: 1; }
.side-link[href="/re/projects"]::before { content: "🏗️"; opacity: 1; }
.side-link[href="/hr/leave"]::before { content: "🌴"; opacity: 1; }
.side-link[href="/acc/income-statement"]::before { content: "📈"; opacity: 1; }
.side-link[href="/hr/reports"]::before { content: "📈"; opacity: 1; }
.side-link[href="/acc/bills"]::before { content: "📄"; opacity: 1; }
.side-link[href="/hr/loans"]::before { content: "🏧"; opacity: 1; }
.side-link[href="/acc/vouchers/new/payment"]::before { content: "💸"; opacity: 1; }
.side-link[href="/re/"]::before { content: "📊"; opacity: 1; }
.side-link[href="/hr/organization"]::before { content: "🏢"; opacity: 1; }
.side-link[href="/hr/attendance"]::before { content: "🕘"; opacity: 1; }
.side-link[href="/acc/trial-balance"]::before { content: "⚖️"; opacity: 1; }
.side-link[href="/hr/holidays"]::before { content: "🎉"; opacity: 1; }
.side-link { font-size: .93rem; padding: .42rem 1rem; }
.side-link.active { border-radius: 0 20px 20px 0; background: linear-gradient(90deg, #2f7bd6, #1b56aa); }
.side-mod { margin: 1rem .8rem .3rem; padding: .4rem .7rem; border-radius: 8px; background: rgba(255,255,255,.07); opacity: 1; color: #8fc8ff; font-weight: 700; letter-spacing: .08em; }
.sidebar::-webkit-scrollbar { width: 8px; } .sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 8px; }

/* ---------- tables & forms polish ---------- */
table.t th { background: linear-gradient(180deg, #eef4fc, #e0ebf9); color: #23446f; border-bottom: 2px solid #c3d4ee; }
table.t tbody tr:nth-child(even) td { background: rgba(27,86,170,.025); }
table.t tbody tr:hover td { background: rgba(75,162,255,.12); }
table.t td { padding: .6rem .75rem; }
.table-wrap { box-shadow: var(--shadow); border-radius: 12px; }
.card { border-radius: 12px; }
.btn { border-radius: 8px; font-weight: 600; }
.btn.primary { background: linear-gradient(135deg, #2f7bd6, #1b56aa); box-shadow: 0 2px 8px rgba(27,86,170,.3); }
input, select, textarea { border-radius: 8px; }
.topbar { box-shadow: 0 1px 0 var(--border), 0 6px 18px rgba(14,36,80,.04); backdrop-filter: blur(6px); }
.page-head h1 { font-size: 1.7rem; font-weight: 800; letter-spacing: -.01em; }
.content > * { animation: rise .3s ease both; } @keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- quick actions ---------- */
.qa { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; margin: 0 0 1.1rem; }
.qa a { display: flex; align-items: center; gap: .65rem; padding: .8rem 1rem; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); color: var(--text); font-weight: 600; box-shadow: var(--shadow); transition: transform .12s, box-shadow .12s, border-color .12s; }
.qa a:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 8px 22px rgba(14,36,80,.14); text-decoration: none; }
.qa .qi { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--green-bg); font-size: 1.15rem; }


/* ================= v2 polish ================= */
:root[data-theme="dark"] {
  --bg: #0a1222; --surface: #111b30; --surface-2: #16233d; --border: #24344f; --text: #e4ecf8; --muted: #93a6c4;
  --green-bg: #17382a; --blue-bg: #17283d; --amber-bg: #3a2f14; --red-bg: #3d1d19; --grey-bg: #1c2a44; --side: #060d1b; --shadow: 0 1px 3px rgba(0,0,0,.4);
}
:root[data-theme="dark"] table.t th { background: #16233d; color: #a9bfe0; border-bottom-color: #2a3d5c; }
:root[data-theme="dark"] .kpi { background: linear-gradient(180deg, #111b30, #0f1829); }
:root[data-theme="dark"] .topbar { background: rgba(22,33,27,.85); }
body { transition: background .2s, color .2s; }
.topbar { background: rgba(255,255,255,.82); }
.kbd-pill { cursor: pointer; font: inherit; font-size: .8rem; display: inline-flex; gap: .4rem; align-items: center; }
kbd { font: inherit; font-size: .7rem; padding: .05rem .35rem; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; background: var(--surface-2); color: var(--muted); }
#theme-toggle { cursor: pointer; font-size: 1rem; line-height: 1; }
.palette-back { position: fixed; inset: 0; z-index: 200; background: rgba(8,20,14,.55); backdrop-filter: blur(4px); display: grid; place-items: start center; padding-top: 12vh; }
.palette-back[hidden] { display: none; }
.palette { width: min(620px, 92vw); background: var(--surface); border-radius: 16px; box-shadow: 0 30px 80px rgba(0,0,0,.5); overflow: hidden; border: 1px solid var(--border); animation: rise .18s ease both; }
.palette input { width: 100%; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding: 1rem 1.2rem; font-size: 1.1rem; background: transparent; color: var(--text); outline: none; }
.palette-list { max-height: 50vh; overflow-y: auto; padding: .4rem; }
.pal-item { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem .8rem; border-radius: 10px; color: var(--text); }
.pal-item small { color: var(--muted); } .pal-item:hover { text-decoration: none; }
.pal-item.sel { background: linear-gradient(90deg, #2f7bd6, #1b56aa); color: #fff; } .pal-item.sel small { color: #cfdcf2; }
.pal-empty { padding: 1rem; color: var(--muted); } .palette-foot { padding: .5rem 1rem; font-size: .75rem; color: var(--muted); border-top: 1px solid var(--border); background: var(--surface-2); }
.an-grid { display: grid; gap: 1rem; grid-template-columns: repeat(3, 1fr); }
.an-grid .an-wide { grid-column: span 2; } .an-grid .card + .card { margin-top: 0; }
@media (max-width: 1100px) { .an-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px) { .an-grid { grid-template-columns: 1fr; } .an-grid .an-wide { grid-column: auto; } }
.legend { font-size: .8rem; color: var(--muted); display: inline-flex; gap: .4rem; align-items: center; } .legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-left: .5rem; }
.chart svg { width: 100%; height: auto; display: block; }
svg.trend path.draw { stroke-dasharray: 1200; stroke-dashoffset: 1200; animation: dash 1.2s ease forwards; } @keyframes dash { to { stroke-dashoffset: 0; } }
.hero { position: relative; overflow: hidden; } .hero::after { content: ""; position: absolute; right: -40px; top: -40px; width: 220px; height: 220px; border-radius: 50%; background: rgba(255,255,255,.07); }
.hero-t { font-size: 1.6rem; }
.bar-row { display: grid; grid-template-columns: 38% 1fr auto; gap: .6rem; align-items: center; margin: .5rem 0; }
.bar-row .bar { height: 12px; border-radius: 8px; } .bar-row .bar > span { border-radius: 8px; transition: width .8s ease; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ================= logo identity + mobile (v3) ================= */
:root { --brand: #1b56aa; --brand-2: #2f7bd6; --accent: #4ba2ff; --logo-red: #fc060d; --side: #0b2750; }
.brand { display: block; padding: .9rem .9rem .7rem; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-card { display: block; background: #fff; border-radius: 14px; padding: .65rem .8rem; box-shadow: 0 6px 18px rgba(0,0,0,.28); border-bottom: 3px solid var(--logo-red); }
.brand-card img { display: block; width: 100%; height: auto; max-height: 64px; object-fit: contain; background: transparent; border-radius: 0; }
.brand small { display: block; text-align: center; margin-top: .45rem; opacity: .65; font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 400; }
.side-close, .bottom-nav, .side-backdrop { display: none; }
.sidebar { background: linear-gradient(180deg, #0b2750 0%, #091d3d 100%); }
.side-link.active { background: linear-gradient(90deg, #2f7bd6, #1b56aa); box-shadow: inset 3px 0 0 var(--logo-red); }
.side-mod { color: #8fc8ff; }
.login-wrap { background: radial-gradient(1000px 520px at 12% 8%, rgba(75,162,255,.55) 0%, transparent 60%), radial-gradient(800px 480px at 92% 92%, rgba(252,6,13,.22) 0%, transparent 55%), linear-gradient(140deg, #071a38, #0d3470 60%, #1b56aa); }
.login-card { border-top: 0; border-bottom: 4px solid var(--logo-red); }
.login-logo { width: min(280px, 82%); height: auto; border-radius: 0; box-shadow: none; margin: 0 auto .8rem; display: block; }
.hero { background: radial-gradient(520px 240px at 96% 0%, rgba(75,162,255,.55), transparent 70%), linear-gradient(120deg, #0a2a5c, #1b56aa); }
.hero-logo { background: #fff; border-radius: 14px; padding: .5rem .8rem; box-shadow: 0 6px 18px rgba(0,0,0,.3); border-bottom: 3px solid var(--logo-red); flex: none; }
.hero img { width: auto; height: 54px; border-radius: 0; box-shadow: none; display: block; }
.btn.primary { background: linear-gradient(135deg, #2f7bd6, #1b56aa); box-shadow: 0 2px 8px rgba(27,86,170,.35); }
.qa a:hover { border-color: var(--logo-red); }
.kpi.green .v { color: var(--green); }
.modcard { border-top-color: var(--brand-2); } .modcard.m2 { border-top-color: var(--logo-red); } .modcard.m3 { border-top-color: #4ba2ff; }
.modicon { background: #e5eefb; } .modcard.m2 .modicon { background: #fde8e9; } .modcard.m3 .modicon { background: #e5f2ff; }
.qa .qi { background: #e5eefb; }

@media (max-width: 900px) {
  html { font-size: 16px; }
  .sidebar { inset: 0 auto 0 0; width: min(86vw, 330px); z-index: 120; box-shadow: none; }
  .sidebar.open { box-shadow: 0 0 60px rgba(0,0,0,.55); }
  .side-close { display: grid; place-items: center; position: absolute; top: .7rem; right: .7rem; width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(255,255,255,.14); color: #fff; font-size: 1rem; cursor: pointer; }
  .side-backdrop { display: block; position: fixed; inset: 0; background: rgba(5,14,32,.55); backdrop-filter: blur(2px); z-index: 110; opacity: 0; pointer-events: none; transition: opacity .2s; }
  .side-backdrop.on { opacity: 1; pointer-events: auto; }
  .brand { padding-right: 3.2rem; }
  .topbar { padding: .5rem .75rem; gap: .5rem; padding-top: calc(.5rem + env(safe-area-inset-top)); }
  .topbar form.search { max-width: none; } .topbar input[type=search] { font-size: 16px; }
  .kbd-pill, .topbar .small.muted { display: none; }
  .content { padding: .8rem .8rem calc(5.4rem + env(safe-area-inset-bottom)); }
  .page-head { flex-direction: column; align-items: stretch; gap: .5rem; } .page-head h1 { font-size: 1.35rem; }
  .hero { padding: .9rem; gap: .8rem; flex-wrap: wrap; } .hero img { height: 44px; } .hero-t { font-size: 1.2rem; } .hero-s { font-size: .8rem; }
  .qa { grid-template-columns: repeat(2, 1fr); gap: .5rem; } .qa a { padding: .6rem .7rem; font-size: .86rem; gap: .5rem; } .qa .qi { width: 30px; height: 30px; font-size: 1rem; }
  .g-auto { grid-template-columns: repeat(2, 1fr); gap: .6rem; } .kpi { padding: .7rem .8rem; } .kpi .v { font-size: 1.3rem; } .kpi .l { font-size: .78rem; }
  .form-grid { grid-template-columns: 1fr; }
  input, select, textarea { font-size: 16px; min-height: 44px; } .btn { min-height: 44px; padding-left: 1rem; padding-right: 1rem; }
  .form-actions .btn { flex: 1 1 140px; justify-content: center; }
  .filters > div { min-width: 0; flex: 1 1 140px; } .filters .btn { flex: 1 1 100%; }
  .table-wrap, .card { max-width: 100%; }
  table.t { font-size: .86rem; } table.t td, table.t th { padding: .5rem .55rem; }
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .card > table.t, .content > table.t { display: block; overflow-x: auto; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; white-space: nowrap; }
  .modal { max-height: 92vh; border-radius: 16px; } .modal-back { align-items: flex-end; padding: 0; } .modal { width: 100%; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
  .an-grid { grid-template-columns: 1fr; } .an-grid .an-wide { grid-column: auto; }
  .bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 90; background: rgba(255,255,255,.94); backdrop-filter: blur(10px); border-top: 1px solid var(--border);
    padding: .25rem .3rem calc(.25rem + env(safe-area-inset-bottom)); justify-content: space-around; box-shadow: 0 -6px 24px rgba(14,36,80,.12); }
  .bottom-nav a, .bottom-nav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .05rem; padding: .3rem .1rem; border: 0; background: none; color: var(--muted); font: inherit; font-size: .68rem; border-radius: 10px; cursor: pointer; text-decoration: none; }
  .bottom-nav i { font-style: normal; font-size: 1.3rem; line-height: 1.2; }
  .bottom-nav a.on, .bottom-nav a:active, .bottom-nav button:active { color: var(--brand); background: #e5eefb; }
}
@media (max-width: 420px) { .g-auto { gap: .5rem; } .kpi .v { font-size: 1.15rem; } .pill { font-size: .75rem; padding: .15rem .5rem; } }
:root[data-theme="dark"] .bottom-nav { background: rgba(17,27,48,.94); } :root[data-theme="dark"] .modicon, :root[data-theme="dark"] .qa .qi { background: #16233d; }
:root[data-theme="dark"] .brand-card, :root[data-theme="dark"] .login-card .login-logo { background: #fff; }

@media (max-width: 900px) {
  .topbar form.search { display: none; }
  .topbar .grow { flex: 1; }
  .topbar .pill { white-space: nowrap; }
  .topbar .pill[href$="/profile"] { font-size: 0; padding: .25rem .5rem; } .topbar .pill[href$="/profile"]::before { content: "👤"; font-size: 1.05rem; }
  .kbd-pill { display: inline-flex; font-size: 0; padding: .25rem .5rem; } .kbd-pill::before { content: "🔎"; font-size: 1.05rem; } .kbd-pill kbd { display: none; }
  .menu-btn { font-size: 1.6rem; padding: 0 .35rem; }
}

/* ---------- mobile guide page ---------- */
.qr-box { display: flex; gap: 1rem; align-items: center; padding: .6rem 0; flex-wrap: wrap; }
.qr-box + .qr-box { border-top: 1px dashed var(--border); }
.qr { width: 210px; max-width: 100%; height: auto; border: 6px solid #fff; border-radius: 12px; box-shadow: var(--shadow); background: #fff; }
.qr-url { font-size: 1.15rem; font-weight: 800; color: var(--brand); word-break: break-all; margin-bottom: .3rem; }
.steps { padding-left: 1.2rem; margin: .4rem 0; } .steps li { margin: .5rem 0; } .steps ul { margin-top: .3rem; }
.side-link[href="/mobile"]::before { content: "📱"; opacity: 1; }
