/* ============================================================================
   Admin — stil
   ============================================================================ */
:root {
  --bg:        #f7f1e3;
  --bg-card:  #fdfaf2;
  --bg-elev: #faf4e1;
  --text:      #2a221a;
  --text-soft: #5a4a3a;
  --text-mute: #897866;
  --line:      #e3d6bb;
  --line-soft: #ede4ce;
  --accent:      #9c1f1f;
  --accent-2:    #b8862f;
  --accent-3:    #4a6b3a;
  --accent-danger: #c14545;
  --shadow-sm: 0 1px 2px rgba(60, 40, 20, 0.06);
  --shadow-md: 0 4px 16px rgba(60, 40, 20, 0.08);
  --radius:     4px;
  --radius-lg:  8px;
  --ff-display: 'Fraunces', Georgia, serif;
  --ff-body:    'Manrope', system-ui, sans-serif;
  --ff-mono:    'JetBrains Mono', ui-monospace, monospace;

  --side-w: 240px;
}
[data-theme="dark"] {
  --bg:        #1a1410;
  --bg-card:  #221913;
  --bg-elev: #2a1f17;
  --text:      #f0e6d2;
  --text-soft: #c9b896;
  --text-mute: #8a7a62;
  --line:      #3a2c20;
  --line-soft: #2e2218;
  --accent:      #d4574e;
  --accent-2:    #d4a543;
  --accent-3:    #8aab78;
  --accent-danger: #e07070;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.5);
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body.admin-body {
  font-family: var(--ff-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Sidebar ---------- */
.admin-side {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--side-w);
  background: var(--bg-card);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  z-index: 30;
  overflow-y: auto;
}
.admin-side__close {
  display: none;
  position: absolute; top: 12px; right: 12px;
  width: 32px; height: 32px;
  background: transparent; border: 1px solid var(--line);
  color: var(--text-soft); border-radius: var(--radius);
  cursor: pointer; font-size: 14px;
}
.admin-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 18px;
  font-family: var(--ff-display);
  font-weight: 600; font-size: 17px;
  color: var(--text); text-decoration: none;
  border-bottom: 1px solid var(--line-soft);
}
.admin-brand:hover { text-decoration: none; }
.admin-brand__mark {
  width: 28px; height: 28px;
  display: inline-grid; place-items: center;
  color: var(--accent); font-size: 16px;
  border: 1px solid var(--accent); border-radius: 4px;
}
.admin-nav { padding: 12px 8px; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.admin-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  font-size: 14px; color: var(--text-soft);
  border-radius: var(--radius);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.admin-link:hover { background: var(--bg-elev); color: var(--text); text-decoration: none; }
.admin-link--active {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent); font-weight: 600;
}
.admin-link__icon {
  display: inline-block; width: 18px; text-align: center;
  color: inherit; opacity: 0.8;
}
.admin-link--logout { color: var(--accent-danger); }
.admin-side__foot {
  padding: 12px 8px;
  border-top: 1px solid var(--line-soft);
  display: flex; flex-direction: column; gap: 2px;
}
.admin-side__user {
  padding: 8px 12px;
  font-size: 12px; color: var(--text-mute);
  font-family: var(--ff-mono);
}

/* ---------- Main area ---------- */
.admin-main {
  margin-left: var(--side-w);
  min-height: 100vh;
  display: flex; flex-direction: column;
}
.admin-topbar {
  padding: 16px 28px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: center; gap: 16px;
  position: sticky; top: 0; z-index: 20;
}
.admin-topbar__title {
  font-family: var(--ff-display);
  font-size: 22px; font-weight: 500; margin: 0;
}
.admin-hamburger {
  display: none;
  width: 36px; height: 36px;
  background: transparent; border: 1px solid var(--line);
  color: var(--text-soft); border-radius: var(--radius);
  cursor: pointer; font-size: 16px;
}
.admin-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 25;
}
.theme-toggle {
  width: 32px; height: 32px;
  display: inline-grid; place-items: center;
  background: transparent; border: 1px solid var(--line);
  color: var(--text-soft); border-radius: var(--radius);
  cursor: pointer; font-size: 14px;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.admin-content { padding: 28px; flex: 1; }

/* ---------- Cards ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}
.card__hd {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}
.card__title {
  font-family: var(--ff-display);
  font-size: 18px; font-weight: 500; margin: 0;
}
.card__desc { font-size: 13px; color: var(--text-mute); margin: 4px 0 0; }

/* ---------- Forms ---------- */
.form-row {
  display: grid; grid-template-columns: 160px 1fr; gap: 14px;
  margin-bottom: 14px; align-items: center;
}
.form-row__lbl {
  font-family: var(--ff-mono); font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-mute);
}
.form-row__lbl--top { align-self: start; padding-top: 8px; }
input[type="text"], input[type="password"], input[type="date"], input[type="number"], select, textarea {
  font-family: var(--ff-body);
  font-size: 14px;
  padding: 8px 12px;
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  width: 100%; max-width: 320px;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.form-row__inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.btn {
  font-family: var(--ff-body);
  font-size: 14px; font-weight: 600;
  padding: 9px 18px;
  background: var(--accent); color: white;
  border: 1px solid var(--accent); border-radius: var(--radius);
  cursor: pointer;
  transition: opacity 0.15s, transform 0.05s;
}
.btn:hover { opacity: 0.9; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--secondary {
  background: var(--bg-elev); color: var(--text);
  border-color: var(--line);
}
.btn--secondary:hover { background: var(--bg-card); }
.btn--danger { background: var(--accent-danger); border-color: var(--accent-danger); }

/* ---------- Tabs / Pills ---------- */
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  font-family: var(--ff-mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 6px 12px;
  background: var(--bg-elev); color: var(--text-soft);
  border: 1px solid var(--line); border-radius: 999px;
  cursor: pointer; user-select: none;
}
.pill:hover { border-color: var(--accent); color: var(--accent); }
.pill input[type="radio"] { display: none; }
.pill--active, .pill:has(input:checked) {
  background: var(--accent); color: white; border-color: var(--accent);
}

/* ---------- Tables ---------- */
.tbl {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}
.tbl th, .tbl td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
}
.tbl th {
  font-family: var(--ff-mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-mute); font-weight: 600;
  background: var(--bg-elev);
}
.tbl tr:hover { background: var(--bg-elev); }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stat {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 20px;
}
.stat__lbl {
  font-family: var(--ff-mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-mute); margin-bottom: 4px;
}
.stat__val {
  font-family: var(--ff-display); font-size: 28px;
  color: var(--text); font-weight: 500;
}
.stat__val--match { color: var(--accent-3); }
.stat__val--diff  { color: var(--accent); }

/* ---------- Result panes ---------- */
.alert {
  padding: 12px 16px; border-radius: var(--radius);
  margin: 16px 0;
  font-size: 14px;
}
.alert--ok    { background: color-mix(in srgb, var(--accent-3) 12%, transparent); color: var(--text); border-left: 4px solid var(--accent-3); }
.alert--warn  { background: color-mix(in srgb, var(--accent-2) 14%, transparent); color: var(--text); border-left: 4px solid var(--accent-2); }
.alert--error { background: color-mix(in srgb, var(--accent-danger) 14%, transparent); color: var(--text); border-left: 4px solid var(--accent-danger); }

.diff-row {
  padding: 12px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 8px;
  font-size: 13px;
}
.diff-row__date {
  font-family: var(--ff-mono); font-weight: 600;
  color: var(--accent);
}
.diff-row__sim {
  font-family: var(--ff-mono); font-size: 11px;
  color: var(--text-mute); margin-left: 8px;
}
.diff-row__cmp {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 6px;
}
.diff-row__col {
  font-size: 12px; padding: 8px;
  background: var(--bg-card); border-radius: 2px;
}
.diff-row__col-lbl {
  font-family: var(--ff-mono); font-size: 10px;
  text-transform: uppercase; color: var(--text-mute);
  display: block; margin-bottom: 4px;
}

/* ---------- Login page ---------- */
.login-wrap {
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 20px;
}
.login-card {
  max-width: 380px; width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-md);
}
.login-card h1 {
  font-family: var(--ff-display);
  text-align: center; margin: 0 0 8px;
  font-size: 22px; font-weight: 500;
}
.login-card p { text-align: center; color: var(--text-mute); font-size: 13px; margin: 0 0 24px; }
.login-form .form-row { grid-template-columns: 1fr; }
.login-card .btn { width: 100%; margin-top: 8px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .admin-side {
    transform: translateX(-100%);
    transition: transform 0.2s;
    width: 280px;
  }
  .admin-side--open { transform: translateX(0); }
  .admin-side__close { display: inline-grid; place-items: center; }
  .admin-main { margin-left: 0; }
  .admin-hamburger { display: inline-grid; place-items: center; }
  .form-row { grid-template-columns: 1fr; gap: 6px; }
  .form-row__lbl { margin-top: 4px; }
  .diff-row__cmp { grid-template-columns: 1fr; }
}
