@font-face { font-family: "Unbounded"; src: url(Unbounded.woff2) format("woff2"); font-weight: 200 900; font-display: swap; }
@font-face { font-family: "Manrope"; src: url(Manrope.woff2) format("woff2"); font-weight: 200 800; font-display: swap; }

:root {
  color-scheme: light;
  --bg: #f4f3ef;
  --surface: #ffffff;
  --surface-2: #f0eee8;
  --border: #e4e1d8;
  --text: #15132b;
  --text-2: #4d4a62;
  --muted: #7a7790;
  --accent: #5c34d6;
  --accent-ink: #ffffff;
  --gold: #ffc531;
  --gold-ink: #241500;
  --gold-grad: linear-gradient(135deg, #ffe896, #ffc531 50%, #e58c16);
  --series-1: #c98500;
  --series-2: #7c5cff;
  --good-bg: #e2f5ea; --good: #146b3a;
  --warn-bg: #fdf0d2; --warn: #7a5200;
  --bad-bg: #fbe3e3; --bad: #a32626;
  --neutral-bg: #eceae4; --neutral: #4d4a62;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 18, 43, .05), 0 4px 16px rgba(20, 18, 43, .04);
  --side-bg: #0b1026;
  --side-text: #a9b0d6;
  --side-active: rgba(255, 197, 49, .12);
  --font: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Unbounded", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #070a1c; --surface: #0f1430; --surface-2: #161d42; --border: #232b55;
    --text: #f6f1e6; --text-2: #c4c8e4; --muted: #8890b8;
    --accent: #b8a6ff; --accent-ink: #120a33;
    --series-1: #c98500; --series-2: #9085e9;
    --good-bg: #12301f; --good: #7fe0a6;
    --warn-bg: #33270b; --warn: #ffd36b;
    --bad-bg: #3a1620; --bad: #ff9a9a;
    --neutral-bg: #1c2350; --neutral: #c4c8e4;
    --shadow: none;
    --side-bg: #0b1026;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #070a1c; --surface: #0f1430; --surface-2: #161d42; --border: #232b55;
  --text: #f6f1e6; --text-2: #c4c8e4; --muted: #8890b8;
  --accent: #b8a6ff; --accent-ink: #120a33;
  --series-1: #c98500; --series-2: #9085e9;
  --good-bg: #12301f; --good: #7fe0a6;
  --warn-bg: #33270b; --warn: #ffd36b;
  --bad-bg: #3a1620; --bad: #ff9a9a;
  --neutral-bg: #1c2350; --neutral: #c4c8e4;
  --shadow: none;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 500 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font: 800 24px/1.2 var(--font-display); margin: 0 0 22px; letter-spacing: -.02em; }
h2 { font-size: 15px; margin: 0 0 14px; font-weight: 800; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; text-align: right; }

/* layout */
.layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar {
  background: radial-gradient(120% 50% at 0% 0%, rgba(92, 52, 214, .35), transparent 70%), var(--side-bg);
  color: var(--side-text); border-right: 1px solid rgba(255, 255, 255, .06);
  padding: 20px 12px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 8px; padding: 4px 10px 22px; font: 800 18px/1 var(--font-display); letter-spacing: -.01em; }
.brand img { width: 24px; height: 24px; filter: drop-shadow(0 0 8px rgba(255, 197, 49, .5)); }
.brand span { background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a {
  color: var(--side-text); padding: 9px 12px; border-radius: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: space-between;
}
.sidebar nav a:hover { background: rgba(255, 255, 255, .06); color: #f6f1e6; text-decoration: none; }
.sidebar nav a.active { background: var(--side-active); color: #ffe896; box-shadow: inset 2px 0 0 #ffc531; }
.pill { background: #ffc531; color: #241500; border-radius: 999px; font-size: 11px; padding: 0 7px; font-weight: 700; }
.content { padding: 28px 32px 48px; min-width: 0; max-width: 1280px; }

/* cards & tiles */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 20px;
}
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.tile .label { color: var(--text-2); font-size: 12px; }
.tile .value { font: 800 clamp(18px, 1.7vw, 23px)/1.25 var(--font); font-variant-numeric: tabular-nums; white-space: nowrap; font-variant-numeric: tabular-nums; margin: 2px 0; letter-spacing: -.01em; }
.tile .sub { color: var(--muted); font-size: 12px; }
.tile.alert { border-color: #ffc531; box-shadow: 0 0 0 1px #ffc531; }
.grid-2 { display: grid; grid-template-columns: 3fr 2fr; gap: 20px; }
.chart-box { position: relative; height: 260px; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-2); margin: -6px 0 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
details summary { cursor: pointer; color: var(--muted); font-size: 12px; margin-top: 10px; }

/* tables */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { font-size: 12px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td .error { color: var(--bad); font-size: 12px; max-width: 280px; word-break: break-word; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; white-space: nowrap; background: var(--neutral-bg); color: var(--neutral); }
.badge.completed { background: var(--good-bg); color: var(--good); }
.badge.review, .badge.processing, .badge.paid { background: var(--warn-bg); color: var(--warn); }
.badge.failed { background: var(--bad-bg); color: var(--bad); }

/* forms */
input[type=text], input[type=password], input[type=number], select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; width: 100%;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #ffc531; outline-offset: -1px; }
.btn {
  font: inherit; font-weight: 550; border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  border-radius: 8px; padding: 7px 14px; cursor: pointer; white-space: nowrap;
}
.btn:hover { filter: brightness(.97); }
.btn.primary { background: var(--gold-grad); border-color: transparent; color: var(--gold-ink); font-weight: 800; }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 3px 10px; font-size: 12px; }
.btn.link { background: none; border: 0; color: var(--side-text); padding: 8px 12px; text-align: left; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.actions form { margin: 0; }
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar select { width: auto; }
.toolbar input[type=text] { width: 260px; max-width: 100%; }
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 550; margin-bottom: 5px; }
.field .help { color: var(--muted); font-size: 12px; margin-top: 4px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 550; }
.check input { width: 16px; height: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.form-grid .wide { grid-column: 1 / -1; }

.flash { white-space: pre-line; padding: 10px 14px; border-radius: 8px; margin-bottom: 18px; background: var(--good-bg); color: var(--good); }
.flash-error { background: var(--bad-bg); color: var(--bad); }
.pager { display: flex; gap: 10px; align-items: center; margin-top: 14px; }
.progress { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; min-width: 120px; }
.progress div { height: 100%; background: var(--gold-grad); }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 12px; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(70% 50% at 100% 0%, rgba(92, 52, 214, .45), transparent 70%), radial-gradient(60% 50% at 0% 100%, rgba(40, 71, 168, .4), transparent 70%), #070a1c; }
.login-logo { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 18px; font: 800 26px/1 var(--font-display); }
.login-logo img { width: 32px; height: 32px; filter: drop-shadow(0 0 10px rgba(255, 197, 49, .55)); }
.login-logo span { background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login { width: 100%; max-width: 360px; }

@media (max-width: 1000px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; padding: 10px 16px; border-right: 0; }
  .brand { padding: 0 8px 0 0; }
  .sidebar nav a.active { box-shadow: none; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; flex: 1 1 100%; order: 3; }
  .sidebar nav a { padding: 6px 8px; }
  .content { padding: 18px 16px 40px; }
  .form-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
  .table-wrap { margin: 0 -16px; padding: 0 16px; }
}
