:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-soft: #f0f2f5;
  --text: #17191c;
  --muted: #69707a;
  --border: #e1e5ea;
  --accent: #22272f;
  --accent-contrast: #ffffff;
  --danger: #b42318;
  --success: #067647;
  --radius: 14px;
  --shadow: 0 12px 36px rgba(20, 24, 31, 0.08);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: inherit; }
button, input, select { font: inherit; }
code { background: var(--surface-soft); border-radius: 6px; padding: 0.15rem 0.35rem; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 240px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 24px 18px; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.brand { font-weight: 750; text-decoration: none; letter-spacing: -0.02em; padding: 8px 10px 24px; }
.nav-list { display: grid; gap: 4px; }
.nav-item { text-decoration: none; padding: 10px 12px; border-radius: 9px; color: var(--muted); }
.nav-item:hover, .nav-item.is-active { background: var(--surface-soft); color: var(--text); }
.sidebar-footer { margin-top: auto; display: grid; gap: 10px; }
.user-email { color: var(--muted); font-size: 0.82rem; overflow-wrap: anywhere; }

.main-content { min-width: 0; padding: 46px clamp(24px, 5vw, 72px); }
.main-content-public { grid-column: 1 / -1; padding: 24px; }
.page-header { display: flex; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.page-header h1, .auth-card h1 { margin: 4px 0 8px; font-size: clamp(1.8rem, 4vw, 2.5rem); letter-spacing: -0.035em; }
.eyebrow { color: var(--muted); font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; }
.muted { color: var(--muted); line-height: 1.6; }

.auth-layout { min-height: calc(100vh - 48px); display: grid; place-items: center; }
.auth-card { width: min(100%, 430px); background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 34px; box-shadow: var(--shadow); }
.auth-switch { margin: 20px 0 0; color: var(--muted); font-size: 0.9rem; text-align: center; }
.form-stack { display: grid; gap: 16px; margin-top: 24px; }
.form-stack label { display: grid; gap: 7px; font-size: 0.9rem; font-weight: 650; }
.form-stack input, .form-stack select { width: 100%; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); padding: 11px 12px; color: var(--text); outline: none; }
.form-stack input:focus, .form-stack select:focus { border-color: #9aa4b2; box-shadow: 0 0 0 3px rgba(80, 95, 115, 0.12); }
.form-error, .form-success { border-radius: 9px; padding: 10px 12px; font-size: 0.9rem; }
.form-error { background: #fff1f0; color: var(--danger); }
.form-success { background: #ecfdf3; color: var(--success); }

.button { border: 0; border-radius: 9px; padding: 10px 14px; cursor: pointer; font-weight: 650; transition: opacity .15s ease, transform .15s ease; }
.button:not(:disabled):active { transform: translateY(1px); }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button-primary { background: var(--accent); color: var(--accent-contrast); }
.button-secondary { background: var(--surface-soft); color: var(--text); }
.button-danger { background: var(--danger); color: #ffffff; }
.button-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.button-full { width: 100%; }

.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card, .panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.stat-card { padding: 18px; display: grid; gap: 8px; }
.stat-card span { color: var(--muted); font-size: 0.82rem; }
.stat-card strong { font-size: 1.05rem; }
.panel { padding: 24px; margin-bottom: 20px; }
.panel h2 { margin-top: 0; }
.panel-header { display: flex; justify-content: space-between; gap: 20px; }
.danger-zone { border-color: #fecdca; }
.empty-state { min-height: 260px; display: grid; place-items: center; align-content: center; text-align: center; padding: 36px; color: var(--muted); }
.empty-state h3 { color: var(--text); margin-bottom: 0; }
.empty-icon { width: 46px; height: 46px; border-radius: 50%; background: var(--surface-soft); display: grid; place-items: center; color: var(--text); font-size: 1.5rem; }
.detail-list { margin: 0; display: grid; }
.detail-list > div { display: grid; grid-template-columns: 150px 1fr; gap: 16px; padding: 15px 0; border-bottom: 1px solid var(--border); }
.detail-list > div:last-child { border-bottom: 0; }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; font-weight: 600; }
.badge { display: inline-flex; padding: 4px 8px; background: var(--surface-soft); border-radius: 999px; font-size: 0.78rem; }
.toast { position: fixed; right: 20px; bottom: 20px; max-width: 360px; background: var(--accent); color: var(--accent-contrast); border-radius: 10px; padding: 12px 14px; box-shadow: var(--shadow); }

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: 14px 16px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; }
  .brand { padding: 4px 0; }
  .nav-list { grid-column: 1 / -1; grid-template-columns: repeat(2, 1fr); }
  .sidebar-footer { margin: 0; grid-column: 2; grid-row: 1; }
  .sidebar-footer .user-email { display: none; }
  .main-content { padding: 28px 18px; }
  .main-content-public { padding: 14px; }
  .stat-grid { grid-template-columns: 1fr; }
  .detail-list > div { grid-template-columns: 1fr; gap: 5px; }
  .auth-card { padding: 26px 22px; }
}
