:root {
  color-scheme: light;
  --surface-0: #f4f3ee;
  --surface-1: #ffffff;
  --surface-2: #ffffff;
  --bg-hover: #f0efe9;
  --bg-accent: #e6f1fb;
  --border: #e2e0d8;
  --border-strong: #d4d2c8;
  --text-primary: #1f1e1c;
  --text-secondary: #5f5e59;
  --text-muted: #a3a199;
  --text-accent: #185fa5;
  --text-danger: #a32d2d;
  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --surface-0: #1c1c1a;
    --surface-1: #242320;
    --surface-2: #2c2b27;
    --bg-hover: #33322e;
    --bg-accent: #0c447c;
    --border: #3a3934;
    --border-strong: #4a4944;
    --text-primary: #f1efe8;
    --text-secondary: #b4b2a9;
    --text-muted: #888780;
    --text-accent: #85b7eb;
    --text-danger: #f09595;
  }
}

* { box-sizing: border-box; }
body {
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
  margin: 0;
  background: var(--surface-0);
  color: var(--text-primary);
}

.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card {
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  width: 300px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-card h1 { font-size: 18px; font-weight: 500; margin: 0 0 4px; color: var(--text-primary); }
.login-card label { display: flex; flex-direction: column; font-size: 13px; gap: 5px; color: var(--text-secondary); }
.login-card input {
  height: 38px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 0 12px;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--surface-1);
}
.login-card input:focus { outline: 2px solid var(--text-accent); outline-offset: 1px; }
.login-card button {
  height: 38px;
  border-radius: var(--radius);
  border: none;
  background: var(--text-primary);
  color: var(--surface-0);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}
.login-card button:hover { opacity: 0.9; }
.error-text { color: var(--text-danger); font-size: 13px; min-height: 16px; margin: 0; }

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 236px;
  flex-shrink: 0;
  border-right: 0.5px solid var(--border);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: width .18s ease, padding .18s ease;
  background: var(--surface-1);
}
.sidebar.collapsed { width: 60px; padding: 12px 8px; overflow: hidden; }
.sidebar.collapsed .label { display: none; }
.sidebar.collapsed .navbtn { justify-content: center; }
.sidebar.collapsed .badge { display: none; }

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}
.sidebar.collapsed .brand .label { display: none; }

.toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  margin-bottom: 8px;
}
.toggle-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

.navbtn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  width: 100%;
  color: var(--text-primary);
}
.navbtn:hover { background: var(--bg-hover); }
.navbtn.active { background: var(--bg-accent); color: var(--text-accent); }
.navbtn.active .icon { color: var(--text-accent); }
.navbtn.locked { color: var(--text-muted); cursor: not-allowed; }
.navbtn.locked:hover { background: transparent; }
.navbtn .icon { flex-shrink: 0; display: flex; color: var(--text-secondary); }
.navbtn .badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-0);
  border-radius: 999px;
  padding: 2px 7px;
  white-space: nowrap;
}

.content { flex: 1; padding: 28px 32px; min-width: 0; }
.content h2 { font-size: 20px; font-weight: 500; margin: 0 0 8px; color: var(--text-primary); }
.content p { color: var(--text-secondary); font-size: 14px; margin: 0; }
.content .empty-state {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 14px;
}

@media (max-width: 480px) {
  .sidebar { position: absolute; z-index: 5; height: 100%; }
  .sidebar.collapsed { width: 0; padding: 0; border: none; }
}
