@import url('https://rsms.me/inter/inter.css');

:root {
  color-scheme: light;
  font-family:
    'InterVariable',
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
  font-feature-settings: 'cv02' 1, 'cv03' 1, 'cv04' 1, 'cv11' 1;

  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-soft: #f3f5f8;
  --surface-muted: #edf0f4;
  --text: #0f172a;
  --text-soft: #1f2937;
  --muted: #5c6773;
  --line: #e3e6eb;
  --line-strong: #cdd2d9;
  --brand: #1e40af;
  --brand-strong: #172e6d;
  --brand-soft: #eaeef8;
  --brand-ring: rgba(30, 64, 175, 0.24);
  --accent: #0f766e;
  --success: #15803d;
  --success-soft: #e6f2ec;
  --warn: #92400e;
  --warn-soft: #f7ecd6;
  --danger: #991b1b;
  --danger-soft: #f7e1e1;
  --radius-sm: 3px;
  --radius-md: 4px;
  --radius-lg: 6px;
}

html[data-theme='federal'] {
  --brand: #1e40af;
  --brand-strong: #172e6d;
  --brand-soft: #eaeef8;
  --brand-ring: rgba(30, 64, 175, 0.24);
  --accent: #0f766e;
}

html[data-theme='civic'] {
  --bg: #f4f6f3;
  --surface-soft: #eef2ec;
  --surface-muted: #e7ede4;
  --line: #dde2d8;
  --line-strong: #c8cec0;
  --brand: #2f5f3a;
  --brand-strong: #1e4026;
  --brand-soft: #e3ece1;
  --brand-ring: rgba(47, 95, 58, 0.24);
  --accent: #8a5a1a;
}

html[data-theme='republic'] {
  --bg: #f7f4f5;
  --surface-soft: #f1ebed;
  --surface-muted: #ebe2e5;
  --line: #e3d8dc;
  --line-strong: #cbbbc1;
  --brand: #7a1f3a;
  --brand-strong: #551025;
  --brand-soft: #f1e4e8;
  --brand-ring: rgba(122, 31, 58, 0.24);
  --accent: #1e4e8a;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-size: 0.875rem;
  line-height: 1.45;
}

[hidden] {
  display: none !important;
}

body.drawer-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  max-width: 100%;
}

.app-shell {
  min-height: 100dvh;
}

.shell-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 52px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-left {
  min-width: 0;
  flex: 1;
}

.menu-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  color: var(--text-soft);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.menu-button:hover,
.icon-button:hover {
  background: var(--surface-soft);
  border-color: var(--line-strong);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: #fff;
  background: var(--brand);
  border-radius: var(--radius-md);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-mark::before {
  content: 'TL';
}

.brand-copy {
  min-width: 0;
  line-height: 1.15;
}

.brand-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.005em;
}

.brand-subtitle {
  margin-top: 2px;
  font-size: 0.6875rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.header-search {
  position: relative;
  min-width: 0;
  flex: 1;
  max-width: 380px;
}

.header-search input {
  width: 100%;
  height: 32px;
  padding: 0 36px 0 32px;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
}

.header-search input::placeholder {
  color: var(--muted);
}

.header-search input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--brand-ring);
}

.search-icon,
.search-shortcut {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
}

.search-icon {
  left: 10px;
  display: inline-flex;
}

.search-shortcut {
  right: 8px;
  padding: 1px 5px;
  font-size: 0.625rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 3px;
  font-variant-numeric: tabular-nums;
}

.header-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  color: var(--text-soft);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  font-size: 0.75rem;
}

.chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--success);
}

.user-pill {
  gap: 8px;
  height: auto;
  min-height: 32px;
  padding: 2px 4px 2px 0;
  border-color: transparent;
  background: transparent;
}

.user-pill > span:first-child {
  display: inline-flex;
  flex-direction: column;
  line-height: 1.15;
}

.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: #fff;
  background: var(--brand);
  border-radius: 999px;
  font-size: 0.625rem;
  font-weight: 600;
}

.notif-counter {
  position: absolute;
  top: -3px;
  right: -3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  color: #fff;
  background: var(--danger);
  border: 1px solid var(--surface);
  border-radius: 999px;
  font-size: 0.625rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.drawer-backdrop {
  position: fixed;
  inset: 52px 0 0;
  z-index: 25;
  background: rgba(15, 23, 42, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.app-frame {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: calc(100dvh - 52px);
}

.sidebar {
  position: sticky;
  top: 52px;
  align-self: start;
  height: calc(100dvh - 52px);
  overflow: auto;
  padding: 14px 10px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}

.sidebar-nav {
  flex: 1;
  min-height: 0;
}

.sidebar-section + .sidebar-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.sidebar-label {
  margin: 0 8px 6px;
  color: var(--muted);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.nav-list,
.nav-children,
.mini-list,
.metric-list,
.legend-list,
.activity-list,
.timeline,
.task-list,
.action-list,
.stat-list,
.tile-list,
.empty-points,
.split-list,
.table-actions,
.tag-list,
.toolbar-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-list,
.nav-children {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nav-item,
.nav-child,
.nav-summary {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 30px;
  padding: 6px 10px;
  color: var(--text-soft);
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
}

.nav-item > svg,
.nav-summary > svg {
  color: var(--muted);
  flex-shrink: 0;
  transition: color 120ms ease;
}

.nav-item:hover,
.nav-child:hover,
.nav-summary:hover {
  color: var(--text);
  background: var(--surface-soft);
}

.nav-item:hover > svg,
.nav-summary:hover > svg {
  color: var(--text-soft);
}

.nav-item.active {
  color: var(--brand-strong);
  background: var(--brand-soft);
  font-weight: 600;
}

.nav-item.active > svg {
  color: var(--brand);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  background: var(--brand);
  border-radius: 0 2px 2px 0;
}

.nav-child.active {
  color: var(--brand-strong);
  background: var(--brand-soft);
  font-weight: 600;
}

.nav-child.active::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 50%;
  width: 4px;
  height: 4px;
  margin-top: -2px;
  background: var(--brand);
  border-radius: 999px;
}

.nav-summary {
  cursor: pointer;
  list-style: none;
}

.nav-summary::-webkit-details-marker {
  display: none;
}

.nav-group[open] .nav-summary {
  color: var(--text);
}

.nav-chevron {
  margin-left: auto;
  color: var(--muted);
  transition: transform 160ms ease;
}

.nav-group[open] .nav-chevron {
  transform: rotate(90deg);
}

.nav-children {
  padding-top: 2px;
  padding-left: 26px;
}

.nav-child {
  min-height: 28px;
  padding: 4px 8px;
  font-size: 0.8125rem;
  color: var(--muted);
  border-left-width: 0;
}

.nav-child.active {
  border-left-width: 0;
}

.sidebar-footnote {
  margin-top: auto;
  padding: 10px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.sidebar-footnote h3 {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
}

.sidebar-footnote p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.4;
}

.sidebar-footnote a {
  color: var(--brand);
  font-weight: 500;
}

.page-area {
  min-width: 0;
}

.page-content {
  padding: 20px 22px 32px;
}

.page-width {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.75rem;
}

.breadcrumbs svg {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  opacity: 0.7;
}

.breadcrumbs a:hover {
  color: var(--text);
  text-decoration: underline;
}

.page-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-top: 8px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.greeting-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.greeting-copy {
  min-width: 0;
}

.greeting-eyebrow {
  display: inline-flex;
  align-items: center;
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
}

.dot-sep {
  display: inline-block;
  margin: 0 8px;
  color: var(--line-strong);
}

.greeting-title {
  margin: 4px 0 0;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.greeting-title > span[data-user-name] {
  color: var(--brand-strong);
}

.greeting-sub {
  margin: 10px 0 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.muted-inline {
  color: var(--muted);
  font-size: 0.75rem;
}

.priority-tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.priority-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius-md);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.priority-tile.warn {
  border-left-color: var(--warn);
}

.priority-tile.danger {
  border-left-color: var(--danger);
}

.priority-tile:hover {
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.priority-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}

.priority-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: 3px;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.priority-tag.neutral {
  color: var(--muted);
  background: var(--surface-muted);
}

.priority-tag.critical {
  color: var(--danger);
  background: var(--danger-soft);
}

.priority-tile.warn .priority-tag {
  color: var(--warn);
  background: var(--warn-soft);
}

.priority-count {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.priority-tile strong {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.priority-tile p {
  flex: 1;
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.45;
}

.priority-link {
  margin-top: 6px;
  color: var(--brand);
  font-size: 0.75rem;
  font-weight: 500;
}

.priority-link:hover {
  text-decoration: underline;
}

@media (max-width: 1100px) {
  .priority-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .greeting-band {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 780px) {
  .priority-tiles {
    grid-template-columns: 1fr;
  }
}

.page-header-copy {
  min-width: 0;
}

.page-title {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.25;
}

.page-subtitle {
  margin: 6px 0 0;
  max-width: 78ch;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn,
.btn-ghost,
.btn-secondary,
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  font-size: 0.8125rem;
  font-weight: 500;
  transition:
    background 120ms ease,
    border-color 120ms ease;
}

.btn-primary {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.btn-primary:hover {
  background: var(--brand-strong);
  border-color: var(--brand-strong);
}

.btn-secondary {
  color: var(--text-soft);
  background: var(--surface);
  border-color: var(--line-strong);
}

.btn-secondary:hover,
.btn-ghost:hover {
  background: var(--surface-soft);
}

.btn-ghost {
  color: var(--brand);
  background: transparent;
  border-color: transparent;
  padding: 0 8px;
  min-height: 28px;
  font-size: 0.75rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.panel-body {
  padding: 14px 16px;
}

.panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.panel-title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.panel-subtitle {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.45;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.panel-link {
  color: var(--brand);
  font-size: 0.75rem;
  font-weight: 500;
}

.panel-link:hover {
  text-decoration: underline;
}

.note-banner {
  display: flex;
  align-items: start;
  gap: 10px;
  padding: 10px 12px;
  margin-top: 12px;
  color: var(--text-soft);
  background: var(--brand-soft);
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius-md);
  font-size: 0.75rem;
}

.note-banner strong {
  color: var(--text);
}

.grid,
.metric-strip,
.quick-grid,
.chart-grid,
.stats-grid,
.form-grid,
.info-grid {
  display: grid;
  gap: 12px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid-2-1 {
  grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
}

.grid-sidebar {
  grid-template-columns: minmax(280px, 1fr) minmax(0, 1.4fr);
}

.span-2 {
  grid-column: span 2;
}

.metric-strip {
  margin-top: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.metric-cell {
  padding: 12px 14px;
}

.metric-cell + .metric-cell {
  border-left: 1px solid var(--line);
}

.metric-label {
  color: var(--muted);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-value {
  margin-top: 4px;
  color: var(--text);
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.metric-meta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
}

.metric-cell-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.spark {
  width: 60px;
  height: 20px;
  flex-shrink: 0;
  color: var(--brand);
}

.spark path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.spark.negative {
  color: var(--danger);
}

.spark.positive {
  color: var(--success);
}

.metric-meta.positive {
  color: var(--success);
}

.metric-meta.warning {
  color: var(--warn);
}

.split-panes {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr);
  gap: 12px;
}

.progress-bar {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 3px;
  margin-top: 10px;
}

.progress-bar span {
  height: 4px;
  border-radius: 2px;
  background: var(--surface-muted);
}

.progress-bar span.done {
  background: var(--brand);
}

.task-list,
.split-list,
.activity-list,
.action-list,
.mini-list,
.stat-list,
.tile-list,
.timeline,
.legend-list,
.metric-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.task-row,
.split-row,
.activity-row,
.action-row,
.mini-row,
.tile-row,
.timeline-row {
  display: flex;
  align-items: start;
  gap: 10px;
  padding: 10px 2px;
  border-top: 1px solid var(--line);
}

.task-row:first-child,
.split-row:first-child,
.activity-row:first-child,
.action-row:first-child,
.mini-row:first-child,
.tile-row:first-child,
.timeline-row:first-child {
  border-top: 0;
  padding-top: 2px;
}

.task-row.done strong {
  color: var(--muted);
}

.task-row strong,
.split-row strong,
.activity-row strong,
.action-row strong,
.mini-row strong,
.tile-row strong,
.timeline-row strong {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
}

.task-row p,
.split-row p,
.activity-row p,
.action-row p,
.mini-row p,
.tile-row p,
.timeline-row p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.45;
}

.task-row > div,
.split-row > div,
.activity-row > div,
.action-row > div,
.mini-row > div,
.tile-row > div {
  flex: 1;
  min-width: 0;
}

.task-icon,
.status-badge,
.badge,
.mini-icon,
.timeline-dot,
.action-icon {
  flex-shrink: 0;
}

.task-icon,
.action-icon,
.mini-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.task-row.done .task-icon {
  color: var(--success);
  background: var(--success-soft);
}

.meta-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
}

.badge,
.status-badge,
.soft-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 20px;
  padding: 0 7px;
  border-radius: 3px;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.badge,
.soft-badge {
  color: var(--text-soft);
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.status-badge {
  color: var(--brand-strong);
  background: var(--brand-soft);
  border: 1px solid color-mix(in srgb, var(--brand) 20%, transparent);
}

.status-badge.success {
  color: var(--success);
  background: var(--success-soft);
  border-color: color-mix(in srgb, var(--success) 25%, transparent);
}

.status-badge.warning {
  color: var(--warn);
  background: var(--warn-soft);
  border-color: color-mix(in srgb, var(--warn) 30%, transparent);
}

.status-badge.danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 30%, transparent);
}

.link-tile {
  display: block;
  padding: 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  transition: border-color 120ms ease, background 120ms ease;
}

.link-tile:hover {
  border-color: var(--brand);
  background: var(--surface-soft);
}

.link-tile strong {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
}

.link-tile p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.45;
}

.chart-shell {
  position: relative;
  min-height: 220px;
}

.chart-frame {
  position: relative;
  height: 200px;
  padding: 10px 0 0;
}

.chart-gridlines {
  position: absolute;
  inset: 8px 0 28px;
  background-image: linear-gradient(to top, var(--line) 1px, transparent 1px);
  background-size: 100% 25%;
}

.bars {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--count, 6), minmax(0, 1fr));
  align-items: end;
  gap: 8px;
  height: 160px;
  padding-top: 10px;
}

.bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.bar-track {
  width: 100%;
  max-width: 32px;
  height: 140px;
  display: flex;
  align-items: end;
  justify-content: center;
  background: transparent;
  overflow: hidden;
}

.bar-fill {
  width: 100%;
  height: var(--value);
  min-height: 3px;
  background: var(--brand);
  border-radius: 2px 2px 0 0;
}

.bar-label {
  color: var(--muted);
  font-size: 0.6875rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.line-chart,
.sparkline {
  width: 100%;
  height: 200px;
}

.line-chart path.area {
  fill: color-mix(in srgb, var(--brand) 10%, transparent);
}

.line-chart path.stroke,
.sparkline path.stroke {
  fill: none;
  stroke: var(--brand);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.line-chart path.stroke.secondary,
.sparkline path.stroke.secondary {
  stroke: var(--accent);
}

.line-chart circle,
.sparkline circle {
  fill: var(--surface);
  stroke: var(--brand);
  stroke-width: 2;
  r: 3;
}

.legend-list {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.75rem;
  border-top: 0;
  padding: 0;
}

.legend-swatch {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.map-canvas {
  position: relative;
  min-height: 300px;
  overflow: hidden;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.map-canvas::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.6;
}

.map-land {
  position: absolute;
  inset: 8% 18% 10% 20%;
  background: color-mix(in srgb, var(--brand) 8%, transparent);
  border: 1px solid var(--line-strong);
  clip-path: polygon(
    25% 6%, 45% 0%, 55% 4%, 62% 11%, 66% 18%, 77% 18%, 85% 27%, 82% 42%,
    88% 58%, 80% 72%, 68% 74%, 57% 90%, 42% 98%, 24% 84%, 18% 70%, 22% 56%,
    10% 41%, 14% 24%
  );
}

.map-point {
  position: absolute;
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 22px;
  padding: 0 6px;
  color: #fff;
  background: var(--brand);
  border: 1px solid var(--brand-strong);
  border-radius: var(--radius-sm);
  font-size: 0.6875rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transform: translate(-50%, -50%);
}

.map-point.secondary {
  background: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 60%, black);
}

.point-a { left: 48%; top: 28%; }
.point-b { left: 58%; top: 33%; }
.point-c { left: 42%; top: 47%; }
.point-d { left: 60%; top: 55%; }
.point-e { left: 52%; top: 63%; }
.point-f { left: 33%; top: 42%; }

.donut-wrap {
  display: grid;
  justify-items: center;
  gap: 12px;
}

.donut {
  position: relative;
  width: 180px;
  height: 180px;
  border-radius: 999px;
  background: conic-gradient(
    var(--brand) 0 calc(var(--a) * 1%),
    var(--accent) calc(var(--a) * 1%) calc((var(--a) + var(--b)) * 1%),
    color-mix(in srgb, var(--brand) 22%, white) calc((var(--a) + var(--b)) * 1%) calc((var(--a) + var(--b) + var(--c)) * 1%),
    var(--surface-muted) calc((var(--a) + var(--b) + var(--c)) * 1%) 100%
  );
}

.donut::after {
  content: '';
  position: absolute;
  inset: 28px;
  background: var(--surface);
  border-radius: 999px;
}

.donut-center {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  text-align: center;
}

.donut-center strong {
  display: block;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.donut-center span {
  color: var(--muted);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ratio-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ratio-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 60px;
  align-items: center;
  gap: 10px;
}

.ratio-label,
.ratio-value {
  font-size: 0.75rem;
}

.ratio-value {
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.ratio-track {
  position: relative;
  height: 8px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 2px;
  overflow: hidden;
}

.ratio-fill {
  height: 100%;
  width: var(--value);
  background: var(--brand);
}

.tabs {
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 2px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.tab {
  min-height: 24px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 2px;
  font-size: 0.75rem;
  font-weight: 500;
}

.tab.active {
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 160px;
  padding: 14px;
  text-align: center;
  background: var(--surface-soft);
  border-radius: var(--radius-md);
  border: 1px dashed var(--line-strong);
}

.empty-state strong {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
}

.empty-state p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
}

.activity-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: var(--brand);
  background: var(--brand-soft);
  border: 1px solid color-mix(in srgb, var(--brand) 18%, transparent);
  border-radius: 999px;
  font-size: 0.625rem;
  font-weight: 600;
}

.activity-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
}

.field-grid,
.form-grid {
  display: grid;
  gap: 12px;
}

.field-label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-soft);
  font-size: 0.75rem;
  font-weight: 500;
}

.field,
.textarea,
.select-shell select {
  width: 100%;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
}

.field,
.select-shell select {
  height: 34px;
  padding: 0 10px;
}

.textarea {
  min-height: 100px;
  padding: 10px;
  resize: vertical;
}

.field:focus,
.textarea:focus,
.select-shell select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--brand-ring);
}

.select-shell {
  display: inline-grid;
  width: 100%;
  grid-template-columns: 1fr 26px;
  align-items: center;
}

.select-shell select {
  grid-column: 1 / span 2;
  grid-row: 1;
  appearance: none;
  padding-right: 30px;
}

.select-shell svg {
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
  color: var(--muted);
  pointer-events: none;
}

.media-dropzone {
  display: grid;
  place-items: center;
  min-height: 120px;
  padding: 16px;
  text-align: center;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  font-size: 0.75rem;
}

.logo-preview {
  display: grid;
  place-items: center;
  width: 80px;
  height: 80px;
  color: var(--brand);
  background: var(--brand-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar-block {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.table-shell {
  margin-top: 12px;
}

.table-scroll {
  margin: 0 -16px;
  overflow-x: auto;
  white-space: nowrap;
}

.table-scroll-inner {
  display: inline-block;
  min-width: 100%;
  padding: 0 16px;
  vertical-align: middle;
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 880px;
}

.table th {
  padding: 8px 0;
  color: var(--muted);
  text-align: left;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  border-bottom: 1px solid var(--line-strong);
  background: var(--surface-soft);
}

.table th:first-child,
.table td:first-child {
  padding-left: 12px;
}

.table th:last-child,
.table td:last-child {
  padding-right: 12px;
}

.table td {
  padding: 10px 0;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
  font-size: 0.8125rem;
}

.table tbody tr:hover {
  background: var(--surface-soft);
}

.table th + th,
.table td + td {
  padding-left: 16px;
}

.table small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.6875rem;
}

.table-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.action-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  color: var(--text-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.action-pill:hover {
  color: var(--brand);
  background: var(--brand-soft);
  border-color: var(--brand);
}

.action-pill svg {
  width: 14px;
  height: 14px;
}

.ops-strip {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin-top: -1px;
  padding: 0 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  overflow-x: auto;
}

.ops-strip-label {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  color: var(--muted);
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-right: 1px solid var(--line);
}

.ops-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 14px;
  white-space: nowrap;
}

.ops-stat + .ops-stat {
  border-left: 1px solid var(--line);
}

.ops-stat > span {
  color: var(--muted);
  font-size: 0.6875rem;
  font-weight: 500;
}

.ops-stat > strong {
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.summary-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.summary-card {
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.summary-card strong {
  display: block;
  margin-top: 4px;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.summary-card span {
  color: var(--muted);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.hero-steps {
  display: grid;
  gap: 4px;
}

.hero-step {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.hero-step strong {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
}

.hero-step span {
  color: var(--muted);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.pill-switcher {
  display: inline-flex;
  gap: 0;
  padding: 2px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.pill-switcher button {
  min-height: 22px;
  padding: 0 8px;
  color: var(--muted);
  border: 0;
  border-radius: 2px;
  background: transparent;
  font-size: 0.6875rem;
  font-weight: 500;
}

.pill-switcher button.active {
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

.control-dock {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 45;
  display: grid;
  gap: 8px;
  width: min(340px, calc(100vw - 24px));
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.1);
}

.control-dock.collapsed {
  width: auto;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.dock-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-self: end;
  padding: 6px 10px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
  font-size: 0.75rem;
  font-weight: 500;
}

.dock-toggle svg {
  color: var(--brand);
}

.dock-toggle:hover {
  border-color: var(--brand);
}

.dock-panel {
  display: grid;
  gap: 6px;
}

.control-dock.collapsed .dock-panel {
  display: none;
}

.dock-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.dock-row > span {
  color: var(--muted);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.notice-panel {
  display: grid;
  gap: 12px;
  place-items: start;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius-md);
}

.notice-panel h2 {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
}

.notice-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.wizard-rail {
  position: relative;
  height: 3px;
  margin: 4px 0 14px;
  background: var(--surface-muted);
  border-radius: 2px;
  overflow: hidden;
}

.wizard-rail-fill {
  display: block;
  height: 100%;
  width: var(--value, 0%);
  background: var(--brand);
  transition: width 180ms ease;
}

.wizard-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0;
}

.wizard-step {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.wizard-step:first-child {
  border-top: 0;
}

.wizard-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.wizard-step.done .wizard-number {
  color: #fff;
  background: var(--success);
  border-color: var(--success);
}

.wizard-step.active .wizard-number {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.wizard-copy strong {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.wizard-step.done .wizard-copy strong {
  color: var(--muted);
}

.wizard-copy p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.45;
}

@media (max-width: 780px) {
  .wizard-step {
    grid-template-columns: 28px minmax(0, 1fr);
    row-gap: 6px;
  }
  .wizard-step .status-badge,
  .wizard-step .btn-ghost,
  .wizard-step .btn-primary,
  .wizard-step .btn-secondary {
    grid-column: 2;
  }
}

dialog.modal {
  width: min(440px, calc(100vw - 32px));
  padding: 0;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
}

dialog.modal::backdrop {
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(2px);
}

.modal-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
}

.modal-title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
}

.modal-close:hover {
  color: var(--text);
  background: var(--surface-soft);
}

.modal-body {
  padding: 12px 16px 14px;
  color: var(--text-soft);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.modal-body p {
  margin: 0 0 8px;
}

.modal-body strong {
  color: var(--text);
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 16px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 12px;
  color: #fff;
  background: var(--danger);
  border: 1px solid var(--danger);
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 500;
}

.btn-danger:hover {
  background: color-mix(in srgb, var(--danger) 85%, black);
}

[data-tooltip] {
  position: relative;
}

[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  padding: 4px 8px;
  color: #fff;
  background: #0f172a;
  border-radius: var(--radius-sm);
  font-size: 0.6875rem;
  font-weight: 500;
  white-space: nowrap;
  z-index: 50;
  pointer-events: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1200px) {
  .grid-3,
  .summary-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .grid-2,
  .grid-3,
  .grid-4,
  .grid-2-1,
  .grid-sidebar,
  .split-panes,
  .summary-row,
  .metric-strip {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }

  .metric-cell + .metric-cell {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .page-header {
    align-items: start;
    flex-direction: column;
  }

  .app-frame {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 62px;
    left: 12px;
    z-index: 30;
    width: min(300px, calc(100vw - 24px));
    height: calc(100dvh - 74px);
    transform: translateX(-120%);
    transition: transform 160ms ease;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.12);
  }

  body.drawer-open .sidebar {
    transform: translateX(0);
  }

  body.drawer-open .drawer-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .page-content {
    padding: 16px 14px 100px;
  }

  .table-scroll {
    margin: 0 -14px;
  }

  .table-scroll-inner {
    padding: 0 14px;
  }
}

@media (min-width: 1101px) {
  .menu-button {
    display: none;
  }
}

@media (max-width: 780px) {
  .shell-header {
    padding: 0 12px;
  }

  .brand-subtitle,
  .search-shortcut,
  .header-search,
  .desktop-only {
    display: none;
  }

  .header-right {
    margin-left: auto;
  }

  .control-dock {
    right: 10px;
    bottom: 10px;
    width: calc(100vw - 20px);
  }

  .dock-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .ratio-row {
    grid-template-columns: 80px minmax(0, 1fr) 48px;
  }

  .summary-row {
    grid-template-columns: 1fr;
  }

  .donut {
    width: 150px;
    height: 150px;
  }

  .donut::after {
    inset: 22px;
  }
}
