@import url("https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;700;800;900&display=swap");

:root {
  --bg: #f4f7fb;
  --bg-dark: #0f172a;
  --bg-dark-2: #152238;
  --panel: rgba(255, 255, 255, 0.94);
  --panel-soft: rgba(255, 255, 255, 0.82);
  --text: #0f172a;
  --muted: #516074;
  --line: rgba(15, 23, 42, 0.12);
  --line-strong: rgba(148, 163, 184, 0.22);
  --primary: #0f766e;
  --primary-dark: #115e59;
  --accent: #f59e0b;
  --danger: #dc2626;
  --success: #16a34a;
  --shadow: 0 22px 60px rgba(15, 23, 42, 0.12);
  --app-font: "Vazirmatn", "Segoe UI", Tahoma, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  min-height: 100%;
  direction: rtl;
}
body {
  margin: 0;
  color: var(--text);
  font-family: var(--app-font);
  background:
    radial-gradient(circle at top right, rgba(245, 158, 11, 0.12), transparent 24%),
    radial-gradient(circle at bottom left, rgba(15, 118, 110, 0.12), transparent 28%),
    linear-gradient(180deg, #0d1b2b 0%, #13243a 18%, #eff4f8 18%, #f4f7fb 100%);
  overflow-x: hidden;
}

body[data-auth="locked"] { overflow: hidden; }
button, input, textarea, select { font: inherit; }
a { color: inherit; }

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 322px;
  grid-template-areas: "workspace sidebar";
  direction: ltr;
  min-height: 100vh;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top, rgba(245, 158, 11, 0.18), transparent 26%),
    linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.9));
  backdrop-filter: blur(12px);
}

.auth-overlay[hidden] {
  display: none !important;
  pointer-events: none;
}

.auth-card {
  width: min(100%, 500px);
  padding: 30px;
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 26px 90px rgba(0, 0, 0, 0.24);
}

.auth-badge,
.auth-form,
.stack,
.feed-grid,
.version-item,
.sidebar-status-grid,
.sidebar-health-grid {
  display: grid;
  gap: 14px;
}

.auth-badge {
  margin-bottom: 24px;
}

.auth-badge h1,
.brand-block h1,
.workspace h2,
.workspace h3 {
  margin: 0;
}

.auth-badge p,
.brand-block p,
.workspace-description,
.muted,
.feed-item p,
.preview-card p,
.version-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.auth-form {
  gap: 16px;
}

.auth-hint {
  margin: 0;
  min-height: 1.6em;
  color: var(--muted);
}

.auth-hint[data-kind="success"] { color: var(--success); }
.auth-hint[data-kind="error"] { color: var(--danger); }

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  min-height: 100vh;
  padding: 28px 22px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(21, 34, 56, 0.94));
  color: #f8fafc;
  border-left: 1px solid rgba(255, 255, 255, 0.06);
}

.brand-block {
  display: grid;
  gap: 10px;
}

.brand-block p {
  color: rgba(248, 250, 252, 0.78);
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  font-weight: 800;
  color: #8fb2ad;
}

.sidebar .eyebrow {
  color: rgba(191, 219, 254, 0.82);
}

.sidebar-card,
.panel,
.stat-card,
.feed-item,
.version-item,
.page-card,
.record-card,
.section-editor,
.preview-card,
.empty-state {
  border-radius: 26px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.sidebar-card {
  padding: 18px;
  margin-top: 16px;
  color: var(--text);
}

.sidebar-status-grid strong,
.sidebar-health-grid strong {
  display: block;
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.sidebar-status-grid span,
.sidebar-health-grid span {
  color: var(--muted);
  font-size: 0.95rem;
}

.nav-stack {
  display: grid;
  gap: 14px;
  margin: 24px 0;
}

.nav-group {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.nav-group-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  color: rgba(248, 250, 252, 0.82);
}

.nav-group-label span {
  font-weight: 800;
}

.nav-group-label small {
  color: rgba(191, 219, 254, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.nav-button,
button {
  border: 0;
  cursor: pointer;
  border-radius: 16px;
  padding: 12px 16px;
  font-weight: 800;
  transition: transform 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.nav-button:hover,
button:hover {
  transform: translateY(-1px);
}

.nav-button {
  width: 100%;
  text-align: right;
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.nav-button.active,
.nav-button:hover {
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.34), rgba(245, 158, 11, 0.16));
  border-color: rgba(15, 118, 110, 0.34);
}

.workspace {
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 20px;
  padding: 24px;
  border-radius: 28px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.88));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.topbar-copy {
  display: grid;
  gap: 8px;
  max-width: 720px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
}

.user-chip p,
.user-chip span {
  margin: 0;
}

.user-chip p {
  font-weight: 800;
}

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

.panel {
  padding: 22px;
}

.soft-panel {
  background: var(--panel-soft);
}

.hero-panel {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.12), transparent 28%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(240, 249, 255, 0.92));
}

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

.mini-actions,
.section-head .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.screen-route-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0 4px;
}

.route-chip {
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  cursor: pointer;
  transition: 160ms ease;
}

.route-chip:hover {
  border-color: rgba(15, 23, 42, 0.28);
  transform: translateY(-1px);
}

.route-chip.active {
  background: rgba(15, 118, 110, 0.1);
  border-color: rgba(15, 118, 110, 0.35);
  color: #0f766e;
}

.branch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.branch-card,
.branch-summary-card {
  padding: 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
}

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

.branch-card-head h4,
.branch-summary-card h4 {
  margin: 2px 0 0;
}

.branch-card-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.12);
  color: #0f766e;
  font-size: 0.82rem;
  font-weight: 800;
}

.branch-card-links,
.branch-summary-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.branch-summary {
  margin-top: 14px;
}

.data-matrix-wrap {
  overflow: auto;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.data-matrix {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

.data-matrix th,
.data-matrix td {
  text-align: right;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.data-matrix th {
  font-size: 0.88rem;
  color: var(--muted);
  background: rgba(15, 118, 110, 0.08);
}

.data-matrix tr:last-child td {
  border-bottom: 0;
}

.data-matrix tr.matrix-row-match td {
  background: rgba(240, 253, 244, 0.82);
}

.data-matrix tr.matrix-row-unmatched td {
  background: rgba(255, 247, 237, 0.9);
}

.data-matrix tr.matrix-row-match td:first-child {
  box-shadow: inset 4px 0 0 rgba(22, 163, 74, 0.65);
}

.data-matrix tr.matrix-row-unmatched td:first-child {
  box-shadow: inset 4px 0 0 rgba(245, 158, 11, 0.8);
}

.matrix-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
  border: 1px solid transparent;
}

.matrix-badge.match {
  color: #166534;
  background: rgba(220, 252, 231, 0.95);
  border-color: rgba(22, 163, 74, 0.22);
}

.matrix-badge.unmatched {
  color: #92400e;
  background: rgba(255, 237, 213, 0.96);
  border-color: rgba(245, 158, 11, 0.26);
}

.settlement-filter-label {
  display: inline-grid;
  gap: 6px;
  min-width: 220px;
}

.settlement-filter-label span {
  color: var(--muted);
  font-size: 0.9rem;
}

.full-width { width: 100%; }
.inline-input { min-width: 240px; }

.ghost {
  background: rgba(15, 118, 110, 0.08);
  color: var(--text);
}

.accent {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #1f2937;
}

button:not(.ghost):not(.nav-button):not(.accent) {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #f8fafc;
}

.danger {
  background: rgba(220, 38, 38, 0.08);
  color: var(--danger);
}

.global-notice {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: 20px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.8);
}

.global-notice strong { font-size: 1rem; }
.global-notice span { color: var(--muted); font-size: 0.88rem; }
.global-notice.success { border-color: rgba(22, 163, 74, 0.26); }
.global-notice.error { border-color: rgba(220, 38, 38, 0.26); }

.app-view { display: grid; gap: 18px; }
.app-view[hidden] { display: none !important; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.stat-card {
  padding: 18px;
  min-height: 120px;
  display: grid;
  gap: 12px;
}

.stat-card strong {
  font-size: 1.8rem;
}

.stat-card p,
.feed-item p,
.preview-card p,
.version-item p {
  margin: 0;
}

.stat-card span,
.feed-item span,
.muted {
  color: var(--muted);
}

.surface-card,
.runtime-item,
.order-runtime-card,
.impact-check-card,
.snapshot-card,
.walkthrough-step {
  display: grid;
  gap: 10px;
}

.surface-card p,
.runtime-item p,
.order-runtime-card p,
.order-runtime-card h4,
.impact-check-card p,
.snapshot-card p,
.walkthrough-step p {
  margin: 0;
}

.surface-card strong,
.runtime-item strong,
.order-runtime-card strong,
.impact-check-card strong,
.snapshot-card strong,
.walkthrough-step strong {
  font-size: 1.05rem;
}

.surface-actions,
.order-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.link-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(15, 118, 110, 0.14);
  background: rgba(15, 118, 110, 0.08);
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
}

.order-runtime-card {
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(240, 249, 255, 0.92));
  box-shadow: var(--shadow);
}

.runtime-kv {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.runtime-kv div {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
}

.runtime-kv span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.88rem;
}

.impact-check-card.is-pass {
  border-color: rgba(22, 163, 74, 0.22);
  background: rgba(240, 253, 244, 0.86);
}

.impact-check-card.is-fail {
  border-color: rgba(220, 38, 38, 0.22);
  background: rgba(254, 242, 242, 0.9);
}

.preset-card {
  text-align: right;
}

.preset-card p {
  margin: 0;
}

.preset-swatch {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.validation-stat.healthy {
  border-color: rgba(22, 163, 74, 0.24);
  background: rgba(240, 253, 244, 0.92);
}

.validation-stat.warning {
  border-color: rgba(245, 158, 11, 0.24);
  background: rgba(255, 251, 235, 0.92);
}

.validation-stat.unknown {
  border-color: rgba(148, 163, 184, 0.22);
  background: rgba(248, 250, 252, 0.92);
}

.check-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
}

.check-badge.pass {
  background: rgba(22, 163, 74, 0.14);
  color: var(--success);
}

.check-badge.fail {
  background: rgba(220, 38, 38, 0.12);
  color: var(--danger);
}

.walkthrough-step.is-done {
  border-color: rgba(22, 163, 74, 0.2);
  background: rgba(240, 253, 244, 0.86);
}

.walkthrough-step.is-warning {
  border-color: rgba(245, 158, 11, 0.22);
  background: rgba(255, 251, 235, 0.88);
}

.walkthrough-step.is-pending {
  border-color: rgba(148, 163, 184, 0.2);
  background: rgba(248, 250, 252, 0.88);
}

.walkthrough-step.is-ready {
  border-color: rgba(15, 118, 110, 0.18);
  background: rgba(240, 249, 255, 0.88);
}

.feed-grid,
.version-item {
  display: grid;
  gap: 10px;
}

.surface-drilldown {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.surface-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.surface-toolbar .mini-actions {
  margin-top: 0;
}

.surface-list,
.surface-detail {
  display: grid;
  gap: 12px;
}

.surface-list-item,
.surface-detail-card {
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.surface-list-item {
  width: 100%;
  padding: 16px;
  display: grid;
  gap: 8px;
  text-align: right;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.surface-list-item:hover,
.surface-list-item:focus-visible,
.surface-list-item.active {
  border-color: rgba(15, 118, 110, 0.28);
  background: rgba(240, 249, 255, 0.96);
  transform: translateY(-1px);
}

.surface-list-item-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.surface-list-item-head strong {
  display: block;
  font-size: 1rem;
}

.surface-list-item-head span,
.surface-list-item p,
.surface-list-item small,
.surface-detail-summary,
.surface-detail-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.surface-list-item small {
  color: rgba(15, 118, 110, 0.9);
  font-weight: 800;
}

.surface-detail-card {
  padding: 18px;
  display: grid;
  gap: 14px;
}

.surface-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.surface-detail-head h4 {
  margin: 6px 0 0;
}

.surface-detail-pill,
.surface-detail-tag {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.1);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 800;
}

.surface-detail-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.surface-detail-row {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
}

.surface-detail-row span {
  color: var(--muted);
  font-size: 0.84rem;
}

.surface-detail-row strong {
  font-size: 1rem;
}

.surface-detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.feed-item,
.version-item,
.page-card,
.record-card,
.section-editor {
  padding: 16px;
}

.split-panel {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 18px;
}

.two-column {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.toggle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.checkbox-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.75);
}

.checkbox-field input { width: auto; }

label {
  display: grid;
  gap: 8px;
}

label span {
  color: var(--muted);
  font-size: 0.92rem;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
}

textarea {
  resize: vertical;
  min-height: 120px;
}

.preview-shell {
  min-height: 360px;
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: #f7f3ea;
}

.preview-frame { padding: 22px; min-height: 360px; }
.preview-hero {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 18px;
  padding: 20px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.84);
}

.preview-banner {
  min-height: 220px;
  border-radius: 20px;
  background-size: cover;
  background-position: center;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.preview-card {
  padding: 14px;
}

.empty-state {
  padding: 18px;
  color: var(--muted);
}

.settlement-import-panel {
  margin-bottom: 8px;
}

.settlement-import-hints {
  display: grid;
  gap: 10px;
}

.settlement-import-hint {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
}

.settlement-import-hint strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
}

.settlement-import-status {
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.84);
}

.settlement-import-status.success {
  border-color: rgba(22, 163, 74, 0.24);
  background: rgba(240, 253, 244, 0.92);
}

.settlement-import-status.error {
  border-color: rgba(220, 38, 38, 0.24);
  background: rgba(254, 242, 242, 0.92);
}

.settlement-import-status.info {
  border-color: rgba(15, 118, 110, 0.22);
  background: rgba(240, 249, 255, 0.9);
}

.settlement-import-unmatched {
  display: grid;
  gap: 12px;
}

.settlement-import-warning {
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid rgba(245, 158, 11, 0.26);
  background: rgba(255, 251, 235, 0.94);
}

.settlement-import-warning strong {
  display: block;
  margin-bottom: 6px;
  color: #92400e;
}

.settlement-import-warning span {
  color: #7c5d12;
}

.settlement-import-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.settlement-import-links button {
  padding: 10px 14px;
}

.three-column {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.policy-grid {
  display: grid;
  gap: 10px;
}

.policy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.policy-row strong {
  color: var(--text);
  font-size: 0.95rem;
}

.policy-row span {
  color: var(--muted);
  text-align: left;
  font-size: 0.88rem;
}

.page-card.selected {
  border-color: rgba(15, 118, 110, 0.32);
  box-shadow: 0 10px 24px rgba(15, 118, 110, 0.1);
}

.fatal-error {
  min-height: 100vh;
  padding: 32px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #0b1f1d, #f5f0e7);
  color: #fff;
}

@media (max-width: 1180px) {
  .app-shell,
  .split-panel,
  .two-column,
  .three-column,
  .surface-drilldown,
  .preview-hero {
    grid-template-columns: 1fr;
  }

  .app-shell {
    grid-template-areas:
      "sidebar"
      "workspace";
  }

  .sidebar {
    position: relative;
    min-height: auto;
    border-left: 0;
  }

  .workspace,
  .sidebar {
    padding: 18px;
  }
}

@media (max-width: 720px) {
  .topbar,
  .section-head {
    flex-direction: column;
  }

  .surface-toolbar,
  .surface-detail-head,
  .surface-list-item-head {
    flex-direction: column;
  }

  .mini-actions,
  .nav-stack {
    width: 100%;
  }

  .inline-input {
    min-width: 100%;
  }
}

body {
  background:
    radial-gradient(circle at top right, rgba(74, 222, 196, 0.12), transparent 22%),
    radial-gradient(circle at bottom left, rgba(15, 118, 110, 0.18), transparent 26%),
    linear-gradient(180deg, #082a31 0%, #0a3942 16%, #06242b 16%, #06242b 100%);
  color: #edf8f7;
}

.app-shell {
  grid-template-columns: minmax(0, 1fr) 322px;
  grid-template-areas: "workspace sidebar";
  direction: ltr;
}

.sidebar {
  grid-area: sidebar;
  direction: rtl;
  background: linear-gradient(180deg, rgba(8, 64, 74, 0.98), rgba(6, 45, 53, 0.98));
  border-left: 0;
  border-right: 1px solid rgba(147, 197, 193, 0.14);
  padding: 22px 18px;
}

.workspace {
  grid-area: workspace;
  direction: rtl;
  padding: 22px 22px 34px;
}

.sidebar-card,
.panel,
.stat-card,
.feed-item,
.version-item,
.page-card,
.record-card,
.section-editor,
.preview-card,
.empty-state,
.topbar,
.nav-group {
  background: rgba(8, 39, 46, 0.9);
  border: 1px solid rgba(151, 201, 196, 0.12);
  box-shadow: 0 24px 60px rgba(1, 14, 19, 0.24);
  backdrop-filter: blur(16px);
}

.brand-block p,
.sidebar .eyebrow,
.sidebar-status-grid span,
.sidebar-health-grid span,
.workspace-description,
.muted,
.feed-item p,
.preview-card p,
.version-item p,
.page-card .muted,
.record-card .muted,
.surface-list-item-head span,
.surface-list-item p,
.surface-list-item small {
  color: rgba(219, 241, 239, 0.72);
}

.eyebrow {
  color: #83f2e0;
}

.topbar,
.panel {
  border-radius: 26px;
}

.topbar {
  align-items: center;
  background: linear-gradient(180deg, rgba(8, 51, 60, 0.94), rgba(6, 38, 45, 0.96));
}

.user-chip {
  background: rgba(126, 243, 209, 0.08);
  border: 1px solid rgba(126, 243, 209, 0.16);
}

.nav-group {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 20px;
}

.nav-button {
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  color: #f2fcfb;
}

.nav-button.active,
.nav-button:hover {
  background: linear-gradient(135deg, rgba(92, 234, 213, 0.26), rgba(27, 166, 155, 0.22));
  border-color: rgba(126, 243, 209, 0.28);
}

.ghost {
  background: rgba(255, 255, 255, 0.05);
  color: #effcfa;
  border: 1px solid rgba(126, 243, 209, 0.12);
}

.accent,
button:not(.ghost):not(.nav-button):not(.danger):not(.preset-card) {
  background: linear-gradient(135deg, #67e8cf, #14b8a6);
  color: #032127;
}

.danger {
  background: rgba(239, 68, 68, 0.12);
  color: #fecaca;
}

.stat-card strong,
.sidebar-status-grid strong,
.sidebar-health-grid strong,
.section-head h2,
.section-head h3,
.topbar h2,
.brand-block h1 {
  color: #f5fffd;
}

.stat-card {
  min-height: 126px;
  position: relative;
  overflow: hidden;
}

.stat-card::before,
.panel::before,
.page-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(126, 243, 209, 0.55), transparent);
}

.pill,
.page-card-badges .pill,
.surface-detail-tag {
  background: rgba(126, 243, 209, 0.08);
  border: 1px solid rgba(126, 243, 209, 0.16);
  color: #dffcf8;
}

.page-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 8px;
}

.surface-list-item.active,
.surface-list-item:hover,
.surface-list-item:focus-visible,
.page-card.selected {
  border-color: rgba(126, 243, 209, 0.3);
  background: linear-gradient(180deg, rgba(11, 57, 65, 0.98), rgba(7, 39, 46, 0.98));
}

.page-card input,
.page-card textarea,
.record-card input,
.record-card textarea,
.record-card select,
.section-editor input,
.section-editor textarea,
.section-editor select,
.auth-card input,
.auth-card select,
.auth-card textarea {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(126, 243, 209, 0.14);
  color: #f7fffe;
}

.auth-card {
  background: linear-gradient(180deg, rgba(8, 49, 57, 0.96), rgba(5, 31, 37, 0.98));
  color: #f6fffe;
}

.data-matrix th,
.data-matrix td {
  border-color: rgba(126, 243, 209, 0.08);
  color: #f2fbfa;
}

.data-matrix th {
  background: rgba(126, 243, 209, 0.06);
}

.preset-card {
  text-align: right;
  padding: 18px;
}

.preset-card strong {
  display: block;
  margin-bottom: 8px;
}

.surface-detail-pill,
.check-badge,
.badge {
  background: rgba(126, 243, 209, 0.12);
  color: #dffcf8;
}

.page-card,
.record-card,
.surface-list-item,
.sidebar-card,
.panel,
.stat-card {
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.page-card:hover,
.record-card:hover,
.surface-list-item:hover,
.sidebar-card:hover,
.panel:hover,
.stat-card:hover {
  transform: translateY(-2px);
}

.branch-card,
.branch-summary-card,
.validation-stat,
.order-runtime-card,
.impact-check-card,
.walkthrough-step {
  color: #edf8f7;
  border-color: rgba(151, 201, 196, 0.16);
  box-shadow: 0 24px 60px rgba(1, 14, 19, 0.24);
}

.branch-card,
.branch-summary-card {
  background: linear-gradient(180deg, rgba(8, 43, 50, 0.96), rgba(6, 34, 40, 0.96));
}

.branch-card h4,
.branch-summary-card h4,
.branch-card p,
.branch-summary-card p,
.branch-card strong,
.branch-summary-card strong,
.branch-card small,
.branch-summary-card small,
.branch-card span,
.branch-summary-card span,
.branch-summary-card .muted,
.branch-card .muted {
  color: #edf8f7;
}

.branch-card-links .route-chip,
.branch-summary-links .route-chip {
  background: rgba(126, 243, 209, 0.08);
  border-color: rgba(126, 243, 209, 0.18);
  color: #e7fffb;
}

.validation-stat.healthy,
.impact-check-card.is-pass,
.walkthrough-step.is-ready {
  background: linear-gradient(180deg, rgba(7, 58, 45, 0.96), rgba(5, 42, 34, 0.96));
  border-color: rgba(74, 222, 128, 0.22);
}

.validation-stat.warning,
.walkthrough-step.is-warning {
  background: linear-gradient(180deg, rgba(84, 58, 10, 0.96), rgba(64, 42, 7, 0.96));
  border-color: rgba(245, 158, 11, 0.24);
}

.validation-stat.unknown,
.walkthrough-step.is-pending {
  background: linear-gradient(180deg, rgba(26, 40, 55, 0.96), rgba(16, 28, 40, 0.96));
  border-color: rgba(148, 163, 184, 0.2);
}

.impact-check-card.is-fail,
.walkthrough-step.is-done {
  background: linear-gradient(180deg, rgba(66, 18, 18, 0.96), rgba(44, 12, 12, 0.96));
  border-color: rgba(248, 113, 113, 0.22);
}

.validation-stat strong,
.validation-stat span,
.validation-stat p,
.order-runtime-card strong,
.order-runtime-card h4,
.order-runtime-card p,
.impact-check-card strong,
.impact-check-card span,
.impact-check-card p,
.walkthrough-step strong,
.walkthrough-step span,
.walkthrough-step p {
  color: #edf8f7;
}

.order-runtime-card {
  background: linear-gradient(180deg, rgba(8, 43, 50, 0.96), rgba(6, 34, 40, 0.96));
}

.runtime-kv div {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(126, 243, 209, 0.14);
}

.runtime-kv span {
  color: rgba(219, 241, 239, 0.72);
}

.feed-item.walkthrough-step,
.feed-item.impact-check-card,
.feed-item.order-runtime-card,
.feed-item.validation-stat {
  color: #edf8f7;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-areas:
      "sidebar"
      "workspace";
  }

  .sidebar,
  .workspace {
    grid-column: auto;
  }
}
