/* LicenseManager v4 — admin UI. Matches the original dark navy look. */
:root {
  --bg: #0f1117;
  --side: #161925;
  --panel: #1b1f2e;
  --panel-2: #20253a;
  --head: #232842;
  --line: #2a3048;
  --text: #e5e7eb;
  --muted: #8b93a7;
  --dim: #5f6780;
  --accent: #6366f1;
  --accent-2: #818cf8;
  --green: #22c55e;
  --green-bg: rgba(34, 197, 94, .14);
  --red: #f87171;
  --red-bg: rgba(239, 68, 68, .14);
  --amber: #fbbf24;
  --amber-bg: rgba(251, 191, 36, .14);
  --grey-bg: rgba(148, 163, 184, .14);
  --radius: 10px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); }

/* ---- shell */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; background: linear-gradient(to right, var(--side) 249px, var(--line) 249px, var(--line) 250px, var(--bg) 250px); }
.side { background: var(--side); border-right: 1px solid var(--line); align-self: start; padding: 26px 16px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 21px; font-weight: 800; letter-spacing: -.3px; padding: 0 10px 26px; }
.brand .k { color: var(--accent-2); }
.brand svg { flex: none; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 8px; color: #c3c8d6; font-weight: 500; margin-bottom: 4px; }
.nav a:hover { background: var(--panel); text-decoration: none; }
.nav a.on { background: var(--panel-2); color: #fff; font-weight: 600; }
.nav .ico { width: 20px; text-align: center; }
.nav hr { border: 0; border-top: 1px solid var(--line); margin: 14px 4px; }
.nav a.logout { color: var(--red); }
.side .who { margin-top: auto; padding: 12px 14px; color: var(--dim); font-size: 12px; border-top: 1px solid var(--line); }
.main { padding: 36px 44px 60px; min-width: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
h1 { font-size: 28px; margin: 0; letter-spacing: -.4px; }
h2 { font-size: 17px; margin: 0; }
.sub { color: var(--muted); margin: 4px 0 0; }

/* ---- panels & tables */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px; margin-bottom: 22px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
thead th { background: var(--head); color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; text-align: left; padding: 13px 16px; white-space: nowrap; }
tbody td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover { background: rgba(255, 255, 255, .02); }
td.name { font-weight: 700; color: #fff; }
td .small, .small { font-size: 12px; color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 34px; }
.slug { font-family: var(--mono); font-size: 12px; background: #0b0d14; border: 1px solid var(--line); padding: 3px 8px; border-radius: 6px; color: #d1d5db; }
.key { font-family: var(--mono); font-size: 12.5px; background: #0b0d14; padding: 4px 10px; border-radius: 6px; color: #e5e7eb; letter-spacing: .4px; white-space: nowrap; }

/* ---- badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.b-green { background: var(--green-bg); color: var(--green); }
.b-red { background: var(--red-bg); color: var(--red); }
.b-amber { background: var(--amber-bg); color: var(--amber); }
.b-grey { background: var(--grey-bg); color: #aeb5c5; }
.b-indigo { background: rgba(99, 102, 241, .16); color: var(--accent-2); }

/* ---- buttons & forms */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); padding: 8px 14px; border-radius: 8px; font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #3a4263; text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #5458e8; }
.btn-danger { color: var(--red); background: rgba(239, 68, 68, .08); border-color: rgba(239, 68, 68, .25); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 6px 9px; }
.actions { display: flex; gap: 6px; align-items: center; flex-wrap: nowrap; }
.actions form { margin: 0; }
label { display: block; font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: #c3c8d6; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=url], input[type=search], select, textarea {
  width: 100%; background: #0d1018; border: 1px solid var(--line); color: var(--text); border-radius: 9px; padding: 11px 13px; font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(99, 102, 241, .5); border-color: var(--accent); }
textarea { min-height: 84px; resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { margin-bottom: 16px; }
.check { display: flex; align-items: center; gap: 10px; text-transform: uppercase; font-size: 12px; font-weight: 700; letter-spacing: .5px; color: #c3c8d6; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }
.hint { font-size: 12px; color: var(--muted); margin-top: 6px; text-transform: none; letter-spacing: 0; font-weight: 400; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; }
.filters input, .filters select { width: auto; min-width: 170px; padding: 8px 12px; }

/* ---- dialogs */
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 16px; padding: 30px 36px; width: min(640px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(0, 0, 0, .55); }
dialog::backdrop { background: rgba(5, 7, 12, .72); }
dialog h2 { font-size: 22px; margin-bottom: 22px; }
dialog .btn-primary.wide, dialog .btn.wide { width: 100%; justify-content: center; padding: 12px; font-size: 14px; margin-top: 6px; }

/* ---- reveal & flash */
.reveal { border: 1px solid #16a34a; background: rgba(22, 163, 74, .08); border-radius: 14px; padding: 24px 28px; margin-bottom: 26px; }
.reveal h3 { margin: 0 0 10px; font-size: 17px; }
.reveal p { color: #c9cfdb; margin: 0 0 14px; }
.reveal .row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.reveal code { font-size: 16px; background: #0b0d14; padding: 10px 16px; border-radius: 8px; letter-spacing: 1px; word-break: break-all; }
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-weight: 500; }
.flash.success { background: var(--green-bg); color: #86efac; border: 1px solid rgba(34, 197, 94, .3); }
.flash.error { background: var(--red-bg); color: #fca5a5; border: 1px solid rgba(239, 68, 68, .3); }
.flash.info { background: rgba(99, 102, 241, .12); color: #c7d2fe; border: 1px solid rgba(99, 102, 241, .3); }

/* ---- dashboard */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 22px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; }
.card .n { font-size: 30px; font-weight: 800; letter-spacing: -.5px; }
.card .l { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.card .n.green { color: var(--green); } .card .n.red { color: var(--red); } .card .n.amber { color: var(--amber); }
.cols { display: grid; grid-template-columns: 3fr 2fr; gap: 22px; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 10px; }
.bars .day { flex: 1; display: flex; flex-direction: column-reverse; gap: 2px; align-items: stretch; min-width: 0; }
.bars .ok { background: var(--accent); border-radius: 3px 3px 0 0; }
.bars .bad { background: var(--red); border-radius: 3px 3px 0 0; opacity: .85; }
.bars-x { display: flex; gap: 6px; color: var(--dim); font-size: 10px; margin-top: 6px; }
.bars-x span { flex: 1; text-align: center; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; }
.list li:last-child { border-bottom: 0; }

/* ---- auth pages */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth .box { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 34px; }
.auth .brand { justify-content: center; padding-bottom: 18px; }
.auth p.lead { color: var(--muted); text-align: center; margin: -6px 0 22px; }

.kv { display: grid; grid-template-columns: 160px 1fr; gap: 10px 18px; }
.kv dt { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
.kv dd { margin: 0; }
pre.log { background: #0b0d14; border: 1px solid var(--line); border-radius: 10px; padding: 14px; white-space: pre-wrap; font-size: 12.5px; max-height: 420px; overflow: auto; }

@media (max-width: 1000px) { .cols { grid-template-columns: 1fr; } }
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; background: var(--bg); }
  .side { position: static; height: auto; padding: 16px; }
  .nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .nav hr, .side .who { display: none; }
  .brand { padding-bottom: 12px; }
  .main { padding: 22px 16px 40px; }
  .grid2 { grid-template-columns: 1fr; }
  dialog { padding: 22px 18px; }
}
