/* ==========================================================================
   Gym ERP — dark, gym-branded design system
   ========================================================================== */

:root{
  /* surfaces */
  --bg:#0a0e13;
  --bg-2:#0e141b;
  --surface:#131b24;
  --surface-2:#18222d;
  --surface-3:#1f2b38;
  --line:#243342;
  --line-soft:#1b2732;

  /* text */
  --text:#e8eef5;
  --text-2:#9fb0c2;
  --text-3:#6b8096;

  /* brand */
  --accent:#2ecc71;          /* athletic green */
  --accent-2:#25a95c;
  --accent-ink:#062712;
  --orange:#ff7a2f;
  --cyan:#35d0e8;
  --violet:#8b7bff;

  /* semantic */
  --ok:#3ddc8a;
  --ok-bg:rgba(61,220,138,.12);
  --bad:#ff5f6d;
  --bad-bg:rgba(255,95,109,.12);
  --warn:#ffbd3d;
  --warn-bg:rgba(255,189,61,.13);
  --info:#4ea8ff;
  --info-bg:rgba(78,168,255,.13);

  --radius:14px;
  --radius-sm:10px;
  --shadow:0 10px 30px rgba(0,0,0,.45);
  --shadow-sm:0 4px 14px rgba(0,0,0,.35);
  --sidebar-w:264px;
  --topbar-h:62px;
  --font:"Inter",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;

  /* sidebar always stays dark navy, independent of light/dark theme */
  --sidebar-bg:#0e131b;
  --sidebar-line:#232f3d;
  --sidebar-text:#c9d4de;
  --sidebar-text-2:#8ea0b3;
  --sidebar-text-3:#5f7185;
  --sidebar-hover:#182130;
}

/* ---- Light theme override (toggled via data-theme="light" on <html>) ---- */
:root[data-theme="light"]{
  --bg:#f3f5f8;
  --bg-2:#eceff3;
  --surface:#ffffff;
  --surface-2:#ffffff;
  --surface-3:#eef1f5;
  --line:#e3e7ec;
  --line-soft:#ecf0f4;

  --text:#141b24;
  --text-2:#576473;
  --text-3:#8996a6;

  --shadow:0 10px 26px rgba(30,40,60,.10);
  --shadow-sm:0 3px 10px rgba(30,40,60,.08);
}
:root[data-theme="light"] body{
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(46,204,113,.08), transparent 60%),
    var(--bg);
}

*,*::before,*::after{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  font-family:var(--font);
  background:var(--bg);
  color:var(--text);
  font-size:14.5px;
  line-height:1.55;
  -webkit-font-smoothing:antialiased;
  min-height:100vh;
}
a{color:var(--accent);text-decoration:none}
a:hover{color:var(--accent-2)}
img{max-width:100%}
h1,h2,h3,h4,h5{margin:0 0 .5rem;font-weight:700;letter-spacing:-.02em}
h1{font-size:1.5rem} h2{font-size:1.25rem} h3{font-size:1.05rem} h4{font-size:.95rem}
p{margin:0 0 .8rem}
small{font-size:.8rem}
code{background:var(--surface-3);padding:.1em .4em;border-radius:5px;font-size:.88em}
hr{border:0;border-top:1px solid var(--line);margin:1.2rem 0}
::selection{background:var(--accent);color:var(--accent-ink)}

/* scrollbars */
*::-webkit-scrollbar{width:10px;height:10px}
*::-webkit-scrollbar-track{background:transparent}
*::-webkit-scrollbar-thumb{background:var(--surface-3);border-radius:10px;border:2px solid var(--bg)}
*::-webkit-scrollbar-thumb:hover{background:#2b3a4a}

/* ============================ Layout ============================ */

.layout{display:flex;min-height:100vh}

.sidebar{
  width:var(--sidebar-w);flex:0 0 var(--sidebar-w);
  background:var(--sidebar-bg);border-right:1px solid var(--sidebar-line);
  position:fixed;inset:0 auto 0 0;z-index:60;
  display:flex;flex-direction:column;
  transition:transform .22s ease;
}
.sidebar .brand{
  height:var(--topbar-h);display:flex;align-items:center;gap:.65rem;
  padding:0 1rem;border-bottom:1px solid var(--sidebar-line);flex:0 0 auto;
}
.brand-logo{
  width:34px;height:34px;border-radius:9px;flex:0 0 auto;
  background:linear-gradient(135deg,var(--accent),var(--accent-2));
  color:var(--accent-ink);display:grid;place-items:center;font-weight:900;font-size:16px;
  overflow:hidden;
}
.brand-logo img{width:100%;height:100%;object-fit:cover}
.brand-txt{min-width:0}
.brand-txt b{display:block;font-size:.95rem;line-height:1.15;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--sidebar-text)}
.brand-txt span{display:block;font-size:.68rem;color:var(--sidebar-text-3);text-transform:uppercase;letter-spacing:.09em}

.nav{flex:1 1 auto;overflow-y:auto;padding:.75rem .6rem 2rem}
.nav-group{margin:.1rem 0 .55rem}
.nav-title{
  font-size:.63rem;text-transform:uppercase;letter-spacing:.14em;color:var(--sidebar-text-3);
  padding:.7rem .7rem .35rem;font-weight:700;
}
.nav a{
  display:flex;align-items:center;gap:.6rem;
  padding:.52rem .7rem;margin:1px 0;border-radius:9px;
  color:var(--sidebar-text-2);font-size:.875rem;font-weight:500;
  transition:background .14s,color .14s;
}
.nav a svg{width:17px;height:17px;flex:0 0 17px;opacity:.85}
.nav a:hover{background:var(--sidebar-hover);color:var(--sidebar-text)}
.nav a.on{background:var(--accent);color:var(--accent-ink);font-weight:650}
.nav a.on svg{opacity:1}
.nav a .pill{margin-left:auto;font-size:.66rem;background:var(--bad);color:#fff;border-radius:20px;padding:.05rem .4rem;font-weight:700}
.nav a.on .pill{background:var(--accent-ink);color:var(--accent)}

.main{flex:1 1 auto;min-width:0;margin-left:var(--sidebar-w);display:flex;flex-direction:column}

.topbar{
  height:var(--topbar-h);flex:0 0 auto;position:sticky;top:0;z-index:50;
  background:rgba(14,20,27,.88);backdrop-filter:blur(10px);
  border-bottom:1px solid var(--line);
  display:flex;align-items:center;gap:.8rem;padding:0 1.1rem;
}
.topbar .page-title{font-weight:700;font-size:1.02rem;letter-spacing:-.01em;margin:0}
.topbar .spacer{flex:1}
.burger{display:none;background:none;border:0;color:var(--text);padding:.35rem;cursor:pointer}

.content{padding:1.1rem 1.2rem 3rem;flex:1 1 auto}
.container-narrow{max-width:980px}

/* topbar status pills */
.topbar-pills{display:flex;align-items:center;gap:.5rem;flex-wrap:nowrap}
.pill{
  display:inline-flex;align-items:center;gap:.4rem;
  padding:.32rem .7rem;border-radius:40px;font-size:.76rem;font-weight:600;
  white-space:nowrap;line-height:1;
}
.pill-dark{background:var(--surface);border:1px solid var(--line);color:var(--text-2)}
.pill-dark svg{opacity:.8;flex:0 0 auto}
.pill-ok{background:var(--ok-bg);color:var(--ok);border:1px solid rgba(61,220,138,.25)}
.dot-live{width:7px;height:7px;border-radius:50%;background:var(--ok);flex:0 0 auto;
  box-shadow:0 0 0 0 rgba(61,220,138,.6);animation:dotpulse 1.8s infinite}
@keyframes dotpulse{
  0%{box-shadow:0 0 0 0 rgba(61,220,138,.55)}
  70%{box-shadow:0 0 0 6px rgba(61,220,138,0)}
  100%{box-shadow:0 0 0 0 rgba(61,220,138,0)}
}
#liveClock{font-variant-numeric:tabular-nums;min-width:5.6em;justify-content:center}
@media (max-width:900px){.topbar-pills{display:none}}

/* light/dark theme toggle switch */
.theme-switch{
  position:relative;width:48px;height:26px;border-radius:20px;flex:0 0 auto;
  background:var(--surface);border:1px solid var(--line);cursor:pointer;padding:0;
}
.theme-switch svg{position:absolute;top:50%;transform:translateY(-50%);z-index:2;pointer-events:none}
.theme-switch .ic-sun{left:6px;color:var(--text-3)}
.theme-switch .ic-moon{right:6px;color:var(--accent)}
.theme-switch-knob{
  position:absolute;top:2px;left:2px;width:20px;height:20px;border-radius:50%;
  background:var(--surface-3);border:1px solid var(--line);transition:transform .18s ease,background .18s ease;z-index:1;
}
:root[data-theme="light"] .theme-switch-knob{transform:translateX(22px);background:var(--accent);border-color:var(--accent)}
:root[data-theme="light"] .theme-switch .ic-sun{color:var(--accent-ink)}
:root[data-theme="light"] .theme-switch .ic-moon{color:var(--text-3)}

/* topbar user */
.userbox{position:relative}
.userbox>button{
  display:flex;align-items:center;gap:.55rem;background:var(--surface);border:1px solid var(--line);
  border-radius:40px;padding:.28rem .7rem .28rem .3rem;color:var(--text);cursor:pointer;font:inherit;font-size:.85rem;
}
.userbox>button:hover{border-color:var(--surface-3)}
.userbox .who{text-align:left;line-height:1.1}
.userbox .who b{display:block;font-size:.83rem;font-weight:650}
.userbox .who span{font-size:.68rem;color:var(--text-3);text-transform:capitalize}
.userbox .chev-down{opacity:.6;flex:0 0 auto;transition:transform .15s}
.userbox>button[aria-expanded="true"] .chev-down,.userbox:has(.dropmenu.open) .chev-down{transform:rotate(90deg)}
.dropmenu{
  position:absolute;right:0;top:calc(100% + 8px);min-width:200px;
  background:var(--surface-2);border:1px solid var(--line);border-radius:var(--radius-sm);
  box-shadow:var(--shadow);padding:.35rem;display:none;z-index:80;
}
.dropmenu.open{display:block}
.dropmenu-wide{min-width:220px}
.dropmenu-head{padding:.5rem .6rem .3rem}
.dropmenu-head b{display:block;font-size:.88rem;color:var(--text)}
.dropmenu-head span{font-size:.72rem;color:var(--text-3);text-transform:capitalize}
.dropmenu a,.dropmenu button{
  display:flex;align-items:center;gap:.55rem;width:100%;text-align:left;
  background:none;border:0;color:var(--text-2);font:inherit;font-size:.85rem;
  padding:.5rem .6rem;border-radius:8px;cursor:pointer;
}
.dropmenu a:hover,.dropmenu button:hover{background:var(--surface-3);color:var(--text)}
.dropmenu a.danger{color:var(--bad)}
.dropmenu a.danger:hover{background:var(--bad-bg);color:var(--bad)}
.dropmenu .sep{height:1px;background:var(--line);margin:.3rem 0}

/* ============================ Cards ============================ */

.card{
  background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);
  box-shadow:var(--shadow-sm);margin-bottom:1.1rem;overflow:hidden;
}
.card-head{
  display:flex;align-items:center;gap:.7rem;flex-wrap:wrap;
  padding:.85rem 1rem;border-bottom:1px solid var(--line-soft);
}
.card-head h3{margin:0;font-size:.98rem}
.card-head .sub{font-size:.78rem;color:var(--text-3);margin-top:.1rem}
.card-head .spacer{flex:1}
.card-body{padding:1rem}
.card-body.tight{padding:.65rem}
.card-foot{padding:.75rem 1rem;border-top:1px solid var(--line-soft);background:var(--bg-2)}

.grid{display:grid;gap:1.1rem}
.g2{grid-template-columns:repeat(2,minmax(0,1fr))}
.g3{grid-template-columns:repeat(3,minmax(0,1fr))}
.g4{grid-template-columns:repeat(4,minmax(0,1fr))}
.g-2-1{grid-template-columns:2fr 1fr}
.g-1-2{grid-template-columns:1fr 2fr}

/* ============================ Stat tiles ============================ */

.stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:.9rem;margin-bottom:1.1rem}
.stat{
  background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);
  padding:.9rem 1rem;position:relative;overflow:hidden;
}
.stat::after{content:"";position:absolute;inset:0 auto 0 0;width:3px;background:var(--accent)}
.stat.s-orange::after{background:var(--orange)}
.stat.s-cyan::after{background:var(--cyan)}
.stat.s-violet::after{background:var(--violet)}
.stat.s-bad::after{background:var(--bad)}
.stat.s-ok::after{background:var(--ok)}
.stat .k{font-size:.72rem;text-transform:uppercase;letter-spacing:.1em;color:var(--text-3);font-weight:650}
.stat .v{font-size:1.65rem;font-weight:800;letter-spacing:-.03em;line-height:1.2;margin-top:.15rem}
.stat .v small{font-size:.8rem;font-weight:600;color:var(--text-3)}
.stat .d{font-size:.76rem;color:var(--text-3);margin-top:.15rem}
.stat .ico{position:absolute;right:.85rem;top:.85rem;opacity:.22}
.stat .ico svg{width:26px;height:26px}

/* ============================ Tables ============================ */

.table-wrap{overflow-x:auto;-webkit-overflow-scrolling:touch}
table.tbl{width:100%;border-collapse:collapse;font-size:.865rem}
table.tbl th{
  text-align:left;font-size:.7rem;text-transform:uppercase;letter-spacing:.09em;
  color:var(--text-3);font-weight:700;padding:.6rem .7rem;
  background:var(--bg-2);border-bottom:1px solid var(--line);white-space:nowrap;
}
table.tbl td{padding:.62rem .7rem;border-bottom:1px solid var(--line-soft);vertical-align:middle}
table.tbl tbody tr:last-child td{border-bottom:0}
table.tbl tbody tr:hover{background:var(--surface-2)}
table.tbl td.num,table.tbl th.num{text-align:right;font-variant-numeric:tabular-nums}
table.tbl td.mid,table.tbl th.mid{text-align:center}
table.tbl .actions{display:flex;gap:.3rem;align-items:center;justify-content:flex-end}
.empty{padding:2.4rem 1rem;text-align:center;color:var(--text-3)}
.empty svg{width:38px;height:38px;opacity:.35;margin-bottom:.5rem}
.empty b{display:block;color:var(--text-2);font-size:.95rem;margin-bottom:.2rem}

/* ============================ Buttons ============================ */

.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:.4rem;
  font:inherit;font-size:.855rem;font-weight:650;line-height:1;
  padding:.58rem .95rem;border-radius:9px;border:1px solid transparent;
  background:var(--surface-3);color:var(--text);cursor:pointer;
  transition:background .14s,border-color .14s,color .14s,transform .06s;
  white-space:nowrap;text-decoration:none;
}
.btn:hover{background:#26364a;color:var(--text)}
.btn:active{transform:translateY(1px)}
.btn svg{width:15px;height:15px}
.btn-primary{background:var(--accent);color:var(--accent-ink)}
.btn-primary:hover{background:var(--accent-2);color:var(--accent-ink)}
.btn-orange{background:var(--orange);color:#160800}
.btn-orange:hover{background:#ff8f52;color:#160800}
.btn-ghost{background:transparent;border-color:var(--line);color:var(--text-2)}
.btn-ghost:hover{background:var(--surface-2);border-color:var(--surface-3);color:var(--text)}
.btn-danger{background:var(--bad);color:#2a0004}
.btn-danger:hover{background:#ff7a85;color:#2a0004}
.btn-danger-outline{background:transparent;border-color:rgba(255,95,109,.4);color:var(--bad)}
.btn-danger-outline:hover{background:rgba(255,95,109,.14);border-color:var(--bad);color:var(--bad)}
.btn-sm{padding:.36rem .6rem;font-size:.78rem;border-radius:7px}
.btn-sm svg{width:13px;height:13px}
.btn-icon{padding:.4rem;width:31px;height:31px}
.btn-icon svg{width:15px;height:15px}
.btn-block{width:100%}
.btn[disabled],.btn.disabled{opacity:.5;pointer-events:none}
.btn-group{display:flex;gap:.4rem;flex-wrap:wrap}

/* ============================ Badges / chips ============================ */

.badge{
  display:inline-block;font-size:.7rem;font-weight:700;letter-spacing:.02em;
  padding:.2rem .5rem;border-radius:20px;white-space:nowrap;
}
.badge-ok{background:var(--ok-bg);color:var(--ok)}
.badge-bad{background:var(--bad-bg);color:var(--bad)}
.badge-warn{background:var(--warn-bg);color:var(--warn)}
.badge-info{background:var(--info-bg);color:var(--info)}
.badge-mute{background:var(--surface-3);color:var(--text-3)}
.badge-accent{background:rgba(46,204,113,.15);color:var(--accent)}

.chip{
  display:inline-flex;align-items:center;gap:.4rem;background:var(--surface-2);
  border:1px solid var(--line);border-radius:30px;padding:.3rem .7rem;font-size:.8rem;color:var(--text-2);
  cursor:pointer;transition:.14s;
}
.chip:hover{border-color:var(--accent);color:var(--text)}
.chip.on{background:var(--accent);border-color:var(--accent);color:var(--accent-ink);font-weight:650}
.chip b{color:var(--text);font-weight:700}
.chip.on b{color:var(--accent-ink)}
.chips{display:flex;flex-wrap:wrap;gap:.45rem}

/* ============================ Avatars ============================ */

.av{width:34px;height:34px;border-radius:50%;overflow:hidden;display:inline-grid;place-items:center;
  background:var(--surface-3);flex:0 0 auto;vertical-align:middle}
.av img{width:100%;height:100%;object-fit:cover}
.av-i{background:linear-gradient(135deg,var(--surface-3),#2c3d50);color:var(--text-2);font-size:.75rem;font-weight:700}
.av-lg{width:78px;height:78px}
.av-lg.av-i{font-size:1.6rem}
.av-sm{width:26px;height:26px}
.av-sm.av-i{font-size:.62rem}
.u-cell{display:flex;align-items:center;gap:.55rem;min-width:0}
.u-cell b{display:block;font-weight:600;font-size:.87rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.u-cell span{display:block;font-size:.73rem;color:var(--text-3)}

/* ============================ Forms ============================ */

.form-row{display:grid;gap:.9rem;margin-bottom:.9rem}
.form-row.c2{grid-template-columns:repeat(2,minmax(0,1fr))}
.form-row.c3{grid-template-columns:repeat(3,minmax(0,1fr))}
.form-row.c4{grid-template-columns:repeat(4,minmax(0,1fr))}
.field{min-width:0}
.field>label,.lbl{
  display:block;font-size:.755rem;font-weight:650;color:var(--text-2);
  text-transform:uppercase;letter-spacing:.07em;margin-bottom:.32rem;
}
.field .req{color:var(--bad)}
.field .hint{font-size:.74rem;color:var(--text-3);margin-top:.28rem}

input[type=text],input[type=number],input[type=email],input[type=password],input[type=date],
input[type=time],input[type=tel],input[type=search],input[type=month],select,textarea{
  width:100%;background:var(--bg-2);border:1px solid var(--line);color:var(--text);
  border-radius:9px;padding:.56rem .7rem;font:inherit;font-size:.875rem;
  transition:border-color .14s,box-shadow .14s;
}
input:focus,select:focus,textarea:focus{
  outline:0;border-color:var(--accent);box-shadow:0 0 0 3px rgba(46,204,113,.12);
}
input::placeholder,textarea::placeholder{color:var(--text-3)}
input[readonly],input:disabled,select:disabled,textarea:disabled{background:var(--surface);color:var(--text-3);cursor:not-allowed}
textarea{min-height:82px;resize:vertical}
select{appearance:none;background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239fb0c2' stroke-width='3'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat:no-repeat;background-position:right .6rem center;padding-right:1.9rem}
input[type=color]{padding:.2rem;height:38px;cursor:pointer}
input[type=file]{font-size:.82rem;padding:.42rem .5rem}
input[type=file]::file-selector-button{
  background:var(--surface-3);border:0;color:var(--text);font:inherit;font-size:.8rem;
  padding:.35rem .7rem;border-radius:7px;margin-right:.6rem;cursor:pointer;
}

.check{display:flex;align-items:center;gap:.5rem;cursor:pointer;font-size:.86rem;color:var(--text-2);user-select:none}
.check input{width:16px;height:16px;accent-color:var(--accent);cursor:pointer;flex:0 0 auto}
.check-list{display:grid;gap:.45rem}

.switch{position:relative;display:inline-block;width:42px;height:23px;flex:0 0 auto}
.switch input{opacity:0;width:0;height:0}
.switch .sl{position:absolute;inset:0;background:var(--surface-3);border-radius:30px;transition:.2s;cursor:pointer}
.switch .sl::before{content:"";position:absolute;width:17px;height:17px;left:3px;top:3px;background:var(--text-3);border-radius:50%;transition:.2s}
.switch input:checked + .sl{background:rgba(46,204,113,.28)}
.switch input:checked + .sl::before{transform:translateX(19px);background:var(--accent)}

.input-group{display:flex}
.input-group input,.input-group select{border-radius:9px 0 0 9px}
.input-group .btn{border-radius:0 9px 9px 0;border:1px solid var(--line);border-left:0}
.prefix{display:flex;align-items:center;padding:0 .65rem;background:var(--surface-3);
  border:1px solid var(--line);border-right:0;border-radius:9px 0 0 9px;color:var(--text-3);font-size:.82rem}
.prefix + input{border-radius:0 9px 9px 0}

.filters{display:flex;gap:.6rem;flex-wrap:wrap;align-items:flex-end}
.filters .field{min-width:150px}
.filters .field.grow{flex:1 1 220px}

/* ============================ Alerts ============================ */

.alert{
  display:flex;align-items:flex-start;gap:.6rem;border-radius:var(--radius-sm);
  padding:.7rem .9rem;margin-bottom:.9rem;font-size:.87rem;border:1px solid transparent;
}
.alert-success{background:var(--ok-bg);border-color:rgba(61,220,138,.28);color:#a8f0cb}
.alert-danger,.alert-error{background:var(--bad-bg);border-color:rgba(255,95,109,.28);color:#ffc0c5}
.alert-warning{background:var(--warn-bg);border-color:rgba(255,189,61,.28);color:#ffe0a8}
.alert-info{background:var(--info-bg);border-color:rgba(78,168,255,.28);color:#bcdcff}
.alert span{flex:1}
.alert-x{background:none;border:0;color:inherit;opacity:.6;cursor:pointer;font-size:1.1rem;line-height:1;padding:0}
.alert-x:hover{opacity:1}

/* ============================ Modal ============================ */

.modal-bg{
  position:fixed;inset:0;background:rgba(3,6,10,.72);backdrop-filter:blur(3px);
  display:none;align-items:flex-start;justify-content:center;z-index:200;padding:4vh 1rem;overflow-y:auto;
}
.modal-bg.open{display:flex}
.modal{
  background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);
  box-shadow:var(--shadow);width:100%;max-width:560px;animation:pop .16s ease;
}
.modal.wide{max-width:860px}
@keyframes pop{from{opacity:0;transform:translateY(-8px) scale(.99)}to{opacity:1;transform:none}}
.modal-head{display:flex;align-items:center;padding:.9rem 1rem;border-bottom:1px solid var(--line-soft)}
.modal-head h3{margin:0;flex:1;font-size:1rem}
.modal-body{padding:1rem}
.modal-foot{padding:.8rem 1rem;border-top:1px solid var(--line-soft);display:flex;gap:.5rem;justify-content:flex-end;background:var(--bg-2)}

/* ============================ Misc UI ============================ */

.pager{display:flex;gap:.3rem;justify-content:center;padding:.9rem;flex-wrap:wrap}
.pg{min-width:32px;height:32px;display:grid;place-items:center;padding:0 .5rem;border-radius:8px;
  background:var(--surface-2);border:1px solid var(--line);color:var(--text-2);font-size:.83rem}
.pg:hover{border-color:var(--surface-3);color:var(--text)}
.pg.on{background:var(--accent);border-color:var(--accent);color:var(--accent-ink);font-weight:700}
.pg.dis{opacity:.35;pointer-events:none}

.tabs{display:flex;gap:.25rem;border-bottom:1px solid var(--line);margin-bottom:1rem;overflow-x:auto}
.tabs a,.tabs button{
  padding:.55rem .85rem;font-size:.86rem;font-weight:600;color:var(--text-3);
  border:0;background:none;cursor:pointer;border-bottom:2px solid transparent;white-space:nowrap;font-family:inherit;
}
.tabs a:hover,.tabs button:hover{color:var(--text)}
.tabs a.on,.tabs button.on{color:var(--accent);border-bottom-color:var(--accent)}

.prog{height:7px;background:var(--surface-3);border-radius:10px;overflow:hidden}
.prog i{display:block;height:100%;background:linear-gradient(90deg,var(--accent-2),var(--accent));border-radius:10px}
.prog.bad i{background:linear-gradient(90deg,#d94452,var(--bad))}
.prog.warn i{background:linear-gradient(90deg,#e0a02c,var(--warn))}

.kv{display:grid;grid-template-columns:auto 1fr;gap:.45rem 1rem;font-size:.87rem}
.kv dt{color:var(--text-3);font-size:.78rem;text-transform:uppercase;letter-spacing:.06em;font-weight:650;align-self:center}
.kv dd{margin:0;font-weight:550}

.timeline{position:relative;padding-left:1.4rem}
.timeline::before{content:"";position:absolute;left:5px;top:6px;bottom:6px;width:2px;background:var(--line)}
.tl-item{position:relative;padding:0 0 .95rem}
.tl-item::before{content:"";position:absolute;left:-1.4rem;top:5px;width:12px;height:12px;border-radius:50%;
  background:var(--surface);border:2px solid var(--accent)}
.tl-item .tl-t{font-size:.72rem;color:var(--text-3)}

.divider-x{display:flex;align-items:center;gap:.7rem;color:var(--text-3);font-size:.75rem;
  text-transform:uppercase;letter-spacing:.1em;margin:1rem 0}
.divider-x::before,.divider-x::after{content:"";flex:1;height:1px;background:var(--line)}

.muted{color:var(--text-3)}
.text-ok{color:var(--ok)} .text-bad{color:var(--bad)} .text-warn{color:var(--warn)} .text-accent{color:var(--accent)}
.tr{text-align:right} .tc{text-align:center}
.nowrap{white-space:nowrap}
.mono{font-variant-numeric:tabular-nums;font-feature-settings:"tnum"}
.mb0{margin-bottom:0} .mb1{margin-bottom:.6rem} .mb2{margin-bottom:1.1rem}
.mt1{margin-top:.6rem} .mt2{margin-top:1.1rem}
.flex{display:flex;gap:.6rem;align-items:center}
.flex-wrap{flex-wrap:wrap}
.between{justify-content:space-between}
.grow{flex:1}
.hide{display:none !important}

/* ============================ Enhanced select ("filled" dropdown) ============================ */

.fsel{position:relative;width:100%}
.fsel-btn{
  width:100%;text-align:left;background:var(--bg-2);border:1px solid var(--line);color:var(--text);
  border-radius:9px;padding:.56rem 1.9rem .56rem .7rem;font:inherit;font-size:.875rem;cursor:pointer;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;position:relative;
}
.fsel-btn::after{
  content:"";position:absolute;right:.7rem;top:50%;width:8px;height:8px;margin-top:-5px;
  border-right:2px solid var(--text-2);border-bottom:2px solid var(--text-2);transform:rotate(45deg);
}
.fsel.open .fsel-btn{border-color:var(--accent);box-shadow:0 0 0 3px rgba(46,204,113,.12)}
.fsel-pop{
  position:absolute;z-index:120;left:0;right:0;top:calc(100% + 4px);
  background:var(--surface-2);border:1px solid var(--line);border-radius:var(--radius-sm);
  box-shadow:var(--shadow);max-height:270px;overflow:auto;display:none;padding:.3rem;
}
.fsel.open .fsel-pop{display:block}
.fsel-pop .fsel-search{position:sticky;top:0;background:var(--surface-2);padding:.15rem .15rem .35rem}
.fsel-pop .fsel-search input{font-size:.83rem;padding:.42rem .55rem}
.fsel-opt{padding:.45rem .6rem;border-radius:7px;font-size:.86rem;color:var(--text-2);cursor:pointer}
.fsel-opt:hover{background:var(--surface-3);color:var(--text)}
.fsel-opt.on{background:var(--accent);color:var(--accent-ink);font-weight:650}
.fsel-opt.dis{opacity:.45;pointer-events:none}
.fsel-none{padding:.6rem;color:var(--text-3);font-size:.83rem;text-align:center}

/* ============================ dd/mm/yyyy date widget ============================ */

.dmy{display:flex;align-items:center;gap:.25rem;background:var(--bg-2);border:1px solid var(--line);
  border-radius:9px;padding:.28rem .4rem;position:relative}
.dmy:focus-within{border-color:var(--accent);box-shadow:0 0 0 3px rgba(46,204,113,.12)}
.dmy input{border:0 !important;background:transparent !important;box-shadow:none !important;
  text-align:center;padding:.26rem .1rem;font-variant-numeric:tabular-nums}
.dmy input.d,.dmy input.m{width:2.4rem}
.dmy input.y{width:3.4rem}
.dmy .sep{color:var(--text-3);font-size:.9rem}
.dmy .cal{margin-left:auto;background:none;border:0;color:var(--text-3);cursor:pointer;padding:.2rem;display:flex}
.dmy .cal:hover{color:var(--accent)}
.dmy .native{position:absolute;right:.4rem;width:1.4rem;opacity:0;cursor:pointer;height:1.7rem}

/* ============================ Login ============================ */

.auth-wrap{min-height:100vh;display:grid;place-items:center;padding:1.2rem;
  background:
    radial-gradient(900px 500px at 80% -10%,rgba(46,204,113,.10),transparent 60%),
    radial-gradient(700px 500px at 10% 110%,rgba(255,122,47,.09),transparent 60%),
    var(--bg);
}
.auth-card{width:100%;max-width:410px;background:var(--surface);border:1px solid var(--line);
  border-radius:18px;box-shadow:var(--shadow);padding:1.8rem 1.6rem}
.auth-logo{width:56px;height:56px;border-radius:15px;margin:0 auto .9rem;
  background:linear-gradient(135deg,var(--accent),var(--accent-2));color:var(--accent-ink);
  display:grid;place-items:center;font-weight:900;font-size:24px}
.auth-card h1{text-align:center;font-size:1.3rem;margin-bottom:.15rem}
.auth-card .sub{text-align:center;color:var(--text-3);font-size:.85rem;margin-bottom:1.3rem}
.auth-foot{text-align:center;margin-top:1.1rem;font-size:.78rem;color:var(--text-3)}

/* ============================ Print ============================ */

@media print{
  .sidebar,.topbar,.no-print,.btn{display:none !important}
  .main{margin:0 !important}
  body{background:#fff;color:#000}
  .card{border:1px solid #ccc;box-shadow:none;background:#fff;color:#000}
  .print-only{display:block !important}
}
.print-only{display:none}

/* ============================ Responsive ============================ */

@media (max-width:1100px){
  .g4{grid-template-columns:repeat(2,minmax(0,1fr))}
  .g-2-1,.g-1-2{grid-template-columns:1fr}
}
@media (max-width:900px){
  .sidebar{transform:translateX(-100%)}
  body.nav-open .sidebar{transform:none}
  body.nav-open::after{content:"";position:fixed;inset:0;background:rgba(0,0,0,.55);z-index:55}
  .main{margin-left:0}
  .burger{display:block}
  .g2,.g3,.g4{grid-template-columns:1fr}
  .form-row.c2,.form-row.c3,.form-row.c4{grid-template-columns:1fr}
  .content{padding:.9rem .8rem 3rem}
}
@media (max-width:540px){
  .userbox .who{display:none}
  .stat .v{font-size:1.4rem}
  .topbar .page-title{font-size:.95rem}
}
