/* License Hub · admin panel */

:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f2f3f8;
  --surface-3: #e9ebf3;
  --border: #e3e6ef;
  --border-strong: #cfd4e2;
  --text: #11142a;
  --text-2: #3a3f58;
  --muted: #6a7089;
  --accent: #6c5ce7;
  --accent-2: #8b7cf6;
  --accent-soft: rgba(108, 92, 231, 0.1);
  --accent-text: #ffffff;
  --success: #12a150;
  --success-soft: rgba(18, 161, 80, 0.11);
  --warning: #c77700;
  --warning-soft: rgba(217, 119, 6, 0.12);
  --danger: #d92d20;
  --danger-soft: rgba(217, 45, 32, 0.1);
  --info: #2463eb;
  --info-soft: rgba(36, 99, 235, 0.1);
  --neutral-soft: rgba(106, 112, 137, 0.12);
  --shadow-sm: 0 1px 2px rgba(16, 20, 40, 0.05);
  --shadow: 0 1px 2px rgba(16, 20, 40, 0.04), 0 4px 16px rgba(16, 20, 40, 0.05);
  --shadow-lg: 0 10px 40px rgba(16, 20, 40, 0.16), 0 2px 6px rgba(16, 20, 40, 0.06);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --sidebar: 252px;
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0c13;
    --surface: #11141e;
    --surface-2: #171b27;
    --surface-3: #1f2433;
    --border: #232839;
    --border-strong: #31374b;
    --text: #eceef6;
    --text-2: #c3c7d6;
    --muted: #8a90a8;
    --accent: #8b7cf6;
    --accent-2: #a597ff;
    --accent-soft: rgba(139, 124, 246, 0.15);
    --success: #3ccf7d;
    --success-soft: rgba(60, 207, 125, 0.13);
    --warning: #f0a83a;
    --warning-soft: rgba(240, 168, 58, 0.14);
    --danger: #ff6b5e;
    --danger-soft: rgba(255, 107, 94, 0.13);
    --info: #6aa2ff;
    --info-soft: rgba(106, 162, 255, 0.14);
    --neutral-soft: rgba(138, 144, 168, 0.16);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 18px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 16px 50px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 22px; letter-spacing: -0.02em; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0; }
code, .mono { font-family: var(--mono); font-size: 0.92em; }
::selection { background: var(--accent-soft); }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* — Boot & spinner — */
.boot { min-height: 100vh; display: grid; place-items: center; }
.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2.5px solid var(--border-strong); border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}
.spinner.sm { width: 16px; height: 16px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* — Shell — */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 16px 12px 12px; gap: 14px;
  z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; }
.brand-logo { width: 30px; height: 30px; border-radius: 9px; flex: none; }
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.brand-sub { color: var(--muted); font-size: 11.5px; line-height: 1.2; }

.app-switch { position: relative; }
.app-switch select {
  width: 100%; appearance: none; -webkit-appearance: none;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; padding: 9px 34px 9px 34px; font: 500 13px/1.3 var(--font); cursor: pointer;
  transition: border-color 0.15s;
}
.app-switch select:hover { border-color: var(--border-strong); }
.app-switch .dot { position: absolute; left: 13px; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 3px; background: var(--accent); pointer-events: none; }
.app-switch .chev { position: absolute; right: 12px; top: 50%; margin-top: -3px; pointer-events: none; color: var(--muted); }

.nav { display: flex; flex-direction: column; gap: 1px; flex: 1; }
.nav-label { color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; padding: 12px 10px 4px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px;
  color: var(--text-2); font-weight: 500; text-decoration: none; position: relative;
  transition: background 0.15s, color 0.15s;
}
.nav a svg { width: 17px; height: 17px; flex: none; color: var(--muted); transition: color 0.15s; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav a.active svg { color: var(--accent); }
.nav a .count { margin-left: auto; background: var(--warning-soft); color: var(--warning); font-size: 11px; font-weight: 600; border-radius: 99px; padding: 0 7px; }

.sidebar-foot { border-top: 1px solid var(--border); padding-top: 10px; display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: #fff; font-weight: 600; font-size: 13px;
}
.who { min-width: 0; flex: 1; }
.who .email { font-weight: 500; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who .role { color: var(--muted); font-size: 11.5px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: none; position: sticky; top: 0; z-index: 30; align-items: center; gap: 10px;
  padding: 10px 16px; background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}
.content { padding: 28px 32px 60px; max-width: 1320px; width: 100%; margin: 0 auto; }
.view { animation: viewIn 0.28s var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.scrim { display: none; }

@media (max-width: 920px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: min(var(--sidebar), 86vw);
    transform: translateX(-102%); transition: transform 0.25s var(--ease); box-shadow: var(--shadow-lg);
  }
  .shell.nav-open .sidebar { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; background: rgba(5, 7, 15, 0.45); z-index: 35; opacity: 0; pointer-events: none; transition: opacity 0.25s; }
  .shell.nav-open .scrim { opacity: 1; pointer-events: auto; }
  .topbar { display: flex; }
  .content { padding: 20px 16px 48px; }
}

/* — Page header — */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumbs { color: var(--muted); font-size: 12.5px; margin-bottom: 6px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); }

/* — Buttons — */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: 550 13px/1 var(--font); cursor: pointer;
  white-space: nowrap; text-decoration: none; box-shadow: var(--shadow-sm);
  transition: background 0.15s, border-color 0.15s, transform 0.08s, box-shadow 0.15s, color 0.15s;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled='true'] { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn svg { width: 15px; height: 15px; flex: none; }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--accent-text); box-shadow: 0 1px 2px rgba(60, 40, 200, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.15); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn.danger.solid { background: var(--danger); color: #fff; border-color: transparent; }
.btn.danger.solid:hover { background: color-mix(in srgb, var(--danger) 88%, #000); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn.xs { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 7px; }
.btn.icon { width: 36px; padding: 0; }
.btn.icon.sm { width: 30px; }
.btn.loading { color: transparent !important; position: relative; pointer-events: none; }
.btn.loading::after {
  content: ''; position: absolute; width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--muted) var(--muted) var(--muted) transparent; animation: spin 0.6s linear infinite;
}
.btn.primary.loading::after { border-color: #fff #fff #fff transparent; }

/* — Cards — */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head .hint { color: var(--muted); font-size: 12.5px; }
.card-body { padding: 18px; }
.card + .card, .stack > * + * { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.side { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.side { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) { .grid.two, .grid.three, .grid.side { grid-template-columns: minmax(0, 1fr); } }

/* — KPIs — */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .kpis .kpi { grid-column: span 2; }
  .kpis .kpi:nth-child(4), .kpis .kpi:nth-child(5) { grid-column: span 3; }
}
@media (max-width: 680px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis .kpi, .kpis .kpi:nth-child(4), .kpis .kpi:nth-child(5) { grid-column: auto; }
  .kpis .kpi:first-child { grid-column: 1 / -1; }
  .kpi .value { font-size: 21px; }
}
.kpi { padding: 16px 16px 15px; position: relative; overflow: hidden; animation: rise 0.4s var(--ease) both; }
.kpi:nth-child(2) { animation-delay: 0.04s; } .kpi:nth-child(3) { animation-delay: 0.08s; } .kpi:nth-child(4) { animation-delay: 0.12s; } .kpi:nth-child(5) { animation-delay: 0.16s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.kpi .label { color: var(--muted); font-size: 12.5px; font-weight: 500; display: flex; align-items: center; gap: 7px; }
.kpi .label .ico { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.kpi .label .ico svg { width: 15px; height: 15px; }
.kpi .value { font-size: 25px; font-weight: 700; letter-spacing: -0.025em; margin-top: 10px; font-variant-numeric: tabular-nums; line-height: 1.15; overflow-wrap: anywhere; }
.kpi .foot { color: var(--muted); font-size: 12px; margin-top: 4px; }
.kpi.warn .label .ico { background: var(--warning-soft); color: var(--warning); }
.kpi.ok .label .ico { background: var(--success-soft); color: var(--success); }
.kpi.info .label .ico { background: var(--info-soft); color: var(--info); }

/* — Chart — */
.chart { position: relative; height: 240px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; shape-rendering: crispEdges; }
.chart .axis-text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .area { fill: url(#chartFill); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.draw { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: draw 0.9s var(--ease) forwards; }
.chart .area.fade { animation: fadeIn 0.7s 0.2s ease both; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.chart .bar { fill: var(--accent); opacity: 0.85; transition: opacity 0.15s; }
.chart .bar:hover { opacity: 1; }
.chart .cursor { stroke: var(--border-strong); stroke-dasharray: 3 3; }
.chart .dot { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.chart-tip {
  position: absolute; pointer-events: none; background: var(--text); color: var(--bg); border-radius: 8px;
  padding: 6px 9px; font-size: 12px; line-height: 1.35; white-space: nowrap; transform: translate(-50%, -100%);
  box-shadow: var(--shadow-lg); opacity: 0; transition: opacity 0.12s;
}
.chart-tip.show { opacity: 1; }
.chart-tip b { font-weight: 650; }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 2px; gap: 2px; }
.seg button {
  border: 0; background: transparent; color: var(--muted); font: 550 12.5px/1 var(--font); padding: 7px 10px; border-radius: 7px; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* — Breakdown bars — */
.breakdown { display: flex; flex-direction: column; gap: 13px; }
.breakdown .row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: baseline; }
.breakdown .name { font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.breakdown .num { font-variant-numeric: tabular-nums; font-weight: 600; }
.breakdown .num small { color: var(--muted); font-weight: 500; margin-left: 6px; }
.breakdown .track { grid-column: 1 / -1; height: 6px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.breakdown .fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); width: 0; transition: width 0.7s var(--ease); }

/* — Tables — */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-weight: 550; color: var(--muted); font-size: 12px; padding: 10px 14px;
  border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface);
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background 0.12s; }
.table tbody tr.click { cursor: pointer; }
.table tbody tr.click:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .nowrap { white-space: nowrap; }
.table .muted { color: var(--muted); }
.table .strong { font-weight: 600; }
.table .ellipsis { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table tfoot td { font-weight: 650; border-top: 1px solid var(--border-strong); border-bottom: 0; }
.cell-main { font-weight: 550; }
.cell-sub { color: var(--muted); font-size: 12px; }

/* — Badges — */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600; background: var(--neutral-soft); color: var(--muted); white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }

.key {
  font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.02em; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 6px; padding: 2px 6px; white-space: nowrap;
}

/* — Toolbar & forms — */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.toolbar .grow { flex: 1 1 220px; min-width: 0; }
.search { position: relative; }
.search svg { position: absolute; left: 11px; top: 50%; margin-top: -8px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.search input { padding-left: 34px; }

.input, select.input, textarea.input {
  width: 100%; height: 36px; padding: 0 11px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: 13.5px/1.4 var(--font);
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea.input { height: auto; min-height: 88px; padding: 9px 11px; resize: vertical; }
select.input {
  appearance: none; -webkit-appearance: none; padding-right: 30px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none' stroke='%238a90a8' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
.input:hover { border-color: var(--border-strong); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.input.mono { font-family: var(--mono); font-size: 12.5px; }
.input::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.toolbar .input { width: auto; }
.toolbar .search .input { width: 100%; }
input[type='color'].input, .field .row input[type='color'].input { padding: 3px; width: 46px; flex: none; cursor: pointer; }

.form { display: grid; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid, .form-grid.three { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .label { font-weight: 550; font-size: 12.5px; color: var(--text-2); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.field .hint { color: var(--muted); font-size: 12px; }
.field .row { display: flex; gap: 8px; align-items: center; }
.field .row .input { flex: 1; }
.check { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; font-size: 13px; user-select: none; }
.check input { margin: 2px 0 0; width: 16px; height: 16px; accent-color: var(--accent); flex: none; cursor: pointer; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding-top: 4px; }
.form-error {
  background: var(--danger-soft); color: var(--danger); border-radius: 9px; padding: 9px 12px; font-size: 13px; font-weight: 500;
  animation: shake 0.35s ease;
}
@keyframes shake { 20%, 60% { transform: translateX(-3px); } 40%, 80% { transform: translateX(3px); } }

/* Switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 38px; height: 22px; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--border-strong); position: relative; transition: background 0.2s, border-color 0.2s; flex: none; }
.switch .track::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.22s var(--ease);
}
.switch input:checked + .track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled + .track { opacity: 0.5; }

/* — Tabs — */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  padding: 10px 12px; color: var(--muted); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px;
  white-space: nowrap; text-decoration: none; transition: color 0.15s, border-color 0.2s;
}
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); }

/* — Definition list — */
.dl { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 10px 18px; margin: 0; }
.dl dt { color: var(--muted); font-size: 12.5px; }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; font-weight: 500; }
@media (max-width: 480px) { .dl { grid-template-columns: 1fr; gap: 2px; } .dl dd { margin-bottom: 10px; } }

/* — Key hero — */
.hero-key {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 18px; border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent-soft), transparent 70%), var(--surface); border: 1px solid var(--border);
}
.hero-key .k { font-family: var(--mono); font-size: 18px; font-weight: 500; letter-spacing: 0.04em; overflow-wrap: anywhere; flex: 1 1 240px; }
@media (max-width: 480px) { .hero-key .k { font-size: 15px; } }

.copy-row { display: flex; gap: 8px; align-items: stretch; }
.copy-row .input { flex: 1; min-width: 0; }

/* — Timeline — */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 16px 26px; }
.timeline li::before { content: ''; position: absolute; left: 7px; top: 18px; bottom: -2px; width: 1px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline .pin { position: absolute; left: 0; top: 3px; width: 15px; height: 15px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border-strong); }
.timeline .pin.success { border-color: var(--success); } .timeline .pin.danger { border-color: var(--danger); }
.timeline .pin.accent { border-color: var(--accent); } .timeline .pin.warning { border-color: var(--warning); }
.timeline .t-title { font-weight: 550; }
.timeline .t-meta { color: var(--muted); font-size: 12px; }
.timeline .t-detail { color: var(--text-2); font-size: 12.5px; margin-top: 3px; overflow-wrap: anywhere; }

/* — Empty / notices — */
.empty { text-align: center; padding: 42px 20px; color: var(--muted); }
.empty .e-ico { width: 44px; height: 44px; margin: 0 auto 12px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.empty .e-ico svg { width: 22px; height: 22px; }
.empty h3 { color: var(--text); margin-bottom: 4px; }
.empty .btn { margin-top: 14px; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: var(--info-soft); color: var(--text-2); font-size: 13px; }
.notice svg { width: 17px; height: 17px; flex: none; margin-top: 1px; color: var(--info); }
.notice.warning { background: var(--warning-soft); } .notice.warning svg { color: var(--warning); }
.notice.danger { background: var(--danger-soft); } .notice.danger svg { color: var(--danger); }
.notice.success { background: var(--success-soft); } .notice.success svg { color: var(--success); }
.notice b { color: var(--text); }

/* — Pagination — */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12.5px; flex-wrap: wrap; }
.pager .btns { display: flex; gap: 6px; }

/* — Skeleton — */
.skel { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; border-radius: 8px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.skel-page { display: grid; gap: 16px; }
.skel-page .s1 { height: 34px; width: 40%; } .skel-page .s2 { height: 110px; } .skel-page .s3 { height: 280px; }

/* — App cards — */
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.app-card { padding: 18px; display: flex; flex-direction: column; gap: 14px; cursor: pointer; text-decoration: none; color: inherit; transition: transform 0.18s var(--ease), box-shadow 0.18s, border-color 0.18s; }
.app-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); text-decoration: none; }
.app-card .top { display: flex; gap: 12px; align-items: center; }
.app-icon { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 17px; flex: none; box-shadow: inset 0 -2px 0 rgba(0,0,0,0.12); }
.app-card .stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; border-top: 1px solid var(--border); padding-top: 12px; }
.app-card .stats .v { font-weight: 650; font-size: 16px; font-variant-numeric: tabular-nums; }
.app-card .stats .l { color: var(--muted); font-size: 12px; }

/* — Payment methods — */
.method { padding: 0; overflow: hidden; }
.method .m-head { display: flex; align-items: center; gap: 14px; padding: 16px 18px; flex-wrap: wrap; }
.method .m-title { flex: 1; min-width: 180px; }
.method .m-title .d { color: var(--muted); font-size: 12.5px; }
.method .m-body { border-top: 1px solid var(--border); padding: 16px 18px; background: var(--surface-2); display: grid; gap: 14px; }
.method .m-body .input { background: var(--surface); }

/* — Code — */
pre.code {
  margin: 0; padding: 14px 16px; border-radius: 10px; background: #0d1020; color: #d9dcf0; overflow-x: auto;
  font: 12.5px/1.6 var(--mono); border: 1px solid #1f2438;
}
.code-wrap { position: relative; }
.code-wrap .btn { position: absolute; top: 8px; right: 8px; background: rgba(255,255,255,0.08); color: #d9dcf0; border-color: rgba(255,255,255,0.12); box-shadow: none; }
.code-wrap .btn:hover { background: rgba(255,255,255,0.16); }
.secret-box { font-family: var(--mono); font-size: 14px; padding: 12px 14px; border-radius: 10px; border: 1px dashed var(--border-strong); background: var(--surface-2); overflow-wrap: anywhere; user-select: all; }

/* — Modal — */
dialog.modal {
  border: 0; padding: 0; background: transparent; color: var(--text); max-width: min(560px, calc(100vw - 24px)); width: 100%;
  max-height: calc(100vh - 32px); overflow: visible;
}
dialog.modal.wide { max-width: min(720px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(6, 8, 18, 0.5); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: fadeIn 0.2s ease; }
dialog.modal[open] .sheet { animation: pop 0.24s var(--ease); }
dialog.modal.closing .sheet { animation: popOut 0.16s ease forwards; }
dialog.modal.closing::backdrop { opacity: 0; transition: opacity 0.16s; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes popOut { to { opacity: 0; transform: translateY(6px) scale(0.98); } }
.sheet { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 0; }
.sheet-head h2 { font-size: 16.5px; }
.sheet-body { padding: 16px 18px; overflow-y: auto; display: grid; gap: 14px; }
.sheet-body > p { color: var(--text-2); }
.sheet-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 18px 18px; flex-wrap: wrap; }
@media (max-width: 480px) { .sheet-foot .btn { flex: 1; } }

/* — Toasts — */
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; pointer-events: none; max-width: calc(100vw - 32px); }
.toast {
  pointer-events: auto; display: flex; gap: 10px; align-items: flex-start; min-width: 260px; max-width: 400px;
  background: var(--text); color: var(--bg); padding: 11px 14px; border-radius: 11px; box-shadow: var(--shadow-lg); font-size: 13px; font-weight: 500;
  animation: toastIn 0.3s var(--ease);
}
.toast svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.toast.success svg { color: #4ade80; } .toast.error svg { color: #ff7b70; }
@media (prefers-color-scheme: dark) { .toast.success svg { color: #15803d; } .toast.error svg { color: #c62828; } }
.toast.out { animation: toastOut 0.2s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px); } }
@media (max-width: 520px) { .toasts { left: 16px; right: 16px; } .toast { min-width: 0; max-width: none; } }

/* — Login — */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background:
    radial-gradient(900px 500px at 15% -10%, var(--accent-soft), transparent 60%),
    radial-gradient(700px 400px at 100% 110%, var(--info-soft), transparent 60%), var(--bg);
}
.login-card { width: 100%; max-width: 380px; padding: 30px 26px 26px; animation: rise 0.45s var(--ease) both; }
.login-card .brand { padding: 0; margin-bottom: 22px; }
.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-card .sub { color: var(--muted); margin-bottom: 20px; }
.login-card .btn.primary { width: 100%; height: 40px; }
.code-input { font-family: var(--mono); font-size: 20px !important; letter-spacing: 0.4em; text-align: center; height: 46px !important; }
.reveal { animation: rise 0.3s var(--ease) both; }
.login-foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 18px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
/* Language selector (EN | ES): on the login card and above the account in the sidebar. */
.lang-switch { display: inline-flex; gap: 2px; padding: 2px; border-radius: 9px; background: var(--surface-2); }
.lang-switch .btn { min-width: 38px; color: var(--muted); font-weight: 600; letter-spacing: 0.02em; }
.lang-switch .btn.active { color: var(--text); background: var(--surface, transparent); box-shadow: 0 1px 2px rgb(0 0 0 / 0.12); }
.lang-switch.compact { align-self: flex-start; margin: 8px 0 10px; }

/* — Misc — */
.row-gap { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.between { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; }
.mt { margin-top: 16px; }
.mt-s { margin-top: 8px; }
.divider { height: 1px; background: var(--border); margin: 4px 0; }
.swatch { width: 12px; height: 12px; border-radius: 4px; display: inline-block; vertical-align: -1px; }
.section-title { font-size: 13px; font-weight: 650; color: var(--text-2); margin: 24px 0 10px; text-transform: uppercase; letter-spacing: 0.05em; }
.pre-line { white-space: pre-line; }
.json { font-family: var(--mono); font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-2); border-radius: 8px; padding: 10px 12px; margin: 0; max-height: 260px; overflow: auto; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* Icons without an explicit size never blow up (zero specificity: any rule above wins). */
:where(svg[aria-hidden='true']:not([width])) { width: 18px; height: 18px; flex: none; }
.hero-key > svg { width: 22px; height: 22px; color: var(--accent); }
.kpis > .card, .grid > .card, .grid > .stack, .app-grid > .card { margin-top: 0; }

/* Updates: upload progress */
.progress { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width 0.2s var(--ease); }
