/* Lyra dashboard. Dark interface in the Avatar Copier lavender palette. */
:root {
  color-scheme: dark;
  --bg: #0e0c16;
  --bg-2: #13111d;
  --surface: #1b1828;
  --surface-2: #221e33;
  --surface-3: #2a253e;
  --border: rgba(188, 167, 246, 0.12);
  --border-strong: rgba(188, 167, 246, 0.24);
  --text: #f4efff;
  --text-2: #c9c1df;
  --text-3: #8f87a8;
  --accent: #bca7f6;
  --accent-2: #8b6fe0;
  --accent-ink: #1a1230;
  --good: #57c99a;
  --warn: #e7b450;
  --bad: #ef7f98;
  --info: #7fb2f5;
  /* Data series (validated against --surface: blue, orange). */
  --series-1: #3987e5;
  --series-2: #d95926;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --sidebar: 248px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(139, 111, 224, 0.16), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(57, 135, 229, 0.08), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; color: var(--text-2); }
p { margin: 0 0 8px; }
::selection { background: rgba(188, 167, 246, 0.35); }

/* ---- shell ---- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: linear-gradient(180deg, rgba(27, 24, 40, 0.92), rgba(19, 17, 29, 0.92));
  border-right: 1px solid var(--border);
  backdrop-filter: blur(12px);
  padding: 18px 12px; display: flex; flex-direction: column; gap: 4px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 13px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink);
  box-shadow: 0 6px 18px rgba(139, 111, 224, 0.45);
}
.brand-name { font-weight: 700; }
.brand-sub { font-size: 11.5px; color: var(--text-3); }
.nav-caption { font-size: 10.5px; letter-spacing: 0.08em; color: var(--text-3); padding: 14px 10px 4px; text-transform: uppercase; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--text-2); cursor: pointer;
  transition: background 0.15s, color 0.15s; border: 1px solid transparent; font-weight: 500;
}
.nav-item:hover { background: rgba(188, 167, 246, 0.07); color: var(--text); text-decoration: none; }
.nav-item.active { background: rgba(188, 167, 246, 0.14); color: var(--text); border-color: var(--border); }
.nav-item .ico { width: 18px; text-align: center; opacity: 0.9; }
.nav-item .count { margin-left: auto; background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 0 7px; font-size: 11px; font-weight: 700; }
.sidebar-foot { margin-top: auto; padding: 10px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--surface-3); object-fit: cover; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 24px;
  background: rgba(14, 12, 22, 0.78); backdrop-filter: blur(14px); border-bottom: 1px solid var(--border);
}
.topbar .title { font-weight: 650; font-size: 15px; }
.topbar .spacer { flex: 1; }
.content { padding: 22px 24px 60px; max-width: 1400px; width: 100%; }
.menu-btn { display: none; }

.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); display: inline-block; }
.dot.on { background: var(--good); box-shadow: 0 0 0 0 rgba(87, 201, 154, 0.6); animation: pulse 2s infinite; }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(87, 201, 154, 0.55); } 70% { box-shadow: 0 0 0 8px rgba(87, 201, 154, 0); } 100% { box-shadow: 0 0 0 0 rgba(87, 201, 154, 0); } }

/* ---- layout helpers ---- */
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.muted { color: var(--text-3); }
.small { font-size: 12px; }
.right { margin-left: auto; }
.mt { margin-top: 16px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { color: var(--text-3); margin: 4px 0 0; }

/* ---- cards ---- */
.card {
  background: linear-gradient(180deg, rgba(34, 30, 51, 0.72), rgba(27, 24, 40, 0.72));
  border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
  animation: rise 0.35s ease both; min-width: 0;
}
.card > .card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.stat .label { color: var(--text-3); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin-top: 4px; }
.stat .sub { color: var(--text-3); font-size: 12px; margin-top: 2px; }

/* ---- controls ---- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface-2); color: var(--text); font: inherit; font-weight: 550; cursor: pointer; transition: transform 0.08s, background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-3); border-color: rgba(188, 167, 246, 0.4); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { border-color: rgba(239, 127, 152, 0.45); color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.sm { padding: 4px 9px; font-size: 12.5px; border-radius: 8px; }
.input, select.input, textarea.input {
  width: 100%; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--bg-2); color: var(--text);
  font: inherit; outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(188, 167, 246, 0.18); }
textarea.input { min-height: 90px; resize: vertical; line-height: 1.45; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 12px; color: var(--text-2); font-weight: 550; }
.field .hint { font-size: 11.5px; color: var(--text-3); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.switch:last-child { border-bottom: 0; }
.switch .txt { display: flex; flex-direction: column; }
.switch .txt b { font-weight: 600; }
.switch .txt small { color: var(--text-3); }
.toggle { position: relative; width: 42px; height: 24px; flex: none; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle i { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border-strong); transition: background 0.2s; cursor: pointer; }
.toggle i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-2); transition: transform 0.2s cubic-bezier(.3,1.4,.6,1), background 0.2s; }
.toggle input:checked + i { background: rgba(188, 167, 246, 0.35); border-color: var(--accent); }
.toggle input:checked + i::after { transform: translateX(18px); background: var(--accent); }
.toggle input:focus-visible + i { box-shadow: 0 0 0 3px rgba(188, 167, 246, 0.3); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--bg-2); color: var(--text-2); cursor: pointer; font-size: 12.5px; user-select: none; }
.chip.on { background: rgba(188, 167, 246, 0.18); border-color: var(--accent); color: var(--text); }
.seg { display: inline-flex; background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; color: var(--text-2); padding: 5px 11px; border-radius: 8px; font: inherit; cursor: pointer; font-size: 12.5px; }
.seg button.on { background: var(--surface-3); color: var(--text); }

/* ---- badges & tables ---- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border); }
.badge.good { color: var(--good); border-color: rgba(87, 201, 154, 0.35); background: rgba(87, 201, 154, 0.08); }
.badge.warn { color: var(--warn); border-color: rgba(231, 180, 80, 0.35); background: rgba(231, 180, 80, 0.08); }
.badge.bad { color: var(--bad); border-color: rgba(239, 127, 152, 0.35); background: rgba(239, 127, 152, 0.08); }
.badge.accent { color: var(--accent); border-color: rgba(188, 167, 246, 0.35); background: rgba(188, 167, 246, 0.08); }
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--text-3); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid rgba(188, 167, 246, 0.06); vertical-align: top; }
tr.click { cursor: pointer; }
tr.click:hover td { background: rgba(188, 167, 246, 0.05); }
.trunc { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { text-align: center; padding: 30px 10px; color: var(--text-3); }

/* ---- drawer / modal / toast ---- */
.overlay { position: fixed; inset: 0; background: rgba(6, 5, 10, 0.6); backdrop-filter: blur(4px); z-index: 50; animation: fade 0.2s ease; }
@keyframes fade { from { opacity: 0; } }
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: min(760px, 100vw); z-index: 51; background: var(--bg-2); border-left: 1px solid var(--border-strong);
  box-shadow: -20px 0 60px rgba(0, 0, 0, 0.5); display: flex; flex-direction: column; animation: slide 0.25s cubic-bezier(.2,.8,.2,1);
}
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.drawer-body { padding: 16px 18px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 14px; }
.drawer-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: min(380px, calc(100vw - 36px)); }
.toast { background: var(--surface-2); border: 1px solid var(--border-strong); border-left: 3px solid var(--accent); border-radius: 12px; padding: 10px 14px; box-shadow: var(--shadow); animation: rise 0.25s ease; font-size: 13px; }
.toast.good { border-left-color: var(--good); }
.toast.bad { border-left-color: var(--bad); }
.toast.warn { border-left-color: var(--warn); }
.banner { padding: 10px 14px; border-radius: 12px; border: 1px solid rgba(231, 180, 80, 0.4); background: rgba(231, 180, 80, 0.08); color: var(--text); margin-bottom: 14px; }
.banner.bad { border-color: rgba(239, 127, 152, 0.4); background: rgba(239, 127, 152, 0.08); }
.banner.info { border-color: rgba(127, 178, 245, 0.4); background: rgba(127, 178, 245, 0.08); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; overflow-x: auto; }
.tabs button { background: transparent; border: 0; border-bottom: 2px solid transparent; color: var(--text-2); padding: 8px 12px; font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.tabs button .lang-ok { color: var(--good); margin-left: 4px; }

/* ---- Discord embed preview ---- */
.embed { background: #2b2d31; border-radius: 6px; border-left: 4px solid var(--accent); padding: 10px 14px 12px; color: #dbdee1; font: 14px/1.375 "gg sans", "Noto Sans", Helvetica, Arial, sans-serif; max-width: 520px; }
.embed .e-title { font-weight: 600; color: #f2f3f5; margin-bottom: 6px; }
.embed .e-desc { white-space: pre-wrap; word-break: break-word; }
.embed .e-field { margin-top: 8px; }
.embed .e-field b { display: block; color: #f2f3f5; font-size: 13px; }
.embed .e-foot { margin-top: 8px; font-size: 12px; color: #b5bac1; }

/* ---- charts ---- */
.chart { width: 100%; position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .grid-line { stroke: rgba(201, 193, 223, 0.08); stroke-width: 1; }
.chart .axis-label { fill: var(--text-3); font-size: 11px; }
.chart .tip {
  position: absolute; pointer-events: none; background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: 10px; padding: 7px 10px; font-size: 12px; white-space: nowrap;
  box-shadow: var(--shadow); transform: translate(-50%, calc(-100% - 10px)); z-index: 5;
}
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.barlist { display: flex; flex-direction: column; gap: 7px; }
.barlist .bl-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; font-size: 12.5px; }
.barlist .bl-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.barlist .bl-value { color: var(--text); font-variant-numeric: tabular-nums; }
.barlist .bl-track { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: rgba(201, 193, 223, 0.06); overflow: hidden; }
.barlist .bl-fill { height: 100%; border-radius: 4px; background: var(--series-1); transition: width 0.5s ease; }
.barlist .bl-row:hover .bl-fill { filter: brightness(1.15); }

.health-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.health-item:last-child { border-bottom: 0; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; word-break: break-word; }
pre.code { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 10px; overflow-x: auto; font-size: 12px; max-height: 300px; }

/* ---- login ---- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { width: min(440px, 100%); padding: 28px; text-align: center; }
.login .brand-mark { width: 54px; height: 54px; font-size: 18px; margin: 0 auto 14px; border-radius: 16px; }

/* ---- responsive ---- */
@media (max-width: 1100px) {
  .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; width: min(280px, 86vw); transform: translateX(-100%); transition: transform 0.25s ease; }
  .sidebar.open { transform: none; box-shadow: 20px 0 60px rgba(0, 0, 0, 0.5); }
  .menu-btn { display: inline-flex; }
  .content { padding: 16px 16px 60px; }
  .topbar { padding: 10px 16px; }
  .cols-2, .cols-3, .cols-4 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .kv { grid-template-columns: 1fr; }
  .stat .value { font-size: 22px; }
  .trunc { max-width: 200px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---- login steps ---- */
.login h1 { font-size: 20px; margin: 0 0 2px; }
.login .steps { text-align: left; margin: 16px 0; padding-left: 20px; color: var(--text-2); line-height: 1.6; }
.login .banner { text-align: left; }
.btn.block { width: 100%; justify-content: center; margin-bottom: 12px; }
.scrim { position: fixed; inset: 0; z-index: 39; background: rgba(6, 5, 10, 0.5); }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; z-index: 100; background: var(--surface-3); padding: 8px 12px; border-radius: 8px; }

/* ---- save bar ---- */
.savebar {
  position: sticky; bottom: 12px; z-index: 15; margin-top: 16px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  width: fit-content; max-width: 100%; padding: 8px; border-radius: 14px; border: 1px solid transparent; transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.savebar.dirty { background: var(--surface-2); border-color: var(--border-strong); box-shadow: var(--shadow); }
.savebar:not(.dirty) { position: static; padding-left: 0; }
