/* ===== Lkhlas developer console ===== */
:root {
  --orange: #FF5A1F; --orange-text: #C2410C; --on-orange: #141B34; --orange-soft: #FFF4EF;
  --navy: #141B34; --ink: #141B34; --ink-2: #5B6272;
  --bg: #F4F5F8; --surface: #FFFFFF; --surface-2: #F4F5F8; --line: #E3E6EE;
  --ok: #15803D; --ok-bg: #DDF4E7; --warn: #B45309; --warn-bg: #FBEACB; --bad: #B91C1C; --bad-bg: #F8DED6;
  --bar: #4F63C9;
  --shadow: 0 1px 2px rgba(20,27,52,.06), 0 8px 24px -12px rgba(20,27,52,.18);
  --font: "Plus Jakarta Sans", "Segoe UI", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --orange-text: #FF7A47; --orange-soft: #2A1C1A; --ink: #FFFFFF; --ink-2: #A5ADC0;
    --bg: #0B1022; --surface: #141B34; --surface-2: #1C2547; --line: #2E3A66;
    --ok: #4ADE80; --ok-bg: #10301F; --warn: #FBBF24; --warn-bg: #36290C; --bad: #F87171; --bad-bg: #3E1C18;
    --bar: #6F82EE; --shadow: 0 8px 24px -12px rgba(0,0,0,.6); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --orange-text: #FF7A47; --orange-soft: #2A1C1A; --ink: #FFFFFF; --ink-2: #A5ADC0;
  --bg: #0B1022; --surface: #141B34; --surface-2: #1C2547; --line: #2E3A66;
  --ok: #4ADE80; --ok-bg: #10301F; --warn: #FBBF24; --warn-bg: #36290C; --bad: #F87171; --bad-bg: #3E1C18;
  --bar: #6F82EE; --shadow: 0 8px 24px -12px rgba(0,0,0,.6); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; letter-spacing: -.02em; }
code { background: var(--surface-2); padding: 2px 6px; border-radius: 6px; }
.muted { color: var(--ink-2); }
.ltr { direction: ltr; unicode-bidi: isolate; }
.num { font-variant-numeric: tabular-nums; }

/* theme-aware logos */
.dk { display: none; }
:root[data-theme="dark"] .lt { display: none; } :root[data-theme="dark"] .dk { display: inline-block; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .lt { display: none; } :root:not([data-theme="light"]) .dk { display: inline-block; } }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 18px;
  border-radius: 999px; border: 1px solid transparent; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none;
  transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease, border-color .18s ease;
}
.btn.small { min-height: 34px; padding: 0 14px; font-size: 13px; }
.btn.primary { background: var(--orange); color: var(--on-orange); }
.btn.primary:hover { background: #C2410C; color: #FFFFFF; transform: translateY(-1px); box-shadow: 0 10px 22px -10px rgba(255,90,31,.7); }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--orange); transform: translateY(-1px); }
.btn.danger { background: var(--bad-bg); color: var(--bad); }
.btn.danger:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn.wa { background: #25D366; color: #FFFFFF; }
.btn.wa:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn:focus-visible, .icon-btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, th button:focus-visible {
  outline: 2px solid var(--orange); outline-offset: 2px;
}
.icon-btn { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn .i-sun { display: none; }
:root[data-theme="dark"] .icon-btn .i-sun { display: block; } :root[data-theme="dark"] .icon-btn .i-moon { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .icon-btn .i-sun { display: block; } :root:not([data-theme="light"]) .icon-btn .i-moon { display: none; } }

/* boot + login */
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 10px; color: var(--ink-2); }
.boot img { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.9); opacity: .7; } }
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 32px; box-shadow: var(--shadow); display: grid; gap: 14px; }
.login-card h1 { font-size: 26px; margin-top: 8px; }
.login-card p { margin: 0; }
.field { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
.field input, .toolbar input, .toolbar select, textarea {
  min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 500;
}
textarea { padding: 10px 14px; width: 100%; resize: vertical; }
.error { color: var(--bad); min-height: 1em; margin: 0; font-weight: 600; font-size: 14px; }
.uid { font-family: ui-monospace, monospace; background: var(--surface-2); padding: 10px; border-radius: 10px; user-select: all; overflow-wrap: anywhere; }

/* top bar */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1240px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { height: 30px; width: auto; }
.badge { background: var(--navy); color: #FF8A5B; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; padding: 4px 9px; border-radius: 999px; }
:root[data-theme="dark"] .badge { background: var(--orange); color: var(--navy); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge { background: var(--orange); color: var(--navy); } }
.tabs { display: flex; gap: 4px; margin-inline: auto; }
.tabs a { position: relative; padding: 8px 14px; border-radius: 999px; color: var(--ink-2); text-decoration: none; font-weight: 600; transition: color .2s; }
.tabs a::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 2px; height: 2px; border-radius: 2px; background: var(--orange); transform: scaleX(0); transition: transform .25s; }
.tabs a:hover { color: var(--ink); }
.tabs a:hover::after, .tabs a.on::after { transform: scaleX(1); }
.tabs a.on { color: var(--ink); }
.top-r { display: flex; align-items: center; gap: 8px; }
.who { font-size: 13px; color: var(--ink-2); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* layout */
.main { max-width: 1240px; margin: 0 auto; padding: 28px 20px 60px; display: grid; gap: 20px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 30px; }
.page-head p { margin: 4px 0 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 22px; box-shadow: var(--shadow); min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head h2 { font-size: 18px; }
.grid2 { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }
.enter { animation: rise .45s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i, 0) * 50ms); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 900px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 18px 20px; display: grid; gap: 4px; box-shadow: var(--shadow); transition: transform .2s; }
.kpi:hover { transform: translateY(-2px); }
.kpi .v { font-size: 28px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--ink-2); font-size: 13px; font-weight: 600; }
.kpi .s { font-size: 12px; color: var(--ink-2); }
.kpi.hl { background: var(--navy); border-color: var(--navy); color: #FFFFFF; }
.kpi.hl .l, .kpi.hl .s { color: #A5ADC0; }
.kpi.hl .v { color: #FF8A5B; }
.kpi .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-inline-end: 6px; }

/* bar chart */
.chart { position: relative; height: 230px; padding-left: 52px; margin-top: 10px; }
.chart .gl { position: absolute; left: 52px; right: 0; border-top: 1px dashed var(--line); }
.chart .gl span { position: absolute; left: -52px; top: -8px; width: 46px; text-align: right; font-size: 11px; color: var(--ink-2); }
.chart .bars { position: absolute; left: 52px; right: 0; top: 0; bottom: 26px; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; align-items: end; border-bottom: 1px solid var(--line); }
.chart .col { position: relative; height: 100%; display: flex; align-items: flex-end; justify-content: center; outline: none; }
.chart .bar { width: min(46px, 100%); border-radius: 6px 6px 0 0; background: var(--bar); transform-origin: bottom; animation: grow .7s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i) * 60ms); transition: filter .15s; }
.chart .col.cur .bar { background: var(--orange); }
.chart .col:hover .bar, .chart .col:focus-visible .bar { filter: brightness(1.12); }
@keyframes grow { from { transform: scaleY(0); } }
.chart .x { position: absolute; bottom: -24px; font-size: 12px; color: var(--ink-2); text-transform: capitalize; white-space: nowrap; }
.tip {
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translate(-50%, 4px); z-index: 4; min-width: max-content;
  background: var(--ink); color: var(--surface); padding: 7px 11px; border-radius: 10px; font-size: 12px; font-weight: 700; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s;
}
.col:hover .tip, .col:focus-visible .tip { opacity: 1; transform: translate(-50%, 0); }
.legend { display: flex; gap: 18px; margin-top: 14px; font-size: 13px; color: var(--ink-2); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 6px; vertical-align: -1px; }

/* status mix bar */
.mix { display: flex; gap: 2px; height: 12px; border-radius: 4px; overflow: hidden; margin: 6px 0 12px; }
.mix span { min-width: 3px; }

/* lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.list li:last-child { border-bottom: 0; }
.list .main-c { flex: 1; min-width: 180px; display: grid; }
.list .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.empty { color: var(--ink-2); margin: 6px 0; }

/* pills */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.active { background: var(--ok-bg); color: var(--ok); }
.pill.trial { background: var(--warn-bg); color: var(--warn); }
.pill.suspended { background: var(--bad-bg); color: var(--bad); }

/* toolbar + table */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar input { flex: 1 1 260px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 4px; gap: 2px; }
.seg button { border: 0; background: none; color: var(--ink-2); font: inherit; font-weight: 600; font-size: 13px; padding: 7px 14px; border-radius: 999px; cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 820px; }
th, td { padding: 12px 12px; text-align: start; border-bottom: 1px solid var(--line); white-space: nowrap; }
thead th { font-size: 12px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .05em; }
th button { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
th button:hover { color: var(--ink); }
th .arr { font-size: 10px; opacity: .8; }
tbody tr { cursor: pointer; transition: background-color .15s; }
tbody tr:hover { background: var(--surface-2); }
td.r, th.r { text-align: end; }
.gym-n { font-weight: 700; }
.gym-n small { display: block; font-weight: 500; color: var(--ink-2); }
.days { font-weight: 700; font-variant-numeric: tabular-nums; }
.days.low { color: var(--bad); }
.days.mid { color: var(--warn); }

/* drawer */
.drawer-bg { position: fixed; inset: 0; background: rgba(11,16,34,.45); z-index: 40; animation: fade .2s both; }
@keyframes fade { from { opacity: 0; } }
.drawer {
  position: fixed; top: 0; bottom: 0; right: 0; width: min(520px, 100%); z-index: 41; background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: -20px 0 60px -20px rgba(0,0,0,.4); overflow-y: auto; padding: 24px; transform: translateX(105%); transition: transform .3s cubic-bezier(.2,.8,.2,1);
  display: grid; align-content: start; gap: 18px; visibility: hidden;
}
.drawer.open { transform: none; visibility: visible; }
.d-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.d-head h2 { font-size: 22px; }
.d-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.d-cell { background: var(--surface-2); border-radius: 14px; padding: 10px 12px; min-width: 0; }
.d-cell small { color: var(--ink-2); display: block; font-size: 12px; font-weight: 600; }
.d-cell b { overflow-wrap: anywhere; }
.d-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.d-sec h3 { font-size: 15px; margin-bottom: 8px; }
.meter { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--orange); border-radius: inherit; }
.meter.low i { background: var(--bad); }

/* modal + toast */
.modal-bg { position: fixed; inset: 0; z-index: 60; background: rgba(11,16,34,.5); display: grid; place-items: center; padding: 20px; animation: fade .15s both; }
.modal { width: min(440px, 100%); background: var(--surface); border-radius: 22px; padding: 24px; display: grid; gap: 12px; box-shadow: var(--shadow); animation: rise .25s both; }
.modal h2 { font-size: 20px; }
.modal p { margin: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); z-index: 70; background: var(--ink); color: var(--surface);
  padding: 11px 18px; border-radius: 14px; font-weight: 700; opacity: 0; pointer-events: none; transition: opacity .2s, transform .3s cubic-bezier(.34,1.56,.64,1);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--bad); color: #FFFFFF; }

@media (max-width: 760px) {
  .top-in { flex-wrap: wrap; gap: 10px; }
  .tabs { order: 3; width: 100%; margin: 0; overflow-x: auto; }
  .who { display: none; }
  .d-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
