:root {
  --color-bg:           #f8f8f6;
  --color-surface:      #ffffff;
  --color-surface-alt:  #fafaf9;
  --color-border:       #e6e6e3;
  --color-border-strong:#d0d0cc;
  --color-text:         #1a1a18;
  --color-muted:        #717170;
  --color-accent:       #3046c0;
  --color-accent-hover: #2538a8;
  --color-danger:       #c33235;
  --color-success:      #2f8a4a;
  --color-warning:      #b46d12;

  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;

  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  1.875rem;

  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-6:  24px;
  --space-8:  32px;
  --space-12: 48px;
  --space-16: 64px;

  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);

  --transition: 150ms ease;
}

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

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.25; }

a { color: var(--color-accent); text-decoration: none; }
a:hover { color: var(--color-accent-hover); }

button { font-family: inherit; }

input, select, textarea, button { font-family: inherit; font-size: inherit; }

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* App shell */
.app-shell {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
}

.content-area {
  padding: var(--space-4);
  background: var(--color-bg);
}

@media (min-width: 640px)  { .content-area { padding: var(--space-6); } }
@media (min-width: 1024px) {
  .app-shell { grid-template-columns: 240px 1fr; }
  .content-area { padding: var(--space-8); }
}

/* Sidebar */
.sidebar {
  display: none;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  width: 280px;
  height: 100vh;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  padding: var(--space-6) var(--space-4);
  transform: translateX(-100%);
  transition: transform 220ms ease;
  flex-direction: column;
}
.sidebar.is-open {
  display: flex;
  transform: translateX(0);
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.32);
  z-index: 49;
}
.sidebar-overlay.is-open { display: block; }

@media (min-width: 1024px) {
  .sidebar {
    display: flex;
    position: sticky;
    top: 0;
    transform: none;
    width: auto;
  }
  .sidebar-overlay { display: none !important; }
}

/* Mobile header */
.mobile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 40;
}
@media (min-width: 1024px) { .mobile-header { display: none; } }

.hamburger {
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  padding: var(--space-2);
  border: none;
  background: transparent;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
}
.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 700;
  font-size: var(--text-base);
  color: var(--color-text);
  margin-bottom: var(--space-8);
  padding: 0 var(--space-2);
}
.mobile-header .brand { margin-bottom: 0; }
.brand-dot {
  width: 10px; height: 10px;
  border-radius: var(--radius-full);
  background: var(--color-accent);
  display: inline-block;
}

/* Nav */
.nav-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-6);
}
.nav-section-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
  padding: 0 var(--space-2);
  margin-bottom: var(--space-2);
}
.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--color-muted);
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
  min-height: 44px;
}
.nav-link:hover { background: var(--color-bg); color: var(--color-text); }
.nav-link--active { background: var(--color-bg); color: var(--color-text); font-weight: 500; }

.sidebar-footer {
  margin-top: auto;
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}
.sidebar-user {
  font-size: var(--text-sm);
  color: var(--color-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.logout-form { margin: 0; }
