@import url("https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@600;700;800&family=Inter:wght@400;500;600;700;800&display=swap");

:root {
  --bp-black: #0b0b0c;
  --bp-charcoal: #151516;
  --bp-surface: #1c1c1e;
  --bp-surface-2: #252528;
  --bp-border: #303033;
  --bp-border-soft: rgba(255, 255, 255, 0.07);
  --bp-text: #f7f3ea;
  --bp-text-muted: #a8a29a;
  --bp-text-dim: #6f6b64;
  --bp-primary: #2dd4bf;
  --bp-primary-soft: rgba(45, 212, 191, 0.14);
  --bp-primary-border: rgba(45, 212, 191, 0.35);
  --bp-brass: #d6a85a;
  --bp-brass-soft: rgba(214, 168, 90, 0.14);
  --bp-success: #22c55e;
  --bp-warning: #f59e0b;
  --bp-danger: #ef4444;
  --bp-info: #38bdf8;
  --bp-radius: 8px;
  --bp-radius-sm: 6px;
  --bp-sidebar: 220px;
  --bp-drawer: 320px;
  --bp-font: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bp-display: "Barlow Condensed", "Inter", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bp-black);
}

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(45, 212, 191, 0.08), transparent 28rem),
    linear-gradient(180deg, #080809 0%, var(--bp-black) 38%, #070708 100%);
  color: var(--bp-text);
  font-family: var(--bp-font);
  line-height: 1.5;
}

button,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  flex: none;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--bp-sidebar) minmax(680px, 1fr) var(--bp-drawer);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  border-right: 1px solid var(--bp-border);
  background: rgba(15, 15, 16, 0.94);
  padding: 18px 14px;
}

.brand {
  border-bottom: 1px solid var(--bp-border-soft);
  padding: 0 8px 18px;
}

.brand strong,
.brand span {
  display: block;
  font-family: var(--bp-display);
  letter-spacing: 0.08em;
  line-height: 0.95;
}

.brand strong {
  color: var(--bp-text);
  font-size: 2.15rem;
  font-weight: 800;
}

.brand span {
  margin-top: 4px;
  color: var(--bp-brass);
  font-size: 1.05rem;
  font-weight: 800;
}

.staff-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  border: 1px solid var(--bp-border-soft);
  border-radius: var(--bp-radius);
  background: rgba(255, 255, 255, 0.025);
  padding: 12px;
}

.avatar {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--bp-primary-border);
  border-radius: 50%;
  background: var(--bp-primary-soft);
  color: var(--bp-text);
  font-size: 0.82rem;
  font-weight: 800;
}

.staff-card strong,
.staff-card span {
  display: block;
}

.staff-card strong {
  font-size: 0.9rem;
}

.staff-card span {
  margin-top: 2px;
  color: var(--bp-text-muted);
  font-size: 0.76rem;
}

.side-nav {
  display: grid;
  gap: 3px;
  overflow-y: auto;
  padding-right: 2px;
}

.side-nav button,
.sidebar-bottom button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 11px;
  border: 0;
  border-radius: var(--bp-radius-sm);
  background: transparent;
  color: var(--bp-text-muted);
  padding: 9px 10px;
  text-align: left;
  transition:
    background 160ms ease,
    color 160ms ease;
}

.side-nav button:hover,
.sidebar-bottom button:hover,
.side-nav button.is-active {
  background: var(--bp-primary-soft);
  color: var(--bp-primary);
}

.side-nav span,
.sidebar-bottom span {
  font-size: 0.88rem;
  font-weight: 600;
}

.sidebar-bottom {
  display: grid;
  gap: 4px;
  margin-top: auto;
  border-top: 1px solid var(--bp-border-soft);
  padding-top: 14px;
}

.collapse-mark {
  display: inline-grid;
  width: 18px;
  place-items: center;
  color: currentColor;
  font-size: 1.3rem;
  line-height: 1;
}

.main {
  min-width: 0;
  padding: 20px 20px 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
}

.topbar h1,
.topbar p {
  margin: 0;
}

.topbar h1 {
  color: var(--bp-primary);
  font-size: 1.02rem;
  font-weight: 700;
}

.topbar p {
  margin-top: 3px;
  color: var(--bp-text-muted);
  font-size: 0.82rem;
}

.topbar-controls {
  display: flex;
  align-items: end;
  gap: 12px;
}

.topbar-controls label {
  display: grid;
  gap: 5px;
  color: var(--bp-text-muted);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.topbar-controls select,
.date-control {
  min-height: 38px;
  border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius-sm);
  background: #09090a;
  color: var(--bp-text);
  padding: 0 12px;
}

.date-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.kpi-card {
  display: flex;
  min-height: 92px;
  gap: 12px;
  border: 1px solid var(--bp-border-soft);
  border-radius: var(--bp-radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.018));
  padding: 13px;
}

.kpi-card p,
.kpi-card strong,
.kpi-card span {
  display: block;
}

.kpi-card p {
  margin: 0;
  color: var(--bp-text-muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.kpi-card strong {
  margin-top: 5px;
  font-size: 1.45rem;
  line-height: 1;
}

.kpi-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  background: var(--bp-primary-soft);
  color: var(--bp-primary);
}

.delta {
  margin-top: 6px;
  color: var(--bp-success);
  font-size: 0.72rem;
  font-weight: 700;
}

.delta--down {
  color: var(--bp-danger);
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(540px, 1.35fr) minmax(300px, 0.75fr);
  gap: 12px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--bp-border-soft);
  border-radius: var(--bp-radius);
  background: rgba(18, 18, 19, 0.92);
  box-shadow: 0 18px 70px rgba(0, 0, 0, 0.28);
}

.panel--wide {
  min-height: 270px;
}

.panel--full {
  grid-column: 1 / -1;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--bp-border-soft);
  padding: 14px;
}

.panel-header h2,
.panel-header p {
  margin: 0;
}

.panel-header h2 {
  font-size: 0.95rem;
  letter-spacing: 0;
}

.panel-header p {
  margin-top: 3px;
  color: var(--bp-text-muted);
  font-size: 0.76rem;
}

.panel-link {
  border: 0;
  background: transparent;
  color: var(--bp-primary);
  font-size: 0.78rem;
  font-weight: 700;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.filter-row button {
  min-height: 30px;
  border: 1px solid var(--bp-border);
  border-radius: 999px;
  background: transparent;
  color: var(--bp-text-muted);
  padding: 0 10px;
  font-size: 0.72rem;
  font-weight: 700;
}

.filter-row button.is-active {
  border-color: var(--bp-primary-border);
  background: var(--bp-primary-soft);
  color: var(--bp-primary);
}

.table-wrap {
  overflow: auto;
}

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

.ops-table,
.compact-table {
  min-width: 100%;
  table-layout: fixed;
}

th,
td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
  padding: 9px 10px;
  text-align: left;
  white-space: nowrap;
}

th {
  background: rgba(255, 255, 255, 0.03);
  color: var(--bp-text-muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

td {
  color: var(--bp-text);
  font-size: 0.74rem;
}

.ops-table th,
.ops-table td,
.compact-table th,
.compact-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}

.compact-table th,
.compact-table td {
  padding: 8px;
  font-size: 0.68rem;
}

.booking-table th:nth-child(1),
.booking-table td:nth-child(1) {
  width: 11%;
}

.booking-table th:nth-child(2),
.booking-table td:nth-child(2) {
  width: 7%;
}

.booking-table th:nth-child(3),
.booking-table td:nth-child(3) {
  width: 17%;
}

.booking-table th:nth-child(4),
.booking-table td:nth-child(4) {
  width: 16%;
}

.booking-table th:nth-child(5),
.booking-table td:nth-child(5) {
  width: 14%;
}

.booking-table th:nth-child(6),
.booking-table td:nth-child(6) {
  width: 13%;
}

.booking-table th:nth-child(7),
.booking-table td:nth-child(7) {
  width: 8%;
}

.booking-table th:nth-child(8),
.booking-table td:nth-child(8) {
  width: 14%;
}

.matching-table th:nth-child(1),
.matching-table td:nth-child(1) {
  width: 11%;
}

.matching-table th:nth-child(2),
.matching-table td:nth-child(2) {
  width: 7%;
}

.matching-table th:nth-child(3),
.matching-table td:nth-child(3) {
  width: 16%;
}

.matching-table th:nth-child(4),
.matching-table td:nth-child(4) {
  width: 21%;
}

.matching-table th:nth-child(5),
.matching-table td:nth-child(5) {
  width: 16%;
}

.matching-table th:nth-child(6),
.matching-table td:nth-child(6),
.matching-table th:nth-child(7),
.matching-table td:nth-child(7) {
  width: 7%;
}

.matching-table th:nth-child(8),
.matching-table td:nth-child(8) {
  width: 15%;
}

.capacity-table th:nth-child(1),
.capacity-table td:nth-child(1) {
  width: 42%;
}

.capacity-table th:nth-child(2),
.capacity-table td:nth-child(2),
.capacity-table th:nth-child(3),
.capacity-table td:nth-child(3) {
  width: 16%;
}

.capacity-table th:nth-child(4),
.capacity-table td:nth-child(4) {
  width: 26%;
}

.vetting-table th:nth-child(1),
.vetting-table td:nth-child(1) {
  width: 17%;
}

.vetting-table th:nth-child(2),
.vetting-table td:nth-child(2) {
  width: 25%;
}

.vetting-table th:nth-child(3),
.vetting-table td:nth-child(3) {
  width: 24%;
}

.vetting-table th:nth-child(4),
.vetting-table td:nth-child(4) {
  width: 15%;
}

.vetting-table th:nth-child(5),
.vetting-table td:nth-child(5) {
  width: 19%;
}

tr:hover td,
tr.is-selected td {
  background: rgba(45, 212, 191, 0.055);
}

.row-link {
  border: 0;
  background: transparent;
  color: var(--bp-text);
  padding: 0;
  font-weight: 800;
}

.row-link:hover {
  color: var(--bp-primary);
}

.empty-row {
  height: 90px;
  color: var(--bp-text-muted);
  text-align: center;
}

.status {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 0.68rem;
  font-weight: 800;
}

.status--primary {
  background: var(--bp-primary-soft);
  color: var(--bp-primary);
}

.status--success {
  background: rgba(34, 197, 94, 0.12);
  color: var(--bp-success);
}

.status--warning {
  background: rgba(245, 158, 11, 0.12);
  color: var(--bp-warning);
}

.status--danger {
  background: rgba(239, 68, 68, 0.12);
  color: var(--bp-danger);
}

.status--info,
.status--muted {
  background: rgba(56, 189, 248, 0.12);
  color: var(--bp-info);
}

.util-cell {
  display: grid;
  grid-template-columns: 36px 1fr;
  align-items: center;
  gap: 9px;
}

.meter {
  display: block;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--bp-primary);
}

.timeline-panel {
  overflow: hidden;
}

.timeline-grid {
  display: grid;
  grid-template-columns: 142px repeat(var(--slot-count), minmax(76px, 1fr));
  overflow-x: auto;
}

.timeline-head,
.timeline-label {
  border-bottom: 1px solid var(--bp-border-soft);
  color: var(--bp-text-muted);
  font-size: 0.74rem;
  font-weight: 800;
  padding: 9px 10px;
}

.timeline-label {
  border-right: 1px solid var(--bp-border-soft);
  color: var(--bp-text);
}

.timeline-row {
  position: relative;
  display: grid;
  grid-column: 2 / -1;
  grid-template-columns: repeat(var(--slot-count), minmax(76px, 1fr));
  min-height: 54px;
  border-bottom: 1px solid var(--bp-border-soft);
}

.timeline-row > span {
  border-right: 1px solid rgba(255, 255, 255, 0.045);
}

.appointment-chip {
  align-self: center;
  z-index: 1;
  display: grid;
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--bp-radius-sm);
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.86), rgba(20, 137, 127, 0.78));
  color: #04100f;
  margin: 6px;
  padding: 6px 8px;
  text-align: left;
}

.appointment-chip strong,
.appointment-chip span {
  font-size: 0.68rem;
  line-height: 1.1;
}

.appointment-chip--skin-fade {
  background: linear-gradient(135deg, #b794f4, #805ad5);
  color: #10071f;
}

.appointment-chip--beard-trim {
  background: linear-gradient(135deg, #f6c85f, #d69e2e);
  color: #1d1300;
}

.appointment-chip--haircut--beard {
  background: linear-gradient(135deg, #7dd3fc, #0ea5e9);
  color: #06121a;
}

.appointment-chip--home-cut,
.appointment-chip--shape-up {
  background: linear-gradient(135deg, #fb923c, #ea580c);
  color: #170900;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  padding: 13px 14px 16px;
  color: var(--bp-text-muted);
  font-size: 0.76rem;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend i {
  width: 14px;
  height: 10px;
  border-radius: 3px;
  background: var(--bp-primary);
}

.legend-fade {
  background: #b794f4 !important;
}

.legend-beard {
  background: #f6c85f !important;
}

.legend-combo {
  background: #7dd3fc !important;
}

.legend-home {
  background: #fb923c !important;
}

.legend-other {
  background: #8b8b90 !important;
}

.detail-drawer {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-left: 1px solid var(--bp-border);
  background:
    linear-gradient(180deg, rgba(45, 212, 191, 0.05), transparent 16rem),
    rgba(18, 18, 19, 0.98);
  padding: 18px;
}

.drawer-top,
.section-split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.eyeline {
  margin: 0 0 3px;
  color: var(--bp-text-muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.drawer-top h2 {
  margin: 0;
  font-size: 1.35rem;
}

.icon-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius-sm);
  background: transparent;
  color: var(--bp-text-muted);
}

.icon-button:hover {
  color: var(--bp-primary);
}

.drawer-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.visit-type {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border: 1px solid var(--bp-border);
  border-radius: 999px;
  color: var(--bp-text);
  padding: 0 9px;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.drawer-section {
  border-top: 1px solid var(--bp-border-soft);
  padding: 16px 0;
}

.drawer-section h3 {
  margin: 0 0 9px;
  font-size: 0.8rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

.drawer-main,
.drawer-muted {
  margin: 0;
}

.drawer-main {
  font-weight: 700;
}

.drawer-muted {
  color: var(--bp-text-muted);
  font-size: 0.82rem;
}

.drawer-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.drawer-meta span,
.snapshot-grid div {
  border: 1px solid var(--bp-border-soft);
  border-radius: var(--bp-radius-sm);
  background: rgba(255, 255, 255, 0.025);
  padding: 9px;
  color: var(--bp-text-muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.quote-list {
  display: grid;
  gap: 8px;
}

.quote-list div,
.quote-total {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--bp-text-muted);
  font-size: 0.82rem;
}

.quote-list strong {
  color: var(--bp-text);
}

.quote-total {
  margin-top: 12px;
  border-top: 1px solid var(--bp-border-soft);
  padding-top: 12px;
  color: var(--bp-text);
  font-size: 0.94rem;
}

.barber-snapshot {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 11px;
}

.barber-snapshot strong,
.barber-snapshot p {
  margin: 0;
}

.barber-snapshot p {
  color: var(--bp-primary);
  font-size: 0.78rem;
  font-weight: 700;
}

.rating {
  color: var(--bp-brass);
  font-weight: 900;
}

.snapshot-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.snapshot-grid span,
.snapshot-grid strong {
  display: block;
}

.snapshot-grid strong {
  margin-top: 4px;
  color: var(--bp-text);
}

.booking-timeline {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.booking-timeline li {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  gap: 8px;
  color: var(--bp-text-muted);
  font-size: 0.78rem;
}

.booking-timeline li span {
  display: block;
  width: 10px;
  height: 10px;
  border: 2px solid var(--bp-primary);
  border-radius: 50%;
}

.booking-timeline strong {
  color: var(--bp-text);
}

.booking-timeline em {
  color: var(--bp-text-dim);
  font-style: normal;
}

.drawer-actions {
  display: grid;
  gap: 10px;
  padding: 4px 0 12px;
}

.primary-action,
.danger-action,
.ghost-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--bp-radius-sm);
  font-size: 0.82rem;
  font-weight: 800;
}

.primary-action {
  border: 1px solid var(--bp-primary-border);
  background: linear-gradient(135deg, var(--bp-primary), #19a998);
  color: #04100f;
}

.danger-action {
  border: 1px solid rgba(239, 68, 68, 0.55);
  background: rgba(239, 68, 68, 0.08);
  color: #ff827d;
}

.ghost-button {
  border: 1px solid var(--bp-primary-border);
  background: transparent;
  color: var(--bp-primary);
}

.ghost-button--brass {
  width: 100%;
  margin-top: 12px;
  border-color: rgba(214, 168, 90, 0.5);
  color: var(--bp-brass);
}

.split-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 30;
  max-width: 360px;
  border: 1px solid var(--bp-primary-border);
  border-radius: var(--bp-radius);
  background: #081211;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.45);
  color: var(--bp-text);
  padding: 12px 14px;
  font-size: 0.86rem;
  font-weight: 700;
}

.session-panel {
  display: grid;
  gap: 9px;
  margin-bottom: 14px;
  border-block: 1px solid var(--bp-border-soft);
  padding: 14px 0;
}

.session-panel__head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.session-panel__head > span {
  display: inline-grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius-sm);
  color: var(--bp-text-muted);
}

.session-panel.is-connected .session-panel__head > span {
  border-color: var(--bp-primary-border);
  background: var(--bp-primary-soft);
  color: var(--bp-primary);
}

.session-panel strong,
.session-panel small {
  display: block;
}

.session-panel strong {
  font-size: 0.82rem;
}

.session-panel small,
.session-panel p,
.session-panel label span {
  color: var(--bp-text-muted);
}

.session-panel small {
  margin-top: 1px;
  font-size: 0.68rem;
}

.session-panel label {
  display: grid;
  gap: 5px;
  font-size: 0.68rem;
  font-weight: 800;
}

.session-panel input {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius-sm);
  background: #09090a;
  color: var(--bp-text);
  padding: 0 9px;
}

.session-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.session-actions--one {
  grid-template-columns: 1fr;
}

.session-actions button {
  min-height: 32px;
  border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius-sm);
  background: transparent;
  color: var(--bp-text-muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.session-actions button:hover {
  border-color: var(--bp-primary-border);
  color: var(--bp-primary);
}

.session-panel p {
  margin: 0;
  font-size: 0.68rem;
}

.api-mini-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  overflow: hidden;
  margin: 0;
  border: 1px solid var(--bp-border-soft);
  border-radius: var(--bp-radius-sm);
  background: var(--bp-border);
}

.api-mini-metrics div {
  display: grid;
  gap: 2px;
  background: rgba(10, 10, 11, 0.86);
  padding: 7px;
}

.api-mini-metrics dt,
.api-mini-metrics dd {
  margin: 0;
}

.api-mini-metrics dt {
  color: var(--bp-text-muted);
  font-size: 0.65rem;
}

.api-mini-metrics dd {
  font-size: 0.82rem;
  font-weight: 900;
}

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

  .detail-drawer {
    position: relative;
    grid-column: 2;
    height: auto;
    border-top: 1px solid var(--bp-border);
  }

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

@media (max-width: 940px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

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

  .main {
    padding: 16px;
  }

  .topbar,
  .topbar-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .kpi-grid,
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .detail-drawer {
    grid-column: auto;
    padding: 16px;
  }
}

@media (max-width: 640px) {
  .brand strong {
    font-size: 1.7rem;
  }

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

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

  .kpi-card {
    min-height: 96px;
    padding: 12px;
  }

  .kpi-card strong {
    font-size: 1.35rem;
  }

  .panel-header,
  .filter-row {
    align-items: stretch;
    flex-direction: column;
  }

  .drawer-meta,
  .snapshot-grid,
  .split-actions {
    grid-template-columns: 1fr;
  }
}
