:root{--orange:#f36a0b;--orange-dark:#d94d00;--ink:#14252e;--muted:#7d8290;--line:#e9e7e2;--green:#196848;--red:#ad3426;--bg:#fbf9f5;--radius:16px;--scans:#f36a0b;--moves:#3a6ea5;--removes:#b6463a}
*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--ink);font-family:Segoe UI,Arial,sans-serif;font-size:14px}
button,input,select{font:inherit}button{cursor:pointer;border:0}button:disabled{opacity:.55;cursor:wait}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible{outline:3px solid #f4a15e;outline-offset:2px}
input:focus,select:focus{outline:none;box-shadow:0 0 0 3px #f36a0b20;border-color:var(--orange)}
h1,h2,h3,p{margin:0}p{line-height:1.45;color:var(--muted)}h2{font-size:22px;letter-spacing:-.6px}h3{font-size:15px}
[hidden]{display:none!important}
label{display:block;font-size:12px;font-weight:600;margin-bottom:6px;color:#3d4a52}
input,select{width:100%;min-width:0;background:#fff;border:1px solid #d9d9d7;border-radius:10px;color:var(--ink);padding:10px 12px;font-size:14px}
.card{border:1px solid var(--line);border-radius:var(--radius);background:#fff;box-shadow:0 3px 12px #472c0f05;padding:18px}
.eyebrow{font-size:10px;letter-spacing:1px;color:var(--muted);font-weight:700}
.primary,.secondary{display:inline-flex;justify-content:center;align-items:center;gap:8px;border-radius:10px;min-height:42px;padding:9px 16px;font-size:14px;font-weight:700;white-space:nowrap}
.primary{background:linear-gradient(110deg,#f87918,#f36007);color:#fff}
.secondary{border:1px solid var(--orange);color:var(--orange-dark);background:#fff}
.text-button{background:none;color:var(--orange-dark);font-size:13px;font-weight:600;min-height:34px;padding:4px 8px;border-radius:8px}.text-button:hover{background:#fff0e4}.text-button.danger{color:var(--red)}
.feedback{border-radius:10px;padding:10px 12px;font-size:13px;line-height:1.45;overflow-wrap:anywhere}
.feedback.neutral{color:#946b45;background:#fff6eb}.feedback.success{background:#eaf7e7;color:var(--green)}.feedback.error{background:#ffebe5;color:var(--red)}
.count-badge{background:#ffeddb;color:var(--orange-dark);border:1px solid #ffe0c4;border-radius:10px;min-width:34px;padding:3px 9px;font-size:14px;font-weight:800;text-align:center}

/* Login */
.login-screen{width:min(100%,420px);margin:auto;padding:48px 16px 24px}
.login-brand{text-align:center;margin-bottom:20px}.login-brand img{width:96px;height:96px}.login-brand h1{font-size:32px;letter-spacing:-1px;margin-top:8px}.login-brand p{margin-top:2px}
.login-card{display:grid;gap:4px}.login-card h2{margin:4px 0 10px}.login-card label{margin-top:8px}.login-card .primary{margin:16px 0 10px;min-height:48px;font-size:16px}

/* Shell */
.topbar{position:sticky;top:0;z-index:5;display:flex;align-items:center;gap:20px;padding:10px 24px;background:#fffdfa;border-bottom:1px solid var(--line)}
.topbar-brand{display:flex;align-items:center;gap:10px}.topbar-brand img{width:38px;height:38px}.topbar-brand strong{display:block;font-size:17px;letter-spacing:-.4px}.topbar-brand span{display:block;font-size:11px;color:var(--muted)}
.tabs{display:flex;gap:4px;background:#f8f5ef;border:1px solid #e9e4da;border-radius:12px;padding:3px}
.tab{background:none;color:#6f7480;font-weight:700;font-size:14px;min-height:36px;padding:6px 16px;border-radius:9px}.tab.active{background:linear-gradient(110deg,#f97918,#f46108);color:#fff}
.topbar-user{margin-left:auto;display:flex;align-items:center;gap:4px;font-size:13px}.topbar-user span{font-weight:700;margin-right:6px}
.content{width:min(100%,1320px);margin:auto;padding:22px 24px 40px}
.section-head{display:flex;align-items:flex-end;justify-content:space-between;gap:12px;margin-bottom:14px}.section-head p{margin-top:3px}
.card-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:12px}
.muted-note{font-size:11px;color:var(--muted)}
.live-badge{font-size:12px;color:var(--muted);white-space:nowrap}.live-badge.ok::before{content:'●';color:#188349;margin-right:6px}.live-badge.bad{color:var(--red)}

/* Dashboard */
.kpis{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:12px;margin-bottom:14px}
.kpi{background:#fff;border:1px solid var(--line);border-radius:14px;padding:14px 16px}.kpi small{display:block;font-size:12px;color:var(--muted);font-weight:600}.kpi b{display:block;font-size:30px;letter-spacing:-1px;margin-top:4px;font-variant-numeric:tabular-nums}
.kpi.accent{background:linear-gradient(115deg,#f47819,#f2610a);border-color:transparent;color:#fff}.kpi.accent small{color:#ffe2c7}
.dash-grid{display:grid;grid-template-columns:minmax(0,3fr) minmax(0,2fr);gap:14px}
.chart-card{grid-column:1}
.legend{display:flex;align-items:center;gap:6px;font-size:11px;color:var(--muted);flex-wrap:wrap}.sw{display:inline-block;width:10px;height:10px;border-radius:3px;margin-left:6px}.sw.scans{background:var(--scans)}.sw.moves{background:var(--moves)}.sw.removes{background:var(--removes)}
.hour-chart svg{display:block;width:100%;height:auto}.hour-chart text{font-size:10px;fill:#8b8e9a}
.table-wrap{overflow:auto}
table{width:100%;border-collapse:collapse;font-size:13px}th{text-align:left;font-size:11px;font-weight:700;color:var(--muted);letter-spacing:.3px;padding:8px 10px;border-bottom:1px solid var(--line);white-space:nowrap;position:sticky;top:0;background:#fff}
td{padding:9px 10px;border-bottom:1px solid #f1efe9;vertical-align:top}tr:last-child td{border-bottom:0}td.num,th.num{text-align:right;font-variant-numeric:tabular-nums}td small{display:block;color:var(--muted);font-size:11px;margin-top:2px}
.tag{display:inline-block;border-radius:6px;padding:2px 7px;font-size:11px;font-weight:700;background:#f4f2e9;white-space:nowrap}.tag.scan,.tag.checked,.tag.login_ok{background:#eaf7e7;color:var(--green)}.tag.move,.tag.mode,.tag.user_update,.tag.user_create{background:#e8f0f9;color:var(--moves)}.tag.remove,.tag.unchecked,.tag.login_fail{background:#ffebe5;color:var(--red)}.tag.volume,.tag.password_change,.tag.logout{background:#fff0e2;color:var(--orange-dark)}
.empty{padding:20px 4px;text-align:center;color:var(--muted);font-size:13px}
.loads{display:grid;gap:12px}
.load-row{border:1px solid var(--line);border-radius:12px;padding:12px}.load-row header{display:flex;justify-content:space-between;gap:8px;align-items:baseline}.load-row strong{font-size:15px}.load-row header small{font-size:11px;color:var(--muted)}
.progress{margin-top:8px}.progress-label{display:flex;justify-content:space-between;font-size:12px;color:#55606a;margin-bottom:4px}.bar{height:8px;background:#f1eee7;border-radius:6px;overflow:hidden}.bar i{display:block;height:100%;background:linear-gradient(90deg,#f87918,#f36007);border-radius:6px}.load-row.complete .bar i{background:#2a9a5c}
.health-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-bottom:12px}.health-box{border:1px solid var(--line);border-radius:12px;padding:10px 12px}.health-box h4{margin:0 0 6px;font-size:12px;color:var(--muted)}.health-box dl{display:grid;grid-template-columns:auto auto;gap:3px 10px;margin:0;font-size:13px}.health-box dt{color:#55606a}.health-box dd{margin:0;text-align:right;font-weight:700;font-variant-numeric:tabular-nums}.health-box dd.bad{color:var(--red)}
.health-section{margin-top:12px}.health-section h4{font-size:12px;color:var(--muted);margin:0 0 6px}
.list-row{display:flex;justify-content:space-between;gap:10px;padding:6px 0;border-bottom:1px solid #f1efe9;font-size:13px}.list-row:last-child{border:0}.list-row small{color:var(--muted);font-size:11px}
.error-row{padding:7px 0;border-bottom:1px solid #f1efe9;font-size:12px}.error-row:last-child{border:0}.error-row b{color:var(--red)}.error-row p{font-size:12px;color:#55606a;overflow-wrap:anywhere}

/* Audit */
.audit-filters{display:grid;gap:14px;margin-bottom:12px}
.segmented{display:inline-flex;gap:4px;background:#f8f5ef;border:1px solid #e9e4da;border-radius:12px;padding:3px;width:fit-content;max-width:100%;flex-wrap:wrap}.segmented label{margin:0}.segmented input{position:absolute;opacity:0;width:1px;height:1px}.segmented span{display:block;padding:7px 14px;border-radius:9px;font-size:13px;font-weight:700;color:#6f7480;cursor:pointer}.segmented input:checked+span{background:#fff;color:var(--orange-dark);box-shadow:0 1px 4px #0000001a}.segmented input:focus-visible+span{outline:3px solid #f4a15e}
.filter-fields{display:flex;flex-wrap:wrap;gap:12px;align-items:flex-end}.filter-fields>div{width:160px}.filter-fields>.grow{flex:1;min-width:200px}.filter-fields>.filter-actions{display:flex;gap:8px;width:auto}
#audit-status{margin-bottom:12px}
.table-card{padding:6px 8px}.table-card .table-wrap{max-height:65vh}.more-button{display:flex;margin:12px auto 8px}

/* Users */
.users-grid{display:grid;grid-template-columns:minmax(0,340px) minmax(0,1fr);gap:14px;align-items:start}
.user-form{display:grid;gap:2px}.user-form h3{margin-bottom:8px}.user-form label{margin-top:8px}.user-form .primary{margin-top:16px}
#users-status{margin-bottom:6px}
.user-row{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px;padding:12px 0;border-bottom:1px solid var(--line)}.user-row:last-child{border:0}.user-row.inactive .user-info{opacity:.55}
.user-info strong{display:block;font-size:14px}.user-info small{display:block;color:var(--muted);font-size:12px;margin-top:2px}
.user-actions{display:flex;flex-wrap:wrap;align-items:center;gap:6px}.user-actions select{width:auto;font-size:12px;padding:6px 8px;border-radius:8px}

/* Dialogs */
dialog{width:min(440px,calc(100vw - 28px));border:1px solid var(--line);border-radius:18px;padding:22px;color:var(--ink);box-shadow:0 25px 100px #39210e40}dialog::backdrop{background:#16211bcc;backdrop-filter:blur(4px)}
dialog h2{margin:8px 0 6px;font-size:19px}dialog label{margin-top:10px}dialog .feedback{margin-top:14px}.dialog-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:20px}

@media(max-width:1100px){.kpis{grid-template-columns:repeat(3,minmax(0,1fr))}.dash-grid{grid-template-columns:minmax(0,1fr)}}
@media(max-width:760px){
  .topbar{flex-wrap:wrap;gap:10px;padding:10px 16px}.topbar-user{margin-left:auto}.tabs{order:3;width:100%}.tab{flex:1;padding:6px 8px}
  .content{padding:16px 16px 32px}.kpis{grid-template-columns:repeat(2,minmax(0,1fr))}.kpi b{font-size:24px}
  .health-grid{grid-template-columns:1fr}.users-grid{grid-template-columns:minmax(0,1fr)}
  .filter-fields>div{width:calc(50% - 6px)}.filter-fields>.grow,.filter-fields>.filter-actions{width:100%}.filter-actions>button{flex:1}
  .topbar-brand span{display:none}
}
