*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}

h1, h2, p {
  margin: 0;
}

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.d-none {
  display: none !important;
}

/* ===========================================================
   Login
   =========================================================== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--canvas);
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: var(--space-6);
  width: 100%;
  max-width: 360px;
}

.login-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--ink);
  margin-bottom: var(--space-5);
  text-align: center;
}

/* ===========================================================
   App shell
   =========================================================== */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
}

/* ---------- Sidebar ---------- */
.sidebar {
  padding: var(--space-4) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  background: linear-gradient(
    168deg,
    hsl(205 76% 31%) 0%,
    hsl(208 74% 24%) 48%,
    hsl(212 68% 18%) 100%
  );
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3) var(--space-4);
  color: #fff;
  font-weight: 700;
  font-size: var(--text-md);
}

.sidebar-brand-icon {
  font-size: 1.2rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border: none;
  background: none;
  color: hsl(0 0% 100% / 0.82);
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  font-weight: 500;
  text-align: left;
  position: relative;
}

.nav-item:hover {
  background: hsl(0 0% 100% / 0.1);
  color: #fff;
}

.nav-item.active {
  background: hsl(0 0% 100% / 0.14);
  box-shadow: inset 0 1px 0 hsl(0 0% 100% / 0.12);
  color: #fff;
  font-weight: 600;
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: calc(-1 * var(--space-3));
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 0 var(--radius-pill) var(--radius-pill) 0;
  background: #fff;
}

.nav-icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: hsl(0 0% 100% / 0.65);
}

.nav-item:hover .nav-icon,
.nav-item.active .nav-icon {
  color: #fff;
}

.nav-icon svg {
  width: 100%;
  height: 100%;
}

.sidebar-logout {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border: none;
  background: none;
  color: hsl(0 0% 100% / 0.65);
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  text-align: left;
  margin-top: auto;
}

.sidebar-logout:hover {
  background: hsl(0 0% 100% / 0.1);
  color: #fff;
}

/* ---------- Main content ---------- */
.main-content {
  padding: var(--space-5);
  min-width: 0;
  overflow-x: auto;
}

.content-section {
  display: none;
}

.content-section.active {
  display: block;
}

.section-title {
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: var(--space-5);
}

.section-placeholder {
  color: var(--ink-faint);
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .sidebar {
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
  }
  .sidebar-brand {
    padding: 0 var(--space-3) 0 0;
  }
  .sidebar-nav {
    flex-direction: row;
    flex: none;
  }
  .nav-item span:last-child,
  .sidebar-logout span:last-child {
    display: none;
  }
  .nav-item.active::before {
    display: none;
  }
  .sidebar-logout {
    margin-top: 0;
    margin-left: auto;
  }
  .main-content {
    padding: var(--space-4);
  }
}