:root{--bg:#eef0f4;--ink:#17181c;--muted:#9aa0ad;--accent:#2f6bff;--shadow:0 6px 24px rgba(20,24,40,.08)}
*{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:transparent}
html,body{height:100%}
body{font-family:-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
  background:radial-gradient(120% 120% at 20% 0%,#20264a 0%,#0e1226 60%,#090c1a 100%);
  display:flex;align-items:center;justify-content:center;min-height:100vh;padding:18px;color:var(--ink)}
.phone{position:relative;width:100%;max-width:400px;height:min(860px,94vh);background:var(--bg);border-radius:44px;
  overflow:hidden;box-shadow:0 30px 80px rgba(0,0,0,.55),inset 0 0 0 8px #0c0e14;display:flex;flex-direction:column}
[dir="rtl"] .phone{direction:rtl}
.ic{display:block;flex:none}
.topbar{display:flex;align-items:center;justify-content:space-between;padding:22px 22px 6px}
.topbar h1{font-size:30px;font-weight:800;letter-spacing:-.5px}
.top-actions{display:flex;gap:10px}
.icon-btn{width:44px;height:44px;border-radius:50%;border:none;background:#fff;box-shadow:var(--shadow);cursor:pointer;color:var(--ink);display:flex;align-items:center;justify-content:center}
.icon-btn:active{transform:scale(.94)}
.selector-row{display:flex;align-items:center;justify-content:center;gap:10px;padding:10px 18px}
.nav-arrow{border:none;background:none;font-size:26px;color:#6b7280;cursor:pointer;padding:0 10px}
.pill{border:none;background:none;font-size:16px;font-weight:700;cursor:pointer;min-width:150px}
.hero{padding:2px 0}
.ring-box{position:relative;width:190px;height:190px;margin:0 auto}
.ring-box canvas{width:100%;height:100%}
.ring-center{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center}
.ring-center strong{font-size:34px;font-weight:800;letter-spacing:-1px}
.muted{color:var(--muted);font-size:13px}
.list{flex:1;overflow-y:auto;padding:10px 18px 130px;scrollbar-width:none}
.list::-webkit-scrollbar{display:none}
.h-card{display:flex;align-items:center;gap:12px;background:#fff;border-radius:20px;padding:12px 14px;margin-bottom:10px;box-shadow:var(--shadow)}
.h-ic{width:42px;height:42px;border-radius:15px;display:flex;align-items:center;justify-content:center;flex:none}
.h-mid{flex:1;min-width:0}
.h-name{font-weight:700;font-size:15px}
.h-sub{font-size:12px;color:var(--muted);margin-top:2px;display:flex;align-items:center;gap:4px}
.week{display:flex;gap:4px;margin-top:7px}
.week i{width:14px;height:6px;border-radius:99px;background:#e8eaf0}
.check{width:38px;height:38px;border-radius:50%;border:2px solid #dfe2ea;background:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center;color:#fff;flex:none}
.check.on{border-color:transparent}
.check:active{transform:scale(.92)}
.p-empty{text-align:center;color:var(--muted);padding:50px 0;font-size:14px}
.fab{position:absolute;bottom:26px;inset-inline-end:22px;width:60px;height:60px;border-radius:50%;border:none;background:var(--ink);color:#fff;
  box-shadow:0 10px 30px rgba(20,24,40,.3);cursor:pointer;z-index:5;display:flex;align-items:center;justify-content:center}
.fab:active{transform:scale(.93)}
.modal-overlay{position:absolute;inset:0;background:rgba(10,12,24,.45);display:none;align-items:flex-end;z-index:10}
.modal-overlay.open{display:flex}
.modal{background:#fff;width:100%;border-radius:28px 28px 0 0;padding:22px 20px 30px;max-height:88%;overflow-y:auto;scrollbar-width:none}
.modal h3{font-size:20px;font-weight:800;margin-bottom:16px}
.field{margin-bottom:14px}
.field label{display:block;font-size:12px;font-weight:700;color:var(--muted);margin-bottom:6px}
.field input{width:100%;border:1.5px solid #e8eaf0;border-radius:14px;padding:12px 14px;font-size:15px;font-family:inherit;background:#fafbfd;outline:none}
.field input:focus{border-color:var(--accent)}
.grid{display:grid;grid-template-columns:repeat(6,1fr);gap:8px}
.cell{aspect-ratio:1;border:1.5px solid #e8eaf0;border-radius:14px;background:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center}
.cell.sel{border-color:var(--accent);background:#f0f4ff}
.sw{aspect-ratio:1;border-radius:50%;border:3px solid #fff;box-shadow:0 0 0 1.5px #e8eaf0;cursor:pointer}
.sw.sel{box-shadow:0 0 0 2.5px var(--ink)}
.btn-primary{width:100%;border:none;background:var(--ink);color:#fff;padding:15px;border-radius:16px;font-size:16px;font-weight:700;cursor:pointer;margin-top:6px}
.btn-danger{width:100%;border:none;background:#fee2e2;color:#b91c1c;padding:13px;border-radius:16px;font-size:15px;font-weight:700;cursor:pointer;margin-top:10px}
.panel-overlay{position:absolute;inset:0;background:var(--bg);z-index:7;display:none;flex-direction:column}
.panel-overlay.open{display:flex}
.panel{display:flex;flex-direction:column;height:100%}
.panel-head{display:flex;align-items:center;justify-content:space-between;padding:22px 22px 10px}
.panel-head h2{font-size:24px;font-weight:800}
.panel-body{flex:1;overflow-y:auto;padding:6px 18px 40px;scrollbar-width:none}
.p-card{background:#fff;border-radius:20px;padding:16px;box-shadow:var(--shadow);margin-bottom:12px}
.stat-row{display:flex;gap:10px;margin-bottom:12px}
.stat{flex:1;background:linear-gradient(135deg,#1d2547,#31408a);color:#fff;border-radius:20px;padding:16px}
.stat b{display:block;font-size:26px;font-weight:800}
.stat span{font-size:12px;color:#aab3d6}
.heat{display:grid;grid-template-columns:repeat(7,1fr);gap:5px;margin-top:10px}
.heat i{aspect-ratio:1;border-radius:7px;background:#eef0f4}
.bar{height:8px;border-radius:99px;background:#eef0f4;overflow:hidden;margin-top:8px}
.bar i{display:block;height:100%;border-radius:99px}
.summary{display:flex;gap:10px;padding:8px 18px}
.sum-card{flex:1;background:#fff;border-radius:20px;padding:14px 16px;box-shadow:var(--shadow);display:flex;flex-direction:column;gap:4px}
.sum-card span{font-size:12px;color:var(--muted)}
.sum-card b{font-size:18px;font-weight:800;letter-spacing:-.3px}
.sum-card.dark{background:linear-gradient(135deg,#1d2547,#31408a);color:#fff}
.sum-card.dark span{color:#aab3d6}
.seg{display:flex;background:#e3e6ee;border-radius:14px;padding:4px;margin:6px 18px 4px}
.seg button{flex:1;border:none;background:none;padding:9px;border-radius:11px;font-weight:700;font-size:13px;cursor:pointer;color:#6b7280}
.seg button.on{background:#fff;color:var(--ink);box-shadow:var(--shadow)}
.list{padding-top:8px}
.inv-card{display:flex;align-items:center;gap:12px;background:#fff;border-radius:20px;padding:12px 14px;margin-bottom:10px;box-shadow:var(--shadow);cursor:pointer}
.inv-ic{width:42px;height:42px;border-radius:15px;background:#e8efff;display:flex;align-items:center;justify-content:center;flex:none}
.inv-mid{flex:1;min-width:0}
.inv-name{font-weight:700;font-size:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.inv-sub{font-size:12px;color:var(--muted);margin-top:3px}
.inv-end{text-align:end;display:flex;flex-direction:column;gap:5px;align-items:flex-end}
.inv-end b{font-size:14px}
.badge{font-size:11px;font-weight:700;padding:3px 10px;border-radius:99px;display:inline-block}
.badge.due{background:#fef3c7;color:#b45309}.badge.ok{background:#dcfce7;color:#15803d}.badge.late{background:#fee2e2;color:#b91c1c}
.item-row{display:grid;grid-template-columns:1fr 54px 78px;gap:6px;margin-bottom:8px}
.item-row input{padding:10px 10px}
.two{display:grid;grid-template-columns:1fr 1.5fr;gap:10px}
.btn-ghost{border:1.5px dashed #cfd4e0;background:#fff;border-radius:14px;padding:10px 14px;font-weight:700;font-size:14px;cursor:pointer;display:inline-flex;align-items:center;gap:6px;color:#4b5563}
.btn-ghost.wide{width:100%;justify-content:center;margin-top:10px;border-style:solid;padding:13px}
.btn-primary{display:flex;align-items:center;justify-content:center;gap:8px}
.btn-danger{display:flex;align-items:center;justify-content:center;gap:8px}
.err{color:#b91c1c;font-size:13px;font-weight:600;min-height:18px;margin-bottom:6px}
.ok{color:#15803d;font-size:13px;font-weight:600;margin-top:10px}
.paper{background:#fff;border-radius:20px;padding:18px;box-shadow:var(--shadow);margin-bottom:14px}
.paper-top{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:14px}
.paper-biz{font-size:20px;font-weight:800}
.p-muted{color:var(--muted);font-size:12px}
.paper-meta{display:grid;grid-template-columns:1.4fr 1fr 1fr;gap:8px;margin-bottom:14px}
.paper-meta div{display:flex;flex-direction:column;gap:3px}
.paper-meta b{font-size:13px}
.lines{width:100%;border-collapse:collapse;font-size:13px}
.lines th{text-align:start;color:var(--muted);font-weight:700;font-size:11px;padding:6px 0;border-bottom:1.5px solid #eef0f4}
.lines td{padding:9px 0;border-bottom:1px solid #f1f2f6}
.lines th:not(:first-child),.lines td:not(:first-child){text-align:end}
.tot{margin-top:12px;display:flex;flex-direction:column;gap:6px;font-size:13px}
.tot div{display:flex;justify-content:space-between}
.tot .grand{font-size:17px;font-weight:800;border-top:1.5px solid #eef0f4;padding-top:8px;margin-top:2px}
@media print{body{background:#fff}.phone{box-shadow:none;height:auto;border-radius:0;background:#fff}
  body.printing .topbar,body.printing .summary,body.printing .seg,body.printing .list,body.printing .fab,body.printing .panel-head,body.printing .btn-primary,body.printing .btn-ghost,body.printing .btn-danger{display:none!important}
  body.printing .panel-overlay{position:static;display:block}.paper{box-shadow:none}}
/* DARK */
html[data-theme=dark]{--bg:#0d1020;--ink:#eef0f6;--muted:#8a90a8;--shadow:0 6px 24px rgba(0,0,0,.35)}
html[data-theme=dark] .phone{background:var(--bg)}
html[data-theme=dark] .icon-btn{background:#1a1e33}
html[data-theme=dark] .nav-arrow{color:#9aa0b5}
html[data-theme=dark] .h-card{background:#1a1e33}
html[data-theme=dark] .week i{background:#2a2f4d}
html[data-theme=dark] .check{background:#1a1e33;border-color:#3a4064}
html[data-theme=dark] .modal{background:#1a1e33}
html[data-theme=dark] .field input{background:#14172a;border-color:#2a2f4d}
html[data-theme=dark] .cell{background:#1a1e33;border-color:#2a2f4d}
html[data-theme=dark] .cell.sel{background:#262d55}
html[data-theme=dark] .sw{border-color:#1a1e33}
html[data-theme=dark] .btn-danger{background:#4a1f26;color:#fca5a5}
html[data-theme=dark] .p-card{background:#1a1e33}
html[data-theme=dark] .heat i{background:#2a2f4d}
html[data-theme=dark] .bar{background:#2a2f4d}
html[data-theme=dark] .sum-card{background:#1a1e33}
html[data-theme=dark] .seg{background:#232846}
html[data-theme=dark] .seg button{color:#9aa0b5}
html[data-theme=dark] .seg button.on{background:#1a1e33}
html[data-theme=dark] .inv-card{background:#1a1e33}
html[data-theme=dark] .inv-ic{background:#262d55}
html[data-theme=dark] .badge.due{background:#4a3a12;color:#fcd34d}
html[data-theme=dark] .badge.late{background:#4a1f26;color:#fca5a5}
html[data-theme=dark] .btn-ghost{background:#1a1e33;border-color:#3a4064}
html[data-theme=dark] .err{color:#fca5a5}
html[data-theme=dark] .paper{background:#1a1e33}
html[data-theme=dark] .phone{background:#1a1e33}
html[data-theme=dark] .btn-primary,html[data-theme=dark] .fab,html[data-theme=dark] .chip.on,html[data-theme=dark] .round.big{background:#2f6bff;color:#fff}
html[data-theme=dark] .seg button.on{color:#eef0f6}
html[data-theme=dark] .field input,html[data-theme=dark] .field textarea,html[data-theme=dark] .field select{background:#14172a;border-color:#2a2f4d;color:#eef0f6}
html[data-theme=dark] .lang-sheet{background:#1a1e33}html[data-theme=dark] .lang-sheet h3,html[data-theme=dark] .lang-item{color:#eef0f6}html[data-theme=dark] .lang-item:hover{background:#232846}html[data-theme=dark] .lang-item.on{background:#262d55;color:#7ea4ff}
html[data-theme=dark] .n-card,html[data-theme=dark] .n-card b,html[data-theme=dark] .n-card p,html[data-theme=dark] .n-card small{color:#17181c}
html[data-theme=dark] .nav-arrow{color:#9aa0b5}
