:root { --bg:#f4f5f7; --card:#fff; --text:#1c2230; --muted:#687083; --line:#e1e4ea; --accent:#1f5fd1; --plus:#14773f; --minus:#c0262d; }
* { box-sizing: border-box; }
body { margin:0; background:var(--bg); color:var(--text); font:16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
[hidden] { display:none !important; }
a { color:var(--accent); }
h1 { font-size:1.4rem; margin:.4rem 0 1rem; }
h2 { font-size:1.15rem; margin:1.2rem 0 .6rem; }
h3 { font-size:1rem; margin:1rem 0 .5rem; }
main { max-width:1100px; margin:0 auto; padding:1rem; padding-bottom:calc(2rem + env(safe-area-inset-bottom)); }
main.narrow { max-width:420px; padding-top:2rem; }

.top { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:.25rem .75rem; background:var(--card); border-bottom:1px solid var(--line); padding:.5rem 1rem 0; }
.top .brand { font-weight:700; text-decoration:none; color:var(--text); font-size:1.15rem; }
.top nav { display:flex; width:100%; overflow-x:auto; }
.top nav a { padding:.75rem .8rem; text-decoration:none; color:var(--muted); white-space:nowrap; border-bottom:3px solid transparent; }
.top nav a.on { color:var(--accent); border-color:var(--accent); font-weight:600; }

.card { background:var(--card); border:1px solid var(--line); border-radius:10px; padding:1rem; margin-bottom:.75rem; }
summary { cursor:pointer; font-weight:600; min-height:28px; }
details[open] > summary { margin-bottom:.75rem; }

input, select, textarea { font:inherit; width:100%; min-height:44px; padding:.5rem .65rem; border:1px solid #c6ccd6; border-radius:8px; background:#fff; color:var(--text); }
input[type=checkbox], input[type=radio] { width:22px; height:22px; min-height:0; margin:0; }
label { display:block; font-size:.9rem; color:var(--muted); }
label.check { display:flex; align-items:center; gap:.6rem; min-height:44px; color:var(--text); }
.stack > * { margin-bottom:.75rem; }
.grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(170px, 1fr)); gap:.7rem; margin-bottom:.8rem; }
.grid .wide { grid-column:1 / -1; }
.grid.two { grid-template-columns:repeat(auto-fit, minmax(260px, 1fr)); }
.row { display:flex; flex-wrap:wrap; gap:.5rem; margin-bottom:0; }
.row input, .row select { flex:1 1 180px; width:auto; }

.btn { display:inline-flex; align-items:center; justify-content:center; min-height:44px; padding:.5rem 1rem; border:1px solid #c6ccd6; border-radius:8px; background:#fff; color:var(--text); font:inherit; text-decoration:none; cursor:pointer; }
.btn.primary { background:var(--accent); border-color:var(--accent); color:#fff; }
.btn.danger { color:var(--minus); border-color:#e8b9bb; }
.btn.ghost { background:transparent; }
.btn:disabled { opacity:.5; }
.chips { display:flex; flex-wrap:wrap; gap:.5rem; margin-bottom:.75rem; }

.segment { display:flex; border:0; padding:0; margin:0 0 .8rem; gap:.5rem; }
.segment label { flex:1; position:relative; }
.segment input { position:absolute; opacity:0; }
.segment span { display:flex; align-items:center; justify-content:center; min-height:48px; border:2px solid #c6ccd6; border-radius:8px; font-size:1rem; font-weight:600; cursor:pointer; }
.segment input:checked + span { border-color:var(--accent); background:#eaf1fd; color:var(--accent); }
.segment input:focus-visible + span { outline:2px solid var(--accent); outline-offset:2px; }

.alert { display:block; padding:.75rem 1rem; border-radius:8px; margin-bottom:.75rem; border:1px solid; text-decoration:none; }
.alert.ok { background:#e8f6ee; border-color:#a9dabd; color:var(--plus); }
.alert.err { background:#fdeced; border-color:#f0bcbf; color:var(--minus); }
.alert.warn { background:#fff6e0; border-color:#f0d58c; color:#7a5800; }

.stats { display:grid; grid-template-columns:repeat(auto-fit, minmax(150px, 1fr)); gap:.75rem; margin-bottom:.75rem; }
.stat { background:var(--card); border:1px solid var(--line); border-radius:10px; padding:.8rem 1rem; }
.stat span { display:block; color:var(--muted); font-size:.85rem; }
.stat b { font-size:1.35rem; font-variant-numeric:tabular-nums; }
.stat.big { grid-column:1 / -1; }
.stat.big b { font-size:2.1rem; }

.arti { color:var(--plus); }
.eksi { color:var(--minus); }
.muted { color:var(--muted); }
.small { font-size:.82rem; overflow-wrap:anywhere; }
.tag { display:inline-block; font-size:.72rem; padding:.05rem .45rem; border-radius:99px; background:#e9ecf2; color:var(--muted); }
.passive { opacity:.6; }

table.list { width:100%; border-collapse:collapse; background:var(--card); border:1px solid var(--line); }
.list th, .list td { text-align:left; padding:.55rem .6rem; border-bottom:1px solid var(--line); vertical-align:top; overflow-wrap:anywhere; }
.list th { font-size:.8rem; color:var(--muted); }
.list .num { text-align:right; white-space:nowrap; font-variant-numeric:tabular-nums; }
.list .actions { text-align:right; white-space:nowrap; }
.list .actions .btn { min-height:36px; padding:.25rem .6rem; font-size:.88rem; }
.list tr.total td { font-weight:700; background:#f0f3f9; }

.bulk { position:sticky; top:0; z-index:5; box-shadow:0 4px 14px rgba(0,0,0,.12); max-height:80vh; overflow:auto; }
.bulk b { display:block; margin-bottom:.6rem; }
.item { padding:.6rem; }
.line { display:flex; justify-content:space-between; align-items:center; gap:.75rem; padding:.6rem 0; border-bottom:1px solid var(--line); }
.pager { display:flex; justify-content:center; align-items:center; gap:.75rem; margin-top:1rem; }
.qr { display:block; margin:0 auto; }
.secret { display:inline-block; font-size:1rem; overflow-wrap:anywhere; user-select:all; }
.codes { display:grid; grid-template-columns:1fr 1fr; gap:.5rem; list-style:none; padding:0; font-size:1.05rem; }
pre { white-space:pre-wrap; overflow-wrap:anywhere; background:#f6f7f9; padding:.6rem; border-radius:6px; font-size:.8rem; }
.audit summary { font-weight:400; font-size:.92rem; }
.mobile-only { display:none; }

@media (max-width:760px) {
  main { padding:.75rem; }
  .grid { grid-template-columns:1fr 1fr; }
  .grid.two { grid-template-columns:1fr; }
  .mobile-only { display:flex; }
  table.list, .list tbody, .list tr, .list td { display:block; }
  table.list { background:transparent; border:0; }
  .list thead { display:none; }
  .list tr { background:var(--card); border:1px solid var(--line); border-radius:10px; margin-bottom:.6rem; padding:.4rem .2rem; }
  .list td, .list .num { display:flex; justify-content:space-between; gap:1rem; border:0; padding:.2rem .6rem; text-align:right; white-space:normal; }
  .list td::before { content:attr(data-label); color:var(--muted); font-size:.82rem; text-align:left; font-weight:400; }
  .list td.sel { justify-content:flex-start; padding:.4rem .6rem; }
  .list td.sel input { width:28px; height:28px; }
  .list .actions { justify-content:flex-end; gap:.5rem; padding-top:.4rem; }
  .list .actions .btn { min-height:44px; flex:1; }
  .line { flex-wrap:wrap; }
}
@media (max-width:400px) { .grid { grid-template-columns:1fr; } }
