:root {
  color-scheme: light;
  --bg: #f3f6f8;
  --surface: #ffffff;
  --surface-soft: #eef3f5;
  --text: #14262c;
  --muted: #62747a;
  --line: #dbe4e7;
  --brand: #156b66;
  --brand-strong: #0d504d;
  --brand-soft: #dff1ee;
  --danger: #b4233c;
  --danger-soft: #fbe8eb;
  --warning: #8b5d12;
  --warning-soft: #fff1d6;
  --info: #225fa6;
  --info-soft: #e7f0fb;
  --shadow: 0 12px 36px rgba(21, 44, 52, 0.09);
  --radius: 18px;
  --radius-small: 12px;
  font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0f181b;
    --surface: #172327;
    --surface-soft: #202f34;
    --text: #edf5f4;
    --muted: #a3b6b8;
    --line: #304247;
    --brand: #70c9bf;
    --brand-strong: #96ddd5;
    --brand-soft: #193d3b;
    --danger: #ff8da0;
    --danger-soft: #43242b;
    --warning: #f4c56f;
    --warning-soft: #44351f;
    --info: #91bff2;
    --info-soft: #243a52;
    --shadow: 0 14px 42px rgba(0, 0, 0, 0.24);
  }
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
}

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

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 38%, transparent);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.55rem, 2vw, 2.1rem);
  letter-spacing: -0.035em;
}

h2 {
  margin-bottom: 0.3rem;
  font-size: 1.15rem;
}

.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;
}

.eyebrow {
  margin-bottom: 0.35rem;
  color: var(--brand);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.mono {
  font-family: "Cascadia Mono", Consolas, monospace;
}

.button {
  min-height: 42px;
  padding: 0.65rem 1rem;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--text);
  font-weight: 650;
}

.button:hover {
  border-color: var(--brand);
  color: var(--brand-strong);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.button-primary {
  border-color: var(--brand-strong);
  background: var(--brand-strong);
  color: #ffffff;
}

.button-primary:hover {
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff;
}

.button-quiet {
  width: 100%;
  background: transparent;
}

.button-block {
  width: 100%;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-soft);
  font-size: 1.5rem;
  line-height: 1;
}

.brand-mark {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 19px 19px 19px 7px;
  background: var(--brand-strong);
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.05em;
}

.brand-mark-small {
  width: 42px;
  height: 42px;
  border-radius: 14px 14px 14px 5px;
  font-size: 0.8rem;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  padding: 2rem;
  place-items: center;
  background:
    radial-gradient(circle at 20% 10%, color-mix(in srgb, var(--brand) 14%, transparent), transparent 28rem),
    var(--bg);
}

.login-card {
  width: min(100%, 430px);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-card .brand-mark {
  margin-bottom: 1.6rem;
}

.login-card h1 {
  margin-bottom: 0.8rem;
}

.login-copy,
.privacy-note {
  color: var(--muted);
  line-height: 1.55;
}

.login-form {
  display: grid;
  gap: 0.65rem;
  margin-top: 1.7rem;
}

.login-form label {
  font-size: 0.9rem;
  font-weight: 650;
}

.login-form input,
.search-field input,
.reply-box textarea,
.select-label select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
}

.login-form input,
.search-field input,
.select-label select {
  min-height: 44px;
  padding: 0.65rem 0.8rem;
}

.form-error {
  margin: 0.3rem 0 0;
  color: var(--danger);
  font-size: 0.9rem;
}

.privacy-note {
  margin: 1.2rem 0 0;
  font-size: 0.78rem;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 238px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  padding: 1.25rem 1rem;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 0.4rem 1.5rem;
}

.brand-row strong,
.brand-row span {
  display: block;
}

.brand-row span {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.nav-list {
  display: grid;
  gap: 0.35rem;
  overflow-y: auto;
}

.nav-button {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 0.8rem;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-weight: 650;
}

.nav-button:hover,
.nav-button.is-active {
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.count-badge {
  min-width: 24px;
  padding: 0.15rem 0.4rem;
  border-radius: 99px;
  background: var(--danger);
  color: #ffffff;
  text-align: center;
  font-size: 0.72rem;
}

.sidebar-footer {
  display: grid;
  gap: 0.75rem;
  margin-top: auto;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2f9b78;
  box-shadow: 0 0 0 4px color-mix(in srgb, #2f9b78 16%, transparent);
}

.workspace {
  min-width: 0;
}

.topbar {
  display: flex;
  min-height: 96px;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem clamp(1rem, 3vw, 2.2rem);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.updated-at {
  color: var(--muted);
  font-size: 0.78rem;
}

.content {
  width: min(100%, 1500px);
  padding: clamp(1rem, 3vw, 2.2rem);
}

.panel-section {
  display: grid;
  gap: 1rem;
}

.alert,
.safety-banner,
.audio-warning {
  border-radius: var(--radius-small);
}

.alert {
  margin-bottom: 1rem;
  padding: 0.8rem 1rem;
}

.alert-error {
  border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent);
  background: var(--danger-soft);
  color: var(--danger);
}

.safety-banner {
  display: grid;
  gap: 0.25rem;
  padding: 0.9rem 1rem;
  border: 1px solid color-mix(in srgb, var(--warning) 30%, transparent);
  background: var(--warning-soft);
  color: var(--warning);
  line-height: 1.45;
}

.safety-banner span {
  font-size: 0.86rem;
}

.section-toolbar,
.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.section-toolbar p,
.section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.select-label {
  display: grid;
  min-width: 220px;
  gap: 0.3rem;
  color: var(--muted);
  font-size: 0.76rem;
}

.crisis-list {
  display: grid;
  gap: 0.75rem;
}

.crisis-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-left: 5px solid var(--warning);
  border-radius: var(--radius-small);
  background: var(--surface);
}

.crisis-card.risk-r3 {
  border-left-color: var(--danger);
}

.risk-badge {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 14px;
  background: var(--warning-soft);
  color: var(--warning);
  font-weight: 800;
}

.risk-r3 .risk-badge {
  background: var(--danger-soft);
  color: var(--danger);
}

.crisis-main {
  min-width: 0;
}

.crisis-title-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.crisis-title-row strong {
  font-size: 0.96rem;
}

.crisis-main p {
  display: -webkit-box;
  margin: 0.35rem 0;
  overflow: hidden;
  color: var(--muted);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-height: 1.45;
}

.crisis-meta {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.76rem;
}

.technical-badge,
.profile-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  border-radius: 99px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 650;
}

.empty-state {
  display: grid;
  min-height: 190px;
  place-content: center;
  gap: 0.35rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--text);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 0.8rem;
}

.metric-grid-compact {
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
}

.metric-grid-compact .metric-card {
  min-height: 100px;
}

.toolbar-actions {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.compact-label {
  min-width: 150px;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

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

.bar-list {
  display: grid;
  gap: 0.75rem;
  min-height: 230px;
  align-content: start;
  margin-top: 1rem;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(120px, 1.6fr) auto;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.8rem;
}

.bar-row > span:first-child {
  overflow-wrap: anywhere;
}

.bar-track {
  height: 12px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--surface-soft);
}

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

.bar-fill.info {
  background: var(--info);
}

.bar-fill.warning {
  background: var(--warning);
}

.bar-fill.danger {
  background: var(--danger);
}

.privacy-chip {
  margin: 0;
  padding: 0.45rem 0.7rem;
  border-radius: 99px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 0.78rem;
  font-weight: 700;
}

.workflow-badge {
  display: inline-flex;
  padding: 0.3rem 0.55rem;
  border-radius: 99px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
}

.workflow-badge.in_progress,
.workflow-badge.follow_up {
  background: var(--info-soft);
  color: var(--info);
}

.workflow-badge.new {
  background: var(--warning-soft);
  color: var(--warning);
}

.workflow-badge.closed {
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.follow-up-overdue {
  color: var(--danger);
  font-weight: 700;
}

.metric-card,
.surface {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 4px 18px color-mix(in srgb, var(--text) 4%, transparent);
}

.metric-card {
  min-height: 126px;
  padding: 1rem;
}

.metric-card span {
  color: var(--muted);
  font-size: 0.8rem;
}

.metric-card strong {
  display: block;
  margin-top: 0.6rem;
  font-size: clamp(1.55rem, 3vw, 2.25rem);
  letter-spacing: -0.05em;
}

.metric-card small {
  display: block;
  margin-top: 0.3rem;
  color: var(--muted);
}

.chart-surface,
.system-surface,
.provider-surface {
  padding: 1rem;
}

.activity-chart {
  min-height: 260px;
  margin-top: 1rem;
}

.activity-chart svg {
  display: block;
  width: 100%;
  height: 260px;
  overflow: visible;
}

.chart-grid-line {
  stroke: var(--line);
  stroke-width: 1;
}

.chart-bar {
  fill: var(--brand);
}

.chart-bar-info {
  fill: var(--info);
}

.chart-bar-warning {
  fill: var(--warning);
}

.chart-bar-danger {
  fill: var(--danger);
}

.chart-user-line {
  fill: none;
  stroke: var(--info);
  stroke-width: 2;
}

.chart-label {
  fill: var(--muted);
  font-size: 11px;
}

.chart-empty {
  display: grid;
  min-height: 240px;
  place-items: center;
  color: var(--muted);
}

.system-surface {
  display: grid;
  grid-template-columns: minmax(190px, 0.6fr) minmax(0, 1.4fr);
  gap: 1rem;
}

.provider-surface {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(280px, 1.2fr);
  align-items: center;
  gap: 1rem;
}

.provider-surface p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.provider-control {
  display: grid;
  justify-items: end;
  gap: 0.45rem;
}

.provider-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.55rem;
}

.provider-actions .button[aria-pressed="true"] {
  border-color: var(--brand);
  background: var(--brand);
  color: var(--surface);
}

.provider-control #provider-note {
  font-size: 0.76rem;
  text-align: right;
}

.system-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  margin: 0;
}

.system-list div {
  padding: 0.75rem;
  border-radius: 11px;
  background: var(--surface-soft);
}

.system-list dt {
  color: var(--muted);
  font-size: 0.72rem;
}

.system-list dd {
  margin: 0.25rem 0 0;
  font-size: 0.86rem;
  font-weight: 650;
}

.search-field {
  width: min(100%, 260px);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 0.8rem 0.9rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

td {
  font-size: 0.86rem;
}

tbody tr:last-child td {
  border-bottom: 0;
}

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

.user-cell {
  display: grid;
  gap: 0.15rem;
}

.user-cell span {
  color: var(--muted);
  font-size: 0.74rem;
}

.table-action {
  min-height: 34px;
  padding: 0.35rem 0.65rem;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.8rem;
}

.pagination span {
  color: var(--muted);
  font-size: 0.8rem;
}

.detail-panel {
  position: fixed;
  z-index: 10;
  top: 0;
  right: 0;
  display: flex;
  width: min(620px, 100%);
  height: 100vh;
  flex-direction: column;
  overflow-y: auto;
  padding: 1.15rem;
  border-left: 1px solid var(--line);
  background: var(--surface);
  box-shadow: -18px 0 55px rgba(8, 24, 28, 0.18);
}

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--line);
}

.detail-header h2 {
  font-size: 1.35rem;
}

.detail-header p:last-child {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  padding: 1rem 0;
}

.profile-field {
  min-width: 0;
  padding: 0.7rem;
  border-radius: 11px;
  background: var(--surface-soft);
}

.profile-field span,
.profile-field strong {
  display: block;
}

.profile-field span {
  margin-bottom: 0.25rem;
  color: var(--muted);
  font-size: 0.7rem;
}

.profile-field strong {
  overflow-wrap: anywhere;
  font-size: 0.84rem;
}

.detail-tabs {
  display: flex;
  gap: 0.35rem;
  margin: 0.2rem 0 0.8rem;
  padding: 0.3rem;
  border-radius: 12px;
  background: var(--surface-soft);
}

.detail-tab {
  flex: 1;
  min-height: 38px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-weight: 650;
}

.detail-tab.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--text) 7%, transparent);
}

.message-list {
  display: grid;
  gap: 0.65rem;
  padding: 0.3rem 0 0.8rem;
}

.conversation-divider {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 650;
}

.conversation-divider::before,
.conversation-divider::after {
  height: 1px;
  flex: 1;
  background: var(--line);
  content: "";
}

.message {
  display: grid;
  max-width: 88%;
  gap: 0.3rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 14px 14px 14px 5px;
  background: var(--surface-soft);
}

.message-user {
  margin-left: auto;
  border-color: color-mix(in srgb, var(--brand) 28%, var(--line));
  border-radius: 14px 14px 5px 14px;
  background: var(--brand-soft);
}

.message-staff {
  border-left: 4px solid var(--info);
  background: var(--info-soft);
}

.message-system {
  max-width: 100%;
  border-style: dashed;
}

.message p {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  line-height: 1.5;
}

.message-meta {
  display: flex;
  gap: 0.55rem;
  color: var(--muted);
  font-size: 0.68rem;
}

.review-actions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.review-button {
  min-height: 28px;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.68rem;
}

.review-button.is-active {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.case-form,
.note-form {
  display: grid;
  gap: 0.75rem;
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--surface-soft);
}

.case-form label,
.note-form label {
  display: grid;
  gap: 0.3rem;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 650;
}

.case-form input,
.case-form select,
.note-form textarea {
  width: 100%;
  min-height: 42px;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.case-notes {
  display: grid;
  gap: 0.6rem;
}

.note-card {
  padding: 0.75rem;
  border-left: 3px solid var(--info);
  border-radius: 9px;
  background: var(--info-soft);
}

.note-card p {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.45;
}

.note-card small {
  display: block;
  margin-top: 0.35rem;
  color: var(--muted);
}

.audio-warning {
  margin-bottom: 0.7rem;
  padding: 0.7rem;
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 0.78rem;
  line-height: 1.45;
}

.voice-list {
  display: grid;
  gap: 0.7rem;
}

.voice-card {
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--surface-soft);
}

.voice-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.voice-card p {
  margin: 0.65rem 0 0;
  white-space: pre-wrap;
  line-height: 1.45;
}

.voice-card audio {
  width: 100%;
  margin-top: 0.75rem;
}

.reply-box {
  display: grid;
  gap: 0.55rem;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.reply-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.reply-heading span,
.reply-box p {
  color: var(--muted);
  font-size: 0.72rem;
}

.reply-box textarea {
  min-height: 100px;
  padding: 0.75rem;
  resize: vertical;
}

.reply-box p {
  margin: 0;
  line-height: 1.45;
}

.toast {
  position: fixed;
  z-index: 20;
  right: 1rem;
  bottom: 1rem;
  max-width: min(420px, calc(100% - 2rem));
  padding: 0.8rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

@media (max-width: 1050px) {
  .app-shell {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .brand-row > div:last-child,
  .nav-button > span:first-child,
  .sidebar-footer .status-line {
    display: none;
  }

  .brand-row {
    justify-content: center;
    padding-inline: 0;
  }

  .nav-button {
    justify-content: center;
    min-height: 46px;
    font-size: 0;
  }

  .nav-button::before {
    content: attr(data-short-label);
    font-size: 0.72rem;
  }

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

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

@media (max-width: 720px) {
  .app-shell {
    display: block;
    padding-bottom: 76px;
  }

  .sidebar {
    position: fixed;
    z-index: 8;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    display: block;
    width: auto;
    height: auto;
    padding: 0.45rem;
    border-top: 1px solid var(--line);
    border-right: 0;
  }

  .brand-row,
  .sidebar-footer {
    display: none;
  }

  .nav-list {
    display: flex;
    gap: 0.2rem;
    overflow-x: auto;
  }

  .nav-button {
    min-width: 74px;
    padding: 0.55rem 0.25rem;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 1rem;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .content {
    padding: 1rem;
  }

  .section-toolbar,
  .section-heading,
  .crisis-card,
  .system-surface,
  .provider-surface {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .chart-grid {
    grid-template-columns: 1fr;
  }

  .toolbar-actions {
    width: 100%;
    justify-content: stretch;
  }

  .toolbar-actions > * {
    flex: 1;
  }

  .section-toolbar,
  .section-heading {
    display: grid;
  }

  .select-label,
  .search-field {
    width: 100%;
    min-width: 0;
  }

  .crisis-card {
    display: grid;
  }

  .risk-badge {
    width: 42px;
    height: 42px;
  }

  .metric-grid,
  .metric-grid-compact,
  .system-list,
  .profile-grid {
    grid-template-columns: 1fr;
  }

  .bar-row {
    grid-template-columns: minmax(90px, 0.9fr) minmax(90px, 1.3fr) auto;
  }

  .provider-control {
    justify-items: start;
  }

  .provider-actions {
    justify-content: flex-start;
  }

  .provider-control #provider-note {
    text-align: left;
  }

  .metric-card {
    min-height: 108px;
  }

  th:nth-child(3),
  td:nth-child(3),
  th:nth-child(4),
  td:nth-child(4) {
    display: none;
  }

  .detail-panel {
    padding: 0.9rem;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .detail-panel,
  .toast {
    animation: appear 160ms ease-out;
  }

  @keyframes appear {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
  }
}
