:root,
[data-theme="night"] {
  --bg: #12100e;
  --glow: #3a2818;
  --aside: rgba(18, 15, 12, 0.92);
  --panel: rgba(30, 25, 21, 0.92);
  --panel-solid: #1e1915;
  --line: #3c332b;
  --line-strong: #5a4636;
  --text: #f6f0e8;
  --muted: #a89888;
  --nav: #cbbba8;
  --accent: #e39a4b;
  --accent-ink: #2a1608;
  --input: #14110e;
  --th: #181410;
  --danger: #e07a72;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  --good-bg: #1d2c24;
  --good-line: #3d6b4f;
  --good-text: #c8efd4;
  --bad-bg: #321c1c;
  --bad-line: #7a3a3a;
  --bad-text: #ffc9c4;
  --overlay: rgba(8, 6, 4, 0.72);
  color-scheme: dark;
}

[data-theme="day"] {
  --bg: #f3eee6;
  --glow: #f3d7b4;
  --aside: rgba(255, 251, 245, 0.94);
  --panel: rgba(255, 253, 249, 0.94);
  --panel-solid: #fffdf9;
  --line: #e3d5c4;
  --line-strong: #c9a27a;
  --text: #241910;
  --muted: #7a6a5a;
  --nav: #5c4d40;
  --accent: #c56a1e;
  --accent-ink: #fffaf5;
  --input: #fff;
  --th: #f7f1e8;
  --danger: #b4232c;
  --shadow: 0 16px 40px rgba(80, 48, 16, 0.08);
  --good-bg: #e7f6ec;
  --good-line: #8dceb0;
  --good-text: #145c32;
  --bad-bg: #fde8e8;
  --bad-line: #e7a8a8;
  --bad-text: #8a1f1f;
  --overlay: rgba(48, 32, 16, 0.35);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: radial-gradient(circle at 82% -8%, var(--glow) 0, var(--bg) 34%);
  color: var(--text);
  font: 14px ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
aside {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: var(--aside);
  backdrop-filter: blur(18px);
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
}
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 40px; }
.brand b { display: block; font-size: 17px; letter-spacing: 0.16em; }
.brand small { display: block; color: var(--muted); font-size: 9px; letter-spacing: 0.32em; margin-top: 2px; }
.brand-mark {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 55%, #2a1608), var(--panel-solid));
  color: var(--accent);
  display: grid;
  place-items: center;
  border-radius: 14px;
  font-weight: 800;
  font-size: 22px;
}
.brand-mark.small { width: 38px; height: 38px; font-size: 18px; border-radius: 12px; }
nav { display: grid; gap: 6px; }
nav a {
  padding: 12px 14px;
  border-radius: 10px;
  color: var(--nav);
  border: 1px solid transparent;
}
nav a:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--text); }
nav a:before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--line-strong);
  margin: 0 11px 2px 0;
}
nav a.active {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--text);
  border-color: var(--line-strong);
  box-shadow: inset 3px 0 0 var(--accent);
}
nav a.active:before { background: var(--accent); }
.side-foot { margin-top: auto; color: var(--muted); line-height: 1.8; padding: 12px 4px; }
.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 7px;
}
.theme-toggle, .logout {
  display: block;
  width: 100%;
  margin-top: 12px;
  text-align: left;
  background: transparent;
  color: var(--nav);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
.theme-toggle:hover, .logout:hover { color: var(--text); border-color: var(--line-strong); }

main { max-width: 1180px; width: 100%; padding: 34px 48px 60px; margin: auto; }
header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
.eyebrow { font-size: 10px; letter-spacing: 0.22em; color: var(--muted); text-transform: uppercase; }
h1 { font-size: 30px; margin: 8px 0 0; letter-spacing: -0.03em; }
h2 { font-size: 34px; line-height: 1.05; letter-spacing: -0.04em; margin: 12px 0; }
h3 { font-size: 22px; margin: 7px 0; }
.page-description { margin: 7px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.header-pill, .tag {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--panel-solid);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 11px;
}
.tag { color: var(--accent); border-color: var(--line-strong); }

.hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  min-height: 210px;
  padding: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 16%, var(--panel-solid)), var(--panel));
  box-shadow: var(--shadow);
}
.hero p { color: var(--muted); max-width: 640px; font-size: 15px; line-height: 1.7; }
.hero-orb {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  align-content: center;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 45%, var(--panel-solid)) 0, var(--panel-solid) 68%);
  border: 1px solid var(--line-strong);
  flex: none;
  text-align: center;
}
.hero-orb span { font-size: 36px; font-weight: 800; }
.hero-orb small { color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 14px 0 28px; }
.stats > div { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.stats span { display: block; color: var(--muted); font-size: 12px; }
.stats b { display: block; font-size: 27px; margin-top: 9px; }

.page-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.quick-card {
  display: grid;
  gap: 8px;
  min-height: 135px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.quick-card:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.quick-card > span { font-size: 10px; letter-spacing: 0.18em; color: var(--accent); }
.quick-card > strong { font-size: 18px; }
.quick-card > small { color: var(--muted); line-height: 1.45; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  margin: 18px 0;
  padding: 24px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
}
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 20px; }
.section-head p { color: var(--muted); margin: 6px 0 0; }
.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  border-radius: 10px;
  padding: 11px 16px;
  font-weight: 800;
}
.primary:hover { filter: brightness(1.06); }
.wide { width: 100%; }
.ghost, .actions button, .danger {
  border: 1px solid var(--line);
  background: var(--input);
  color: var(--nav);
  padding: 7px 10px;
  border-radius: 8px;
}
.danger { color: var(--danger); }
.ghost:hover, .actions button:hover { color: var(--text); border-color: var(--line-strong); }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 13px; }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th, td { text-align: left; padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  background: var(--th);
}
tr:last-child td { border-bottom: 0; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.actions { display: flex; gap: 7px; }
.actions form { margin: 0; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

label { display: grid; gap: 7px; color: var(--nav); font-size: 12px; margin: 12px 0; }
input, select, textarea {
  width: 100%;
  background: var(--input);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
.hint { color: var(--muted); font-size: 12px; line-height: 1.55; margin: 0 0 8px; }

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(8px);
  z-index: 20;
  padding: 30px;
  overflow: auto;
}
.modal.open { display: grid; place-items: center; }
.modal-card {
  position: relative;
  width: min(520px, 100%);
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 26px;
  box-shadow: var(--shadow);
}
.close {
  position: absolute;
  right: 14px;
  top: 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 28px;
}

.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card {
  width: min(430px, 100%);
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 34px;
  box-shadow: var(--shadow);
}
.login-card .brand { margin-bottom: 8px; }
.login-card p { color: var(--muted); line-height: 1.6; }
.login-tools { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.login-tools .theme-toggle { width: auto; margin: 0; }

.alert { padding: 12px 14px; border-radius: 10px; margin: 0 0 16px; }
.alert.good { background: var(--good-bg); border: 1px solid var(--good-line); color: var(--good-text); }
.alert.bad { background: var(--bad-bg); border: 1px solid var(--bad-line); color: var(--bad-text); }
footer { text-align: center; color: var(--muted); padding: 28px 0 0; font-size: 11px; }

@media (max-width: 1000px) {
  .shell { grid-template-columns: 1fr; }
  aside { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  nav { display: flex; overflow: auto; }
  nav a { white-space: nowrap; }
  nav a.active { box-shadow: inset 0 -3px 0 var(--accent); }
  .side-foot { display: flex; gap: 10px; align-items: center; margin-top: 16px; }
  .side-foot .status-line { display: none; }
  .theme-toggle, .logout { width: auto; margin-top: 0; }
  main { padding: 25px 18px 40px; }
}
@media (max-width: 650px) {
  .hero { padding: 24px; flex-direction: column; align-items: flex-start; }
  .hero-orb { width: 96px; height: 96px; }
  .hero-orb span { font-size: 28px; }
  h2 { font-size: 28px; }
  .stats, .page-grid { grid-template-columns: 1fr; }
  .section-head { align-items: flex-start; flex-direction: column; }
}
