/* ======================================================================
   HSCo — Hindustan Scale Co · portal design system
   Manager + Super-Admin consoles. Light + Dark via [data-theme].
   ====================================================================== */

:root,
[data-theme="light"] {
  --bg:        #f4f6f8;
  --surface:   #ffffff;
  --surface-2: #fbfcfd;
  --border:    #ecedf1;
  --border-2:  #e1e4e9;
  --text:      #1c2330;
  --text-2:    #5c6473;
  --text-3:    #97a0ad;
  --accent:    #ef7c2d;
  --accent-600:#e36d17;
  --accent-soft:#fff2e8;
  --navy:      #1f2a44;
  --green:     #16a34a;
  --green-bg:  #e8f7ee;
  --red:       #e0484d;
  --red-bg:    #fdeaea;
  --blue:      #3b82f6;
  --blue-bg:   #e9f1fe;
  --purple:    #8b5cf6;
  --amber:     #d99413;
  --amber-bg:  #fdf2dd;
  --shadow:    0 1px 2px rgba(16,24,40,.04), 0 2px 6px rgba(16,24,40,.05);
  --shadow-lg: 0 12px 32px rgba(16,24,40,.10);
  --radius:    16px;
  --radius-sm: 12px;
  --t-blue:    #eef4fe;  --t-blue-i:  #dfeafc;
  --t-orange:  #fff3ea;  --t-orange-i:#ffe5d2;
  --t-green:   #ecfaf1;  --t-green-i: #d4f4e1;
  --t-purple:  #f5f0fe;  --t-purple-i:#e8ddfc;
  --t-lime:    #f0f9e9;  --t-lime-i:  #ddefcf;
}

[data-theme="dark"] {
  --bg:        #0e1218;
  --surface:   #161b23;
  --surface-2: #1b212b;
  --border:    #262d39;
  --border-2:  #2f3744;
  --text:      #e8ebf0;
  --text-2:    #98a2b1;
  --text-3:    #69727f;
  --accent:    #f5853a;
  --accent-600:#ef7c2d;
  --accent-soft:#2a2018;
  --navy:      #243154;
  --green:     #34d27f;
  --green-bg:  #14271d;
  --red:       #f0676b;
  --red-bg:    #2a191a;
  --blue:      #5b9bf8;
  --blue-bg:   #16202f;
  --purple:    #a78bfa;
  --amber:     #e0a836;
  --amber-bg:  #2a2113;
  --shadow:    0 1px 2px rgba(0,0,0,.30), 0 2px 8px rgba(0,0,0,.28);
  --shadow-lg: 0 14px 36px rgba(0,0,0,.45);
  --t-blue:   rgba(59,130,246,.12); --t-blue-i:  rgba(59,130,246,.20);
  --t-orange: rgba(239,124,45,.13); --t-orange-i:rgba(239,124,45,.22);
  --t-green:  rgba(22,163,74,.13);  --t-green-i: rgba(22,163,74,.22);
  --t-purple: rgba(139,92,246,.14); --t-purple-i:rgba(139,92,246,.24);
  --t-lime:   rgba(132,204,22,.13); --t-lime-i:  rgba(132,204,22,.22);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: 'Plus Jakarta Sans', 'Inter', sans-serif; margin: 0; color: var(--text); }
a { color: inherit; }
.mono { font-family: 'IBM Plex Mono', ui-monospace, monospace; }
.muted { color: var(--text-2); }

/* ── App shell ───────────────────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px; flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 22px 16px;
  position: sticky; top: 0; height: 100vh;
}
.side-logo { display: flex; align-items: center; gap: 10px; padding: 4px 6px 18px; }
.side-logo img { height: 40px; width: auto; object-fit: contain; }
.side-logo .lt { display: flex; flex-direction: column; line-height: 1.15; }
.side-logo .lt b { font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 800; font-size: 15px; letter-spacing: .2px; }
.side-logo .lt small { color: var(--text-3); font-size: 10px; letter-spacing: .4px; text-transform: uppercase; }

.side-section { color: var(--accent); font-size: 10.5px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; padding: 16px 10px 8px; }
.side-nav { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.side-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 11px;
  color: var(--text-2); text-decoration: none; font-weight: 600; font-size: 13.5px;
  transition: background .15s, color .15s;
}
.side-link:hover { background: var(--surface-2); color: var(--text); }
.side-link.active { background: var(--accent-soft); color: var(--accent-600); }
.side-link .si { width: 18px; height: 18px; flex-shrink: 0; display: inline-flex; }
.side-link.active .si { color: var(--accent); }

.side-spacer { flex: 1; }
.side-card {
  margin: 14px 4px 10px; padding: 18px 16px;
  border: 1px solid var(--border); border-radius: 14px;
  background: linear-gradient(170deg, var(--accent-soft), var(--surface));
  text-align: center;
}
.side-card .shield { width: 42px; height: 42px; margin: 0 auto 10px; display: flex; align-items: center; justify-content: center;
  border-radius: 12px; background: var(--surface); border: 1px solid var(--border); color: var(--accent); box-shadow: var(--shadow); }
.side-card b { display: block; font-size: 13px; font-family: 'Plus Jakarta Sans', sans-serif; }
.side-card p { margin: 6px 0 0; font-size: 11px; color: var(--text-2); line-height: 1.45; }
.side-foot { display: flex; align-items: center; gap: 8px; padding: 10px 8px 0; font-size: 11.5px; color: var(--text-2); }
.side-foot .si { color: var(--green); width: 15px; height: 15px; }

/* ── Main / topbar ───────────────────────────────────────────────────── */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.imp-banner {
  background: var(--navy); color: #fff; padding: 9px 30px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  font-size: 12.5px;
}
.imp-banner strong { color: #ffd9b8; }
.imp-banner a { color: #fff; background: rgba(255,255,255,.16); padding: 6px 14px; border-radius: 8px; text-decoration: none; font-weight: 700; white-space: nowrap; display: inline-flex; gap: 7px; align-items: center; }
.imp-banner a:hover { background: rgba(255,255,255,.28); }

.page-wrap { padding: 28px 32px 40px; max-width: 1320px; width: 100%; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 27px; font-weight: 800; letter-spacing: -.4px; }
.page-head .sub { color: var(--text-2); margin-top: 4px; font-size: 14px; }
.head-right { display: flex; align-items: center; gap: 14px; }

.lic-pill {
  font-family: 'IBM Plex Mono', monospace; font-size: 12px; font-weight: 600;
  color: var(--accent-600); background: var(--surface);
  border: 1.5px solid var(--accent); border-radius: 10px; padding: 8px 14px; letter-spacing: .5px;
}
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-chip .u-av { width: 42px; height: 42px; border-radius: 50%; background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 17px; font-family: 'Plus Jakarta Sans', sans-serif; }
.user-chip .u-name { font-weight: 700; font-size: 14px; }
.user-chip .u-role { font-size: 10.5px; color: var(--text-3); letter-spacing: .6px; text-transform: uppercase; }

.theme-toggle {
  width: 40px; height: 40px; border-radius: 11px; border: 1px solid var(--border-2);
  background: var(--surface); color: var(--text-2); cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: .15s;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle .moon { display: none; }
[data-theme="dark"] .theme-toggle .moon { display: inline-flex; }
[data-theme="dark"] .theme-toggle .sun { display: none; }

/* ── KPI tiles ───────────────────────────────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; margin-bottom: 22px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 18px 8px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.kpi.t-blue   { background: linear-gradient(180deg, var(--t-blue),  var(--surface) 70%); }
.kpi.t-orange { background: linear-gradient(180deg, var(--t-orange),var(--surface) 70%); }
.kpi.t-green  { background: linear-gradient(180deg, var(--t-green), var(--surface) 70%); }
.kpi.t-purple { background: linear-gradient(180deg, var(--t-purple),var(--surface) 70%); }
.kpi.t-lime   { background: linear-gradient(180deg, var(--t-lime),  var(--surface) 70%); }
.kpi-top { display: flex; align-items: center; gap: 12px; }
.kpi-icon { width: 44px; height: 44px; border-radius: 13px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.kpi.t-blue   .kpi-icon { background: var(--t-blue-i);   color: var(--blue); }
.kpi.t-orange .kpi-icon { background: var(--t-orange-i); color: var(--accent); }
.kpi.t-green  .kpi-icon { background: var(--t-green-i);  color: var(--green); }
.kpi.t-purple .kpi-icon { background: var(--t-purple-i); color: var(--purple); }
.kpi.t-lime   .kpi-icon { background: var(--t-lime-i);   color: #4d7c0f; }
.kpi-label { font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--text-2); }
.kpi-num { font-size: 30px; font-weight: 800; font-family: 'Plus Jakarta Sans', sans-serif; line-height: 1.1; margin-top: 2px; }
.kpi-sub { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.kpi-spark { height: 34px; margin: 6px -4px -2px; }
.kpi-spark svg { width: 100%; height: 100%; display: block; }

/* ── Cards ───────────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; }
.card-head { display: flex; align-items: center; gap: 14px; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.card-head .ci { width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.card-head h2 { font-size: 18px; font-weight: 700; }
.card-head .csub { font-size: 12.5px; color: var(--text-2); margin-top: 1px; }
.card-head .grow { flex: 1; }
.card-body { padding: 8px 12px 12px; }
.card-pad { padding: 22px 24px; }

/* ── Table ───────────────────────────────────────────────────────────── */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 10.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--text-3); padding: 12px 14px; }
.tbl td { padding: 14px 14px; border-top: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
.tbl tr:hover td { background: var(--surface-2); }
.cust { display: flex; align-items: center; gap: 12px; }
.cust b { font-weight: 700; }
.av { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; color: #fff; flex-shrink: 0; font-family: 'Plus Jakarta Sans', sans-serif; }
.av.c0{background:#3b82f6}.av.c1{background:#16a34a}.av.c2{background:#8b5cf6}.av.c3{background:#ef7c2d}.av.c4{background:#0ea5e9}.av.c5{background:#e0484d}.av.c6{background:#d99413}.av.c7{background:#14b8a6}

.chip { display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.chip.green  { background: var(--green-bg); color: var(--green); }
.chip.red    { background: var(--red-bg);   color: var(--red); }
.chip.blue   { background: var(--blue-bg);  color: var(--blue); }
.chip.amber  { background: var(--amber-bg); color: var(--amber); }
.chip.grey   { background: var(--surface-2);color: var(--text-3); border: 1px solid var(--border); }
.bmi-chip { font-family: 'IBM Plex Mono', monospace; background: var(--amber-bg); color: var(--amber); padding: 3px 9px; border-radius: 7px; font-weight: 600; font-size: 12.5px; }
.pos { color: var(--green); font-weight: 700; } .neg { color: var(--red); font-weight: 700; }
.dash { color: var(--text-3); }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 11px; font-weight: 700; font-size: 13.5px; cursor: pointer; text-decoration: none; border: 1px solid transparent; transition: .15s; font-family: inherit; }
.btn--primary { background: linear-gradient(135deg, var(--accent), var(--accent-600)); color: #fff; box-shadow: 0 4px 12px rgba(239,124,45,.30); }
.btn--primary:hover { filter: brightness(1.05); }
.btn--outline { background: var(--surface); border-color: var(--accent); color: var(--accent-600); }
.btn--outline:hover { background: var(--accent-soft); }
.btn--ghost { background: var(--surface-2); border-color: var(--border-2); color: var(--text-2); }
.btn--ghost:hover { color: var(--text); }
.btn--sm { padding: 7px 13px; font-size: 12.5px; border-radius: 9px; }
.btn-icon { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border-2); background: var(--surface); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; text-decoration: none; transition: .15s; }
.btn-icon:hover { background: var(--accent-soft); border-color: var(--accent); }
.btn-icon.danger { color: var(--red); } .btn-icon.danger:hover { background: var(--red-bg); border-color: var(--red); }

/* ── CTA banner ──────────────────────────────────────────────────────── */
.cta { display: flex; align-items: center; gap: 18px; padding: 22px 24px; }
.cta .cta-icon { width: 52px; height: 52px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cta h3 { font-size: 17px; font-weight: 700; }
.cta p { color: var(--text-2); font-size: 13px; margin-top: 2px; }
.cta .grow { flex: 1; }

/* ── Forms ───────────────────────────────────────────────────────────── */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--text-2); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .4px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border-2); border-radius: 11px;
  background: var(--surface); color: var(--text); font-size: 14px; font-family: inherit; transition: .15s;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 16px 24px; border-bottom: 1px solid var(--border); }
.toolbar input, .toolbar select { padding: 9px 12px; border: 1px solid var(--border-2); border-radius: 10px; background: var(--surface); color: var(--text); font-size: 13px; font-family: inherit; }
.search { flex: 1; min-width: 200px; }

/* ── Idle / inactivity modal ─────────────────────────────────────────── */
.idle-mask { position: fixed; inset: 0; background: rgba(15,20,28,.55); backdrop-filter: blur(3px); z-index: 9999; display: none; align-items: center; justify-content: center; }
.idle-mask.show { display: flex; }
.idle-box { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg); width: 380px; max-width: 90vw; padding: 28px; text-align: center; }
.idle-box .ib-icon { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px; background: var(--amber-bg); color: var(--amber); display: flex; align-items: center; justify-content: center; }
.idle-box h3 { font-size: 19px; margin-bottom: 8px; }
.idle-box p { color: var(--text-2); font-size: 13.5px; margin: 0 0 6px; }
.idle-box .count { font-family: 'IBM Plex Mono', monospace; font-size: 30px; font-weight: 700; color: var(--accent); margin: 8px 0 18px; }
.idle-box .row { display: flex; gap: 10px; }
.idle-box .row .btn { flex: 1; justify-content: center; }

/* ── Login ───────────────────────────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow-lg); width: 410px; max-width: 100%; padding: 38px 36px; }
.login-card .lg-logo { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 26px; }
.login-card .lg-logo img { height: 56px; }
.login-card h1 { font-size: 22px; text-align: center; }
.login-card .lg-sub { text-align: center; color: var(--text-2); font-size: 13.5px; margin: 6px 0 24px; }
.login-card .btn { width: 100%; justify-content: center; padding: 13px; font-size: 15px; }
.alert { background: var(--red-bg); color: var(--red); border-radius: 11px; padding: 11px 14px; font-size: 13px; font-weight: 600; margin-bottom: 16px; }

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 1100px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 920px) {
  .sidebar { display: none; }
  .page-wrap { padding: 18px; }
}
@media (max-width: 560px) { .kpi-grid { grid-template-columns: 1fr; } .form-grid { grid-template-columns: 1fr; } }
