/* ============================================================
   Lizenz-Admin – Theme (schwarz / lila), vanilla CSS, no CDNs
   ============================================================ */

:root {
  --bg:        #07060b;
  --surface-1: #0f0d17;
  --surface-2: #15121f;
  --surface-3: #1c1830;
  --border:    #241f38;
  --border-strong: #322a4d;

  --accent:    #8b5cf6;
  --accent-lt: #a78bfa;
  --glow:      #7c3aed;
  --magenta:   #c026d3;

  --text:      #ECE9F5;
  --muted:     #8b86a3;
  --muted-2:   #635e7a;

  --green:  #34d399;
  --amber:  #fbbf24;
  --red:    #f87171;
  --grey:   #94a3b8;
  --cyan:   #22d3ee;
  --gold:   #fcd34d;

  --radius:    16px;
  --radius-sm: 10px;
  --radius-lg: 22px;

  --shadow-soft: 0 10px 40px -12px rgba(0,0,0,.6);
  --shadow-glow: 0 0 0 1px rgba(139,92,246,.15), 0 12px 42px -14px rgba(124,58,237,.45);

  --sidebar-w: 248px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  --mono: "SFMono-Regular", "Cascadia Code", "JetBrains Mono", Consolas, "Roboto Mono", ui-monospace, monospace;

  --ease: cubic-bezier(.22,.61,.36,1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

.hidden { display: none !important; }

/* ------------------------------------------------------------
   Aurora background
   ------------------------------------------------------------ */
.aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(1200px 700px at 15% -10%, rgba(124,58,237,.16), transparent 60%),
    radial-gradient(1000px 600px at 110% 10%, rgba(192,38,211,.12), transparent 55%),
    var(--bg);
}
.aurora-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .5;
  will-change: transform;
}
.aurora-blob--1 {
  width: 520px; height: 520px;
  background: radial-gradient(circle, rgba(139,92,246,.55), transparent 70%);
  top: -140px; left: -80px;
  animation: floatA 22s var(--ease) infinite alternate;
}
.aurora-blob--2 {
  width: 460px; height: 460px;
  background: radial-gradient(circle, rgba(192,38,211,.42), transparent 70%);
  bottom: -160px; right: -60px;
  animation: floatB 26s var(--ease) infinite alternate;
}
.aurora-blob--3 {
  width: 380px; height: 380px;
  background: radial-gradient(circle, rgba(34,211,238,.18), transparent 70%);
  top: 40%; left: 55%;
  animation: floatC 30s var(--ease) infinite alternate;
}
@keyframes floatA { to { transform: translate(120px, 80px) scale(1.1); } }
@keyframes floatB { to { transform: translate(-100px, -70px) scale(1.15); } }
@keyframes floatC { to { transform: translate(-140px, 60px) scale(.9); } }

/* ------------------------------------------------------------
   Shared: glass, buttons, inputs
   ------------------------------------------------------------ */
.glass {
  background: linear-gradient(160deg, rgba(21,18,31,.86), rgba(15,13,23,.9));
  border: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.btn {
  --btn-bg: var(--surface-2);
  --btn-fg: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: transform .15s var(--ease), box-shadow .2s var(--ease),
              background .2s var(--ease), border-color .2s var(--ease), opacity .2s;
  white-space: nowrap;
  user-select: none;
}
.btn:hover { transform: translateY(-1px); border-color: var(--accent); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn:focus-visible { outline: 2px solid var(--accent-lt); outline-offset: 2px; }

.btn-primary {
  --btn-bg: linear-gradient(135deg, var(--accent), var(--glow));
  --btn-fg: #fff;
  border-color: transparent;
  box-shadow: 0 6px 20px -8px rgba(124,58,237,.7);
}
.btn-primary:hover { box-shadow: 0 10px 30px -8px rgba(124,58,237,.9); border-color: transparent; }

.btn-ghost { background: transparent; border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }

.btn-danger { --btn-fg: #fecaca; border-color: rgba(248,113,113,.35); background: rgba(248,113,113,.08); }
.btn-danger:hover { border-color: var(--red); background: rgba(248,113,113,.16); }

.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn-xs { padding: 4px 9px; font-size: 11.5px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-icon-only { padding: 8px; }

.input, .select, .textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), background .18s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139,92,246,.2);
  background: var(--surface-2);
}
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.textarea { resize: vertical; min-height: 74px; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%238b86a3' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }

.checkbox {
  width: 17px; height: 17px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* toggle switch */
.switch { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  width: 42px; height: 24px; border-radius: 999px;
  background: var(--surface-3); border: 1px solid var(--border-strong);
  transition: background .2s var(--ease), border-color .2s;
  position: relative;
}
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--muted); transition: transform .2s var(--ease), background .2s;
}
.switch input:checked + .track { background: linear-gradient(135deg, var(--accent), var(--glow)); border-color: transparent; }
.switch input:checked + .track::after { transform: translateX(18px); background: #fff; }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px rgba(139,92,246,.3); }

/* ------------------------------------------------------------
   Login
   ------------------------------------------------------------ */
.login-screen {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow-glow);
  animation: pop .5s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.login-brand { text-align: center; margin-bottom: 26px; }
.login-logo {
  width: 58px; height: 58px; margin: 0 auto 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--glow));
  display: grid; place-items: center;
  box-shadow: 0 10px 30px -8px rgba(124,58,237,.8);
}
.login-logo svg { width: 32px; height: 32px; }
.login-title { margin: 0 0 4px; font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.login-sub { margin: 0; color: var(--muted); font-size: 13px; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-form .btn { margin-top: 6px; }

.form-error {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(248,113,113,.1);
  border: 1px solid rgba(248,113,113,.35);
  color: #fecaca;
  font-size: 13px;
  animation: shake .35s var(--ease);
}
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-5px)} 75%{transform:translateX(5px)} }

/* ------------------------------------------------------------
   App shell
   ------------------------------------------------------------ */
.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  background: linear-gradient(180deg, rgba(15,13,23,.92), rgba(9,8,14,.96));
  border-right: 1px solid var(--border);
  backdrop-filter: blur(12px);
  z-index: 40;
}
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 22px; }
.sidebar-logo {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--glow));
  display: grid; place-items: center;
  box-shadow: 0 6px 18px -6px rgba(124,58,237,.8);
  flex-shrink: 0;
}
.sidebar-logo svg { width: 20px; height: 20px; }
.sidebar-brand-text { font-weight: 700; font-size: 15px; letter-spacing: -.01em; }

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  text-decoration: none;
  font-weight: 600; font-size: 13.5px;
  border: 1px solid transparent;
  position: relative;
  transition: color .18s var(--ease), background .18s var(--ease), border-color .18s;
  cursor: pointer;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }
.nav-item:hover { color: var(--text); background: var(--surface-2); }
.nav-item.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(139,92,246,.22), rgba(124,58,237,.1));
  border-color: rgba(139,92,246,.35);
}
.nav-item.active::before {
  content: ""; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 22px; border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--accent), var(--magenta));
}
.nav-item.active svg { opacity: 1; }

.sidebar-footer { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-sm); background: var(--surface-1); border: 1px solid var(--border); }
.sidebar-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent-lt), var(--magenta));
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px;
}
.sidebar-user-meta { display: flex; flex-direction: column; min-width: 0; }
.sidebar-user-name { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11px; color: var(--muted); }

.sidebar-scrim {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 39;
  opacity: 0; pointer-events: none; transition: opacity .25s var(--ease);
}

/* topbar */
.main-wrap { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 26px;
  border-bottom: 1px solid var(--border);
  border-left: none; border-right: none; border-top: none;
}
.topbar-title { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -.01em; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.content { padding: 26px; flex: 1; min-width: 0; }

.icon-btn {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface-2); color: var(--text); cursor: pointer;
  transition: border-color .18s, background .18s;
}
.icon-btn:hover { border-color: var(--accent); background: var(--surface-3); }
.menu-icon, .menu-icon::before, .menu-icon::after {
  display: block; width: 18px; height: 2px; background: var(--text); border-radius: 2px; position: relative;
}
.menu-icon::before, .menu-icon::after { content: ""; position: absolute; left: 0; }
.menu-icon::before { top: -6px; } .menu-icon::after { top: 6px; }
.mobile-only { display: none; }

/* ------------------------------------------------------------
   Cards / layout helpers
   ------------------------------------------------------------ */
.card {
  background: linear-gradient(160deg, rgba(21,18,31,.7), rgba(15,13,23,.85));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}
.card-pad { padding: 20px; }
.card-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.card-title { margin: 0; font-size: 15px; font-weight: 700; }
.card-sub { color: var(--muted); font-size: 12.5px; margin: 2px 0 0; }

.section-title { margin: 0 0 14px; font-size: 15px; font-weight: 700; color: var(--text); }
.grid { display: grid; gap: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-end { justify-content: flex-end; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }

.animate-in { animation: fadeUp .4s var(--ease); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------
   Dashboard stat cards
   ------------------------------------------------------------ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.stat-card {
  position: relative;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(21,18,31,.8), rgba(15,13,23,.9));
  border: 1px solid var(--border);
  overflow: hidden;
  transition: transform .18s var(--ease), box-shadow .2s var(--ease), border-color .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-glow); border-color: var(--border-strong); }
.stat-card::after {
  content: ""; position: absolute; right: -30px; top: -30px; width: 90px; height: 90px;
  border-radius: 50%; background: radial-gradient(circle, var(--sc, rgba(139,92,246,.25)), transparent 70%);
  opacity: .8;
}
.stat-label { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); font-weight: 600; }
.stat-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sc-solid, var(--accent)); box-shadow: 0 0 8px var(--sc-solid, var(--accent)); }
.stat-value { font-size: 30px; font-weight: 800; margin-top: 8px; letter-spacing: -.02em; line-height: 1; }
.stat-value.small { font-size: 24px; }

.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 22px; }
.chart-box { padding: 18px 20px; }
.chart-svg { width: 100%; height: 180px; display: block; margin-top: 8px; }
.bar-rect { transition: opacity .15s; }
.bar-rect:hover { opacity: .8; }

.dash-lower { display: grid; grid-template-columns: 1fr; gap: 16px; }

/* ------------------------------------------------------------
   Tables
   ------------------------------------------------------------ */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.data {
  width: 100%; border-collapse: collapse; font-size: 13px; min-width: 720px;
}
table.data thead th {
  text-align: left; padding: 12px 14px;
  color: var(--muted); font-weight: 600; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--border); white-space: nowrap;
  background: var(--surface-1);
  position: sticky; top: 0; z-index: 2;
}
table.data th.sortable { cursor: pointer; user-select: none; }
table.data th.sortable:hover { color: var(--text); }
.sort-caret { display: inline-block; margin-left: 5px; opacity: .5; }
th.sorted .sort-caret { opacity: 1; color: var(--accent-lt); }
table.data tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: rgba(139,92,246,.06); }
table.data tbody tr.selected { background: rgba(139,92,246,.12); }
table.data tbody tr:last-child td { border-bottom: none; }
.td-actions { display: flex; gap: 6px; justify-content: flex-end; }
.col-check { width: 36px; }

.empty-state { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty-state svg { width: 44px; height: 44px; opacity: .4; margin-bottom: 10px; }

/* status badges */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
  border: 1px solid transparent; white-space: nowrap;
}
.badge .bdot { width: 7px; height: 7px; border-radius: 50%; }
.badge-active  { color: var(--green);  background: rgba(52,211,153,.12);  border-color: rgba(52,211,153,.3); }
.badge-active .bdot { background: var(--green); }
.badge-expired { color: var(--grey);   background: rgba(148,163,184,.12); border-color: rgba(148,163,184,.3); }
.badge-expired .bdot { background: var(--grey); }
.badge-paused  { color: var(--amber);  background: rgba(251,191,36,.12);  border-color: rgba(251,191,36,.3); }
.badge-paused .bdot { background: var(--amber); }
.badge-banned  { color: var(--red);    background: rgba(248,113,113,.12); border-color: rgba(248,113,113,.35); }
.badge-banned .bdot { background: var(--red); }
.badge-unused  { color: var(--accent-lt); background: rgba(139,92,246,.14); border-color: rgba(139,92,246,.32); }
.badge-unused .bdot { background: var(--accent-lt); }
.badge-lifetime{ color: var(--cyan);   background: rgba(34,211,238,.12);  border-color: rgba(34,211,238,.32); }
.badge-lifetime .bdot { background: var(--cyan); }

.badge-type {
  color: var(--accent-lt); background: rgba(139,92,246,.1);
  border-color: rgba(139,92,246,.25); font-family: var(--mono); font-size: 11px;
}
.badge-type.admin { color: var(--magenta); background: rgba(192,38,211,.1); border-color: rgba(192,38,211,.28); }
.badge-type.err { color: var(--red); background: rgba(248,113,113,.1); border-color: rgba(248,113,113,.28); }

.online-pill { display: inline-flex; align-items: center; gap: 6px; color: var(--green); font-weight: 600; font-size: 12px; }
.online-pill .bdot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* toolbar / filters */
.toolbar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin-bottom: 16px;
}
.toolbar .search { position: relative; flex: 1; min-width: 200px; max-width: 340px; }
.toolbar .search .input { padding-left: 36px; }
.toolbar .search .search-ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted-2); pointer-events: none; }
.toolbar .search .search-ic svg { width: 16px; height: 16px; display: block; }

.pagination { display: flex; align-items: center; gap: 10px; justify-content: space-between; margin-top: 16px; flex-wrap: wrap; }
.pagination .pg-info { color: var(--muted); font-size: 12.5px; }
.pagination .pg-controls { display: flex; align-items: center; gap: 6px; }

/* bulk bar */
.bulk-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; margin-bottom: 14px;
  background: linear-gradient(135deg, rgba(139,92,246,.16), rgba(124,58,237,.06));
  border: 1px solid rgba(139,92,246,.35);
  border-radius: var(--radius-sm);
  animation: fadeUp .25s var(--ease);
}
.bulk-bar .bulk-count { font-weight: 700; color: var(--accent-lt); }

/* key cell */
.key-cell { display: flex; align-items: center; gap: 8px; }
.key-mono { font-family: var(--mono); font-size: 12.5px; letter-spacing: .02em; }
.copy-btn {
  border: none; background: transparent; color: var(--muted); cursor: pointer;
  padding: 3px; border-radius: 6px; display: inline-grid; place-items: center; transition: color .15s, background .15s;
}
.copy-btn:hover { color: var(--accent-lt); background: var(--surface-3); }
.copy-btn svg { width: 14px; height: 14px; }

.remaining-good { color: var(--text); }
.remaining-warn { color: var(--amber); }
.remaining-bad { color: var(--red); }
.remaining-none { color: var(--muted-2); }

/* ------------------------------------------------------------
   Skeleton loaders
   ------------------------------------------------------------ */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: 6px;
}
@keyframes shimmer { 0%{background-position:100% 0} 100%{background-position:-100% 0} }
.sk-line { height: 12px; margin: 8px 0; }
.sk-row { height: 44px; margin: 6px 0; border-radius: 8px; }
.sk-card { height: 96px; border-radius: var(--radius); }
.sk-chart { height: 180px; border-radius: var(--radius); }

/* ------------------------------------------------------------
   Modal
   ------------------------------------------------------------ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(4,3,8,.66);
  backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 20px;
  animation: fadeIn .2s var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glow);
  animation: pop .28s var(--ease);
}
.modal.wide { max-width: 620px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 12px; }
.modal-title { margin: 0; font-size: 17px; font-weight: 700; }
.modal-body { padding: 4px 22px 8px; display: flex; flex-direction: column; gap: 16px; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 22px 22px; flex-wrap: wrap; }
.modal-close { border: none; background: transparent; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 8px; display: grid; place-items: center; }
.modal-close:hover { color: var(--text); background: var(--surface-2); }
.modal-close svg { width: 18px; height: 18px; }

.form-grid { display: flex; flex-direction: column; gap: 14px; }
.form-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.inline-radio { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface-1); cursor: pointer; font-size: 13px; font-weight: 600; transition: all .16s var(--ease);
}
.radio-chip:hover { border-color: var(--accent); }
.radio-chip input { position: absolute; opacity: 0; }
.radio-chip.checked { background: linear-gradient(135deg, rgba(139,92,246,.24), rgba(124,58,237,.1)); border-color: var(--accent); color: #fff; }

.created-keys {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px; max-height: 240px; overflow-y: auto; font-family: var(--mono); font-size: 12.5px;
  display: flex; flex-direction: column; gap: 4px;
}
.created-keys .ck { display: flex; justify-content: space-between; align-items: center; padding: 3px 0; }

/* ------------------------------------------------------------
   Drawer (key detail)
   ------------------------------------------------------------ */
.drawer-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(4,3,8,.55); backdrop-filter: blur(3px);
  animation: fadeIn .2s var(--ease);
}
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: 480px; max-width: 94vw;
  z-index: 91;
  background: linear-gradient(180deg, rgba(21,18,31,.98), rgba(12,10,18,.99));
  border-left: 1px solid var(--border-strong);
  box-shadow: -20px 0 60px -20px rgba(0,0,0,.7);
  display: flex; flex-direction: column;
  animation: slideIn .3s var(--ease);
  overflow: hidden;
}
@keyframes slideIn { from { transform: translateX(30px); opacity: .4; } to { transform: none; opacity: 1; } }
.drawer-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px; border-bottom: 1px solid var(--border); }
.drawer-body { padding: 20px 22px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 20px; }
.drawer-title { margin: 0; font-size: 16px; font-weight: 700; }

.detail-key {
  display: flex; align-items: center; gap: 10px; justify-content: space-between;
  padding: 14px 16px; border-radius: var(--radius-sm);
  background: var(--surface-1); border: 1px solid var(--border-strong);
}
.detail-key .dk-key { font-family: var(--mono); font-size: 15px; font-weight: 700; letter-spacing: .04em; word-break: break-all; }

.detail-list { display: grid; grid-template-columns: 1fr; gap: 0; }
.detail-row { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.detail-row:last-child { border-bottom: none; }
.detail-row .dl-label { color: var(--muted); font-weight: 600; }
.detail-row .dl-value { text-align: right; word-break: break-word; }

.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.event-log { display: flex; flex-direction: column; gap: 8px; }
.event-item { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-1); border: 1px solid var(--border); }
.event-item .ei-top { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.event-item .ei-time { color: var(--muted); font-size: 11.5px; }
.event-item .ei-detail { color: var(--muted); font-size: 12px; margin-top: 4px; word-break: break-word; }

/* ------------------------------------------------------------
   Toasts
   ------------------------------------------------------------ */
.toast-root {
  position: fixed; bottom: 22px; right: 22px; z-index: 200;
  display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 10px;
  min-width: 240px; max-width: 380px;
  padding: 12px 15px; border-radius: var(--radius-sm);
  background: linear-gradient(160deg, rgba(28,24,48,.97), rgba(18,15,28,.98));
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-soft);
  animation: toastIn .3s var(--ease);
  font-size: 13px; font-weight: 500;
}
.toast.leaving { animation: toastOut .25s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }
.toast .t-ic { width: 20px; height: 20px; flex-shrink: 0; display: grid; place-items: center; }
.toast .t-ic svg { width: 20px; height: 20px; }
.toast.success { border-color: rgba(52,211,153,.4); }
.toast.success .t-ic { color: var(--green); }
.toast.error { border-color: rgba(248,113,113,.45); }
.toast.error .t-ic { color: var(--red); }
.toast.info .t-ic { color: var(--accent-lt); }

/* settings */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.setting-row:last-child { border-bottom: none; }
.setting-row .sr-meta { display: flex; flex-direction: column; gap: 2px; }
.setting-row .sr-title { font-weight: 600; font-size: 13.5px; }
.setting-row .sr-desc { color: var(--muted); font-size: 12px; }

.info-block {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; word-break: break-all; font-family: var(--mono); font-size: 12px; line-height: 1.6;
  position: relative;
}
.pubkey-note { color: var(--accent-lt); font-size: 12.5px; margin-top: 8px; display: flex; align-items: center; gap: 6px; }

.spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.3); border-top-color: #fff;
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------
   Responsive
   ------------------------------------------------------------ */
@media (max-width: 1000px) {
  .chart-grid { grid-template-columns: 1fr; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; width: 260px;
    transform: translateX(-100%); transition: transform .28s var(--ease);
  }
  .app-shell.sidebar-open .sidebar { transform: none; }
  .app-shell.sidebar-open .sidebar-scrim { opacity: 1; pointer-events: auto; }
  .mobile-only { display: grid; }
  .form-two { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .content { padding: 16px; }
  .topbar { padding: 12px 16px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .modal { max-width: 100%; }
  .action-grid { grid-template-columns: 1fr; }
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .aurora-blob { animation: none !important; }
}

/* scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); background-clip: padding-box; }
