*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sidebar-width: 200px;
  --bg: #F4F8F4;
  --text: #1a1a1a;
  --text-muted: #888;
  --nav-active: #1a1a1a;
  --nav-inactive: #aaa;
  --border: #e8e8e4;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131311;
    --text: #e0e0dc;
    --text-muted: #5a5a56;
    --nav-active: #e0e0dc;
    --nav-inactive: #4a4a46;
    --border: #242420;
  }
}

[data-theme="dark"] {
  --bg: #131311;
  --text: #e0e0dc;
  --text-muted: #5a5a56;
  --nav-active: #e0e0dc;
  --nav-inactive: #4a4a46;
  --border: #242420;
}

[data-theme="light"] {
  --bg: #F4F8F4;
  --text: #1a1a1a;
  --text-muted: #888;
  --nav-active: #1a1a1a;
  --nav-inactive: #aaa;
  --border: #e8e8e4;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
}

/* ── Layout ── */

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

/* ── Sidebar ── */

.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  padding: 32px 20px 40px 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-identity { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.sidebar-avatar { width: 64px; height: 64px; object-fit: contain; display: block; }
.sidebar-name { font-size: 13px; font-weight: 600; letter-spacing: 0.01em; color: var(--text); }
.sidebar-tagline { font-size: 11px; color: var(--text-muted); line-height: 1.5; margin-top: -6px; }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav a {
  display: block;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--nav-inactive);
  padding: 5px 0;
  transition: color 0.12s;
}
.sidebar-nav a:hover, .sidebar-nav a.active { color: var(--nav-active); }

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
}
.sidebar-footer a { color: var(--text-muted); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color 0.1s; }
.sidebar-footer a:hover { border-bottom-color: var(--text-muted); }

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 0;
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  width: fit-content;
  transition: border-color 0.15s;
}
.theme-toggle:hover { border-color: var(--text-muted); }
.theme-toggle span {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 5px 10px;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
  user-select: none;
}
.theme-toggle span.active {
  background: var(--text);
  color: var(--bg);
}
.sidebar-footer .theme-toggle { margin-bottom: 6px; }

.mobile-header-controls { display: flex; align-items: center; gap: 12px; }

/* ── Main content ── */

.main {
  flex: 1;
  padding: 52px 56px 80px 52px;
  max-width: 680px;
}

.page-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 40px;
}

/* ── Mobile (hidden on desktop) ── */

.mobile-header { display: none; }
.mobile-nav { display: none; }
.mobile-footer { display: none; }

/* ── Responsive ── */

@media (max-width: 640px) {
  .layout { flex-direction: column; min-height: 100vh; }
  .sidebar { display: none; }

  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 10;
  }

  .mobile-identity { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
  .mobile-identity img { width: 40px; height: 40px; object-fit: contain; }
  .mobile-identity-text { display: flex; flex-direction: column; gap: 1px; }
  .mobile-identity-text .sidebar-name { font-size: 13px; }
  .mobile-identity-text .sidebar-tagline { margin-top: 0; }

  .hamburger { background: none; border: none; cursor: pointer; padding: 6px; display: flex; flex-direction: column; gap: 5px; }
  .hamburger span { display: block; width: 22px; height: 1.5px; background: var(--text); transition: transform 0.2s, opacity 0.2s; transform-origin: center; }
  .hamburger.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
  .hamburger.open span:nth-child(2) { opacity: 0; }
  .hamburger.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

  .mobile-nav { flex-direction: column; background: var(--bg); border-bottom: 1px solid var(--border); padding: 8px 20px 12px; gap: 0; }
  .mobile-nav.open { display: flex; }
  .mobile-nav a { font-size: 12px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; text-decoration: none; color: var(--nav-inactive); padding: 10px 0; border-bottom: 1px solid var(--border); transition: color 0.12s; }
  .mobile-nav a:last-child { border-bottom: none; }
  .mobile-nav a:hover, .mobile-nav a.active { color: var(--nav-active); }

  .main { padding: 32px 20px 48px; }

  .mobile-footer { display: flex; align-items: center; gap: 16px; padding: 20px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-muted); margin-top: auto; }
  .mobile-footer a { color: var(--text-muted); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color 0.1s; }
  .mobile-footer a:hover { border-bottom-color: var(--text-muted); }
}
