:root {
  --ds-shell-width: 1380px;
  --ds-font-sans: "IBM Plex Sans", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --ds-ink: #152338;
  --ds-ink-strong: #0f1b2d;
  --ds-muted: #607086;
  --ds-line: #d8e2ef;
  --ds-line-strong: #c8d5e5;
  --ds-surface: rgba(255, 255, 255, 0.88);
  --ds-surface-strong: rgba(255, 255, 255, 0.96);
  --ds-surface-soft: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(246,250,255,0.95));
  --ds-surface-soft-blue: linear-gradient(180deg, rgba(255,255,255,0.99), rgba(247,250,255,0.96));
  --ds-brand: #000078;
  --ds-brand-strong: #173f8d;
  --ds-accent: #1f4fd6;
  --ds-danger: #a32020;
  --ds-success: #1f7a3f;
  --ds-warning: #9a6400;
  --ds-radius-shell: 28px;
  --ds-radius-xl: 24px;
  --ds-radius-lg: 20px;
  --ds-radius-md: 16px;
  --ds-radius-sm: 12px;
  --ds-shadow-shell: 0 22px 56px rgba(18, 34, 56, 0.14);
  --ds-shadow-card: 0 14px 28px rgba(15, 23, 42, 0.06);
  --ds-shadow-hover: 0 18px 32px rgba(15, 23, 42, 0.08);
  --ds-motion-fast: 160ms;
  --ds-motion-base: 220ms;
  --ds-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  padding: 24px;
  font-family: var(--ds-font-sans);
  color: var(--ds-ink);
  background:
    radial-gradient(72% 90% at 8% 8%, rgba(0, 0, 120, 0.12), rgba(0, 0, 120, 0)),
    radial-gradient(60% 82% at 92% 88%, rgba(163, 32, 32, 0.08), rgba(163, 32, 32, 0)),
    linear-gradient(160deg, #eef3ff 0%, #f9fbff 48%, #edf4ff 100%);
}

.shell {
  width: min(var(--ds-shell-width), 100%);
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(216, 226, 239, 0.9);
  border-radius: var(--ds-radius-shell);
  box-shadow: var(--ds-shadow-shell);
  overflow: hidden;
}

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

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  flex-wrap: wrap;
}

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

.page-eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 120, 0.12);
  background: rgba(0, 0, 120, 0.05);
  color: var(--ds-brand);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.page-header h1,
.page-title {
  margin: 10px 0 0;
  color: var(--ds-ink-strong);
  font-size: clamp(30px, 4vw, 42px);
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.page-subtitle,
.sub {
  margin: 8px 0 0;
  color: var(--ds-muted);
  font-size: 14px;
  line-height: 1.55;
}

.page-section,
.card,
.surface-card {
  border: 1px solid rgba(216, 226, 239, 0.94);
  border-radius: var(--ds-radius-lg);
  background:
    radial-gradient(120% 120% at 100% 0%, rgba(31, 79, 214, 0.05), rgba(31, 79, 214, 0)),
    var(--ds-surface-soft);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.94), var(--ds-shadow-card);
}

.page-section {
  padding: 18px;
}

.page-section-head,
.surface-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.page-section-head h2,
.surface-head h2 {
  margin: 0;
  color: #17345e;
  font-size: 20px;
}

.page-section-head p,
.surface-head p {
  margin: 4px 0 0;
  color: var(--ds-muted);
  font-size: 13px;
  line-height: 1.5;
}

.surface-grid {
  display: grid;
  gap: 14px;
}

.app-workspace {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  padding: 24px;
}

.app-sidebar {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 14px;
}

.app-editor-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.app-editor-sidebar {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 14px;
}

.app-editor-main {
  min-width: 0;
  display: grid;
  gap: 14px;
}

.app-sidebar-card {
  padding: 16px;
  border: 1px solid rgba(216, 226, 239, 0.94);
  border-radius: 18px;
  background:
    radial-gradient(120% 120% at 100% 0%, rgba(31, 79, 214, 0.05), rgba(31, 79, 214, 0)),
    var(--ds-surface-soft);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.94), var(--ds-shadow-card);
}

.app-sidebar-card h1,
.app-sidebar-card h2 {
  margin: 6px 0 0;
  color: var(--ds-ink-strong);
  line-height: 1.08;
}

.app-sidebar-card p {
  margin: 8px 0 0;
  color: var(--ds-muted);
  font-size: 13px;
  line-height: 1.55;
}

.app-sidebar-eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(0, 0, 120, 0.07);
  color: var(--ds-brand-strong);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.app-side-nav {
  display: grid;
  gap: 8px;
}

.app-side-link {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid rgba(216, 226, 239, 0.94);
  border-radius: 16px;
  background: linear-gradient(180deg, #fbfdff, #ffffff);
  color: var(--ds-ink-strong);
  text-decoration: none;
  transition:
    transform var(--ds-motion-fast) var(--ds-ease),
    border-color var(--ds-motion-fast) var(--ds-ease),
    box-shadow var(--ds-motion-fast) var(--ds-ease),
    background var(--ds-motion-fast) var(--ds-ease);
}

.app-side-link:hover {
  transform: translateY(-1px);
  border-color: #b8cae0;
  box-shadow: var(--ds-shadow-hover);
}

.app-side-link.is-active {
  border-color: #9eb6d8;
  background: linear-gradient(180deg, #eef5ff, #ffffff);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}

.app-side-link-title {
  font-size: 14px;
  font-weight: 800;
}

.app-side-link-meta {
  color: var(--ds-muted);
  font-size: 12px;
  font-weight: 700;
}

.app-sidebar-stats {
  display: grid;
  gap: 12px;
}

.app-stat-grid {
  display: grid;
  gap: 12px;
}

.app-stat-card {
  display: grid;
  gap: 2px;
  padding: 14px;
  border: 1px solid rgba(216, 226, 239, 0.94);
  border-radius: 16px;
  background: linear-gradient(180deg, #fbfdff, #ffffff);
}

.app-stat-card strong {
  font-size: 22px;
  line-height: 1;
  color: #163566;
}

.app-stat-card span {
  color: var(--ds-muted);
  font-size: 12px;
  font-weight: 700;
}

.app-side-stat {
  display: grid;
  gap: 2px;
}

.app-side-stat strong {
  font-size: 22px;
  line-height: 1;
  color: #163566;
}

.app-side-stat span {
  color: var(--ds-muted);
  font-size: 12px;
  font-weight: 700;
}

.app-flow-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.app-flow-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px;
  border: 1px solid rgba(216, 226, 239, 0.94);
  border-radius: 14px;
  background: linear-gradient(160deg, #f8faff, #fcfdff);
  transition:
    border-color var(--ds-motion-fast) var(--ds-ease),
    transform var(--ds-motion-fast) var(--ds-ease),
    box-shadow var(--ds-motion-fast) var(--ds-ease);
}

.app-flow-item.is-active {
  border-color: #9db4ff;
  background: linear-gradient(160deg, #eaf0ff, #f4f7ff);
  box-shadow: 0 6px 16px rgba(0, 0, 120, 0.08);
}

.app-flow-item:hover {
  border-color: #b2c3ff;
}

.app-flow-dot {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 120, 0.06);
  border: 1px solid rgba(0, 0, 120, 0.14);
  color: var(--ds-brand);
  font-size: 12px;
  font-weight: 700;
  flex: 0 0 auto;
}

.app-flow-title {
  font-weight: 700;
  color: #1d2c68;
  margin-bottom: 2px;
}

.app-flow-sub {
  font-size: 12px;
  color: var(--ds-muted);
}

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

.metric-card {
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius-md);
  background: rgba(255,255,255,0.86);
  padding: 14px;
  display: grid;
  gap: 6px;
}

.metric-card strong {
  color: #17345e;
  font-size: 24px;
  line-height: 1.05;
}

.metric-card span,
.mini,
.hint {
  color: var(--ds-muted);
  font-size: 12px;
  line-height: 1.45;
}

.app-table-wrap,
.table-wrap,
.option-table-wrap {
  overflow-x: auto;
}

.app-table-shell {
  border: 1px solid rgba(216, 226, 239, 0.94);
  border-radius: var(--ds-radius-md);
  background: rgba(255,255,255,0.86);
  overflow: hidden;
}

.app-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.app-table th,
.app-table td,
table th,
table td {
  border: 1px solid #dce5f1;
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

.app-table th,
table th {
  background: #f6f9ff;
  color: #334155;
}

.app-table tr:last-child td {
  border-bottom: 0;
}

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

.app-module-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.app-action-row {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.app-action-row.is-sticky {
  position: sticky;
  bottom: 14px;
  z-index: 4;
  padding-top: 12px;
  border-top: 1px solid #dbe5f2;
  background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(255,255,255,0.98));
}

.app-note-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.app-module-link,
.tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid #c6d1e1;
  border-radius: 999px;
  text-decoration: none;
  color: #1c2a41;
  background: #f8fbff;
  font-weight: 700;
  transition:
    transform var(--ds-motion-fast) var(--ds-ease),
    border-color var(--ds-motion-fast) var(--ds-ease),
    background var(--ds-motion-fast) var(--ds-ease),
    box-shadow var(--ds-motion-fast) var(--ds-ease);
}

.app-module-link:hover,
.tab:hover {
  transform: translateY(-1px);
  border-color: #9db4d2;
  box-shadow: 0 8px 16px rgba(16, 32, 57, 0.06);
}

.app-module-link.is-active,
.tab.active {
  background: linear-gradient(135deg, #0f3b7a 0%, #1759b8 100%);
  color: #fff;
  border-color: #1759b8;
}

.inline-action-form {
  display: inline;
}

.inline-flex-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.u-mt-12 {
  margin-top: 12px;
}

.u-mt-16 {
  margin-top: 16px;
}

.u-align-end {
  align-items: end;
}

.audit-request-list {
  margin: 6px 0 10px 18px;
  padding: 0;
}

.status-note-error {
  margin-top: 8px;
  color: #8e1e1e;
}

@media (max-width: 980px) {
  .app-workspace {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .app-sidebar {
    position: static;
  }
}

.status-note-error + .status-note-error {
  margin-top: 6px;
}

@media (max-width: 900px) {
  body {
    padding: 18px;
  }

  .page-stack {
    padding: 18px;
  }

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

  .app-editor-sidebar {
    position: static;
  }

  .app-action-row {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 760px) {
  body {
    padding: 12px;
  }

  .shell {
    border-radius: 22px;
  }

  .page-stack {
    padding: 16px;
  }
}
