:root{
  --bg:#f4f6f8;
  --surface:#fff;
  --text:#17202a;
  --muted:#6b7280;
  --line:#e5e7eb;
  --accent:#123b5d;
  --accent2:#1e5f8a;
  --header1:#102d46;
  --header2:#1c5277;
}
*{box-sizing:border-box}
body{margin:0;background:var(--bg);font-family:Inter,Arial,sans-serif;color:var(--text)}
html:has(body.app-locked),
body.app-locked{
  overflow:hidden!important;
  width:100%!important;
  height:100%!important;
}
body.app-locked{
  min-height:100vh!important;
  min-height:100dvh!important;
  background:linear-gradient(135deg,#0f2940,#1c5277)!important;
}
body.app-locked > :not(#pinLock){
  visibility:hidden!important;
}
body.app-locked #pinLock,
body.app-locked #pinLock *{
  visibility:visible!important;
}
header{padding:28px clamp(20px,5vw,70px);background:linear-gradient(135deg,var(--header1),var(--header2));color:#fff}
.header-inner{display:flex;align-items:center;gap:22px;max-width:1200px;margin:auto}
.header-logo-wrap{width:110px;height:110px;border-radius:18px;background:rgba(255,255,255,.94);display:flex;align-items:center;justify-content:center;padding:10px;box-shadow:0 12px 30px rgba(0,0,0,.12);flex:0 0 auto}
.header-logo-wrap[hidden]{display:none!important}
.header-logo-wrap img{width:100%;height:100%;object-fit:contain;border-radius:10px}
header h1{margin:4px 0 4px;font-size:clamp(28px,4vw,42px)}
header p{margin:0;opacity:.85}
.eyebrow{font-size:12px;letter-spacing:2px;opacity:.7}
nav{display:flex;gap:8px;overflow:auto;padding:12px clamp(14px,4vw,60px);background:#fff;border-bottom:1px solid var(--line);position:sticky;top:0;z-index:10}
.tab{white-space:nowrap;border:0;background:transparent;padding:10px 14px;border-radius:10px;cursor:pointer;font-weight:700;color:#4b5563}
.tab.active{background:#e9f2f8;color:var(--accent)}
main{max-width:1200px;margin:auto;padding:24px}
.panel{display:none}
.panel.active{display:block}
.cards{display:grid;grid-template-columns:repeat(4,1fr);gap:14px;margin-bottom:20px}
.cards.compact{margin-top:18px}
.card{background:var(--surface);border:1px solid var(--line);border-radius:16px;padding:18px;box-shadow:0 8px 30px rgba(0,0,0,.035)}
.card small{display:block;color:var(--muted);margin-bottom:8px}
.card strong{font-size:25px}
.box{background:var(--surface);border:1px solid var(--line);border-radius:18px;padding:20px;margin-bottom:20px}
.box h2{margin-top:0}
.grid{display:grid;grid-template-columns:repeat(3,1fr);gap:12px}
input,select,button{font:inherit}
input,select{width:100%;padding:12px 13px;border:1px solid #cfd6dd;border-radius:10px;background:#fff}
input[type="color"]{padding:4px;height:46px;cursor:pointer}
button{border:0;border-radius:10px;padding:12px 16px;background:var(--accent);color:#fff;font-weight:700;cursor:pointer}
button.secondary{background:#e9eef2;color:#17364d}
button.danger{padding:7px 10px;background:#fee2e2;color:#991b1b}
.table-wrap{overflow:auto}
table{width:100%;border-collapse:collapse;min-width:720px}
th,td{text-align:left;padding:12px;border-bottom:1px solid var(--line);font-size:14px}
th{color:#52606d;background:#fafbfc}
.report-controls{display:grid;grid-template-columns:1fr 2fr auto auto;gap:10px}
.branding-grid{display:grid;grid-template-columns:2fr 1fr 1fr;gap:14px;align-items:end}
.branding-field{display:grid;gap:7px}
.branding-field label{font-weight:700;font-size:14px;color:#374151}
.branding-field small{color:var(--muted);font-size:12px}
.branding-actions{display:flex;flex-wrap:wrap;gap:10px;margin-top:16px}
#toast{position:fixed;right:20px;bottom:20px;background:#111827;color:#fff;padding:12px 16px;border-radius:10px;opacity:0;transform:translateY(10px);transition:.2s;pointer-events:none;z-index:1001}
#toast.show{opacity:1;transform:none}
.security-note{font-size:13px;color:var(--muted);margin:14px 0}
.pin-lock{
  position:fixed!important;
  top:0!important;
  right:0!important;
  bottom:0!important;
  left:0!important;
  inset:0!important;
  width:100vw!important;
  height:100vh!important;
  width:100dvw!important;
  height:100dvh!important;
  min-width:100vw!important;
  min-height:100vh!important;
  min-height:100dvh!important;
  margin:0!important;
  padding:20px!important;
  border:0!important;
  border-radius:0!important;
  z-index:2147483647!important;
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  background:linear-gradient(135deg,#0f2940,#1c5277)!important;
  overflow:auto!important;
  box-sizing:border-box!important;
}
.pin-lock.unlocked{
  display:none!important;
}
.pin-card{
  position:relative!important;
  width:min(100%,390px)!important;
  max-width:390px!important;
  margin:auto!important;
  flex:0 0 auto!important;
  background:#fff!important;
  border-radius:22px!important;
  padding:28px!important;
  box-shadow:0 24px 80px rgba(0,0,0,.25)!important;
  text-align:center!important;
}
.pin-card h1{margin:8px 0 6px;font-size:28px;color:#17364d}
.pin-card p{color:#6b7280}
.pin-badge{display:inline-block;font-size:11px;letter-spacing:1.5px;font-weight:800;color:#1e5f8a;background:#e9f2f8;padding:7px 10px;border-radius:999px}
#pinLoginForm{display:grid;gap:12px;margin-top:20px}
#pinInput{text-align:center;font-size:30px;letter-spacing:12px;font-weight:800;padding-left:24px}
.pin-error{min-height:20px;color:#b91c1c!important;font-weight:700}
.pin-card small{display:block;color:#8a94a0;margin-top:10px}
@media(max-width:800px){
  .cards{grid-template-columns:repeat(2,1fr)}
  .grid,.branding-grid{grid-template-columns:1fr}
  .report-controls{grid-template-columns:1fr}
  .header-inner{align-items:flex-start}
  .header-logo-wrap{width:82px;height:82px;border-radius:15px}
}
@media(max-width:520px){
  .header-inner{gap:14px}
  .header-logo-wrap{width:68px;height:68px;padding:7px}
  header{padding:22px 18px}
  header h1{font-size:25px}
}
