
:root{
  --bg:#E9ECE8; --surface:#FFFFFF; --surface2:#F4F6F3; --ink:#22303A; --muted:#5E6B73; --line:#CDD3CF;
  --eu:#1D4E9E; --red:#C8312B; --redbg:#FBE6E4; --orange:#D9730D; --orangebg:#FDEBD8; --green:#2E7D4F; --greenbg:#E1F1E7;
  --wa:#1E8E4E;
  --font:"Barlow",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  --cond:"Barlow Condensed","Arial Narrow",system-ui,sans-serif;
  box-sizing:border-box; padding-top:env(safe-area-inset-top,0px); padding-bottom:env(safe-area-inset-bottom,0px);
}
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]){
    color-scheme:dark;
    --bg:#172027; --surface:#1F2A33; --surface2:#25313B; --ink:#E6EBEE; --muted:#9AA7AF; --line:#34424D;
    --eu:#5B8BE0; --red:#FF7A70; --redbg:#46231F; --orange:#F5A04A; --orangebg:#40291A; --green:#6BC793; --greenbg:#1C3A2A; --wa:#4CC27E;
  }
}
:root[data-theme="dark"]{
  color-scheme:dark;
  --bg:#172027; --surface:#1F2A33; --surface2:#25313B; --ink:#E6EBEE; --muted:#9AA7AF; --line:#34424D;
  --eu:#5B8BE0; --red:#FF7A70; --redbg:#46231F; --orange:#F5A04A; --orangebg:#40291A; --green:#6BC793; --greenbg:#1C3A2A; --wa:#4CC27E;
}
*,*::before,*::after{box-sizing:inherit}
html{scroll-padding-top:env(safe-area-inset-top,0px)}
body{margin:0;background:var(--bg);color:var(--ink);font-family:var(--font);font-size:16px;line-height:1.45}
.wrap{max-width:920px;margin:0 auto;padding:20px 16px 60px}
header.top{display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:space-between;gap:12px;margin-bottom:14px}
h1{font-family:var(--cond);font-weight:700;font-size:2.1rem;line-height:1;margin:0;cursor:pointer}
h2{font-family:var(--cond);font-weight:700;font-size:1.45rem;margin:0}
.sub{color:var(--muted);margin:4px 0 0;font-size:.95rem}
button,.btn{font:inherit;font-weight:600;border-radius:8px;border:1px solid var(--line);background:var(--surface);color:var(--ink);padding:9px 14px;cursor:pointer;min-height:42px;text-decoration:none;display:inline-flex;align-items:center;justify-content:center;gap:6px}
button.primary,.btn.primary{background:var(--eu);border-color:var(--eu);color:#fff}
button.ghost{background:transparent;border-color:transparent;color:var(--muted);padding:6px 8px;min-height:auto}
button.danger{color:var(--red)}
button:disabled,.btn[aria-disabled="true"]{opacity:.45;cursor:not-allowed;pointer-events:none}
.btn.wa{background:var(--wa);border-color:var(--wa);color:#fff}
button:focus-visible,input:focus-visible,select:focus-visible,a:focus-visible,.vrow:focus-visible,.tile:focus-visible{outline:3px solid var(--eu);outline-offset:2px}
.actions{display:flex;gap:8px;flex-wrap:wrap}
input,select,textarea{font:inherit;color:var(--ink);background:var(--surface);border:1px solid var(--line);border-radius:8px;padding:9px 11px;min-height:42px;width:100%}
textarea{min-height:80px;resize:vertical}
.searchbox{margin-bottom:16px}
.searchbox input{font-size:1.15rem;min-height:54px;padding-left:16px;border-width:2px}

/* Home tiles */
.tiles{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin-bottom:16px}
@media (max-width:640px){.tiles{grid-template-columns:repeat(2,minmax(0,1fr))}}
.tile{aspect-ratio:1/1;max-height:200px;width:100%;display:flex;flex-direction:column;align-items:flex-start;justify-content:space-between;text-align:left;padding:14px;border-radius:12px;border:0;color:#fff;font-weight:400;min-height:auto}
.tile b{font-family:var(--cond);font-size:clamp(2.4rem,9vw,3.6rem);line-height:.9;font-weight:700}
.tile .t{font-family:var(--cond);font-size:1.3rem;font-weight:700;line-height:1.05}
.tile .s{font-size:.85rem;opacity:.9;line-height:1.25;margin-top:2px}
.tile:hover{filter:brightness(1.06)}
.t-blue{background:var(--eu)} .t-ink{background:#3A4A55} .t-orange{background:var(--orange)} .t-red{background:var(--red)} .t-green{background:var(--green)} .t-grey{background:#7A868D}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]) .tile{color:#14191D} :root:not([data-theme="light"]) .t-ink{background:#9FB0BB;} :root:not([data-theme="light"]) .t-grey{background:#7F8C93}}
:root[data-theme="dark"] .tile{color:#14191D} :root[data-theme="dark"] .t-ink{background:#9FB0BB}

/* Squares */
.sq{flex:none;width:52px;height:52px;border-radius:7px;display:flex;flex-direction:column;align-items:center;justify-content:center;color:#fff;font-family:var(--cond);font-weight:700;font-size:1.35rem;line-height:1}
.sq small{font-size:.6rem;font-weight:600;letter-spacing:.02em;margin-top:2px}
.sq.red{background:var(--red)} .sq.orange{background:var(--orange)} .sq.green{background:var(--green)} .sq.none{background:var(--muted)}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]) .sq{color:#14191D}}
:root[data-theme="dark"] .sq{color:#14191D}

.notify{background:var(--surface);border-radius:12px;padding:14px;margin-bottom:16px;border-left:6px solid var(--red)}
.notify.ok{border-left-color:var(--green)}
.notify ul{margin:8px 0 12px;padding-left:18px}
.notify li{margin:2px 0}

.plate{display:inline-flex;align-items:stretch;background:#fff;color:#151A1E;border:2px solid #151A1E;border-radius:6px;overflow:hidden;font-family:var(--cond);font-weight:700;font-size:1.4rem;letter-spacing:.06em;line-height:1;text-transform:uppercase;flex:none}
.plate .eu{background:#1D4E9E;color:#fff;font-size:.62rem;letter-spacing:.04em;display:flex;flex-direction:column;justify-content:flex-end;align-items:center;padding:3px 4px 4px;min-width:20px}
.plate .eu i{display:block;width:10px;height:10px;border-radius:50%;border:1.5px dotted #FFD200;margin-bottom:auto;margin-top:1px}
.plate .num{padding:6px 10px 5px}
.plate.big{font-size:2rem}
.plate.sm{font-size:1.05rem}

.viewhead{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;margin-bottom:12px}
.vlist{display:flex;flex-direction:column;gap:8px}
.vrow{display:flex;align-items:center;gap:12px;background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:12px 14px;cursor:pointer;text-align:left;width:100%;font-weight:400}
.vrow:hover{border-color:var(--muted)}
.vinfo{flex:1;min-width:0}
.vinfo b{display:block}
.vinfo .hit{color:var(--ink);font-weight:500}
.vinfo span{color:var(--muted);font-size:.9rem;display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.dots{display:flex;gap:4px;flex-wrap:wrap;justify-content:flex-end;max-width:120px}
.dot{width:14px;height:14px;border-radius:3px;display:inline-block}
.dot.red{background:var(--red)}.dot.orange{background:var(--orange)}.dot.green{background:var(--green)}.dot.none{background:var(--line)}
@media (max-width:520px){.vrow{flex-wrap:wrap}.dots{max-width:none;width:100%;justify-content:flex-start}}

.vcard{background:var(--surface);border-radius:12px;padding:16px;margin-bottom:14px;border:1px solid var(--line)}
.vcard .head{display:flex;gap:14px;align-items:center;flex-wrap:wrap;margin-bottom:12px}
.facts{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:10px 16px;margin:0}
.facts dt{font-size:.85rem;color:var(--muted)}
.facts dd{margin:0;font-weight:600;word-break:break-all}
.notes{margin-top:12px;padding-top:12px;border-top:1px solid var(--line);white-space:pre-wrap}
.docs{list-style:none;margin:0;padding:0;background:var(--surface);border-radius:12px;border:1px solid var(--line)}
.doc{display:flex;gap:12px;padding:14px;border-bottom:1px solid var(--line);align-items:flex-start;flex-wrap:wrap}
.doc:last-child{border-bottom:0}
.doc .body{flex:1;min-width:180px}
.doc .k{font-weight:600}
.doc .d{color:var(--muted);font-size:.9rem}
.doc .btns{display:flex;gap:6px;flex-wrap:wrap;width:100%;padding-left:64px}
@media (max-width:480px){.doc .btns{padding-left:0}.doc .btns>*{flex:1 1 30%}}
.thumb{width:56px;height:42px;object-fit:cover;border-radius:5px;border:1px solid var(--line);display:block;margin-top:6px}
.sechead{display:flex;justify-content:space-between;align-items:center;margin:18px 0 8px;gap:8px}
.legend{display:flex;gap:14px;flex-wrap:wrap;color:var(--muted);font-size:.88rem;margin:8px 0 0}
.legend span{display:inline-flex;align-items:center;gap:5px}
.empty{background:var(--surface);border:2px dashed var(--line);border-radius:12px;padding:26px 18px;text-align:center}
.empty p{color:var(--muted);margin:6px 0 14px}
.status{color:var(--muted);font-size:.9rem;margin:10px 0}
.drow{display:flex;align-items:center;gap:12px;background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:10px 12px;cursor:pointer;text-align:left;width:100%;font-weight:400}
.drow .sq{width:46px;height:46px;font-size:1.2rem}
.drow:hover{border-color:var(--muted)}

dialog{border:0;border-radius:14px;padding:0;background:var(--surface);color:var(--ink);width:min(540px,calc(100% - 24px));max-height:calc(100% - 40px)}
dialog::backdrop{background:rgba(10,18,24,.5)}
.dlg{padding:18px}
.dlg h2{margin-bottom:4px}
.dlg .lead{color:var(--muted);margin:0 0 14px;font-size:.95rem}
.field{margin-bottom:12px}
.field label,.field .lbl{display:block;font-weight:600;font-size:.9rem;margin-bottom:4px}
.field small{color:var(--muted)}
.row2{display:grid;grid-template-columns:1fr 1fr;gap:10px}
@media (max-width:420px){.row2{grid-template-columns:1fr}}
.dlg .actions{justify-content:flex-end;margin-top:6px}
.pick{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.pick button{min-height:56px}
.picked{margin-top:8px;display:flex;align-items:center;gap:10px;font-size:.9rem;color:var(--muted)}
.picked img{width:64px;height:48px;object-fit:cover;border-radius:5px;border:1px solid var(--line)}
.vh{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
.toast{position:fixed;left:50%;transform:translateX(-50%);bottom:calc(16px + env(safe-area-inset-bottom,0px));background:var(--ink);color:var(--surface);padding:10px 16px;border-radius:8px;font-weight:600;opacity:0;pointer-events:none;transition:opacity .2s;max-width:calc(100% - 32px)}
.toast.on{opacity:1}
@media (prefers-reduced-motion:reduce){.toast{transition:none}}
.ro .w,.nodel .del,.noadm .adm{display:none!important}
.rolebadge{display:inline-block;font-size:.8rem;font-weight:600;background:var(--surface);border:1px solid var(--line);border-radius:999px;padding:1px 9px;margin-left:4px;vertical-align:1px}
.admsec{background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:16px;margin-bottom:14px}
.admsec h2{margin-bottom:4px}
.admsec>.sub{margin:0 0 12px}
.arow{display:flex;align-items:center;gap:10px;padding:10px 0;border-top:1px solid var(--line);width:100%;background:none;border-left:0;border-right:0;border-bottom:0;border-radius:0;text-align:left;font-weight:400;cursor:pointer;color:var(--ink)}
.arow:hover{background:var(--surface2)}
.arow .grow{flex:1;min-width:0}
.arow .em{display:block;color:var(--muted);font-size:.85rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tag{font-size:.8rem;font-weight:600;border-radius:999px;padding:2px 9px;background:var(--surface2);border:1px solid var(--line);white-space:nowrap}
.tag.off{color:var(--red)}
.uveh{display:flex;flex-wrap:wrap;gap:6px 14px;font-size:.92rem}
.uveh label{display:inline-flex;align-items:center;gap:5px;cursor:pointer;font-weight:500}
.uveh input{width:18px;height:18px;min-height:0}
.log{list-style:none;margin:0;padding:0;max-height:420px;overflow:auto}
.log li{padding:8px 0;border-top:1px solid var(--line);font-size:.92rem}
.log .lt{color:var(--muted);font-size:.85rem;display:block}
.hist{margin-top:6px;font-size:.88rem}
.hist summary{cursor:pointer;color:var(--eu);font-weight:600}
.hist ul{margin:6px 0 0;padding-left:18px;color:var(--muted)}
.btn.danger{color:var(--red)}
