:root {
  --navy: #1e293b;
  --blue: #2563eb;
  --border: #e2e8f0;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: #f8fafc; color: #0f172a; }
a { color: inherit; text-decoration: none; }
.bg-navy { background: var(--navy); }
.text-navy { color: var(--navy); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; border-radius: .75rem; padding: .65rem 1rem; font-weight: 700; transition: .16s ease; border: 1px solid transparent; cursor: pointer; white-space: nowrap; }
.btn-blue { background: var(--blue); color: white; box-shadow: 0 10px 25px rgba(37, 99, 235, .18); }
.btn-blue:hover { background: #1d4ed8; }
.btn-navy { background: var(--navy); color: white; }
.btn-outline { border-color: var(--border); background: white; color: #334155; }
.btn-ghost { background: transparent; color: inherit; }
.card { background: white; border: 1px solid var(--border); border-radius: .85rem; box-shadow: 0 1px 2px rgba(15, 23, 42, .04); overflow: hidden; }
.card-pad { padding: 1.5rem; }
.input, .textarea, .select { width: 100%; border: 1px solid #cbd5e1; background: white; border-radius: .75rem; padding: .75rem .9rem; color: #0f172a; outline: none; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.textarea { min-height: 10rem; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.badge { display: inline-flex; align-items: center; gap: .25rem; border: 1px solid var(--border); border-radius: .45rem; padding: .15rem .45rem; font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.badge-green { color: #047857; background: #ecfdf5; border-color: #a7f3d0; }
.badge-blue { color: #1d4ed8; background: #eff6ff; border-color: #bfdbfe; }
.badge-amber { color: #b45309; background: #fffbeb; border-color: #fde68a; }
.table { width: 100%; border-collapse: collapse; }
.table th { background: #f8fafc; color: #64748b; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; text-align: left; padding: .9rem 1rem; }
.table td { border-top: 1px solid var(--border); padding: .95rem 1rem; vertical-align: middle; }
.dashboard-shell {
  display: grid;
  grid-template-columns: 16rem minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
  transition: grid-template-columns .18s ease;
}
.dashboard-shell.sidebar-collapsed {
  grid-template-columns: 4.75rem minmax(0, 1fr);
}
.sidebar {
  width: 100%;
  transition: width .18s ease;
}
.sidebar-brand-text,
.sidebar-label,
.sidebar-section-label,
.sidebar-chevron {
  transition: opacity .14s ease;
}
.sidebar-link { display: flex; align-items: center; gap: .75rem; border-radius: .6rem; padding: .55rem .75rem; color: rgba(255,255,255,.64); font-weight: 650; font-size: .9rem; }
.sidebar-link:hover, .sidebar-link.active { color: white; background: rgba(255,255,255,.10); }
.sidebar-submenu-toggle { border: 0; cursor: pointer; text-align: left; }
.sidebar-submenu-toggle .sidebar-chevron { transition: opacity .14s ease, transform .18s ease; }
.sidebar-submenu-toggle[aria-expanded="true"] .sidebar-chevron { transform: rotate(180deg); }
.sidebar-subnav[hidden] { display: none; }
.sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: .6rem;
  color: rgba(255,255,255,.75);
  background: rgba(255,255,255,.08);
}
.sidebar-toggle:hover { color: white; background: rgba(255,255,255,.14); }
.sidebar-collapsed .sidebar { overflow-x: hidden; }
.sidebar-collapsed .sidebar-brand-text,
.sidebar-collapsed .sidebar-label,
.sidebar-collapsed .sidebar-section-label,
.sidebar-collapsed .sidebar-chevron {
  opacity: 0;
  pointer-events: none;
  width: 0;
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
}
.sidebar-collapsed .sidebar-link,
.sidebar-collapsed .sidebar nav > div > .sidebar-link {
  justify-content: center;
  gap: 0;
}
.sidebar-collapsed .sidebar-subnav {
  margin-left: 0 !important;
  padding-left: 0 !important;
  border-left: 0 !important;
}
.sidebar-collapsed .sidebar-header {
  justify-content: center;
  align-items: flex-start;
  height: 6.25rem;
  padding-top: .875rem;
  padding-left: .75rem !important;
  padding-right: .75rem !important;
}
.sidebar-collapsed .sidebar-toggle {
  position: absolute;
  top: 3.75rem;
  right: 50%;
  transform: translateX(50%);
  width: 1.9rem;
  height: 1.9rem;
}
.news-sheet { position: fixed; inset: 0 0 0 auto; width: min(420px, 100vw); background: white; box-shadow: -20px 0 50px rgba(15,23,42,.18); z-index: 80; transform: translateX(100%); transition: .2s ease; }
.news-sheet.open { transform: translateX(0); }
.overlay { position: fixed; inset: 0; background: rgba(15,23,42,.35); z-index: 70; display: none; }
.overlay.open { display: block; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.flash { position: fixed; top: 1rem; right: 1rem; z-index: 100; max-width: 28rem; border-radius: .8rem; border: 1px solid var(--border); background: white; padding: .9rem 1rem; box-shadow: 0 20px 40px rgba(15,23,42,.12); }
.progress { height: .35rem; border-radius: 999px; background: #1e293b; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--blue); }
@media (max-width: 900px) {
  .dashboard-shell {
    grid-template-columns: 4.75rem minmax(0, 1fr) !important;
    height: 100vh !important;
    min-height: 100vh !important;
    overflow: hidden !important;
  }
  .sidebar {
    width: 100% !important;
    height: 100vh !important;
    min-height: 0 !important;
    overflow: auto !important;
  }
  .dash-main {
    height: 100vh !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }
  .dashboard-shell.sidebar-expanded {
    grid-template-columns: 16rem minmax(0, 1fr) !important;
  }
  .dashboard-shell:not(.sidebar-expanded) .sidebar-brand-text,
  .dashboard-shell:not(.sidebar-expanded) .sidebar-label,
  .dashboard-shell:not(.sidebar-expanded) .sidebar-section-label,
  .dashboard-shell:not(.sidebar-expanded) .sidebar-chevron {
    opacity: 0 !important;
    pointer-events: none !important;
    width: 0 !important;
    max-width: 0 !important;
    overflow: hidden !important;
    white-space: nowrap !important;
  }
  .dashboard-shell:not(.sidebar-expanded) .sidebar-link {
    justify-content: center;
    gap: 0;
  }
  .sidebar-link {
    min-height: 2.35rem;
    font-size: .82rem;
    padding: .45rem .55rem;
  }
  .dashboard-shell:not(.sidebar-expanded) .sidebar-subnav {
    margin-left: 0 !important;
    padding-left: 0 !important;
    border-left: 0 !important;
  }
  .dashboard-shell:not(.sidebar-expanded) .sidebar-header {
    justify-content: center;
    align-items: flex-start;
    height: 6.25rem;
    padding-top: .875rem;
    padding-left: .75rem !important;
    padding-right: .75rem !important;
  }
  .sidebar-toggle {
    position: absolute;
    top: 3.75rem;
    right: 50%;
    transform: translateX(50%);
    width: 1.9rem;
    height: 1.9rem;
  }
  .dashboard-shell.sidebar-expanded .sidebar-toggle {
    top: .875rem;
    right: .45rem;
    transform: none;
  }
}
