@import url("/assets/fonts/fraunces/500.css");
@import url("/assets/fonts/fraunces/700.css");
@import url("/assets/fonts/manrope/300.css");
@import url("/assets/fonts/manrope/400.css");
@import url("/assets/fonts/manrope/600.css");
@import url("/assets/fonts/manrope/700.css");

:root {
  color-scheme: light;
  --control-label-height: 14px;
  --ink-900: #111318;
  --ink-700: #2c3240;
  --ink-500: #4b5567;
  --ink-300: #8d96a6;
  --paper-100: #f8f6f1;
  --paper-200: #f1eee6;
  --sand-200: #e8e2d6;
  --sand-300: #d6cdbd;
  --accent-600: #21A55E;
  --accent-500: #21A55E;
  --accent-200: #21A55E;
  --accent-rgb: 33, 165, 94;
  --warm-200: #f2d7b3;
  --warm-300: #e8c59a;
  --status-complete: #1f8f4a;
  --status-complete-rgb: 31, 143, 74;
  --status-draft: #f2d7b3;
  --status-draft-rgb: 242, 215, 179;
  --status-review: #87CEEB;
  --status-review-rgb: 135, 206, 235;
  --status-planning: #cdd5e0;
  --status-planning-rgb: 205, 213, 224;
  --status-progress: #a8d8b5;
  --status-progress-rgb: 168, 216, 181;
  --status-pending: #7d8795;
  --status-pending-rgb: 125, 135, 149;
  --shadow-soft: 0 18px 45px rgba(17, 19, 24, 0.08);
  --shadow-card: 0 12px 28px rgba(17, 19, 24, 0.08);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--ink-900);
  background: radial-gradient(circle at top left, #ffffff 0%, var(--paper-100) 55%, var(--paper-200) 100%);
  min-height: 100vh;
}

.delete-cross {
  border: 1px solid #e4a2a2;
  background: #ffffff;
  color: #b04747;
  border-radius: 999px;
  width: 20px;
  height: 20px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(17, 19, 24, 0.12);
}

.delete-cross.is-corner {
  position: absolute;
  top: 0;
  right: 0;
  transform: translate(40%, -40%);
  z-index: 3;
}

.drag-dots {
  width: 16px;
  height: 16px;
  border: 0;
  background: transparent;
  box-shadow: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  user-select: none;
  touch-action: none;
  color: transparent;
}

.drag-dots:active {
  cursor: grabbing;
}

.drag-dots::before {
  content: "";
  width: 14px;
  height: 14px;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.95) 1px, transparent 2px),
    radial-gradient(circle, rgba(17, 19, 24, 0.28) 1px, transparent 2px);
  background-size: 5px 5px, 5px 5px;
  background-position: 0 0, 0.8px 0.8px;
}

body.is-loading [data-static-key] {
  visibility: hidden;
}

.page {
  padding: 32px clamp(20px, 4vw, 60px) 40px;
}

.page.has-app-footer {
  padding-bottom: 8px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 32px;
  height: auto;
  min-height: 240px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #ffffff, #f6f2ea 60%, #efe7d9 100%);
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}

.people-topbar {
  height: auto;
  min-height: 200px;
}

.topbar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 85% 20%, rgba(var(--accent-rgb), 0.12), transparent 50%);
  pointer-events: none;
}

.brand {
  max-width: min(50vw, 900px);
  width: min(50vw, 900px);
  flex: 1 1 50vw;
  min-width: 320px;
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
  z-index: 1;
}

.brand-kicker {
  text-transform: uppercase;
  letter-spacing: 0.4em;
  font-size: 12px;
  color: var(--ink-300);
  margin-bottom: 8px;
}

.brand h1 {
  margin: 0 0 8px;
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: clamp(28px, 3vw, 40px);
  color: var(--ink-900);
}

.brand-subtitle {
  margin: 0;
  color: var(--ink-500);
  font-size: 14px;
  overflow-wrap: anywhere;
  line-height: 1.4;
  width: 100%;
}

.brand-blurb {
  margin: 10px 0 0;
  color: var(--ink-700);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  max-width: 100%;
  width: 100%;
  overflow-wrap: anywhere;
  flex: 1 1 auto;
  min-height: 0;
}


.topbar-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 18px;
  z-index: 1;
  min-width: 0;
  width: 100%;
  align-items: flex-start;
  justify-content: flex-end;
  margin-top: 8px;
}

.topbar-controls > .control {
  flex: 0 1 auto;
  min-width: 0;
}

.topbar-controls > .view-control {
  flex: 1 1 320px;
  min-width: 220px;
  width: auto;
  max-width: 100%;
  display: grid;
  align-items: start;
  justify-items: start;
}

.topbar-controls > .resources-control {
  flex: 0 1 150px;
  min-width: 130px;
}

.topbar-controls > .search-control {
  flex: 1 1 320px;
  min-width: 220px;
  max-width: 360px;
}

.topbar-controls > .status-control {
  flex: 0 1 200px;
  min-width: 160px;
}

.topbar-controls > .action-link,
.topbar-controls > .icon-button {
  flex: 0 0 auto;
  align-self: flex-end;
}

.topbar-right {
  display: grid;
  gap: 16px;
  justify-items: end;
  z-index: 1;
  position: relative;
  flex: 1 1 520px;
  min-width: 0;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
}

.people-topbar .topbar-actions {
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.people-topbar .topbar-actions > * {
  white-space: nowrap;
}

.account-name {
  font-size: 12px;
  color: var(--ink-500);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-name:empty {
  display: none;
}

.edit-indicator {
  display: none;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent-600);
}

body.editing .edit-indicator {
  display: inline-flex;
}

.save-status {
  font-size: 12px;
  color: var(--ink-300);
}

.save-status.is-dirty {
  color: var(--accent-600);
  font-weight: 600;
}

body.has-app-footer {
  min-height: 100vh;
}

body.has-app-footer:not(.login-page):not(.markdown-viewer) {
  display: flex;
  flex-direction: column;
}

body.admin-page.has-app-footer {
  padding-bottom: 8px;
}

.login-page.has-app-footer {
  grid-template-rows: auto 1fr auto;
}

.page.has-app-footer {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page.has-app-footer > main {
  flex: 1 0 auto;
}

.app-footer {
  margin-top: auto;
  padding: 8px 12px 0;
  border-top: 1px solid var(--sand-200);
  font-size: 12px;
  color: var(--ink-500);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
}

.app-footer[data-container="body"] {
  padding: 8px clamp(20px, 4vw, 60px) 8px;
}

.app-footer-link {
  color: var(--accent-600);
  text-decoration: none;
  font-weight: 600;
}

.app-footer-link:hover {
  text-decoration: underline;
}

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

.ps-sidebar,
.ps-dashboard {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ps-form-grid {
  display: grid;
  gap: 12px;
}

.ps-two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.ps-addon-grid {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.ps-addon-card {
  border: 1px solid var(--sand-200);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
  display: grid;
  gap: 6px;
}

.ps-addon-card[data-active="true"] {
  border-color: rgba(var(--accent-rgb), 0.4);
  box-shadow: 0 8px 18px rgba(33, 165, 94, 0.1);
}

.ps-addon-desc {
  font-size: 11px;
  color: var(--ink-300);
}

.ps-addon-pct {
  font-weight: 700;
  color: var(--accent-600);
  font-size: 13px;
}

.ps-note {
  font-size: 11px;
  color: var(--ink-500);
  margin-top: 6px;
}

.ps-metric-card {
  border: 1px solid var(--sand-200);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--paper-100);
}

.ps-metric-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-300);
}

.ps-metric-value {
  font-size: 16px;
  font-weight: 800;
  color: var(--accent-600);
  margin-top: 4px;
}

.ps-metric-sub {
  font-size: 9px;
  color: var(--ink-500);
  margin-top: 2px;
}

.ps-phase-block {
  border: 1px solid var(--sand-200);
  border-radius: 12px;
  padding: 8px 10px;
  background: #fff;
  margin-bottom: 10px;
}

.ps-phase-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
}

.ps-phase-title {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ps-phase-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
}

.ps-phase-meta {
  font-size: 11px;
  color: var(--ink-500);
}

.ps-phase-lines {
  display: grid;
  gap: 6px;
}

.ps-line-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(64px, 84px) max-content max-content;
  column-gap: 4px;
  row-gap: 6px;
  align-items: center;
  min-width: 0;
}

.ps-line-row .calc-select,
.ps-line-row .calc-input {
  height: 34px;
  font-size: 12px;
  padding: 6px 10px;
}

.ps-line-row .calc-select,
.ps-line-row .calc-input,
.ps-line-row .ps-line-sell {
  min-width: 0;
}

.ps-line-row .ps-line-sell {
  justify-self: start;
  text-align: left;
  white-space: nowrap;
}

.ps-line-row .calc-inline-button {
  justify-self: end;
  white-space: nowrap;
  padding: 4px 10px;
  font-size: 10px;
  box-sizing: border-box;
}

.ps-phase-lines > .calc-inline-button {
  width: fit-content;
  white-space: nowrap;
  max-width: 100%;
  justify-self: start;
  padding: 4px 10px;
  font-size: 10px;
}

.ps-line-sell {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-700);
}

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

.ps-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--ink-900);
}

.ps-subtitle {
  font-size: 12px;
  color: var(--ink-500);
  margin-top: 4px;
}

.ps-header-metrics {
  display: flex;
  gap: 8px;
}

.ps-badge {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--sand-200);
  background: #fff;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-500);
}

.ps-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.ps-kpi-card {
  border: 1px solid var(--sand-200);
  border-radius: 14px;
  padding: 12px 14px;
  background: #fff;
}

.ps-kpi-value {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 4px;
}

.ps-kpi-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-300);
}

.ps-kpi-sub {
  font-size: 10px;
  color: var(--ink-500);
  margin-top: 4px;
}

.ps-blended-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.ps-mini-card {
  border: 1px solid var(--sand-200);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
}

.ps-mini-value {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink-700);
}

.ps-mini-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-300);
  margin-top: 4px;
}

.ps-mini-sub {
  font-size: 9px;
  color: var(--ink-500);
  margin-top: 3px;
}

.ps-seg-label {
  font-size: 10px;
  color: var(--ink-300);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 6px;
}

.ps-segbar {
  display: flex;
  height: 6px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--paper-200);
  gap: 2px;
}

.ps-seg {
  height: 100%;
  display: block;
}

.ps-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
  font-size: 10px;
  color: var(--ink-500);
}

.ps-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ps-legend-dot {
  width: 6px;
  height: 6px;
  border-radius: 2px;
  display: inline-block;
}

.ps-cross-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.ps-table-header,
.ps-table-row {
  display: grid;
  grid-template-columns: 2fr 56px 60px 90px 90px 90px 80px;
  gap: 8px;
  align-items: center;
}

.ps-table-header {
  background: var(--paper-200);
  border-radius: 8px;
  padding: 6px 8px;
  margin-bottom: 6px;
}

.ps-table-head {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-300);
}

.ps-table-row {
  padding: 8px;
  border-radius: 8px;
}

.ps-table-row[data-alt="1"] {
  background: #fff;
}

.ps-table-cell {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 11px;
  color: var(--ink-700);
}

.ps-table-title {
  font-weight: 700;
  font-size: 11px;
}

.ps-table-sub {
  font-size: 9px;
  color: var(--ink-300);
}

.ps-table-num {
  justify-content: flex-end;
  font-weight: 700;
}

.ps-bar {
  height: 4px;
  background: var(--paper-200);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}

.ps-bar > span {
  display: block;
  height: 100%;
}

.ps-bar-value {
  font-size: 10px;
}

.ps-table-total {
  border-top: 1px solid var(--sand-200);
  margin-top: 6px;
  padding-top: 10px;
  font-weight: 700;
}

.ps-table-total-label {
  font-weight: 800;
}

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

.ps-role-line {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.ps-role-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 11px;
  color: var(--ink-700);
}

.ps-role-phase {
  font-size: 9px;
  color: var(--ink-300);
}

.ps-role-stats {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  font-size: 10px;
  color: var(--ink-500);
}

.ps-waterfall-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--sand-200);
  font-size: 11px;
}

.ps-waterfall-total {
  display: flex;
  justify-content: space-between;
  padding: 10px 0 4px;
  font-weight: 800;
  font-size: 13px;
}

.ps-waterfall-sub {
  font-size: 11px;
  color: var(--ink-500);
}

.ps-waterfall-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.ps-bench {
  margin-top: 10px;
  padding: 8px 10px;
  background: var(--paper-200);
  border-radius: 8px;
  font-size: 10px;
}

.ps-bench-title {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 6px;
  color: var(--ink-500);
}

.ps-bench-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 4px;
  color: var(--ink-500);
}

.ps-bench-chip {
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(33, 165, 94, 0.12);
  color: var(--accent-600);
  font-weight: 700;
  text-align: center;
}

@media (max-width: 1200px) {
  .ps-grid {
    grid-template-columns: 1fr;
  }
  .ps-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ps-cross-grid,
  .ps-blended-grid,
  .ps-waterfall-grid,
  .ps-bottom-grid {
    grid-template-columns: 1fr;
  }
  .ps-table-header,
  .ps-table-row {
    grid-template-columns: 2fr 50px 60px 70px 70px 70px 60px;
  }
}

@media (max-width: 720px) {
  .ps-line-row {
    grid-template-columns: minmax(0, 1fr) minmax(64px, 80px) max-content;
  }

  .ps-line-row .calc-inline-button {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

.view-toolbar {
  width: 100%;
  background: #ffffff;
  border: 1px solid var(--sand-200);
  border-radius: var(--radius-md);
  padding: 10px;
  box-shadow: var(--shadow-card);
}

.view-toggle {
  display: flex;
  gap: 10px;
  position: static;
  flex-wrap: wrap;
  width: 100%;
  align-items: center;
  justify-content: flex-start;
}

.view-button {
  border: 1px solid var(--sand-300);
  background: #ffffff;
  color: var(--ink-700);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
  padding-right: 26px;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.view-button.view-add {
  display: none;
}

body.editing .view-button.view-add {
  display: inline-flex;
}

.view-label {
  outline: none;
  white-space: nowrap;
}

.view-delete {
  display: none;
}

body.editing .view-delete {
  display: inline-flex;
}

body.editing .view-label {
  cursor: text;
}

.view-button.active {
  background: var(--accent-500);
  color: #ffffff;
  border-color: var(--accent-500);
}

.view-button.view-add {
  width: 40px;
  min-width: 40px;
  padding: 0;
  padding-right: 0;
  justify-content: center;
  border: 1px dashed var(--sand-300);
  color: var(--ink-700);
}

.view-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.resources-link {
  padding: 8px 12px;
  font-size: 12px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.toast {
  position: fixed;
  right: 28px;
  bottom: 28px;
  background: #ffffff;
  color: var(--ink-700);
  border: 1px solid var(--sand-200);
  box-shadow: var(--shadow-card);
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 200ms ease, transform 200ms ease;
  pointer-events: none;
  z-index: 999;
}

.toast-action {
  border: none;
  background: none;
  color: var(--accent-600);
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.status-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.icon-button {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--sand-300);
  background: #ffffff;
  color: var(--ink-700);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

.icon-button.primary {
  background: var(--accent-500);
  border-color: var(--accent-500);
  color: #ffffff;
}

.icon-button.is-editing {
  color: var(--accent-500);
  border-color: var(--accent-500);
}

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

.action-button {
  border: 1px solid var(--sand-300);
  background: #ffffff;
  color: var(--ink-700);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.action-button.primary {
  background: var(--accent-500);
  border-color: var(--accent-500);
  color: #ffffff;
}

.action-button:hover {
  transform: translateY(-1px);
  border-color: var(--accent-500);
}

.action-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.control {
  display: grid;
  gap: 6px;
  grid-template-rows: var(--control-label-height) auto;
}

.control-label {
  min-height: var(--control-label-height);
  line-height: var(--control-label-height);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--ink-300);
  display: block;
}

.control-label.is-hidden {
  visibility: hidden;
}

.status-control {
  gap: 10px;
}

.control input,
.control select {
  border: 1px solid var(--sand-300);
  background: #ffffff;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.2;
  color: var(--ink-700);
  outline: none;
  height: 40px;
}

.control input:focus,
.control select:focus {
  border-color: var(--accent-500);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15);
}

.action-link {
  text-decoration: none;
  color: var(--accent-600);
  font-weight: 600;
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--sand-300);
  background: #ffffff;
}

.logout-button {
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

body.role-viewer #editToggle,
body.role-viewer #saveButton,
body.role-viewer .edit-indicator,
body.role-viewer #resourcesEditToggle,
body.role-viewer #resourcesSave,
body.role-viewer #peopleEditToggle,
body.role-viewer #peopleSaveButton,
body.role-viewer #peopleAdd {
  display: none !important;
}

body:not(.role-admin) #adminLink,
body:not(.role-admin) #calcAdminToggle {
  display: none !important;
}

.calc-topbar {
  min-height: 220px;
}

.calc-view-toggle {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.calc-view-button {
  padding: 10px 16px;
  font-size: 13px;
}

.calc-view-button.is-active {
  background: var(--accent-500);
  border-color: var(--accent-500);
  color: #ffffff;
}

.calc-shell {
  margin-top: 24px;
}

.calc-viewbar {
  margin-bottom: 20px;
}

.calc-layout {
  display: grid;
  gap: 24px;
}

.calc-inputs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
}

.calc-inputs.is-masonry {
  position: relative;
  display: block;
}

.calc-inputs.is-masonry > * {
  position: absolute;
  width: 100%;
  margin: 0;
}

.calc-results {
  display: grid;
  gap: 20px;
}

.calc-panel,
.calc-card,
.calc-admin-card {
  background: #ffffff;
  border: 1px solid var(--sand-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 18px;
}

.calc-details {
  display: block;
}

.calc-details > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  list-style: none;
  flex-wrap: wrap;
  row-gap: 6px;
}

.calc-details > summary::-webkit-details-marker {
  display: none;
}

.calc-details > summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--ink-300);
  border-bottom: 2px solid var(--ink-300);
  transform: rotate(-45deg);
  transition: transform 150ms ease;
  margin-left: 6px;
}

.calc-details[open] > summary::after {
  transform: rotate(45deg);
}

.calc-details[open] > summary {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--sand-200);
}

.calc-summary-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--ink-700);
  font-weight: 800;
}

.calc-details-meta {
  margin-left: auto;
  font-size: 11px;
  color: var(--ink-500);
  font-weight: 600;
}

.calc-details-meta:empty {
  display: none;
}

.calc-details-body {
  display: grid;
  gap: 16px;
  margin-top: 8px;
}

.calc-subsection {
  display: grid;
  gap: 10px;
}

.calc-block {
  background: var(--tone-bg, var(--paper-100));
  border: 1px solid var(--tone-border, var(--sand-200));
  border-radius: 14px;
  padding: 14px 16px;
}

.calc-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--ink-500);
  font-weight: 800;
  margin-bottom: 12px;
}

.calc-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.calc-add-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.calc-add-row .calc-select {
  min-width: 220px;
  flex: 1;
}

.calc-quote-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.calc-quote-meta {
  font-size: 11px;
  color: var(--ink-500);
  font-weight: 600;
}

.calc-quote-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.calc-quote-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.calc-section {
  display: grid;
  gap: 10px;
}

.calc-section + .calc-section {
  margin-top: 14px;
}

.calc-option-list {
  display: grid;
  gap: 10px;
}

.calc-option {
  text-align: left;
  width: 100%;
  border: 1px solid var(--sand-200);
  background: #ffffff;
  border-radius: 14px;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.calc-option:hover {
  transform: translateY(-1px);
}

.calc-option[data-selected="true"] {
  border-color: var(--option-color);
  background: var(--option-tint);
  box-shadow: 0 10px 20px rgba(17, 19, 24, 0.08);
}

.calc-option-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.calc-option-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--paper-100);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--ink-700);
  font-size: 12px;
}

.calc-option-text {
  flex: 1;
  min-width: 0;
}

.calc-option-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-900);
}

.calc-option-subtitle {
  font-size: 11px;
  color: var(--ink-500);
  margin-top: 2px;
}

.calc-option-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.calc-option-indicator {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--option-color);
  opacity: 0;
}

.calc-option[data-selected="true"] .calc-option-indicator {
  opacity: 1;
}

.calc-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--pill-color, var(--sand-200));
  background: var(--pill-bg, var(--paper-100));
  color: var(--pill-color, var(--ink-500));
  font-size: 11px;
  font-weight: 600;
}

.calc-chip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.calc-chip-row-wrap {
  flex-wrap: wrap;
}

.calc-chip {
  border: 1px solid var(--sand-300);
  background: #ffffff;
  color: var(--ink-500);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.calc-chip[data-active="true"] {
  border-color: var(--accent-500);
  color: var(--accent-600);
  background: rgba(var(--accent-rgb), 0.12);
}

.calc-chip-small {
  padding: 6px 10px;
  font-size: 11px;
}

.calc-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.calc-field-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--ink-300);
  font-weight: 600;
}

.calc-field-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-800);
}

.calc-input,
.calc-select {
  border: 1px solid var(--sand-300);
  background: #ffffff;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.2;
  color: var(--ink-700);
  outline: none;
  height: 40px;
  width: 100%;
}

.calc-input:focus,
.calc-select:focus {
  border-color: var(--accent-500);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15);
}

.calc-input-compact {
  height: 32px;
  font-size: 12px;
  padding: 6px 10px;
}

.calc-input-large {
  height: 46px;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-600);
}

.calc-field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.calc-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.calc-summary-card {
  border: 1px solid var(--sand-200);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--paper-100);
}

.calc-summary-label {
  font-size: 11px;
  color: var(--ink-500);
}

.calc-summary-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-900);
  margin-top: 4px;
}

.calc-mini-row {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--ink-500);
  margin-top: 10px;
  flex-wrap: wrap;
}

.calc-callout {
  border-radius: 12px;
  border: 1px solid var(--sand-200);
  padding: 10px 12px;
  font-size: 12px;
  color: var(--ink-600);
  background: var(--paper-100);
  margin-top: 12px;
}

.calc-callout[data-tone="warning"] {
  border-color: var(--warm-300);
  color: #b45309;
  background: rgba(232, 197, 154, 0.35);
}

.calc-callout[data-tone="positive"] {
  border-color: var(--status-complete);
  color: var(--status-complete);
  background: rgba(var(--status-complete-rgb), 0.12);
}

.calc-callout[data-tone="info"] {
  border-color: var(--status-review);
  color: var(--ink-600);
  background: rgba(var(--status-review-rgb), 0.15);
}

.calc-resource-card {
  border: 1px solid var(--sand-200);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: #ffffff;
}

.calc-resource-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.calc-resource-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.calc-resource-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-900);
}

.calc-resource-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.calc-resource-qty {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-500);
}

.calc-resource-cost {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-700);
}

.calc-resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.calc-service-card {
  border: 1px solid var(--sand-200);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: #ffffff;
}

.calc-service-card[data-active="true"] {
  border-color: rgba(var(--accent-rgb), 0.5);
}

.calc-service-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.calc-service-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-900);
}

.calc-service-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.calc-service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.calc-duration-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.calc-duration-row .calc-input {
  min-width: 120px;
  width: 100%;
}

.calc-duration-unit {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-500);
  white-space: nowrap;
}

.calc-inline-button {
  border: 1px solid var(--sand-300);
  background: #ffffff;
  color: var(--ink-600);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.calc-primary {
  border: 1px solid var(--accent-500);
  background: var(--accent-500);
  color: #ffffff;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 12px;
}

.calc-primary:disabled,
.calc-inline-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.calc-switch-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--ink-500);
}

.calc-switch {
  appearance: none;
  width: 38px;
  height: 20px;
  border-radius: 999px;
  background: var(--sand-300);
  border: 1px solid var(--sand-300);
  position: relative;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
}

.calc-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(17, 19, 24, 0.2);
  transition: transform 160ms ease;
}

.calc-switch:checked {
  background: var(--accent-500);
  border-color: var(--accent-500);
}

.calc-switch:checked::after {
  transform: translateX(18px);
}

.calc-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.calc-kpi {
  border-radius: 14px;
  border: 1px solid var(--tone-border, var(--sand-200));
  background: var(--tone-bg, #ffffff);
  padding: 14px 16px;
}

.calc-kpi-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--tone-color, var(--ink-900));
}

.calc-kpi-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-500);
  margin-top: 6px;
}

.calc-kpi-sub {
  font-size: 11px;
  color: var(--tone-color, var(--ink-500));
  margin-top: 4px;
}

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

.calc-card-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--ink-700);
  font-weight: 800;
  margin-bottom: 12px;
}

.calc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--ink-600);
  margin-bottom: 8px;
}

.calc-row-strong {
  font-weight: 700;
  color: var(--ink-900);
}

.calc-profit {
  font-size: 28px;
  font-weight: 800;
  color: var(--tone-color, var(--ink-900));
  margin-bottom: 12px;
}

.calc-profit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  font-size: 11px;
  color: var(--ink-500);
}

.calc-profit-grid strong {
  display: block;
  color: var(--tone-color, var(--ink-900));
  font-size: 14px;
  margin-top: 4px;
}

.calc-profit-note {
  font-size: 11px;
  color: var(--ink-500);
  margin-top: 10px;
}

.calc-line-items {
  display: grid;
  gap: 8px;
}

.calc-export {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.calc-line-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--sand-200);
}

.calc-line-item.is-emphasis {
  border: 1px solid rgba(var(--accent-rgb), 0.35);
  background: rgba(var(--accent-rgb), 0.12);
  border-radius: 12px;
  padding: 12px 14px;
  margin-top: 8px;
  box-shadow: 0 10px 18px rgba(17, 19, 24, 0.08);
}

.calc-line-item.is-emphasis .calc-line-label {
  color: var(--ink-700);
  font-weight: 700;
}

.calc-line-item.is-emphasis .calc-line-value {
  color: var(--accent-600);
  font-size: 15px;
  font-weight: 800;
}

.calc-line-item:last-child:not(.is-emphasis) {
  border-bottom: none;
}

.calc-line-label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--ink-600);
}

.calc-line-sub {
  font-size: 10px;
  color: var(--ink-400);
}

.calc-line-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--tone-color, var(--ink-900));
}

.calc-line-summary {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--sand-200);
}


.calc-margin-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: end;
}

.calc-mini-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.calc-mini-card {
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid var(--tone-border, var(--sand-200));
  background: var(--tone-bg, #ffffff);
  font-size: 11px;
  color: var(--ink-500);
}

.calc-mini-card strong {
  display: block;
  font-size: 14px;
  color: var(--tone-color, var(--ink-900));
  margin-top: 4px;
}

.calc-table {
  margin-top: 14px;
}

.calc-table-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-300);
  margin-bottom: 8px;
}

.calc-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.calc-table th,
.calc-table td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--sand-200);
}

.calc-table tr[data-active="true"] {
  background: rgba(var(--accent-rgb), 0.12);
}

.calc-empty {
  font-size: 12px;
  color: var(--ink-400);
  padding: 8px 0;
}

.calc-admin {
  display: grid;
  gap: 18px;
}

.calc-admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.calc-admin-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.calc-admin-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink-900);
}

.calc-admin-subtitle {
  font-size: 12px;
  color: var(--ink-500);
  margin-top: 4px;
}

.calc-admin-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-800);
  margin-bottom: 12px;
}

.calc-admin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.calc-admin-card-header .calc-admin-card-title {
  margin-bottom: 0;
}

.calc-admin-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.calc-admin-grid-tight {
  grid-template-columns: 2fr 1fr 1fr 1fr auto;
  align-items: end;
}

.calc-admin-grid-wide {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.calc-admin-stack {
  display: grid;
  gap: 16px;
}

.calc-admin-note {
  font-size: 12px;
  color: var(--ink-500);
}

.calc-admin-add {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.calc-admin-add .calc-input {
  max-width: 160px;
}

.calc-admin-list {
  display: grid;
  gap: 10px;
}

.ps-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.ps-admin-region-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.ps-admin-rate {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--sand-200);
  background: var(--paper-100);
  display: grid;
  gap: 8px;
}

.ps-admin-addon-grid {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) minmax(120px, 1fr) minmax(160px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.ps-admin-addon-meta {
  display: grid;
  gap: 8px;
}

.ps-admin-region-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.ps-admin-region-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.ps-admin-region-flag {
  font-size: 18px;
  font-weight: 700;
}

.ps-admin-region-meta {
  display: grid;
  gap: 2px;
}

.ps-admin-region-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-800);
}

.ps-admin-region-sub {
  font-size: 11px;
  color: var(--ink-500);
}

.ps-admin-region-rates {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.ps-admin-region-rate {
  border: 1px solid var(--sand-200);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--paper-100);
}

.ps-admin-region-rate-label {
  font-size: 10px;
  color: var(--ink-400);
}

.ps-admin-region-rate-value {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-700);
}

.calc-service-toggle {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.calc-notice {
  position: fixed;
  top: 16px;
  right: 16px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid rgba(var(--accent-rgb), 0.3);
  background: rgba(var(--accent-rgb), 0.12);
  color: var(--accent-600);
  font-size: 12px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 150ms ease, transform 150ms ease;
  pointer-events: none;
  z-index: 9999;
}

.calc-notice.show {
  opacity: 1;
  transform: translateY(0);
}

.admin-body {
  display: grid;
  gap: 18px;
  color: var(--ink-700);
}

.admin-section {
  display: grid;
  gap: 10px;
}

.admin-section h4 {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-300);
}

.admin-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 14px;
}

.admin-label {
  color: var(--ink-500);
}

.admin-value {
  color: var(--ink-900);
  font-weight: 600;
  text-align: right;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-page {
  background: #f6f2ea;
  min-height: 100vh;
  padding: 32px;
}

.admin-shell {
  max-width: 720px;
  margin: 0 auto;
  flex: 1 0 auto;
}

.admin-card {
  background: #ffffff;
  border-radius: 22px;
  padding: 32px;
  border: 1px solid var(--sand-200);
  box-shadow: var(--shadow-soft);
  display: grid;
  gap: 24px;
}

.admin-header h1 {
  margin: 0;
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: 28px;
  color: var(--ink-900);
}

.admin-header p {
  margin: 6px 0 0;
  color: var(--ink-500);
  font-size: 14px;
}

.admin-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.admin-form {
  display: grid;
  gap: 10px;
}

.admin-field span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--ink-300);
}

.admin-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.admin-input-row input {
  border: 1px solid var(--sand-200);
  background: #ffffff;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 15px;
  color: var(--ink-700);
  outline: none;
}

.admin-input-row input:focus {
  border-color: var(--accent-500);
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.18);
}

.admin-message {
  min-height: 18px;
  font-size: 12px;
  color: var(--ink-400);
  margin: 0;
}

.admin-message.is-error {
  color: #b04747;
}

.admin-list h2 {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--ink-700);
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

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

.admin-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--sand-200);
  background: #fbfaf7;
}

.admin-email {
  color: var(--ink-800);
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-remove {
  font-size: 12px;
}

.admin-empty {
  color: var(--ink-400);
  font-size: 13px;
}


.icon-button:focus-visible,
.action-link:focus-visible,
.view-button:focus-visible,
.attachment-button:focus-visible,
.attachment-link:focus-visible,
.toast-action:focus-visible,
.phase:focus-visible,
.category:focus-visible,
.section-add:focus-visible {
  outline: 3px solid rgba(var(--accent-rgb), 0.35);
  outline-offset: 2px;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.is-open {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 19, 24, 0.4);
  backdrop-filter: blur(2px);
}

.modal-content {
  position: relative;
  z-index: 1;
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 20px 22px;
  width: min(520px, 90vw);
}

.crop-modal {
  width: min(640px, 92vw);
}

.crop-body {
  display: grid;
  gap: 16px;
  color: var(--ink-700);
}

.crop-help {
  margin: 0;
  color: var(--ink-500);
  font-size: 13px;
}

.crop-stage {
  width: min(320px, 80vw);
  height: min(320px, 80vw);
  margin: 0 auto;
  border-radius: var(--radius-md);
  background: var(--paper-200);
  position: relative;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}

.crop-stage.is-dragging {
  cursor: grabbing;
}

.crop-stage img {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: top left;
  user-select: none;
  pointer-events: none;
}

.crop-rect {
  position: absolute;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 9999px rgba(17, 19, 24, 0.45);
  cursor: move;
  z-index: 2;
  box-sizing: border-box;
}

.crop-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: #ffffff;
  border: 1px solid rgba(17, 19, 24, 0.25);
  box-shadow: 0 2px 6px rgba(17, 19, 24, 0.2);
}

.crop-handle[data-crop-handle="nw"] {
  top: -6px;
  left: -6px;
  cursor: nwse-resize;
}

.crop-handle[data-crop-handle="n"] {
  top: -6px;
  left: calc(50% - 6px);
  cursor: ns-resize;
}

.crop-handle[data-crop-handle="ne"] {
  top: -6px;
  right: -6px;
  cursor: nesw-resize;
}

.crop-handle[data-crop-handle="e"] {
  top: calc(50% - 6px);
  right: -6px;
  cursor: ew-resize;
}

.crop-handle[data-crop-handle="sw"] {
  bottom: -6px;
  left: -6px;
  cursor: nesw-resize;
}

.crop-handle[data-crop-handle="s"] {
  bottom: -6px;
  left: calc(50% - 6px);
  cursor: ns-resize;
}

.crop-handle[data-crop-handle="se"] {
  bottom: -6px;
  right: -6px;
  cursor: nwse-resize;
}

.crop-handle[data-crop-handle="w"] {
  top: calc(50% - 6px);
  left: -6px;
  cursor: ew-resize;
}

.crop-zoom {
  display: grid;
  gap: 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--ink-300);
}

.crop-zoom input {
  width: 100%;
}

.crop-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

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

.modal-header h3 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: 20px;
}

.resources-modal {
  width: min(920px, 94vw);
  height: min(92vh, 1230px);
  max-height: min(92vh, 1230px);
  min-height: min(70vh, 960px);
  display: grid;
  grid-template-rows: auto 1fr;
}

.resources-modal .modal-body {
  overflow: auto;
  color: var(--ink-900);
  min-height: 0;
}

.resources-modal-header {
  align-items: flex-start;
}

.resources-modal-headline h3 {
  margin: 0;
}

.resources-modal-subtitle {
  margin: 6px 0 0;
  color: var(--ink-500);
  font-size: 13px;
  line-height: 1.5;
}

.resources-modal-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.resources-picker {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.resources-picker-row {
  display: grid;
  gap: 8px;
}

.resources-picker-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--ink-300);
}

.resources-picker-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.resources-add {
  padding: 8px 14px;
  font-size: 12px;
}

.resources-select {
  border: 1px solid var(--sand-300);
  background: #ffffff;
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--ink-700);
  height: 36px;
  min-width: 220px;
}

.resources-modal-body {
  display: grid;
  gap: 18px;
}

.resources-modal-body .resources-grid {
  grid-template-columns: repeat(auto-fit, 200px);
  width: 100%;
  justify-content: start;
  align-content: start;
  grid-auto-flow: row;
}

.resources-modal-body .resource-card {
  width: 200px;
  height: 260px;
  padding: 14px 14px 24px;
  box-shadow: var(--shadow-card);
}

.resources-empty {
  border: 1px dashed var(--sand-200);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  color: var(--ink-300);
  font-size: 13px;
}

.resource-card {
  position: relative;
}

.resource-card-actions {
  display: none;
}

.resource-upload {
  display: none;
  margin-top: 10px;
  border: 1px dashed var(--sand-300);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 11px;
  color: var(--ink-500);
  cursor: pointer;
  width: fit-content;
}

.resource-upload input {
  display: none;
}

body.editing .resource-upload {
  display: inline-flex;
}

.resource-photo {
  position: relative;
  z-index: 1;
}

#resourcesModal.is-editing .resource-card-actions {
  display: contents;
}

.people {
  display: grid;
  gap: 24px;
  margin-top: 28px;
}

.people-header h2 {
  margin: 0 0 6px;
  font-family: "Fraunces", serif;
  font-size: 24px;
}

.people-header p {
  margin: 0;
  color: var(--ink-500);
}

.people-grid {
  --people-card-min: 160px;
  --people-card-max: clamp(180px, 20vw, 250px);
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(
    auto-fit,
    minmax(min(100%, var(--people-card-min)), var(--people-card-max))
  );
  justify-content: start;
  align-items: start;
}


.people-card {
  position: relative;
  width: 100%;
  max-width: var(--people-card-max);
  min-width: 0;
  background: #ffffff;
  border-radius: 18px;
  padding: 14px;
  display: grid;
  gap: 12px;
  border: 1px solid var(--sand-200);
  box-shadow: var(--shadow-card);
}

.people-card,
.people-card * {
  box-sizing: border-box;
}

.people-card-actions {
  display: none;
}

body.editing .people-card-actions {
  display: contents;
}

.people-drag {
  position: absolute;
  top: 6px;
  right: 32px;
  z-index: 3;
}

.people-drag:active {
  cursor: grabbing;
}

.people-card.is-dragging {
  opacity: 0.6;
}

.people-card.is-drop-target {
  outline: 2px dashed rgba(var(--accent-rgb), 0.4);
  outline-offset: 4px;
}

.people-card-body {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.people-photo {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 14px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #dfe8f3, #f5f0e8);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  min-width: 0;
}

.people-photo.has-photo {
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}

.people-photo[data-theme="teal"] {
  background-image: linear-gradient(135deg, #c9f0ea, #f2f7f5);
}

.people-photo[data-theme="amber"] {
  background-image: linear-gradient(135deg, #fbe4c2, #faf5ee);
}

.people-photo[data-theme="sage"] {
  background-image: linear-gradient(135deg, #d8efdc, #f4f8f5);
}

.people-photo[data-theme="plum"] {
  background-image: linear-gradient(135deg, #e6d5f2, #f6f2fa);
}

.people-photo[data-theme="ocean"] {
  background-image: linear-gradient(135deg, #cfe7f7, #f3f7fb);
}

.people-photo[data-theme="clay"] {
  background-image: linear-gradient(135deg, #f3d6c4, #fbf4ef);
}

.people-photo[data-theme="ink"] {
  background-image: linear-gradient(135deg, #d4d9e2, #f5f6f8);
}

.people-photo[data-theme="rose"] {
  background-image: linear-gradient(135deg, #f4c9d7, #fbf1f4);
}

.people-field {
  display: grid;
  gap: 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-300);
}

.people-text {
  display: grid;
  gap: 4px;
}

.people-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-300);
}

.people-value {
  font-size: 13px;
  color: var(--ink-700);
  line-height: 1.3;
}

.people-field input {
  border: 1px solid var(--sand-300);
  background: #ffffff;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
  color: var(--ink-700);
  outline: none;
  width: 100%;
  min-width: 0;
}

.people-field input:focus {
  border-color: var(--accent-500);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
}

.people-field input:disabled {
  background: var(--paper-200);
  color: var(--ink-500);
  cursor: not-allowed;
}

.photo-upload {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(17, 19, 24, 0.35);
  color: #ffffff;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  z-index: 2;
  border-radius: inherit;
}

.photo-upload input {
  display: none;
}

body.editing .photo-upload {
  display: inline-flex;
}

.photo-remove {
  display: none;
}

body.editing .photo-remove {
  display: inline-flex;
}

.people-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.modal-body {
  margin-top: 12px;
  color: var(--ink-500);
  font-size: 13px;
  line-height: 1.6;
}

.modal-body p {
  margin: 0 0 10px;
}

.modal-body p:last-child {
  margin-bottom: 0;
}

.is-invalid {
  outline: 2px solid #b04747;
  outline-offset: 2px;
  background: rgba(176, 71, 71, 0.06);
}

.layout {
  display: grid;
  grid-template-columns: minmax(220px, 260px) 1fr;
  gap: 24px;
  margin-top: 28px;
}

.sidebar {
  border-radius: var(--radius-lg);
  background: #ffffff;
  padding: 24px;
  box-shadow: var(--shadow-card);
  position: sticky;
  top: 24px;
  height: fit-content;
}

.sidebar-header h2 {
  margin: 0 0 4px;
  font-family: "Fraunces", serif;
  font-size: 20px;
}

.sidebar-header p {
  margin: 0 0 18px;
  color: var(--ink-500);
  font-size: 13px;
}

.category-list {
  display: grid;
  gap: 10px;
}

.category {
  border: 1px solid var(--sand-200);
  border-radius: var(--radius-sm);
  padding: 12px 46px 12px 14px;
  background: #fbfaf7;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
  position: relative;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.category.active {
  border-color: var(--accent-500);
  background: rgba(var(--accent-rgb), 0.16);
}

.category:hover {
  transform: translateY(-2px);
}

.category.add-category {
  border-style: dashed;
  background: #ffffff;
  justify-content: center;
}

.category.add-category span {
  color: var(--ink-500);
}

.category span {
  font-weight: 600;
  color: var(--ink-700);
}

.category .count {
  background: var(--warm-300);
  color: var(--ink-700);
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  margin-left: auto;
}

.category-actions {
  display: contents;
}

.category-handle {
  position: absolute;
  top: 50%;
  right: 18px;
  transform: translateY(-50%);
  z-index: 3;
}

.category-handle.drag-dots {
  width: 20px;
  height: 20px;
}

.category-handle.drag-dots::before {
  width: 16px;
  height: 16px;
}

.category-handle,
.category-delete {
  padding: 0;
}

.category.is-drop-target {
  border-color: var(--accent-500);
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.18);
}

.category.category-drop-slot {
  border-style: dashed;
  border-color: var(--accent-500);
  background: rgba(var(--accent-rgb), 0.06);
  box-shadow: none;
  box-sizing: border-box;
  min-height: 0;
  pointer-events: none;
}

.category.is-dragging {
  opacity: 0.9;
  box-shadow: var(--shadow-soft);
  cursor: grabbing;
  transition: none;
}

.content {
  display: grid;
  gap: 20px;
}

.resources {
  display: grid;
  gap: 24px;
  margin-top: 28px;
}

.resources-header h2 {
  margin: 0 0 6px;
  font-family: "Fraunces", serif;
  font-size: 24px;
}

.resources-header p {
  margin: 0;
  color: var(--ink-500);
}

.resources-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, 240px);
  justify-content: start;
}

.resource-card {
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 16px 16px 32px;
  box-shadow: var(--shadow-card);
  display: grid;
  gap: 12px;
  align-content: start;
  width: 240px;
  height: 226px;
}


.resource-card h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.resource-card p {
  margin: 0;
  color: var(--ink-500);
  font-size: 13px;
}


.resource-photo {
  width: 100%;
  height: 140px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #dfe8f3, #f5f0e8);
  position: relative;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.resource-photo.has-photo::after {
  background: none;
}

.resource-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.7), transparent 55%);
  pointer-events: none;
}

.resource-photo[data-theme="teal"] {
  background-image: linear-gradient(135deg, #c9f0ea, #f2f7f5);
}

.resource-photo[data-theme="amber"] {
  background-image: linear-gradient(135deg, #fbe4c2, #faf5ee);
}

.resource-photo[data-theme="sage"] {
  background-image: linear-gradient(135deg, #d8efdc, #f4f8f5);
}

.resource-photo[data-theme="plum"] {
  background-image: linear-gradient(135deg, #e6d5f2, #f6f2fa);
}

.resource-photo[data-theme="ocean"] {
  background-image: linear-gradient(135deg, #cfe7f7, #f3f7fb);
}

.resource-photo[data-theme="clay"] {
  background-image: linear-gradient(135deg, #f3d6c4, #fbf4ef);
}

.resource-photo[data-theme="ink"] {
  background-image: linear-gradient(135deg, #d4d9e2, #f5f6f8);
}

.resource-photo[data-theme="rose"] {
  background-image: linear-gradient(135deg, #f4c9d7, #fbf1f4);
}

.resource-photo.has-photo {
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}

.phase-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 4px;
}

.phase-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.phase-row .resources-link {
  margin-left: auto;
}

.phase-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.phase-edit {
  display: flex;
  align-items: center;
}

.phase-input {
  border: 1px solid var(--sand-300);
  background: #ffffff;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--ink-700);
  outline: none;
  min-width: 120px;
}

.add-phase {
  background: #ffffff;
  border-style: dashed;
}

.phase {
  border-radius: 999px;
  border: 1px solid var(--sand-300);
  padding: 8px 16px;
  font-size: 13px;
  color: var(--ink-500);
  cursor: pointer;
  background: #ffffff;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}


.phase-label[contenteditable="true"] {
  outline: 2px dashed rgba(var(--accent-rgb), 0.4);
  outline-offset: 4px;
  border-radius: 6px;
}

.phase-actions {
  display: contents;
}


.phase.active {
  background: var(--accent-500);
  color: #ffffff;
  border-color: var(--accent-500);
}

.content-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  gap: 20px;
  align-items: start;
}

@media (min-width: 1025px) {
  .content-body {
    grid-template-columns: minmax(0, 1fr) minmax(420px, 560px);
  }
}

.dashboard {
  display: none;
  gap: 20px;
  grid-template-columns: 1fr;
  align-items: start;
}

.content-body.dashboard-active {
  grid-template-columns: minmax(0, 1fr);
}

.content-body.dashboard-active .dashboard {
  display: grid;
}

.content-body.dashboard-active .cards,
.content-body.dashboard-active .detail {
  display: none;
}

.dashboard-panel {
  border-radius: var(--radius-lg);
  background: #ffffff;
  padding: 22px;
  box-shadow: var(--shadow-card);
  display: grid;
  gap: 16px;
}

.dashboard-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.dashboard-panel-header h3 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: 20px;
}

.dashboard-panel-header p {
  margin: 6px 0 0;
  color: var(--ink-500);
  font-size: 13px;
}

.dashboard-total {
  text-align: right;
  font-size: 12px;
  color: var(--ink-300);
}

.dashboard-total strong {
  display: block;
  font-size: 22px;
  color: var(--ink-900);
  font-family: "Fraunces", serif;
}

.dashboard-overview {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
}

.dashboard-pie {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: conic-gradient(var(--paper-200) 0% 100%);
  position: relative;
  margin: 0 auto;
  box-shadow: inset 0 0 0 1px var(--sand-200);
  flex: 0 0 180px;
}

.dashboard-pie::after {
  content: "";
  position: absolute;
  inset: 18%;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px var(--sand-200);
}


.dashboard-legend {
  width: 100%;
  flex: 1 1 260px;
  min-width: 220px;
}

.legend-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  --legend-count-max: calc(5ch + 2px);
  --legend-percent-max: calc(7ch + 12px);
  font-size: 13px;
  color: var(--ink-700);
  border: 1px solid var(--sand-200);
  background: #ffffff;
}

.legend-table th,
.legend-table td {
  padding: 6px 10px;
  text-align: left;
  vertical-align: middle;
  border-left: 1px solid var(--sand-200);
}

.legend-table .legend-count {
  padding-left: 2px;
  padding-right: 2px;
  white-space: nowrap;
  width: var(--legend-count-max);
  max-width: var(--legend-count-max);
  text-align: center;
}

.legend-table .legend-percent {
  padding-left: 6px;
  padding-right: 6px;
  white-space: nowrap;
  width: var(--legend-percent-max);
  max-width: var(--legend-percent-max);
  text-align: center;
}

.legend-table th:first-child,
.legend-table td:first-child {
  border-left: none;
}

.legend-table th {
  font-weight: 600;
  color: var(--ink-500);
}

.legend-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.legend-percent {
  white-space: nowrap;
}

.legend-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  font-size: 13px;
  color: var(--ink-700);
}

.legend-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: var(--swatch-color, var(--ink-300));
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9);
  flex-shrink: 0;
}

.legend-value {
  color: var(--ink-500);
  font-weight: 600;
  text-align: right;
  min-width: 110px;
  padding-left: 6px;
  font-variant-numeric: tabular-nums;
}


.phase-progress {
  display: grid;
  gap: 14px;
}

.phase-progress-row {
  background: #fbfaf7;
  border: 1px solid var(--sand-200);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: grid;
  gap: 10px;
}

.phase-row-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.phase-row-head h4 {
  margin: 0;
  font-size: 14px;
  color: var(--ink-900);
}

.phase-count {
  font-size: 12px;
  color: var(--ink-300);
}

.phase-bar {
  height: 10px;
  background: var(--paper-200);
  border-radius: 999px;
  overflow: hidden;
  display: flex;
}

.phase-bar-segment {
  height: 100%;
}

.phase-bar-segment.is-complete {
  background: var(--status-complete);
}

.phase-bar-segment.is-planning {
  background: var(--status-planning);
}

.phase-bar-segment.is-review {
  background: var(--status-review);
}

.phase-bar-segment.is-draft {
  background: var(--status-draft);
}

.phase-bar-segment.is-progress {
  background: var(--status-progress);
}

.phase-bar-segment.is-pending {
  background: var(--status-pending);
}

.phase-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.metric-chip {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--paper-200);
  color: var(--ink-700);
  border: 1px solid var(--sand-200);
}

.metric-chip.is-complete {
  background: rgba(var(--status-complete-rgb), 0.16);
  border-color: rgba(var(--status-complete-rgb), 0.5);
}

.metric-chip.is-planning {
  background: rgba(var(--status-planning-rgb), 0.18);
  border-color: rgba(var(--status-planning-rgb), 0.55);
  color: var(--ink-700);
}

.metric-chip.is-draft {
  background: rgba(var(--status-draft-rgb), 0.18);
  border-color: rgba(var(--status-draft-rgb), 0.55);
}

.metric-chip.is-review {
  background: rgba(var(--status-review-rgb), 0.16);
  border-color: rgba(var(--status-review-rgb), 0.5);
}

.metric-chip.is-progress {
  background: rgba(var(--status-progress-rgb), 0.18);
  border-color: rgba(var(--status-progress-rgb), 0.55);
  color: var(--ink-700);
}

.metric-chip.is-pending {
  background: rgba(var(--status-pending-rgb), 0.18);
  border-color: rgba(var(--status-pending-rgb), 0.55);
  color: var(--ink-700);
}

.dashboard-empty {
  border: 1px dashed var(--sand-200);
  border-radius: var(--radius-md);
  padding: 30px;
  text-align: center;
  color: var(--ink-300);
  font-size: 13px;
}

@media (min-width: 1100px) {
  .dashboard {
    grid-template-columns: minmax(170px, 0.65fr) minmax(320px, 1.35fr);
  }

  .dashboard-overview {
    align-items: center;
  }

  .dashboard-pie {
    width: 200px;
    height: 200px;
    flex-basis: 200px;
  }
}

@media (max-width: 720px) {
  .dashboard-overview {
    justify-content: center;
    text-align: center;
  }

  .dashboard-legend {
    width: 100%;
  }

  .dashboard-panel-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .dashboard-total {
    text-align: left;
  }
}

.cards {
  --card-min: 240px;
  --card-max: 280px;
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(var(--card-min), var(--card-max)));
  align-content: start;
  position: relative;
  justify-content: start;
}

.stream-divider {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
}

.stream-divider::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: var(--sand-200);
}

.stream-divider-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--ink-700);
  font-weight: 600;
  background: #ffffff;
  border: 1px solid var(--sand-200);
  padding: 6px 12px;
  border-radius: 999px;
}

.card {
  width: 100%;
  max-width: var(--card-max);
  min-width: 0;
  box-sizing: border-box;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #ffffff 0%, var(--stream-bg, #ffffff) 120%);
  padding: 18px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--stream-border, transparent);
  display: grid;
  gap: 12px;
  cursor: pointer;
  transition: border-color 160ms ease, transform 160ms ease;
  animation: fadeInUp 300ms ease forwards;
  position: relative;
}

.card:hover {
  border-color: var(--accent-500);
  transform: translateY(-3px);
}

.card h3 {
  margin: 0;
  font-size: 16px;
  color: var(--ink-900);
}

.card p {
  margin: 0;
  color: var(--ink-500);
  font-size: 13px;
  line-height: 1.5;
}

.card .meta {
  display: grid;
  grid-auto-flow: dense;
  grid-template-columns: repeat(auto-fit, minmax(90px, max-content));
  gap: 8px;
  font-size: 11px;
  align-items: center;
  justify-content: start;
}

.card .meta .chip {
  justify-self: start;
}

.card .meta .stream-chip.is-wide {
  grid-column: span 2;
}

.card-actions {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 8px;
}

.card-handle {
  padding: 0;
}

.card.is-dragging {
  opacity: 0.95;
  box-shadow: var(--shadow-soft);
  cursor: grabbing;
  transition: none;
}

.add-card {
  border: 1px dashed var(--sand-300);
  background: rgba(var(--accent-rgb), 0.05);
  color: var(--ink-700);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
}

.drop-slot {
  border: 2px dashed var(--accent-500);
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--ink-300);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  pointer-events: none;
}

body.card-dragging {
  cursor: grabbing;
  user-select: none;
}

.chip {
  padding: 0 11px;
  border-radius: 999px;
  background: var(--paper-200);
  color: var(--ink-700);
  font-size: 12px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  line-height: 1;
  white-space: nowrap;
  box-sizing: border-box;
}

.stream-chip {
  background: var(--stream-bg, var(--paper-200));
  color: var(--stream-text, var(--ink-700));
  border: 1px solid var(--stream-border, var(--sand-200));
}

.chip.status {
  background: var(--warm-200);
  border: 1px solid transparent;
}

.chip.status.status-completed {
  background: rgba(var(--status-complete-rgb), 0.18);
  border-color: rgba(var(--status-complete-rgb), 0.45);
  color: var(--ink-900);
}

.chip.status.status-draft {
  background: rgba(var(--status-draft-rgb), 0.2);
  border-color: rgba(var(--status-draft-rgb), 0.5);
  color: var(--ink-900);
}

.chip.status.status-planning {
  background: rgba(var(--status-planning-rgb), 0.2);
  border-color: rgba(var(--status-planning-rgb), 0.5);
  color: var(--ink-900);
}

.chip.status.status-review {
  background: rgba(var(--status-review-rgb), 0.18);
  border-color: rgba(var(--status-review-rgb), 0.45);
  color: var(--ink-900);
}

.chip.status.status-progress {
  background: rgba(var(--status-progress-rgb), 0.2);
  border-color: rgba(var(--status-progress-rgb), 0.5);
  color: var(--ink-900);
}

.chip.status.status-pending {
  background: rgba(var(--status-pending-rgb), 0.2);
  border-color: rgba(var(--status-pending-rgb), 0.5);
  color: var(--ink-900);
}


.detail {
  border-radius: var(--radius-lg);
  background: #ffffff;
  padding: 20px;
  box-shadow: var(--shadow-card);
  min-height: 50vh;
  max-height: calc(100vh - 48px);
  overflow: auto;
  display: grid;
  gap: 14px;
  align-content: start;
  position: sticky;
  top: 24px;
  align-self: start;
}

.detail h3 {
  margin: 0;
  font-size: 18px;
  font-family: "Fraunces", serif;
}

.detail .summary {
  margin: 0;
  color: var(--ink-500);
  font-size: 14px;
  line-height: 1.6;
}

.detail .summary[contenteditable="true"] {
  white-space: pre-wrap;
}

.detail .summary.markdown {
  display: grid;
  gap: 10px;
}

.detail .summary.markdown p {
  margin: 0;
}

.detail .summary.markdown ul,
.detail .summary.markdown ol {
  margin: 0;
  padding-left: 20px;
}

.detail .summary.markdown li {
  margin: 4px 0;
}

.detail .summary.markdown a {
  color: var(--accent-600);
  text-decoration: none;
  font-weight: 600;
}

.detail .summary.markdown a:hover,
.detail .summary.markdown a:focus {
  text-decoration: underline;
}

.detail .summary.markdown code {
  background: var(--paper-200);
  padding: 2px 6px;
  border-radius: 8px;
  font-size: 12px;
}

.detail-divider {
  border: none;
  border-top: 1px dashed var(--sand-200);
  margin: 4px 0;
}

.detail-section {
  display: grid;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--sand-200);
}

.detail-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.detail-section h4 {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-300);
}

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

.metadata-field {
  display: grid;
  gap: 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--ink-300);
}

.metadata-input {
  border: 1px solid var(--sand-300);
  background: #ffffff;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  color: var(--ink-700);
  outline: none;
}

.metadata-input:focus {
  border-color: var(--accent-500);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
}

.section-add {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid var(--sand-300);
  background: #ffffff;
  color: var(--ink-700);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.attachment-section {
  display: grid;
  gap: 18px;
}

.attachment-block {
  display: grid;
  gap: 12px;
}

.attachment-list {
  display: grid;
  gap: 10px;
}

.attachment-logos {
  gap: 14px;
}

.logo-carousel {
  --logo-height: 72px;
  overflow: hidden;
  scroll-snap-type: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

body.editing .logo-carousel {
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
}

.logo-carousel.is-manual {
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
}

.logo-track {
  display: inline-flex;
  gap: 14px;
  align-items: center;
  width: max-content;
  padding: 2px 2px 6px;
  will-change: transform;
}

.logo-carousel.is-animating .logo-track {
  animation: logo-marquee var(--marquee-duration, 30s) linear infinite;
}

.logo-carousel.is-manual .logo-track {
  animation-play-state: paused;
}

.logo-item {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid var(--sand-200);
  padding: 10px 12px;
  display: grid;
  gap: 8px;
  justify-items: center;
  scroll-snap-align: start;
  min-width: 120px;
}

.logo-media {
  height: var(--logo-height);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 8px;
  border-radius: 10px;
  background: var(--paper-200);
  border: 1px solid var(--sand-200);
}

.logo-media img {
  height: var(--logo-height);
  width: auto;
  max-width: 200px;
  object-fit: contain;
}

.logo-placeholder {
  font-size: 11px;
  color: var(--ink-300);
}

.logo-link {
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
}

.logo-label {
  font-size: 11px;
  color: var(--ink-500);
  text-align: center;
}

.logo-input {
  border: 1px solid var(--sand-300);
  background: #ffffff;
  padding: 6px 8px;
  border-radius: 10px;
  font-size: 12px;
  width: 100%;
  min-width: 120px;
}

.logo-actions {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.detail-section a {
  color: var(--accent-600);
  text-decoration: none;
  font-weight: 600;
}

.attachment-link {
  border: none;
  background: none;
  padding: 0;
  color: var(--accent-600);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  display: inline-flex;
  align-items: center;
}

.attachment-label-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.attachment-type-row {
  display: flex;
  align-items: center;
}

.attachment-type-chip {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid var(--sand-200);
  background: var(--paper-200);
  color: var(--ink-500);
}

.attachment-item[data-attachment-kind="links"] .attachment-link {
  max-width: 100%;
  min-width: 0;
}

.attachment-item[data-attachment-kind="links"] .attachment-label {
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-link:hover,
.attachment-link:focus {
  text-decoration: underline;
}

.detail-section .text-block {
  background: var(--paper-200);
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  color: var(--ink-700);
}

.attachment-item {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fbfaf7;
  border: 1px solid var(--sand-200);
  position: relative;
}

.attachment-item.is-dragging {
  opacity: 0.6;
  border-style: dashed;
}

.attachment-item.is-dragover {
  border-color: var(--accent-500);
  background: rgba(var(--accent-rgb), 0.08);
}

.attachment-item.logo-item {
  background: #ffffff;
  padding: 10px 12px;
  border-radius: 12px;
}

.attachment-handle {
  padding: 0;
}

.attachment-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.attachment-fields {
  display: grid;
  gap: 8px;
}

.attachment-field {
  display: grid;
  gap: 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--ink-300);
}

.attachment-input {
  border: 1px solid var(--sand-300);
  background: #ffffff;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  color: var(--ink-700);
  outline: none;
  resize: vertical;
  width: 100%;
}

.attachment-input:focus {
  border-color: var(--accent-500);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
}

.attachment-meta {
  font-size: 12px;
  color: var(--ink-300);
  word-break: break-word;
}

.attachment-item[data-attachment-kind="links"] .attachment-meta {
  word-break: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-button {
  border: 1px solid var(--sand-300);
  background: #ffffff;
  color: var(--ink-700);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.attachment-button.danger {
  border-color: #e4a2a2;
  color: #b04747;
}

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

.attachment-label {
  display: inline-block;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.4;
}

.video-embed {
  position: relative;
  padding-top: 56.25%;
  border-radius: 12px;
  overflow: hidden;
  background: #000000;
}

.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.drop-zone {
  border: 1px dashed var(--sand-300);
  border-radius: 14px;
  padding: 14px;
  font-size: 13px;
  color: var(--ink-500);
  background: #fbfaf7;
  transition: border-color 160ms ease, background 160ms ease;
}

.drop-zone.is-dragover {
  border-color: var(--accent-500);
  background: rgba(var(--accent-rgb), 0.08);
}

body.editing [contenteditable="true"] {
  outline: 2px dashed rgba(var(--accent-rgb), 0.4);
  outline-offset: 4px;
  background: rgba(var(--accent-rgb), 0.06);
}

.detail-empty {
  color: var(--ink-300);
  text-align: center;
  margin-top: 40px;
}

.login-page {
  min-height: 100vh;
  background: #f6f2ea;
  display: grid;
  grid-template-rows: auto 1fr;
  align-items: start;
  padding: 0;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  --login-width: min(560px, 92vw);
}

.login-page::before,
.login-page::after {
  content: "";
  position: absolute;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  display: none;
}

.login-page::before {
  top: -260px;
  left: -160px;
  background: radial-gradient(circle, rgba(var(--accent-rgb), 0.18), transparent 60%);
}

.login-page::after {
  bottom: -280px;
  right: -200px;
  background: radial-gradient(circle, rgba(var(--accent-rgb), 0.12), transparent 62%);
}

.login-topbar {
  width: 100%;
  max-width: none;
  margin: 0;
  align-self: stretch;
  justify-self: stretch;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  position: relative;
  z-index: 1;
  animation: fadeInUp 0.55s ease both;
  transition: opacity 200ms ease, transform 200ms ease;
  background: #ffffff;
  border-radius: 0;
  border-bottom: 1px solid var(--sand-200);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-service {
  font-size: 12px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--ink-300);
  font-weight: 600;
}

.login-logo {
  height: 32px;
  width: auto;
  display: block;
}

.login-brand-title {
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: 18px;
  color: var(--ink-900);
  letter-spacing: 0.01em;
}

.login-shell {
  width: var(--login-width);
  margin: 0 auto;
  align-self: center;
  position: relative;
  z-index: 1;
  transition: opacity 200ms ease, transform 200ms ease;
  padding: 24px 0 0;
}

.login-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 22px;
  padding: 36px 40px;
  min-height: 300px;
  box-shadow: 0 24px 60px rgba(17, 19, 24, 0.14), 0 6px 16px rgba(17, 19, 24, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.9);
  display: grid;
  gap: 24px;
  position: relative;
  overflow: hidden;
  animation: fadeInUp 0.65s ease both;
  animation-delay: 0.05s;
}

.login-page.is-checking .login-topbar,
.login-page.is-checking .login-shell {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}

.login-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.2), var(--accent-500), rgba(var(--accent-rgb), 0.2));
}

.login-sso {
  display: grid;
  gap: 12px;
  justify-items: center;
}

.login-sso .action-button {
  width: 240px;
  height: 44px;
  padding: 0;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1;
  box-shadow: 0 10px 18px rgba(var(--accent-rgb), 0.2);
  justify-self: center;
  display: block;
  margin: 0 auto;
}

.login-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--ink-300);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

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

.login-card.is-sso-only .login-header {
  text-align: center;
  justify-items: center;
}

.login-card.is-sso-only .login-kicker {
  text-align: center;
}

.login-card.is-sso-only .login-error {
  text-align: center;
}

.login-header {
  display: grid;
  gap: 6px;
}

.login-kicker {
  font-size: 11px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--ink-300);
}

.login-header h1 {
  margin: 0;
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: 30px;
  color: var(--ink-900);
}

.login-header p {
  margin: 0;
  color: var(--ink-500);
  font-size: 14px;
  line-height: 1.5;
}

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

.login-field {
  display: grid;
  gap: 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--ink-300);
}

.login-field input {
  border: 1px solid var(--sand-200);
  background: #ffffff;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 15px;
  color: var(--ink-700);
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.login-field input:focus {
  border-color: var(--accent-500);
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.22);
}

.login-form .action-button {
  width: 240px;
  height: 44px;
  padding: 0;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1;
  box-shadow: 0 10px 18px rgba(var(--accent-rgb), 0.2);
  justify-self: center;
  display: block;
  margin: 0 auto;
}

.login-form .action-button:hover {
  box-shadow: 0 12px 20px rgba(var(--accent-rgb), 0.24);
}

.login-form .action-button:active {
  transform: translateY(0);
}

.login-error {
  margin: 0;
  min-height: 18px;
  font-size: 12px;
  color: #b04747;
}

@media (max-width: 600px) {
  .login-page {
    padding: 18px;
  }

  .login-topbar {
    padding: 12px 0 18px;
  }

  .login-card {
    padding: 26px;
    border-radius: 18px;
  }

  .login-header h1 {
    font-size: 26px;
  }

  .login-brand-title {
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
.login-topbar,
.login-card {
  animation: none;
}
}

.login-page .is-hidden {
  display: none;
}

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

@keyframes logo-marquee {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(calc(-1 * var(--marquee-width, 0px)));
  }
}

@media (max-width: 1024px) {
  .calc-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .calc-quote-grid {
    grid-template-columns: 1fr 1fr;
  }

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

  .calc-margin-grid {
    grid-template-columns: 1fr;
  }

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

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

  .sidebar {
    position: static;
  }
}

@media (max-width: 900px) {
  .calc-split-grid {
    grid-template-columns: 1fr;
  }

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

  .calc-summary-grid {
    grid-template-columns: 1fr;
  }

  .calc-inputs {
    grid-template-columns: 1fr;
  }

  .calc-quote-grid {
    grid-template-columns: 1fr;
  }


  .content-body {
    grid-template-columns: 1fr;
  }

  .phase-row .resources-link {
    margin-left: 0;
    width: 100%;
    justify-content: center;
  }

  .detail {
    order: -1;
    position: static;
    top: auto;
    max-height: none;
  }
}

@media (max-width: 1480px) {
  .topbar {
    flex-wrap: wrap;
    height: auto;
    min-height: 0;
  }

  .topbar-right {
    width: 100%;
    justify-items: stretch;
  }

  .topbar-controls {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .topbar-controls > .view-control {
    flex: 1 1 100%;
    max-width: 100%;
  }

  .view-toggle {
    flex-wrap: wrap;
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .calc-field-grid {
    grid-template-columns: 1fr;
  }

  .calc-admin-grid,
  .calc-admin-grid-wide,
  .calc-admin-grid-tight {
    grid-template-columns: 1fr;
  }

  .ps-admin-grid,
  .ps-admin-addon-grid,
  .ps-admin-region-rates {
    grid-template-columns: 1fr;
  }

  .ps-admin-region-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .calc-mini-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    height: auto;
    min-height: 0;
  }

  .topbar-controls {
    width: 100%;
    justify-content: flex-start;
  }

  .topbar-right {
    width: 100%;
    justify-items: stretch;
  }
}

@media (prefers-reduced-motion: reduce) {
  .logo-carousel.is-animating .logo-track {
    animation: none;
  }
}

.markdown-viewer .viewer-shell {
  padding: 32px clamp(20px, 4vw, 60px) 60px;
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  gap: 24px;
}

.markdown-viewer .viewer-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.markdown-viewer .viewer-title {
  display: grid;
  gap: 8px;
}

.markdown-viewer .viewer-kicker {
  font-size: 12px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--ink-300);
  font-weight: 600;
}

.markdown-viewer #viewerTitle {
  margin: 0;
  font-size: 32px;
  font-family: "Fraunces", serif;
  color: var(--ink-900);
}

.markdown-viewer .viewer-subtitle {
  margin: 0;
  color: var(--ink-500);
  font-size: 14px;
}

.markdown-viewer .viewer-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.markdown-viewer .viewer-body {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--sand-200);
  box-shadow: var(--shadow-soft);
  padding: clamp(24px, 3vw, 48px);
  min-height: 60vh;
}

.markdown-viewer .viewer-empty {
  color: var(--ink-300);
  font-size: 14px;
}

.markdown-viewer .markdown-body {
  display: grid;
  gap: 16px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink-700);
}

.markdown-viewer .markdown-body h1,
.markdown-viewer .markdown-body h2,
.markdown-viewer .markdown-body h3,
.markdown-viewer .markdown-body h4,
.markdown-viewer .markdown-body h5,
.markdown-viewer .markdown-body h6 {
  margin: 0;
  font-family: "Fraunces", serif;
  color: var(--ink-900);
}

.markdown-viewer .markdown-body h1 {
  font-size: 28px;
}

.markdown-viewer .markdown-body h2 {
  font-size: 24px;
}

.markdown-viewer .markdown-body h3 {
  font-size: 20px;
}

.markdown-viewer .markdown-body p {
  margin: 0;
}

.markdown-viewer .markdown-body ul,
.markdown-viewer .markdown-body ol {
  margin: 0;
  padding-left: 22px;
}

.markdown-viewer .markdown-body li {
  margin: 4px 0;
}

.markdown-viewer .markdown-body a {
  color: var(--accent-600);
  text-decoration: none;
  font-weight: 600;
}

.markdown-viewer .markdown-body a:hover,
.markdown-viewer .markdown-body a:focus {
  text-decoration: underline;
}

.markdown-viewer .markdown-body code {
  background: var(--paper-200);
  padding: 2px 6px;
  border-radius: 8px;
  font-size: 13px;
}

.markdown-viewer .markdown-body pre {
  margin: 0;
  padding: 16px;
  border-radius: 14px;
  background: #16181d;
  color: #f8f6f1;
  overflow: auto;
  font-size: 13px;
  line-height: 1.6;
}

.markdown-viewer .markdown-body pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}

.markdown-viewer .markdown-body blockquote {
  margin: 0;
  padding: 12px 16px;
  border-left: 3px solid var(--accent-500);
  background: var(--paper-100);
  border-radius: 12px;
  color: var(--ink-500);
}

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

.markdown-viewer .markdown-body th,
.markdown-viewer .markdown-body td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--sand-200);
  text-align: left;
}

.markdown-viewer .markdown-body th {
  color: var(--ink-900);
  font-weight: 600;
}

.markdown-viewer .markdown-body hr {
  border: none;
  border-top: 1px dashed var(--sand-200);
  width: 100%;
}

.markdown-viewer .markdown-body img {
  max-width: 100%;
  border-radius: 16px;
  box-shadow: var(--shadow-card);
}

@media (max-width: 720px) {
  .markdown-viewer .viewer-topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .markdown-viewer #viewerTitle {
    font-size: 26px;
  }
}
