* { box-sizing: border-box; }
body { font-family: var(--font-family); background: var(--gray-100); color: var(--gray-800); font-size: 14px; margin: 0; }

/* === APP LAYOUT (Sidebar + Content) === */
.layout { display: flex; min-height: 100vh; }

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--gray-900);
  color: var(--gray-300);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-right: 1px solid var(--gray-800);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
}
.sidebar-header {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--gray-800);
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-logo .logo-icon {
  width: 32px;
  height: 32px;
  background: var(--olive-500);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  font-size: 14px;
  flex-shrink: 0;
}
.sidebar-logo .logo-text .name { font-size: 16px; font-weight: 700; color: white; }
.sidebar-logo .logo-text .subtitle { font-size: 11px; color: var(--gray-500); }

/* --- Navigation --- */
.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
}
.nav-group { margin-bottom: 16px; }
.nav-group-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--gray-500);
  padding: 4px 12px 6px;
  font-weight: 600;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius);
  text-decoration: none;
  font-size: 13px;
  color: var(--gray-400);
  font-weight: 500;
  transition: all .15s;
}
.nav-item:hover { background: var(--gray-800); color: var(--gray-100); text-decoration: none; }
.nav-item.active { background: var(--olive-800); color: var(--olive-200); }
.nav-item .nav-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: .7;
}
.nav-item .nav-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-item .nav-badge {
  margin-left: auto;
  background: var(--wine-600);
  color: var(--wine-100);
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 600;
}

/* --- Sidebar Footer --- */
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--gray-800);
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--wine-600);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 12px;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-200);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role { font-size: 10px; color: var(--gray-500); }
.logout-btn {
  color: var(--gray-500);
  text-decoration: none;
  display: flex;
  align-items: center;
}
.logout-btn:hover { color: var(--wine-400); }
.logout-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --- Content Area --- */
.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin-left: var(--sidebar-w);
}
.content-header {
  height: var(--header-h);
  background: white;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 40;
}
.content-header h1 { font-size: 16px; font-weight: 600; color: var(--gray-800); margin: 0; }
.content-header .header-actions { margin-left: auto; display: flex; gap: 8px; }
.content-body { flex: 1; padding: 24px; overflow-y: auto; }

/* === AUTH LAYOUT (no sidebar) === */
.auth-layout {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--gray-900);
}
.auth-card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 400px;
  max-width: 95vw;
}
.auth-logo { text-align: center; margin-bottom: 24px; }
.auth-logo .logo-icon {
  width: 48px;
  height: 48px;
  background: var(--olive-500);
  border-radius: var(--radius-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  font-size: 20px;
  margin-bottom: 8px;
}
.auth-logo h2 { font-size: 20px; font-weight: 700; margin: 0; }
.auth-logo p { font-size: 12px; color: var(--gray-500); margin-top: 4px; }
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  font-size: 12px;
  color: var(--gray-400);
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gray-200);
}

/* Auth form fields — auto-style allauth widgets */
.auth-card input[type="text"],
.auth-card input[type="email"],
.auth-card input[type="password"],
.auth-card input[type="url"],
.auth-card input[type="tel"],
.auth-card select,
.auth-card textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font-family);
  background: white;
  transition: border-color .15s, box-shadow .15s;
  color: var(--gray-800);
}
.auth-card input[type="text"]:focus,
.auth-card input[type="email"]:focus,
.auth-card input[type="password"]:focus,
.auth-card input[type="url"]:focus,
.auth-card input[type="tel"]:focus,
.auth-card select:focus,
.auth-card textarea:focus {
  outline: none;
  border-color: var(--olive-400);
  box-shadow: 0 0 0 3px rgba(122, 138, 62, .15);
}

/* Checkbox inline layout */
.auth-card .form-group:has(input[type="checkbox"]) {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-direction: row;
}
.auth-card .form-group:has(input[type="checkbox"]) .form-label {
  display: inline;
  margin-bottom: 0;
  font-weight: 500;
  cursor: pointer;
}
.auth-card input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--olive-600);
  cursor: pointer;
  flex-shrink: 0;
}

/* Auth links */
.auth-links {
  text-align: center;
  margin-top: 16px;
  font-size: 12px;
  color: var(--gray-500);
}
.auth-links a {
  color: var(--olive-600);
  text-decoration: none;
}
.auth-links a:hover {
  text-decoration: underline;
}
.auth-links strong a {
  font-weight: 600;
}

/* Auth error messages */
.auth-card .field-error {
  color: var(--wine-500);
  font-size: 12px;
  margin-top: 2px;
}

/* === MOBILE RESPONSIVE === */
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--gray-600);
  cursor: pointer;
  padding: 4px;
}
.sidebar-toggle svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: 45;
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .2s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .content { margin-left: 0; }
  .sidebar-toggle { display: block; }
  .content-body { padding: 16px; }
}
