/* NFG Core — NFG group palette: black #000000, dark grey #A7A9AC, light grey #D9D9D9.
   Status colours (green, amber, blue, red) are semantic only. Type: Lato (the logo's face). */
:root{
  --ink:#000; --grey-dk:#a7a9ac; --grey-lt:#d9d9d9;
  --muted:#55585c; --line:#e3e3e3; --ground:#f4f4f4; --surface:#fff; --soft:#f7f7f7;
  --ok-bg:#e1f0e5; --ok:#1d5a30; --warn-bg:#fbedd5; --warn:#714200; --info-bg:#e2eaf2; --info:#1f4469; --err-bg:#fbe4e2; --err:#8f1d18;
  --rail:84px; --subw:248px;
}
*{box-sizing:border-box}
html,body{height:100%}
body{margin:0;background:var(--ground);color:var(--ink);font-family:Lato,"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:1.45}
button{font:inherit}
.mono{font-family:"IBM Plex Mono",ui-monospace,Menlo,Consolas,monospace;font-size:12.5px}
h1{margin:0;font-size:25px;line-height:1.2;font-weight:900}
h2{margin:0;font-size:16px;font-weight:900}
h3{margin:0;font-size:11px;letter-spacing:.12em;text-transform:uppercase;color:var(--muted);font-weight:900}
p{margin:0;max-width:85ch}
.sub-t{color:var(--muted)}
.row{display:flex;flex-wrap:wrap;gap:10px;align-items:center}
[hidden]{display:none!important}

/* sign-in */
.login{min-height:100%;display:flex;align-items:center;justify-content:center;padding:24px 16px;background:var(--ground)}
.login-card{background:var(--surface);border:1px solid var(--grey-lt);border-radius:12px;padding:32px 28px;width:100%;max-width:380px;display:flex;flex-direction:column;gap:14px}
.login-logo{width:190px;height:auto;margin-bottom:6px}
.btn.wide{width:100%;justify-content:center}
.linkbtn{all:unset;cursor:pointer;color:var(--muted);font-size:13px;text-decoration:underline;align-self:center}

/* frame */
.app{position:relative;display:flex;min-height:100vh;width:100%}
.rail{flex:0 0 var(--rail);background:#000;color:#fff;display:flex;flex-direction:column;padding:14px 6px 12px;gap:4px;z-index:5;position:sticky;top:0;height:100vh;overflow-y:auto}
.brand{display:flex;flex-direction:column;align-items:center;gap:6px;padding:4px 0 14px;border-bottom:1px solid #2a2a2a;margin-bottom:8px}
.brand img{width:34px;height:auto}
.brand .word{font-weight:900;font-size:13px;letter-spacing:.18em}
.mods{display:flex;flex-direction:column;gap:2px;flex:1 1 auto}
.mod{all:unset;box-sizing:border-box;cursor:pointer;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;padding:9px 2px 8px;border-radius:8px;color:var(--grey-dk);font-size:10.5px;font-weight:700;text-align:center;line-height:1.15;min-height:56px}
.mod svg{width:22px;height:22px;stroke:currentColor;fill:none;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.mod:hover{color:#fff;background:#1a1a1a}
.mod:focus-visible{outline:2px solid #fff;outline-offset:-2px}
.mod.on{color:#000;background:#fff}
.mod.later{opacity:.55}
.railsep{height:1px;background:#2a2a2a;margin:6px 8px}
.me{all:unset;box-sizing:border-box;cursor:pointer;display:flex;flex-direction:column;align-items:center;gap:4px;padding:8px 2px;border-radius:8px;color:var(--grey-lt);font-size:10px;text-align:center}
.me:hover{background:#1a1a1a}
.av{width:32px;height:32px;border-radius:50%;background:var(--grey-lt);color:#000;font-weight:900;font-size:12px;display:flex;align-items:center;justify-content:center}

.sub{background:var(--surface);border-right:1px solid var(--grey-lt);width:var(--subw);display:flex;flex-direction:column;z-index:4}
.sub.pinned{flex:0 0 var(--subw);position:sticky;top:0;height:100vh}
.sub.over{position:fixed;left:var(--rail);top:0;bottom:0;box-shadow:12px 0 32px rgba(0,0,0,.18)}
.subhd{display:flex;align-items:center;gap:6px;padding:16px 12px 12px 18px;border-bottom:1px solid #ececec}
.subhd h2{flex:1 1 auto}
.subbd{padding:10px 8px 20px;display:flex;flex-direction:column;gap:14px;overflow-y:auto}
.sec{display:flex;flex-direction:column;gap:1px}
.sech{font-size:10.5px;font-weight:900;letter-spacing:.12em;text-transform:uppercase;color:var(--muted);padding:4px 10px 5px}
.item{all:unset;box-sizing:border-box;cursor:pointer;display:flex;align-items:center;gap:8px;padding:8px 10px;border-radius:6px;font-size:14px;min-height:36px}
.item:hover{background:#f2f2f2}
.item:focus-visible{outline:2px solid #000}
.item.on{background:#000;color:#fff;font-weight:700}
.item .lk{margin-left:auto;display:inline-flex;color:#8a8c90}
.item .lk svg{width:14px;height:14px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.scrim{all:unset;position:fixed;inset:0 0 0 var(--rail);background:rgba(0,0,0,.28);z-index:3;cursor:pointer}

.col{flex:1 1 auto;min-width:0;display:flex;flex-direction:column;min-height:100vh}
.topbar{display:flex;align-items:center;gap:8px;padding:10px 18px;background:var(--surface);border-bottom:1px solid var(--grey-lt);flex-wrap:wrap;position:sticky;top:0;z-index:2}
.ib{all:unset;box-sizing:border-box;cursor:pointer;width:34px;height:34px;border-radius:6px;display:inline-flex;align-items:center;justify-content:center;color:var(--muted)}
.ib:hover{background:#f0f0f0;color:#000}
.ib:focus-visible{outline:2px solid #000}
.ib svg{width:18px;height:18px;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.ib.on{background:#000;color:#fff}
.crumbs{display:flex;align-items:center;gap:6px;font-size:13.5px;flex-wrap:wrap;min-width:0}
.crumbs .c1{all:unset;cursor:pointer;font-weight:700}
.crumbs .c1:hover{text-decoration:underline}
.crumbs .sep{color:var(--grey-dk)}
.crumbs .cur{font-weight:900}
.tools{margin-left:auto;display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.ctx{display:inline-flex;align-items:center;gap:6px;border:1px solid var(--grey-lt);border-radius:6px;padding:4px 8px;font-size:12.5px;min-height:34px}
.va{font:inherit;font-size:12.5px;font-weight:900;border:0;background:transparent;color:#000;cursor:pointer;max-width:240px}
.main{flex:1 1 auto;padding:22px 26px 40px;display:flex;flex-direction:column;gap:18px;min-width:0}
.status{display:flex;flex-wrap:wrap;gap:6px 16px;justify-content:space-between;padding:8px 18px;border-top:1px solid var(--grey-lt);background:var(--surface);font-size:12px;color:var(--muted)}
.loading{color:var(--muted);padding:20px 0}

/* content */
.grid3{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:12px}
.card{background:var(--surface);border:1px solid var(--grey-lt);border-radius:8px;padding:14px 16px;display:flex;flex-direction:column;gap:8px;min-width:0}
.kpi{font-size:26px;font-weight:900;font-variant-numeric:tabular-nums}
.kv{display:grid;grid-template-columns:minmax(120px,40%) 1fr;gap:4px 12px;font-size:13px;margin:0}
.kv dt{color:var(--muted)} .kv dd{margin:0;min-width:0;overflow-wrap:anywhere}
.tbl{overflow-x:auto;background:var(--surface);border:1px solid var(--grey-lt);border-radius:8px}
.t{min-width:var(--min,640px);font-size:13px}
.tr{display:grid;grid-template-columns:var(--cols);border-bottom:1px solid #ededed;align-items:start}
.tr:last-child{border-bottom:0}
.c{padding:8px 12px;min-width:0;overflow-wrap:anywhere}
.n{text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap}
.ctr{text-align:center}
.th{background:var(--soft);border-bottom:1px solid var(--grey-lt)}
.th .c{font-size:10.5px;letter-spacing:.09em;text-transform:uppercase;color:var(--muted);font-weight:900}
.tot{font-weight:900;border-top:2px solid #000;background:var(--soft)}
.segr{background:#000;color:#fff;font-weight:900}
.opr{background:#ececec;font-weight:700}
.full{grid-column:1/-1}
.btn{display:inline-flex;align-items:center;gap:6px;font-size:13px;font-weight:700;border:1px solid var(--grey-dk);background:#fff;color:#000;border-radius:6px;padding:8px 13px;cursor:pointer;min-height:36px}
.btn:hover{border-color:#000}
.btn.pri{background:#000;border-color:#000;color:#fff}
.btn.danger{background:var(--err);border-color:var(--err);color:#fff}
.btn.ghost{border-style:dashed;color:var(--muted)}
.btn.sm{min-height:28px;padding:3px 9px;font-size:12px}
.btn:disabled{opacity:.45;cursor:not-allowed;border-style:dashed}
.btn .bi{width:13px;height:13px;stroke:currentColor;fill:none;stroke-width:2}
.btn:focus-visible,.chip:focus-visible,.link:focus-visible{outline:2px solid #000;outline-offset:2px}
.link{all:unset;cursor:pointer;font-weight:700;text-decoration:underline;text-underline-offset:3px}
.chip{font:inherit;font-size:13px;border:1px solid var(--grey-dk);background:#fff;border-radius:999px;padding:6px 13px;cursor:pointer;color:#000;min-height:34px}
.chip.on{background:#000;color:#fff;border-color:#000}
.tag{display:inline-block;border-radius:4px;padding:1px 7px;font-size:11.5px;font-weight:700;white-space:nowrap}
.t-ok{background:var(--ok-bg);color:var(--ok)} .t-warn{background:var(--warn-bg);color:var(--warn)}
.t-info{background:var(--info-bg);color:var(--info)} .t-mute{background:#ececec;color:#3c3e41}
.t-err{background:var(--err-bg);color:var(--err)}
.t-reg{background:#ececec;color:#000;font-family:"IBM Plex Mono",ui-monospace,monospace}
.banner{border:1px solid #e3c68c;background:#fdf6e8;border-radius:8px;padding:10px 14px;font-size:13px;color:#573a00}
.banner.err{border-color:#e6aaa5;background:var(--err-bg);color:var(--err)}
.note{border:1px dashed var(--grey-dk);border-radius:8px;padding:10px 14px;font-size:13px;color:#3c3e41;background:#fafafa}
.yes{font-weight:900;text-align:center} .nope{color:var(--grey-dk);text-align:center}
.lock{max-width:560px;margin:40px auto;display:flex;flex-direction:column;align-items:center;gap:14px;text-align:center}
.ring{width:64px;height:64px;border-radius:50%;border:2px solid #000;display:flex;align-items:center;justify-content:center}
.ring svg{width:26px;height:26px;stroke:#000;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}

/* files */
.gal{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:10px}
.gal-i{all:unset;box-sizing:border-box;cursor:pointer;display:flex;flex-direction:column;background:var(--surface);border:1px solid var(--grey-lt);border-radius:8px;overflow:hidden}
.gal-i:hover,.gal-i:focus-visible{border-color:#000;outline:none}
.gal-i img,.gal-x{width:100%;aspect-ratio:4/3;object-fit:cover;background:var(--soft);display:flex;align-items:center;justify-content:center;font-weight:700;color:var(--muted)}
.gal-c{font-size:12px;padding:6px 8px;color:var(--muted)}
.gal-i.old{opacity:.55}
.ph-big{max-width:100%;max-height:60vh;object-fit:contain;border-radius:6px;background:var(--soft);align-self:center}
.drop input[type=file]{border-style:dashed;padding:18px 10px;cursor:pointer}
.drop.on input[type=file]{border-color:#000;background:var(--soft)}
.flist{display:flex;flex-direction:column;gap:6px;font-size:13px;border:1px solid var(--grey-lt);border-radius:6px;padding:8px 10px;max-height:180px;overflow:auto}

/* forms and dialogs */
.fld{display:flex;flex-direction:column;gap:4px;font-size:12.5px;font-weight:700;color:var(--muted)}
.fld input,.fld select,.fld textarea{font:inherit;font-size:14px;font-weight:400;color:#000;background:#fff;border:1px solid var(--grey-dk);border-radius:6px;padding:8px 10px;width:100%;min-width:0}
.fld input:focus,.fld select:focus,.fld textarea:focus{outline:2px solid #000;outline-offset:0}
.chk{display:flex;gap:8px;align-items:center;font-size:13.5px}
.dlg-wrap{position:fixed;inset:0;background:rgba(0,0,0,.35);display:flex;align-items:flex-start;justify-content:center;padding:60px 16px;z-index:50;overflow-y:auto}
.dlg{background:#fff;border-radius:10px;padding:22px;width:100%;max-width:520px;display:flex;flex-direction:column;gap:14px;box-shadow:0 20px 50px rgba(0,0,0,.25)}
.dlg-fields{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:12px}
.dlg-btns{justify-content:flex-end}
.dlg-err{color:var(--err);font-size:13px;font-weight:700}
#toast{position:fixed;bottom:22px;left:50%;transform:translateX(-50%) translateY(20px);background:#000;color:#fff;padding:10px 16px;border-radius:8px;font-size:13.5px;opacity:0;pointer-events:none;transition:opacity .2s,transform .2s;z-index:60}
#toast.show{opacity:1;transform:translateX(-50%) translateY(0)}
#toast.err{background:var(--err)}
@media (max-width:700px){
  .main{padding:16px}
  .sub.pinned{position:fixed;left:var(--rail);top:0;bottom:0}
}
@media (prefers-reduced-motion:reduce){*{transition:none!important}}
