:root {
  --dash-sidebar-width: 292px;
  --dash-shell-gap: 18px;
  --dash-topbar-height: 86px;
}

.dashboard-body,
.login-body {
  min-height: 100vh;
}

.dashboard-body {
  margin: 0;
}

.dashboard-shell {
  width: min(1600px, calc(100% - 24px));
  margin: 12px auto 24px;
  display: grid;
  grid-template-columns: var(--dash-sidebar-width) minmax(0, 1fr);
  gap: var(--dash-shell-gap);
  align-items: start;
}

.dashboard-sidebar {
  position: sticky;
  top: 12px;
  display: grid;
  gap: 14px;
}

.dashboard-brand {
  padding: 20px;
}

.dashboard-brand h1 {
  font-size: 1.35rem;
}

.dashboard-brand p,
.sidebar-copy,
.topbar-copy,
.page-header-copy,
.record-meta,
.audit-meta,
.list-card p,
.table-caption,
.empty-state-card p {
  color: var(--muted);
}

.dashboard-nav {
  padding: 12px;
}

.dashboard-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.dashboard-nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  color: var(--text);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid transparent;
}

.dashboard-nav-link.is-active {
  background: rgba(12, 106, 96, 0.12);
  border-color: rgba(12, 106, 96, 0.24);
}

.dashboard-nav-link small {
  color: var(--muted);
}

.dashboard-main {
  min-width: 0;
  display: grid;
  gap: 18px;
}

.dashboard-topbar {
  position: static;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(340px, 1fr) auto;
  gap: 14px;
  padding: 18px 22px;
}

.page-header-title {
  margin-bottom: 4px;
}

.command-bar-shell {
  position: relative;
}

.command-bar-input {
  width: 100%;
  min-height: 52px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(73, 54, 34, 0.14);
  background: rgba(255, 255, 255, 0.85);
}

.command-results {
  position: absolute;
  inset: calc(100% + 8px) 0 auto 0;
  display: none;
  max-height: 360px;
  overflow: auto;
  padding: 10px;
  border-radius: 18px;
  background: rgba(255, 252, 247, 0.98);
  border: 1px solid rgba(73, 54, 34, 0.1);
  box-shadow: var(--shadow);
}

.command-results.is-open {
  display: grid;
  gap: 8px;
}

.command-result-card {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 14px;
  cursor: pointer;
  border: 1px solid rgba(73, 54, 34, 0.08);
  background: rgba(255, 255, 255, 0.75);
}

.command-result-card:hover {
  border-color: rgba(12, 106, 96, 0.25);
}

.command-result-kicker,
.badge-subtle {
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 700;
}

.topbar-side {
  display: flex;
  align-items: start;
  justify-content: end;
  gap: 10px;
}

.operator-card {
  min-width: 230px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(73, 54, 34, 0.08);
}

.operator-card strong {
  display: block;
}

.operator-card input {
  width: 100%;
  margin-top: 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
}

.page-shell {
  display: grid;
  gap: 18px;
}

.page-panel {
  padding: 22px;
}

.page-grid {
  display: grid;
  gap: 18px;
}

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

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

.stack-list {
  display: grid;
  gap: 12px;
}

.list-card,
.audit-card,
.integrity-card,
.preview-card {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(73, 54, 34, 0.08);
  background: rgba(255, 255, 255, 0.74);
}

.list-card h3,
.audit-card h3,
.integrity-card h3,
.preview-card h3 {
  margin-bottom: 6px;
}

.list-card-actions,
.inline-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.structure-tree {
  gap: 10px;
}

.structure-node {
  border: 1px solid rgba(73, 54, 34, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  overflow: hidden;
}

.structure-node-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  padding: 14px 16px;
  align-items: start;
}

.structure-node-level {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(12, 106, 96, 0.12);
  color: var(--teal);
  font-weight: 700;
}

.structure-node-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.structure-node-children {
  padding: 0 16px 16px;
  display: grid;
  gap: 10px;
}

.structure-override-form,
.inline-editor-grid,
.bulk-mini-grid,
.filters-inline-grid {
  display: grid;
  gap: 10px;
}

.structure-override-form {
  grid-template-columns: minmax(220px, 1.2fr) minmax(140px, 0.4fr) minmax(220px, 1fr) auto;
  padding: 0 16px 16px;
}

.table-shell {
  overflow: auto;
  border: 1px solid rgba(73, 54, 34, 0.08);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.75);
}

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

.data-table th,
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(73, 54, 34, 0.08);
  text-align: right;
  vertical-align: top;
}

.data-table th {
  background: rgba(255, 248, 240, 0.85);
  color: var(--muted);
  font-size: 0.84rem;
}

.data-table tr:hover td {
  background: rgba(12, 106, 96, 0.04);
}

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0 0;
}

.status-chip,
.tone-chip,
.metric-chip,
.badge,
.record-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(71, 85, 105, 0.12);
  color: var(--ink);
}

.status-chip.is-success,
.tone-chip.is-success {
  background: rgba(12, 106, 96, 0.12);
  color: var(--teal);
}

.status-chip.is-warning,
.tone-chip.is-warning {
  background: rgba(196, 117, 38, 0.12);
  color: var(--orange);
}

.status-chip.is-danger,
.tone-chip.is-danger {
  background: rgba(180, 76, 52, 0.12);
  color: var(--danger);
}

.record-badge.is-hidden {
  background: rgba(180, 76, 52, 0.12);
  color: var(--danger);
}

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

.bulk-card {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(73, 54, 34, 0.08);
  background: rgba(255, 255, 255, 0.74);
}

.bulk-action-bar {
  margin: 16px 0;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(12, 106, 96, 0.1);
  border: 1px solid rgba(12, 106, 96, 0.18);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.is-hidden {
  display: none !important;
}

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

.audit-json-wrap {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.audit-json {
  margin: 0;
  padding: 14px;
  border-radius: 16px;
  background: rgba(32, 21, 12, 0.9);
  color: #f9f6f1;
  overflow: auto;
  direction: ltr;
  text-align: left;
  font-size: 0.82rem;
}

.toast-stack {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 1000;
  display: grid;
  gap: 10px;
}

.toast-card {
  min-width: 280px;
  max-width: 360px;
  padding: 14px 16px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  background: rgba(255, 252, 247, 0.96);
  border: 1px solid rgba(73, 54, 34, 0.12);
}

.toast-card[data-tone="success"] {
  border-color: rgba(12, 106, 96, 0.24);
}

.toast-card[data-tone="error"] {
  border-color: rgba(180, 76, 52, 0.24);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(560px, calc(100% - 16px));
  padding: 28px;
  display: grid;
  gap: 18px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.ghost-link {
  color: var(--teal);
  text-decoration: none;
}

.empty-state-card {
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px dashed rgba(73, 54, 34, 0.12);
}

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

.progression-list {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.progression-list li {
  display: grid;
  gap: 4px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(73, 54, 34, 0.1);
  padding: 12px;
}

.progression-list span,
.progression-list small {
  color: var(--muted);
}

@media (max-width: 1280px) {
  .dashboard-shell {
    grid-template-columns: 1fr;
  }

  .dashboard-sidebar,
  .dashboard-topbar {
    position: static;
  }

  .dashboard-topbar {
    grid-template-columns: 1fr;
  }

  .page-grid-overview,
  .bulk-grid,
  .dashboard-summary-grid,
  .progression-list {
    grid-template-columns: 1fr 1fr;
  }

  .structure-override-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 780px) {
  .page-grid-overview,
  .bulk-grid,
  .dashboard-summary-grid,
  .progression-list {
    grid-template-columns: 1fr;
  }

  .dashboard-shell {
    width: min(100%, calc(100% - 16px));
    margin-inline: auto;
  }

  .topbar-side,
  .page-toolbar,
  .bulk-action-bar,
  .audit-card-head,
  .result-head {
    flex-direction: column;
    align-items: stretch;
  }
}
