* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--sans); color: var(--text); background: var(--bg); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
[x-cloak] { display: none !important; }
a { color: var(--brand); text-decoration: none; }
.mono { font-family: var(--mono); font-size: .92em; letter-spacing: -.01em; }
.dim { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.ico { width: 16px; height: 16px; flex: none; display: inline-block; vertical-align: -3px; }

/* Shell */
.shell { display: grid; grid-template-columns: 244px 1fr; min-height: 100vh; }
.sidebar { background: var(--ink); color: #B9C7CA; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sb-brand { display: flex; align-items: center; gap: 11px; padding: 20px 20px 18px; color: #fff; font-weight: 800; font-size: 15px; letter-spacing: -.01em; border-bottom: 1px solid rgba(255,255,255,.06); }
.sb-brand .mark { width: 30px; height: 30px; border-radius: 8px; background: var(--brand); display: grid; place-items: center; box-shadow: inset 0 0 0 1px rgba(255,255,255,.14); }
.sb-brand small { display: block; font-size: 10.5px; font-weight: 600; color: #6F878C; letter-spacing: .08em; text-transform: uppercase; margin-top: 1px; }
.sb-nav { padding: 14px 10px; flex: 1; overflow-y: auto; }
.sb-group { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #5D7479; padding: 14px 12px 6px; }
.sb-link { display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: 7px; color: #B9C7CA; font-weight: 600; font-size: 13.5px; cursor: pointer; transition: background .12s, color .12s; }
.sb-link:hover { background: rgba(255,255,255,.05); color: #fff; }
.sb-link.on { background: rgba(11,110,106,.32); color: #fff; box-shadow: inset 2px 0 0 #3CC2AA; }
.sb-link .count { margin-left: auto; font-family: var(--mono); font-size: 11px; background: var(--accent); color: var(--ink); padding: 1px 7px; border-radius: 10px; font-weight: 600; }
.sb-link .count.red { background: #E2593F; color: #fff; }
.sb-user { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.06); display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #1E3A44; color: #CFE3E0; display: grid; place-items: center; font-weight: 700; font-size: 12.5px; flex: none; }
.sb-user .who { min-width: 0; flex: 1; }
.sb-user .who b { display: block; color: #E7EEEF; font-size: 12.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-user .who span { font-size: 11px; color: #6F878C; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.sb-user button { background: none; border: 0; color: #7F9499; cursor: pointer; padding: 6px; border-radius: 6px; }
.sb-user button:hover { color: #fff; background: rgba(255,255,255,.06); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 64px; display: flex; align-items: center; gap: 16px; padding: 0 32px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.crumbs { font-size: 12.5px; color: var(--text-faint); font-weight: 600; }
.topbar h1 { font-size: 18px; letter-spacing: -.015em; margin: 0; color: var(--ink); font-weight: 800; }
.topbar .spacer { flex: 1; }
.today { font-family: var(--mono); font-size: 12px; color: var(--text-dim); padding: 6px 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; }
.content { padding: 28px 32px 48px; max-width: 1480px; width: 100%; }
.menu-btn { display: none; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: 600 13px var(--sans); cursor: pointer; transition: background .12s, border-color .12s; white-space: nowrap; }
.btn:hover { background: var(--surface-2); border-color: #B9BFB7; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-deep); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: #E9B5A8; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--muted-soft); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Page header */
.ph { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.ph h2 { margin: 0; font-size: 22px; letter-spacing: -.02em; color: var(--ink); font-weight: 800; }
.ph p { margin: 4px 0 0; color: var(--text-dim); font-size: 13.5px; }

/* Cards & stats */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-h h3 { margin: 0; font-size: 14px; font-weight: 800; color: var(--ink); letter-spacing: -.005em; }
.card-h .sub { font-size: 12px; color: var(--text-faint); font-weight: 600; }
.card-b { padding: 16px 18px; }
.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; position: relative; overflow: hidden; }
.stat .lbl { font-size: 11.5px; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: .07em; display: flex; align-items: center; gap: 7px; }
.stat .val { font-size: 27px; font-weight: 800; letter-spacing: -.03em; color: var(--ink); margin-top: 8px; font-variant-numeric: tabular-nums; }
.stat .hint { font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }
.stat.clickable { cursor: pointer; transition: border-color .12s, transform .12s; }
.stat.clickable:hover { border-color: var(--border-strong); }
.stat .bar { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; }
.stat.red .bar { background: var(--danger); } .stat.amber .bar { background: var(--accent); } .stat.green .bar { background: var(--ok); } .stat.teal .bar { background: var(--brand); }
.stat.red .val { color: var(--danger); }

/* Tables */
.tbl-wrap { overflow: auto; max-height: calc(100vh - 230px); min-height: 0; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.tbl-wrap::-webkit-scrollbar { width: 9px; height: 9px; }
.tbl-wrap::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 2px solid var(--surface); }
.card .card .tbl-wrap, .drawer .tbl-wrap { max-height: none; }
.tbl thead th, .tbl thead tr::before { position: sticky; top: 0; z-index: 3; box-shadow: inset 0 -1px 0 var(--border); }
.dash-list .tbl-wrap { max-height: 380px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 11px; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: .07em; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover td { background: #F7F9F7; }
.tbl .primary-cell b { display: block; color: var(--ink); font-weight: 700; }
.tbl .primary-cell span { font-size: 12px; color: var(--text-dim); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.g6 { grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); }
.stat .val.sm { font-size: 23px; }
.tbl tfoot td { padding: 11px 14px; background: var(--surface-2); border-top: 1px solid var(--border-strong); font-weight: 700; color: var(--ink); position: sticky; bottom: 0; }
.tbl tfoot tr::before { content: ''; display: table-cell; background: var(--surface-2); border-top: 1px solid var(--border-strong); position: sticky; bottom: 0; }
.bulk-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; background: var(--brand-soft); border-bottom: 1px solid #C3E0DC; }
.bulk-bar .input { height: 34px; }
.tbl input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }
.acr-head { display: flex; justify-content: space-between; gap: 16px; padding: 18px 22px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.acr-sec { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--brand-deep); padding: 16px 22px 8px; }
.acr-link { margin: 18px 22px 24px; padding: 14px; border: 1px dashed var(--border-strong); border-radius: 10px; }
.term-box { background: #FDF3F0; border: 1px solid #F0C9BE; border-radius: 10px; padding: 14px 16px; }
.term-h { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--danger); font-size: 13.5px; margin-bottom: 10px; }
.term-h span { margin-left: auto; font-weight: 600; font-size: 11.5px; color: var(--text-faint); }
.term-box .kv div { border-bottom: 1px solid #F3DCD5; }
/* Serial numbers on every list */
.tbl tbody { counter-reset: sr; }
.tbl thead tr::before { content: 'Sr.'; display: table-cell; font-size: 11px; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: .07em; padding: 10px 4px 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; width: 1%; vertical-align: middle; }
.tbl tbody tr { counter-increment: sr; }
.tbl tbody tr::before { content: counter(sr); display: table-cell; padding: 11px 4px 11px 16px; border-bottom: 1px solid var(--border); font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--text-faint); vertical-align: middle; width: 1%; white-space: nowrap; }
.tbl tbody tr:last-child::before { border-bottom: 0; }
.tbl tbody tr.click:hover::before { background: #F7F9F7; }
.tbl input.input { height: 32px; }
.special { font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #8A5300; background: var(--warn-soft); border-radius: 4px; padding: 1px 6px; margin-left: 6px; vertical-align: 1px; }
.switch { position: relative; width: 36px; height: 20px; border-radius: 10px; background: var(--border-strong); border: 0; cursor: pointer; transition: background .15s; padding: 0; flex: none; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch.on { background: var(--brand); }
.switch.on::after { transform: translateX(16px); }
.type-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.type-pick .plan-pick { padding: 14px; }
.type-pick .plan-pick p { margin: 4px 0 0; font-size: 12.5px; color: var(--text-dim); }
.empty { padding: 40px 20px; text-align: center; color: var(--text-faint); font-size: 13.5px; }
.empty b { display: block; color: var(--text-dim); font-size: 14px; margin-bottom: 4px; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 20px; white-space: nowrap; letter-spacing: .01em; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.nodot::before { display: none; }
.b-green { background: var(--ok-soft); color: var(--ok); }
.b-amber { background: var(--warn-soft); color: var(--warn); }
.b-red { background: var(--danger-soft); color: var(--danger); }
.b-blue { background: var(--info-soft); color: var(--info); }
.b-gray { background: var(--muted-soft); color: var(--text-dim); }
.b-teal { background: var(--brand-soft); color: var(--brand-deep); }
.cfg { font-family: var(--mono); font-size: 12px; color: var(--text); white-space: nowrap; }
.cfg i { font-style: normal; color: var(--text-faint); }

/* Filters */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.search { position: relative; flex: 1; min-width: 220px; max-width: 340px; }
.search .ico { position: absolute; left: 11px; top: 10px; color: var(--text-faint); }
.search input { padding-left: 34px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); padding: 0 14px; }
.tab { padding: 12px 14px; font-weight: 700; font-size: 13px; color: var(--text-dim); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; display: flex; gap: 7px; align-items: center; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--brand-deep); border-bottom-color: var(--brand); }
.tab .n { font-family: var(--mono); font-size: 11px; background: var(--muted-soft); padding: 0 6px; border-radius: 9px; color: var(--text-dim); }

/* Forms */
.input, select.input, textarea.input { width: 100%; height: 36px; padding: 0 11px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); font: 500 13.5px var(--sans); outline: none; transition: border-color .12s, box-shadow .12s; }
textarea.input { height: auto; min-height: 72px; padding: 9px 11px; resize: vertical; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235F6B74' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
.filters select.input { width: auto; min-width: 150px; }
.fgrid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px 14px; }
.f { grid-column: span 6; }
.f.s3 { grid-column: span 3; } .f.s4 { grid-column: span 4; } .f.s12 { grid-column: span 12; } .f.s8 { grid-column: span 8; }
.f label { display: block; font-size: 12px; font-weight: 700; color: var(--text-dim); margin-bottom: 5px; }
.f label .req { color: var(--danger); }
.fsec { grid-column: span 12; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: var(--brand-deep); padding-top: 8px; margin-top: 2px; border-top: 1px dashed var(--border); }
.fsec:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.help { font-size: 12px; color: var(--text-faint); margin-top: 4px; }
.callout { background: var(--brand-soft); border: 1px solid #C3E0DC; color: var(--brand-deep); border-radius: var(--radius); padding: 10px 12px; font-size: 13px; }
.callout.warn { background: var(--warn-soft); border-color: #F1D6A6; color: #7A4A00; }

/* Modal & drawer */
.overlay { position: fixed; inset: 0; background: rgba(14,26,36,.45); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; backdrop-filter: blur(2px); }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 720px; box-shadow: 0 24px 60px rgba(14,26,36,.25); }
.modal.sm { max-width: 460px; }
.modal-h { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-h h3 { margin: 0; font-size: 16px; font-weight: 800; color: var(--ink); }
.modal-b { padding: 20px 22px; }
.modal-f { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-2); border-radius: 0 0 14px 14px; align-items: center; }
.modal-f .err { color: var(--danger); font-size: 13px; margin-right: auto; font-weight: 600; }
.drawer-o { position: fixed; inset: 0; background: rgba(14,26,36,.35); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 100vw); background: var(--surface); z-index: 41; display: flex; flex-direction: column; box-shadow: -20px 0 50px rgba(14,26,36,.18); animation: slide .2s ease-out; }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-h { padding: 18px 22px; border-bottom: 1px solid var(--border); }
.drawer-b { flex: 1; overflow-y: auto; }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0; }
.kv div { padding: 10px 22px; border-bottom: 1px solid var(--border); }
.kv dt { font-size: 11px; font-weight: 700; color: var(--text-faint); text-transform: uppercase; letter-spacing: .07em; }
.kv dd { margin: 2px 0 0; font-weight: 600; color: var(--ink); word-break: break-word; }
.timeline { padding: 6px 22px 20px; }
.tl { position: relative; padding: 10px 0 10px 22px; border-left: 2px solid var(--border); margin-left: 5px; }
.tl::before { content: ''; position: absolute; left: -6px; top: 15px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand); }
.tl b { font-size: 13px; color: var(--ink); }
.tl p { margin: 2px 0 0; font-size: 12.5px; color: var(--text-dim); }
.tl small { font-size: 11.5px; color: var(--text-faint); font-family: var(--mono); }

/* Capacity */
.cap { margin-top: 10px; }
.cap-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-dim); margin-bottom: 3px; }
.cap-bar { height: 6px; border-radius: 3px; background: var(--muted-soft); overflow: hidden; }
.cap-bar i { display: block; height: 100%; background: var(--brand); border-radius: 3px; }
.cap-bar i.hi { background: var(--accent); } .cap-bar i.full { background: var(--danger); }
.dc-card { padding: 16px 18px; border-bottom: 1px solid var(--border); }
.dc-card:last-child { border-bottom: 0; }
.dc-top { display: flex; justify-content: space-between; align-items: baseline; }
.dc-top b { color: var(--ink); font-size: 14px; }
.dc-stats { display: flex; gap: 16px; margin-top: 6px; font-size: 12.5px; color: var(--text-dim); flex-wrap: wrap; }
.dc-stats b { color: var(--ink); font-family: var(--mono); font-weight: 600; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 10px; font-weight: 600; font-size: 13.5px; z-index: 90; box-shadow: 0 10px 30px rgba(0,0,0,.2); display: flex; gap: 9px; align-items: center; }
.toast.err { background: var(--danger); }
.loading { padding: 60px; text-align: center; color: var(--text-faint); }
.spin { width: 22px; height: 22px; border: 2.5px solid var(--border); border-top-color: var(--brand); border-radius: 50%; animation: sp .7s linear infinite; display: inline-block; }
@keyframes sp { to { transform: rotate(360deg); } }
.fade-in { animation: fi .28s ease-out both; }
@keyframes fi { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.noaccess { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.noaccess .card { max-width: 440px; padding: 32px; text-align: center; }
.noaccess h2 { margin: 12px 0 8px; color: var(--ink); }

/* Hero */
.hero { position: relative; overflow: hidden; border-radius: 18px; background: var(--ink); color: #DCE6E5; padding: 28px 30px 24px; margin-bottom: 22px; isolation: isolate; }
.hero::before { content: ''; position: absolute; inset: 0; z-index: -1; background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px); background-size: 28px 28px; mask-image: linear-gradient(100deg, transparent 15%, #000 70%); }
.hero::after { content: ''; position: absolute; z-index: -1; width: 560px; height: 560px; right: -140px; top: -300px; background: radial-gradient(circle, rgba(31,170,155,.55), transparent 62%); }
.hero .glow2 { position: absolute; z-index: -1; width: 380px; height: 380px; left: 30%; bottom: -260px; background: radial-gradient(circle, rgba(230,162,60,.18), transparent 65%); }
.hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; }
.hero-eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 11.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #7FD3C4; }
.hero-eyebrow a { color: #7FD3C4; cursor: pointer; }
.hero-eyebrow a:hover { color: #fff; }
.hero-eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: #3CC2AA; box-shadow: 0 0 0 4px rgba(60,194,170,.18); }
.hero h2 { margin: 8px 0 6px; font-size: 30px; line-height: 1.15; letter-spacing: -.03em; color: #fff; font-weight: 800; }
.hero p.sub { margin: 0; font-size: 14.5px; color: #9DB0B4; max-width: 640px; line-height: 1.55; }
.hero-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.hero-tag { font-size: 12px; font-weight: 600; color: #CFE0DE; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1); padding: 3px 10px; border-radius: 20px; }
.hero-tag.red { background: rgba(226,89,63,.18); border-color: rgba(226,89,63,.4); color: #FFB4A5; }
.hero-tag.green { background: rgba(60,194,170,.15); border-color: rgba(60,194,170,.35); color: #8FE6D4; }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.hero .btn { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.16); color: #fff; height: 38px; }
.hero .btn:hover { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.28); }
.hero .btn.primary { background: #fff; color: var(--ink); border-color: #fff; }
.hero .btn.primary:hover { background: #E8F3F1; }
.hero-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 24px; }
.hstat { background: rgba(255,255,255,.055); border: 1px solid rgba(255,255,255,.09); border-radius: 12px; padding: 13px 15px; backdrop-filter: blur(4px); transition: background .15s, border-color .15s; position: relative; }
.hstat.click { cursor: pointer; }
.hstat.click:hover { background: rgba(255,255,255,.09); border-color: rgba(255,255,255,.18); }
.hstat .l { font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: #8AA0A5; display: flex; align-items: center; gap: 7px; }
.hstat .l::before { content: ''; width: 7px; height: 7px; border-radius: 2px; background: #5D7479; }
.hstat.green .l::before { background: #3CC2AA; } .hstat.red .l::before { background: #E2593F; } .hstat.amber .l::before { background: var(--accent); } .hstat.blue .l::before { background: #6C9BE0; }
.hstat .v { font-size: 25px; font-weight: 800; letter-spacing: -.03em; color: #fff; margin-top: 6px; font-variant-numeric: tabular-nums; line-height: 1.15; }
.hstat.red .v { color: #FF9C88; }
.hstat .h { font-size: 12px; color: #8AA0A5; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Machine form page */
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.fcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: 16px; }
.fcard-h { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.fcard-h .step { width: 28px; height: 28px; border-radius: 8px; background: var(--brand-soft); color: var(--brand-deep); display: grid; place-items: center; font-family: var(--mono); font-weight: 600; font-size: 13px; flex: none; }
.fcard-h h3 { margin: 0; font-size: 15px; font-weight: 800; color: var(--ink); }
.fcard-h p { margin: 1px 0 0; font-size: 12.5px; color: var(--text-dim); }
.fcard-b { padding: 18px 20px; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.plan-pick { border: 1.5px solid var(--border); border-radius: 10px; padding: 12px 14px; cursor: pointer; transition: border-color .12s, background .12s, box-shadow .12s; background: var(--surface); position: relative; }
.plan-pick:hover { border-color: var(--border-strong); }
.plan-pick.on { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 3px rgba(11,110,106,.1); }
.plan-pick.on::after { content: '✓'; position: absolute; top: 10px; right: 12px; width: 18px; height: 18px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 11px; display: grid; place-items: center; font-weight: 800; }
.plan-pick b { display: block; color: var(--ink); font-size: 13.5px; padding-right: 20px; }
.plan-pick .cfg { display: block; margin-top: 4px; font-size: 11.5px; color: var(--text-dim); white-space: normal; }
.plan-pick .pr { margin-top: 8px; font-family: var(--mono); font-weight: 600; font-size: 13px; color: var(--brand-deep); }
.seg { display: inline-flex; background: var(--muted-soft); border-radius: 9px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; font: 700 12.5px var(--sans); color: var(--text-dim); padding: 7px 14px; border-radius: 7px; cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(14,26,36,.12); }
.summary { position: sticky; top: 84px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.summary-h { background: var(--ink); color: #fff; padding: 18px 20px; position: relative; overflow: hidden; }
.summary-h::after { content: ''; position: absolute; width: 240px; height: 240px; right: -90px; top: -140px; background: radial-gradient(circle, rgba(31,170,155,.5), transparent 65%); }
.summary-h small { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: #7FD3C4; font-weight: 700; }
.summary-h .code { font-family: var(--mono); font-size: 20px; font-weight: 600; margin-top: 4px; position: relative; }
.summary-h .who { color: #9DB0B4; font-size: 13px; margin-top: 2px; position: relative; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.chip { font-family: var(--mono); font-size: 12px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; color: var(--ink); }
.sum-row { display: flex; justify-content: space-between; gap: 10px; padding: 10px 20px; border-bottom: 1px solid var(--border); font-size: 13px; }
.sum-row span { color: var(--text-dim); }
.sum-row b { color: var(--ink); text-align: right; }
.sum-total { padding: 16px 20px; background: var(--surface-2); }
.sum-total .l { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-dim); }
.sum-total .v { font-size: 26px; font-weight: 800; letter-spacing: -.03em; color: var(--ink); font-variant-numeric: tabular-nums; }
.sum-total .h { font-size: 12.5px; color: var(--text-dim); }
.sum-actions { padding: 14px 20px 18px; display: grid; gap: 8px; }
.sum-actions .btn { justify-content: center; height: 42px; font-size: 14px; }
.form-err { background: var(--danger-soft); color: var(--danger); border: 1px solid #F0C0B4; padding: 10px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; }

@media (max-width: 1180px) {
  .form-layout { grid-template-columns: 1fr; }
  .summary { position: static; }
  .hero-stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 600px) { .hero { padding: 22px 18px; } .hero h2 { font-size: 24px; } .hero-stats { grid-template-columns: 1fr 1fr; gap: 8px; } .hstat .v { font-size: 20px; } }

@media (max-width: 1180px) { .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g-main { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: 260px; z-index: 60; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
  .g3, .g2 { grid-template-columns: 1fr; }
  .f, .f.s3, .f.s4, .f.s8 { grid-column: span 12; }
  .today { display: none; }
}

/* ---------- Protection plans ---------- */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.plan-card { padding: 16px 18px; display: flex; flex-direction: column; }
.plan-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.plan-name { font-weight: 800; color: var(--ink); font-size: 15px; line-height: 1.3; word-break: break-word; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chips .chip { font-size: 11px; padding: 3px 7px; }
.plan-stats { display: flex; gap: 14px; font-size: 12.5px; color: var(--text-dim); margin-top: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.plan-stats b { color: var(--ink); }
.plan-applied { max-height: 210px; overflow: auto; flex: 1; }
.applied-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px dashed var(--border); font-size: 12.5px; }
.applied-row a { font-weight: 700; cursor: pointer; white-space: nowrap; }
.applied-row .btn { margin-left: auto; height: 24px; padding: 0 5px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pick-list { max-height: 46vh; overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
.pick-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 13px; }
.pick-row:last-child { border-bottom: 0; }
.pick-row:hover { background: var(--surface-2); }
.pick-row.on { background: var(--brand-soft); }
.pick-row input { width: 16px; height: 16px; accent-color: var(--brand); flex: none; }
.badge.clickable { cursor: pointer; }
.badge.clickable:hover { filter: brightness(.95); text-decoration: underline; }
.bk-sum { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.bk-sum .lbl { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 4px; }
.bk-sum b { font-size: 13px; color: var(--ink); }

/* ---------- Users & access / sheet sync ---------- */
.perm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.steps { margin: 0; padding: 14px 18px 10px 38px; font-size: 13.5px; line-height: 1.6; }
.steps li { margin-bottom: 6px; }
.code-box { margin: 0; padding: 14px 18px; background: #0E1A24; color: #CFE3E0; font: 12px/1.55 var(--mono); max-height: 380px; overflow: auto; border-radius: 0 0 12px 12px; white-space: pre; }
@media (max-width: 860px) { .perm-grid { grid-template-columns: 1fr; } }

/* ---------- PWA / install ---------- */
.sb-install { margin: 8px 14px 10px; display: flex; align-items: center; justify-content: center; gap: 8px; height: 36px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.06); color: #E4EEEF; font: 700 12.5px var(--sans); cursor: pointer; }
.sb-install:hover { background: rgba(255,255,255,.12); }
.sb-backdrop { display: none; }
body { -webkit-tap-highlight-color: transparent; }
@media (display-mode: standalone) {
  .topbar { padding-top: env(safe-area-inset-top); height: calc(64px + env(safe-area-inset-top)); }
  .sidebar { padding-top: env(safe-area-inset-top); }
}

/* ---------- Mobile & tablet ---------- */
@media (max-width: 860px) {
  .sb-backdrop { display: block; position: fixed; inset: 0; background: rgba(14,26,36,.45); z-index: 55; }
  .sidebar { height: 100dvh; overflow-y: auto; box-shadow: 20px 0 50px rgba(14,26,36,.3); padding-bottom: env(safe-area-inset-bottom); }
  .topbar { height: 56px; gap: 10px; }
  .crumbs { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .content { padding-top: 16px; padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
  .hero-top { flex-direction: column; align-items: stretch; gap: 14px; }
  .hero-actions { width: 100%; }
  .hero-actions .btn { flex: 1 1 auto; justify-content: center; }
  .filters { padding: 10px; gap: 8px; }
  .filters .search { max-width: none; min-width: 100%; }
  .filters select.input { flex: 1 1 140px; min-width: 0; }
  .tbl-wrap { max-height: none; -webkit-overflow-scrolling: touch; }
  .tbl th, .tbl td { padding: 9px 10px; }
  .tbl td { white-space: nowrap; }
  .tbl td .faint, .tbl td small { white-space: normal; }
  .card-h { flex-wrap: wrap; gap: 6px; }
  .overlay { padding: 0; align-items: flex-end; }
  .modal, .modal.sm { max-width: none; border-radius: 16px 16px 0 0; max-height: 92dvh; display: flex; flex-direction: column; }
  .modal .modal-b { overflow-y: auto; }
  .modal-f { flex-wrap: wrap; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .modal-f .err { flex-basis: 100%; }
  .drawer { width: 100vw; }
  .drawer .tbl td { white-space: normal; }
  .bk-sum { grid-template-columns: 1fr 1fr; }
  .plan-grid { grid-template-columns: 1fr; }
  .seg { max-width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .seg button { white-space: nowrap; }
  .form-layout { gap: 14px; }
  input.input, select.input, textarea.input { font-size: 16px; } /* stops iOS zoom on focus */
}
@media (max-width: 480px) {
  .hero h2 { font-size: 21px; }
  .hero .sub { font-size: 13px; }
  .hstat { padding: 10px 11px; }
  .hstat .v { font-size: 18px; }
  .page-seg { display: flex; }
  .page-seg button { flex: 1; }
}