.shell {
  display: flex;
  min-height: 100dvh;
  background: var(--omw-bg);
}

.sidebar {
  width: var(--omw-sidebar);
  flex: 0 0 var(--omw-sidebar);
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100dvh;
  padding: 26px 18px 18px;
  background: var(--omw-surface);
  border-right: 1px solid var(--omw-border);
  z-index: 20;
  transition: width 0.2s ease, flex-basis 0.2s ease;
}

.sidebar-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.nav-collapse {
  display: none;
  flex: 0 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px 16px;
  text-decoration: none;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--omw-action);
  box-shadow: inset 0 0 0 7px var(--omw-action), inset 0 0 0 9px var(--omw-text-inverse);
}

.brand strong {
  display: block;
  font-size: 15px;
  line-height: 1.2;
}

.brand span {
  display: block;
  font-size: 12px;
  color: var(--omw-text-secondary);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 12px;
  color: var(--omw-text);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}

.nav-link svg {
  flex: 0 0 auto;
  color: var(--omw-text-secondary);
}

.nav-link.is-active {
  background: var(--omw-surface-muted);
  font-weight: 700;
}

.nav-link.is-active svg {
  color: var(--omw-accent);
}

.sidebar-spacer {
  flex: 1;
}

.org-card,
.user-card {
  border-radius: var(--omw-radius);
  background: var(--omw-bg);
  padding: 14px;
}

.org-card strong,
.user-card strong {
  display: block;
  font-size: 13px;
}

.org-card p,
.user-card p {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.35;
  color: var(--omw-text-secondary);
}

.user-card {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
  background: transparent;
  padding: 6px;
}

.logout {
  color: var(--omw-accent);
  font-weight: 600;
  text-decoration: none;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--omw-surface-muted);
  color: var(--omw-accent);
  font-size: 12px;
  font-weight: 700;
}

.theme-toggle {
  margin-top: 8px;
  border: 1px solid var(--omw-border);
  background: var(--omw-surface);
  border-radius: var(--omw-radius-pill);
  min-height: 32px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.shell-main {
  flex: 1;
  min-width: 0;
}

.mobilebar {
  display: none;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 15;
  padding: 12px 16px;
  background: color-mix(in srgb, var(--omw-bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--omw-border);
}

.mobilebar strong {
  flex: 1;
  font-size: 15px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--omw-border);
  border-radius: 10px;
  background: var(--omw-surface);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.scrim {
  display: none;
}

.page {
  padding: 28px 36px 36px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px 24px;
  flex-wrap: wrap;
}

.page-head h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.lede {
  margin: 4px 0 0;
  max-width: 640px;
  color: var(--omw-text-secondary);
  font-size: 13px;
  line-height: 1.45;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.select {
  position: relative;
}

.select select {
  appearance: none;
  height: 34px;
  padding: 0 32px 0 14px;
  border-radius: var(--omw-radius-pill);
  border: 1px solid var(--omw-border);
  background: var(--omw-surface);
  font-size: 13px;
  font-weight: 500;
}

.select svg {
  position: absolute;
  right: 12px;
  top: 10px;
  width: 14px;
  height: 14px;
  pointer-events: none;
  color: var(--omw-text-secondary);
}

.btn {
  height: 39px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--omw-action);
  background: transparent;
  color: var(--omw-accent);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary {
  background: var(--omw-action);
  color: var(--omw-action-text);
  border-color: var(--omw-action);
}

.btn-primary:hover {
  background: var(--omw-action-hover);
}

.btn-quiet {
  border-color: transparent;
  background: transparent;
  color: var(--omw-accent);
  height: auto;
  padding: 0;
}

.strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--omw-border);
  border-radius: 14px;
  background: var(--omw-surface);
  font-size: 13px;
}

.strip-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--omw-accent);
  flex: 0 0 auto;
}

.dot-watch { background: var(--omw-status-watch); }
.dot-high { background: var(--omw-zone-high); }
.dot-positive { background: var(--omw-zone-optimal); }
.dot-low { background: var(--omw-zone-low); }
.dot-very { background: var(--omw-zone-very); }

.grid {
  display: grid;
  gap: 16px;
}

.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.layout-aside { grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.8fr); }

.card,
.kpi {
  background: var(--omw-surface);
  border: 1px solid var(--omw-border);
  border-radius: var(--omw-radius-lg);
  box-shadow: var(--omw-shadow);
}

.card { padding: 18px 20px 20px; }
.kpi { padding: 18px 18px 14px; display: flex; flex-direction: column; gap: 8px; min-height: 214px; }

.card-head,
.kpi-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.card-head h2,
.kpi-top h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.card-head p,
.muted {
  margin: 4px 0 0;
  color: var(--omw-text-secondary);
  font-size: 12px;
  line-height: 1.45;
}

.card-link {
  color: var(--omw-accent);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.kpi-label {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}

.kpi-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--omw-surface-muted);
  color: var(--omw-text-secondary);
  flex: 0 0 auto;
}

.kpi-value {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}

.kpi-value span {
  font-size: 14px;
  font-weight: 600;
  color: var(--omw-text-secondary);
  margin-bottom: 4px;
}

.kpi-note {
  margin: 0;
  color: var(--omw-text-secondary);
  font-size: 12px;
  line-height: 1.4;
}

.delta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
}

.delta-up { color: var(--omw-status-positive); }
.delta-down { color: var(--omw-zone-high-text); }
.delta-flat { color: var(--omw-text-secondary); }

.chart { width: 100%; height: 220px; }
.chart-sm { height: 36px; margin-top: auto; }
.chart-md { height: 260px; }

.donut-wrap {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 12px;
  align-items: center;
}

.donut {
  position: relative;
  height: 180px;
}

.donut .chart { height: 180px; }

.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.donut-center strong { font-size: 28px; line-height: 1; }
.donut-center span { font-size: 12px; color: var(--omw-text-secondary); }

.legend { display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.legend-row { display: flex; justify-content: space-between; gap: 8px; }
.legend-row b { font-weight: 700; }

.callout {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--omw-surface-muted);
  color: var(--omw-text-secondary);
  font-size: 12px;
  line-height: 1.45;
}

.callout-soft { background: var(--omw-action-soft); }

.metric-list,
.stack { display: flex; flex-direction: column; gap: 12px; }

.metric-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13px; }
.metric-row select {
  height: 34px;
  border-radius: var(--omw-radius-pill);
  border: 1px solid var(--omw-border);
  background: var(--omw-surface);
  padding: 0 12px;
}
.metric-row strong { font-size: 14px; }

.meter {
  display: flex;
  height: 8px;
  border-radius: var(--omw-radius-pill);
  overflow: hidden;
  background: var(--omw-surface-muted);
}

.meter > i { display: block; height: 100%; }
.meter-lg { height: 10px; }

.fill-low { background: var(--omw-zone-low); }
.fill-optimal { background: var(--omw-zone-optimal); }
.fill-high { background: var(--omw-zone-high); }
.fill-very { background: var(--omw-zone-very); }
.fill-action { background: var(--omw-action); }
.fill-watch { background: var(--omw-status-watch); }
.fill-off { background: var(--omw-zone-off); }

.zone-pills { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 8px; font-size: 12px; color: var(--omw-text-secondary); }
.zone-pills span { display: inline-flex; align-items: center; gap: 6px; }

.hbar { display: grid; grid-template-columns: minmax(120px, 180px) 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.hbar .meter { height: 8px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border-radius: var(--omw-radius-pill);
  background: var(--omw-surface-muted);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
}
.chip strong { font-weight: 700; }
.chip-warn { background: var(--omw-status-watch-soft); color: var(--omw-status-watch-text); }

.suggest {
  background: var(--omw-surface-muted);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.suggest h3 { margin: 0; font-size: 14px; }
.suggest p { margin: 0; font-size: 12px; color: var(--omw-text-secondary); line-height: 1.45; }
.suggest .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }

.steps { display: flex; flex-direction: column; gap: 12px; }
.step { display: grid; grid-template-columns: 64px 1fr; gap: 10px; font-size: 13px; }
.step b { color: var(--omw-text-secondary); font-size: 12px; }

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat {
  background: var(--omw-surface-muted);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
}
.stat strong { display: block; font-size: 20px; }
.stat span { font-size: 12px; color: var(--omw-text-secondary); }

.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 720px;
}
table.data th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--omw-text-secondary);
  background: var(--omw-surface-muted);
  padding: 10px 12px;
}
table.data td {
  padding: 12px;
  border-top: 1px solid var(--omw-border);
  vertical-align: top;
}
table.data tr:first-child td { border-top: 0; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--omw-radius-pill);
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.badge-run { background: var(--omw-zone-optimal-soft); color: var(--omw-zone-optimal-text); }
.badge-plan { background: var(--omw-action-soft); color: var(--omw-accent); }
.badge-done { background: var(--omw-surface-muted); color: var(--omw-text-secondary); }
.badge-watch { background: var(--omw-status-watch-soft); color: var(--omw-status-watch-text); }
.badge-danger { background: var(--omw-zone-very-soft); color: var(--omw-status-danger); }
.badge-draft { background: var(--omw-status-watch-soft); color: var(--omw-status-watch-text); }

.kv { width: 100%; border-collapse: collapse; font-size: 13px; }
.kv th, .kv td { padding: 10px 0; border-bottom: 1px solid var(--omw-border); vertical-align: top; }
.kv th { text-align: left; font-weight: 500; color: var(--omw-text-secondary); width: 42%; }
.kv td { text-align: right; font-weight: 600; }

.switch {
  position: relative;
  width: 42px;
  height: 24px;
  flex: 0 0 auto;
}
.switch input { position: absolute; opacity: 0; }
.switch i {
  position: absolute;
  inset: 0;
  border-radius: var(--omw-radius-pill);
  background: var(--omw-zone-off);
}
.switch i::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--omw-surface);
  transition: transform 0.15s ease;
}
.switch input:checked + i { background: var(--omw-action); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { outline: 2px solid var(--omw-focus-ring); }

.choice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: 14px;
  font-size: 13px;
}
.check-grid { display: flex; flex-direction: column; gap: 8px; }
.check-grid label {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--omw-surface-muted);
}

.mosaic { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; }
.mosaic-col { display: flex; flex-direction: column; gap: 4px; min-height: 220px; }
.mosaic-col i {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--omw-text-inverse);
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
  border-radius: 4px;
}
.mosaic-col span { text-align: center; font-size: 11px; color: var(--omw-text-secondary); font-weight: 700; }

.rank { display: flex; gap: 10px; align-items: center; font-size: 13px; }
.rank b {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--omw-action);
  color: var(--omw-action-text);
  font-size: 12px;
}
.report-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--omw-action-soft);
  color: var(--omw-accent);
}

.footnote {
  margin: 4px 0 0;
  color: var(--omw-text-tertiary);
  font-size: 12px;
  line-height: 1.45;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 40;
  max-width: min(360px, calc(100% - 32px));
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--omw-text);
  color: var(--omw-bg);
  font-size: 13px;
  box-shadow: var(--omw-shadow);
}

.missing { padding: 48px 16px; text-align: center; }
.missing h1 { margin-bottom: 8px; }

.auth-body {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.auth-card {
  width: min(100%, 440px);
  background: var(--omw-surface);
  border: 1px solid var(--omw-border);
  border-radius: var(--omw-radius-lg);
  box-shadow: var(--omw-shadow);
  padding: 28px 28px 24px;
}

.auth-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}

.auth-toolbar .theme-toggle {
  margin-top: 0;
}

.auth-card h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}

.field input {
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--omw-border);
  background: var(--omw-bg);
  padding: 0 14px;
  font-weight: 500;
}

.auth-form .btn {
  width: 100%;
  margin-top: 4px;
}

.auth-error {
  margin: 12px 0 0;
  color: var(--omw-status-danger);
  font-size: 13px;
  font-weight: 600;
}

@media (min-width: 961px) {
  .nav-collapse { display: grid; }

  html.nav-collapsed .sidebar {
    width: 76px;
    flex-basis: 76px;
    padding-inline: 12px;
  }

  html.nav-collapsed .sidebar-top {
    flex-direction: column;
    align-items: center;
  }

  html.nav-collapsed .brand-copy,
  html.nav-collapsed .nav-label,
  html.nav-collapsed .org-card,
  html.nav-collapsed .user-copy {
    display: none;
  }

  html.nav-collapsed .brand {
    padding: 0 0 8px;
  }

  html.nav-collapsed .nav-link,
  html.nav-collapsed .user-card {
    justify-content: center;
    padding-inline: 0;
  }

  html.nav-collapsed .nav-collapse svg {
    transform: scaleX(-1);
  }

  html.nav-collapsed .theme-toggle {
    width: 36px;
    height: 36px;
    margin-inline: auto;
    padding: 0;
    overflow: hidden;
    font-size: 0;
  }

  html.nav-collapsed .theme-toggle::before {
    content: "";
    display: block;
    width: 12px;
    height: 12px;
    margin: 11px auto;
    border-radius: 50%;
    background: var(--omw-accent);
    box-shadow: inset 0 0 0 3px var(--omw-surface);
  }
}

@media (max-width: 1200px) {
  .grid-5, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .layout-aside { grid-template-columns: 1fr; }
}

@media (max-width: 960px) {
  .sidebar {
    position: fixed;
    left: 0;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: var(--omw-shadow);
  }
  .shell.is-nav-open .sidebar { transform: none; }
  .shell.is-nav-open .scrim {
    display: block;
    position: fixed;
    inset: 0;
    background: color-mix(in srgb, var(--omw-text) 35%, transparent);
    z-index: 19;
  }
  .mobilebar { display: flex; }
  .page { padding: 16px; }
  .sidebar .theme-toggle { display: none; }
}

@media (max-width: 720px) {
  .grid-5,
  .grid-4,
  .grid-3,
  .grid-2,
  .stat-row,
  .donut-wrap,
  .hbar { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 22px; }
  .filters { justify-content: flex-start; }
  .mosaic { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
