:root {
  --bg-deep: #0f172a;
  --bg-page: #f3f6fb;
  --bg-page-soft: #eef3f9;
  --bg-panel: rgba(255, 255, 255, 0.98);
  --bg-panel-strong: rgba(255, 255, 255, 1);
  --bg-soft: rgba(246, 249, 252, 0.94);
  --ink: #172033;
  --ink-soft: #657487;
  --line: rgba(140, 156, 178, 0.22);
  --line-strong: rgba(120, 141, 168, 0.32);
  --accent: #2563eb;
  --accent-deep: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, 0.12);
  --green: #1f3558;
  --green-soft: rgba(31, 53, 88, 0.08);
  --danger: #c03f44;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  --radius-xl: 5px;
  --radius-lg: 5px;
  --radius-md: 5px;
  --radius-sm: 5px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0)),
    linear-gradient(180deg, var(--bg-page) 0%, var(--bg-page-soft) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.08;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.2) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.18) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.3), transparent 90%);
}

#app {
  min-height: 100vh;
  overflow-x: clip;
}

.shell {
  width: min(1460px, calc(100% - 88px));
  margin: 0 auto;
  padding: 28px 6px 48px;
}

.panel {
  position: relative;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.panel-hero {
  overflow: hidden;
  padding: 24px 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(248, 251, 255, 0.98));
  color: var(--ink);
}

.panel-hero::after {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), rgba(37, 99, 235, 0.15) 60%, transparent);
}

.soft-panel {
  background: linear-gradient(180deg, var(--bg-panel-strong), var(--bg-soft));
}

.intro-panel,
.main-nav,
.page-grid > .panel,
.content-grid > .panel,
.content-grid > aside.panel,
.stat-card,
.info-card,
.login-panel,
.login-brand {
  padding: 24px;
}

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

.brand-lockup {
  display: flex;
  align-items: flex-start;
  gap: 18px;
}

.brand-logo {
  width: 156px;
  max-width: 24vw;
  height: auto;
  flex: 0 0 auto;
}

.topbar h1,
.login-brand h1 {
  margin: 10px 0 10px;
  font-size: clamp(1.85rem, 3vw, 2.7rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

.topbar p,
.login-brand p {
  margin: 0;
  max-width: 760px;
  color: var(--ink-soft);
  font-size: 0.98rem;
}

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

.topbar-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #f8fbff;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 700;
}

.meta-chip.accent {
  border-color: rgba(37, 99, 235, 0.2);
  background: rgba(37, 99, 235, 0.08);
  color: var(--accent-deep);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--ink-soft);
}

.topbar-side {
  display: grid;
  gap: 12px;
  justify-items: end;
}

.status-chip,
.identity-card,
.role-pill,
.metric-tile,
.support-box,
.info-card,
.stat-card,
.main-nav,
.nav-btn,
.feature-item {
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.status-chip,
.identity-card {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 5px;
  background: #f8fbff;
  color: var(--green);
  border: 1px solid var(--line);
}

.identity-card {
  display: grid;
  gap: 2px;
  border-radius: 5px;
  text-align: right;
}

.identity-card strong {
  font-size: 0.96rem;
}

.identity-card span {
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.12);
}

.main-nav {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--line);
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.nav-btn {
  border: 1px solid transparent;
  padding: 11px 15px;
  border-radius: 5px;
  background: transparent;
  color: var(--ink-soft);
  font-weight: 700;
}

.nav-btn.active {
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.18);
  color: var(--accent-deep);
  box-shadow: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 5px;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

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

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
  box-shadow: none;
}

.primary,
.secondary,
.ghost,
.danger,
.linkish {
  padding: 11px 16px;
  font-weight: 700;
}

.small {
  padding: 9px 14px;
  font-size: 0.92rem;
}

.primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
  color: #f8fbff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.16);
}

.secondary {
  background: #ffffff;
  color: var(--ink);
  border: 1px solid var(--line);
}

.ghost {
  background: #f8fbff;
  color: var(--ink);
  border: 1px solid var(--line);
}

.danger {
  background: linear-gradient(180deg, #cf4a50, #b5353d);
  color: white;
}

.linkish {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 10px;
  background: #ffffff;
  color: var(--green);
  border: 1px solid var(--line);
  text-decoration: none;
  font-size: 0.85rem;
}

.danger-text {
  color: var(--danger);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: #ffffff;
  padding: 13px 14px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
  background: white;
}

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

.page-grid,
.stack {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.stack > .panel {
  padding: 24px;
}

.page-grid > .panel,
.content-grid > .panel,
.content-grid > aside.panel,
.stack > .panel {
  min-width: 0;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(340px, 0.96fr);
  gap: 18px;
}

.content-grid.two-thirds {
  grid-template-columns: minmax(0, 1.75fr) minmax(320px, 0.95fr);
}

.formula-detail-grid {
  grid-template-columns: minmax(0, 1.45fr) minmax(310px, 0.82fr);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 18px;
}

.section-heading.compact {
  margin-top: 4px;
  margin-bottom: 14px;
}

.section-heading h2,
.section-heading h3,
.section-heading h4 {
  margin: 8px 0 0;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.section-heading h2 {
  font-size: clamp(1.55rem, 2.4vw, 2.3rem);
}

.section-heading h3 {
  font-size: 1.28rem;
}

.section-copy {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.58;
}

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

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

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

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  color: var(--ink-soft);
  font-size: 0.92rem;
  font-weight: 700;
}

.field-span {
  grid-column: 1 / -1;
}

.compact-grid {
  gap: 12px;
}

.filter-actions {
  align-items: end;
}

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

.stat-card {
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(250, 252, 255, 0.98));
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.stat-card strong {
  display: block;
  margin-top: 16px;
  font-size: clamp(1.75rem, 2.5vw, 2.2rem);
  letter-spacing: -0.05em;
}

.stat-label,
.info-card span,
.metric-tile span {
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-card small,
.subtle {
  color: var(--ink-soft);
}

.table-wrap {
  overflow: auto;
  max-width: 100%;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: #ffffff;
}

.cost-integrity-banner {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: 5px;
  border: 1px solid var(--line);
}

.cost-integrity-banner.info {
  background: rgba(37, 99, 235, 0.06);
  border-color: rgba(37, 99, 235, 0.18);
}

.cost-integrity-banner.danger {
  background: rgba(192, 63, 68, 0.08);
  border-color: rgba(192, 63, 68, 0.22);
}

.cost-integrity-banner strong {
  font-size: 0.98rem;
}

.cost-integrity-banner p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.6;
}

.banner-meta {
  display: grid;
  gap: 4px;
}

.banner-meta span {
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.banner-meta strong {
  font-size: 0.95rem;
  letter-spacing: 0;
}

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

.data-table th,
.data-table td {
  padding: 15px 16px;
  border-bottom: 1px solid rgba(30, 36, 35, 0.08);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f6f9fc;
  color: #627288;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line-strong);
}

.table-sort {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}

.table-sort span {
  font-size: 0.86rem;
  color: var(--accent-deep);
}

.table-sort.active {
  color: var(--ink);
}

.data-table tbody tr:nth-child(even) {
  background: rgba(248, 251, 255, 0.72);
}

.data-table tbody tr:hover {
  background: rgba(37, 99, 235, 0.04);
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.45);
  outline-offset: -2px;
}

.clickable-row:hover td,
.clickable-row:focus-visible td {
  background: rgba(37, 99, 235, 0.05);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-badge.live {
  background: rgba(15, 163, 104, 0.1);
  color: #0f6f48;
}

.status-badge.snapshot {
  background: rgba(217, 119, 6, 0.12);
  color: #b45309;
}

.status-badge.missing {
  background: rgba(192, 63, 68, 0.12);
  color: #a12a31;
}

.cost-stack {
  display: grid;
  gap: 4px;
}

.cost-stack strong {
  font-size: 0.92rem;
}

.cost-stack span {
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.45;
}

.cost-stack.snapshot strong {
  color: #b45309;
}

.cost-stack.missing strong {
  color: var(--danger);
}

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

.pagination-status {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: #f8fbff;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 700;
}

.table-actions {
  white-space: nowrap;
}

.table-actions .linkish + .linkish {
  margin-left: 8px;
}

.info-list,
.list-rows {
  display: grid;
  gap: 12px;
}

.info-list > div,
.list-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  padding: 12px 14px;
  border-radius: 5px;
  background: #ffffff;
  border: 1px solid var(--line);
}

.info-list span,
.list-row span {
  color: var(--ink-soft);
}

.role-pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 5px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
}

.role-pill.accent {
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.15);
  color: var(--accent-deep);
}

.role-pill.neutral {
  background: rgba(31, 53, 88, 0.06);
  border-color: rgba(31, 53, 88, 0.12);
  color: var(--green);
}

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

.info-card {
  border-radius: 5px;
  background: #ffffff;
  border: 1px solid var(--line);
}

.info-card strong {
  display: block;
  margin-top: 12px;
  font-size: 1.24rem;
}

.note-box {
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: 5px;
  background: #ffffff;
  border: 1px solid var(--line);
}

.note-box p {
  margin: 10px 0 0;
  line-height: 1.6;
}

.print-sheet {
  display: none;
}

.print-sheet-header,
.print-title-block,
.print-summary-grid,
.print-cost-band,
.print-notes-grid,
.print-table-wrap {
  display: grid;
}

.print-sheet-header {
  grid-template-columns: minmax(0, 1.3fr) auto;
  gap: 24px;
  align-items: start;
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.12);
}

.print-brand {
  display: flex;
  align-items: center;
  gap: 18px;
}

.print-brand img {
  width: 180px;
  height: auto;
}

.print-brand span,
.print-kicker,
.print-meta span,
.print-summary-grid span,
.print-cost-band span,
.print-notes-grid span {
  display: block;
  color: #64748b;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.print-brand strong,
.print-meta strong {
  display: block;
  margin-top: 6px;
  color: #0f172a;
  font-size: 1.1rem;
  font-weight: 800;
}

.print-meta {
  justify-items: end;
  text-align: right;
}

.print-meta small {
  margin-top: 8px;
  color: #64748b;
  font-size: 0.85rem;
}

.print-title-block {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
  padding: 28px 0 24px;
}

.print-title-block h1 {
  margin: 8px 0 10px;
  font-size: 2rem;
  line-height: 1.02;
  letter-spacing: -0.04em;
  color: #0f172a;
}

.print-title-block p {
  margin: 0;
  color: #334155;
  font-size: 1rem;
}

.print-status {
  align-self: start;
  padding: 12px 16px;
  border: 1px solid rgba(19, 52, 97, 0.15);
  border-radius: 5px;
  background: #eef5ff;
  color: #143461;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

.print-summary-grid article,
.print-notes-grid section {
  padding: 16px 18px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 5px;
  background: #ffffff;
}

.print-summary-grid strong,
.print-cost-band strong {
  display: block;
  margin-top: 10px;
  color: #0f172a;
  font-size: 1.06rem;
  font-weight: 800;
}

.print-cost-band {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.print-cost-band > div {
  padding: 18px;
  border-radius: 5px;
  background: linear-gradient(180deg, #123256, #0f2744);
  color: #f8fbff;
}

.print-cost-band > div span,
.print-cost-band > div strong {
  color: #f8fbff;
}

.print-notes-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.print-notes-grid p {
  margin: 10px 0 0;
  color: #334155;
  line-height: 1.65;
}

.print-table-wrap {
  margin-top: 20px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 5px;
  overflow: hidden;
}

.print-table {
  width: 100%;
  border-collapse: collapse;
}

.print-table th,
.print-table td {
  padding: 11px 10px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  text-align: left;
  vertical-align: top;
  font-size: 0.87rem;
}

.print-table th {
  background: #eef4fb;
  color: #475569;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.print-table tbody tr:nth-child(even) {
  background: #f8fbff;
}

.sticky-panel {
  position: sticky;
  top: 24px;
  align-self: start;
}

.editor-panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(249, 251, 255, 0.98));
  box-shadow: 0 18px 34px rgba(15, 23, 42, 0.08);
}

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

.component-line {
  padding: 14px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: #f8fbff;
}

.component-grid {
  grid-template-columns: minmax(0, 1.2fr) minmax(130px, 0.7fr) minmax(0, 1fr) auto;
  align-items: end;
}

.component-meta {
  min-height: 52px;
  display: grid;
  align-content: center;
  gap: 4px;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.component-meta strong {
  color: var(--ink);
  font-size: 0.95rem;
}

.component-remove {
  display: flex;
  align-items: end;
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.formula-table strong,
.info-list strong,
.list-row strong {
  font-weight: 800;
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  color: var(--ink);
}

.checkbox-row input {
  width: 18px;
  height: 18px;
}

.login-shell {
  min-height: 100vh;
  width: min(1320px, calc(100% - 96px));
  margin: 0 auto;
  padding: 42px 8px;
  display: grid;
  grid-template-columns: minmax(0, 1.14fr) minmax(390px, 0.86fr);
  gap: 28px;
  align-items: stretch;
}

.login-brand,
.login-panel {
  border-radius: 5px;
}

.login-brand {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(255, 190, 92, 0.2), transparent 34%),
    radial-gradient(circle at 78% 20%, rgba(37, 99, 235, 0.28), transparent 32%),
    linear-gradient(145deg, #0f1b31 0%, #14284a 42%, #173a6d 100%);
  color: #f8fbff;
  padding: 42px;
  display: grid;
  gap: 32px;
  align-content: space-between;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 28px 60px rgba(11, 23, 43, 0.24);
}

.login-brand::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(130deg, rgba(255, 255, 255, 0.12), transparent 28%),
    linear-gradient(180deg, transparent 0%, rgba(8, 16, 31, 0.28) 100%);
}

.login-brand::after {
  content: "";
  position: absolute;
  inset: 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 5px;
  opacity: 0.35;
  pointer-events: none;
}

.login-brand-copy,
.brand-stage {
  position: relative;
  z-index: 1;
}

.login-brand-copy {
  display: grid;
  gap: 20px;
  max-width: 620px;
}

.login-logo {
  width: 230px;
  max-width: 58%;
  height: auto;
  margin: 0;
  filter: drop-shadow(0 16px 24px rgba(0, 0, 0, 0.18));
}

.login-brand .eyebrow {
  width: max-content;
  padding: 8px 12px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
  color: #d9e6ff;
  letter-spacing: 0.18em;
}

.login-brand h1 {
  margin: 0;
  display: grid;
  gap: 10px;
  font-size: clamp(2.7rem, 4vw, 4.3rem);
  line-height: 0.95;
  letter-spacing: -0.06em;
  max-width: 700px;
}

.login-brand h1 span {
  font-size: clamp(1.08rem, 1.4vw, 1.38rem);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
  color: rgba(229, 239, 255, 0.78);
}

.login-brand h1 strong {
  display: block;
  max-width: 11ch;
  font-weight: 800;
}

.login-brand p {
  max-width: 600px;
  color: rgba(233, 240, 250, 0.82);
  font-size: 1.03rem;
  line-height: 1.7;
}

.brand-ribbon {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.brand-ribbon span {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 5px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.06));
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #f7fbff;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  backdrop-filter: blur(12px);
}

.brand-stage {
  min-height: 330px;
  display: grid;
  align-items: end;
}

.stage-frame {
  position: relative;
  width: min(100%, 640px);
  margin-left: auto;
  padding: 22px;
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: linear-gradient(180deg, rgba(10, 18, 33, 0.52), rgba(17, 35, 63, 0.78));
  box-shadow: 0 26px 48px rgba(5, 12, 24, 0.28);
}

.stage-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.3;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 28px 28px;
}

.stage-header,
.stage-grid,
.stage-kicker,
.stage-title {
  position: relative;
  z-index: 1;
}

.stage-header {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}

.stage-header span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.56);
}

.stage-kicker {
  color: rgba(225, 237, 255, 0.62);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.stage-title {
  margin-top: 10px;
  margin-bottom: 18px;
  color: #ffffff;
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.stage-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 14px;
  min-height: 210px;
}

.stage-block {
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.03));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.stage-block-large {
  min-height: 126px;
  background: linear-gradient(180deg, rgba(82, 156, 255, 0.22), rgba(255, 255, 255, 0.04));
}

.stage-block-tall {
  grid-row: span 2;
  min-height: 210px;
}

.stage-block-wide {
  min-height: 72px;
}

.stage-block-focus {
  min-height: 72px;
  background: linear-gradient(135deg, rgba(255, 184, 76, 0.25), rgba(37, 99, 235, 0.18));
}

.stage-orbit {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.24);
  opacity: 0.75;
}

.stage-orbit-a {
  width: 180px;
  height: 180px;
  top: 72px;
  right: -48px;
}

.stage-orbit-b {
  width: 98px;
  height: 98px;
  top: 22px;
  right: 100px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.14), transparent 70%);
}

.stage-line {
  position: absolute;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.32), transparent);
}

.stage-line-a {
  width: 160px;
  left: 22px;
  bottom: 84px;
}

.stage-line-b {
  width: 120px;
  top: 92px;
  right: 18px;
  transform: rotate(-28deg);
}

.login-panel {
  position: relative;
  overflow: hidden;
  padding: 34px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 249, 252, 0.96));
  display: grid;
  align-content: start;
  gap: 24px;
  border: 1px solid rgba(152, 164, 183, 0.22);
  box-shadow: 0 24px 54px rgba(15, 23, 42, 0.12);
}

.login-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, #f4b44a, #2563eb 46%, transparent);
}

.login-panel-head {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.login-panel-head h2 {
  margin: 8px 0 0;
  font-size: clamp(1.8rem, 2vw, 2.45rem);
  letter-spacing: -0.04em;
}

.login-panel-copy {
  margin: 10px 0 0;
  color: var(--ink-soft);
  line-height: 1.65;
  max-width: 28ch;
}

.login-panel .role-pill.neutral {
  background: #f7fbff;
  border-color: rgba(37, 99, 235, 0.12);
  color: var(--accent-deep);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.08);
}

.login-panel .form-grid {
  gap: 16px;
}

.login-panel .field span {
  color: #4c5c70;
}

.login-panel input {
  background: #f8fbff;
  border-color: rgba(120, 141, 168, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.login-panel input:focus {
  border-color: rgba(37, 99, 235, 0.5);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
  background: #ffffff;
}

.login-panel .actions {
  margin-top: 4px;
}

.login-panel .primary {
  display: inline-flex;
  align-items: center;
  width: 100%;
  min-height: 54px;
  justify-content: center;
  font-size: 1rem;
  box-shadow:
    0 18px 36px rgba(37, 99, 235, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.login-note {
  position: relative;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.65;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  max-width: min(420px, calc(100vw - 40px));
  padding: 14px 18px;
  border-radius: 5px;
  background: #162137;
  color: #f8fbff;
  box-shadow: 0 18px 32px rgba(15, 23, 42, 0.18);
}

.toast.danger {
  background: #8f342f;
}

@media (max-width: 1220px) {
  .stat-grid,
  .info-grid,
  .print-summary-grid,
  .print-cost-band {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1080px) {
  .content-grid,
  .content-grid.two-thirds,
  .formula-detail-grid,
  .login-shell {
    grid-template-columns: 1fr;
  }

  .sticky-panel {
    position: static;
  }

  .topbar {
    flex-direction: column;
  }

  .brand-lockup {
    flex-direction: column;
  }

  .topbar-side {
    justify-items: start;
  }

  .print-sheet-header,
  .print-title-block,
  .print-notes-grid {
    grid-template-columns: 1fr;
  }

  .print-meta {
    justify-items: start;
    text-align: left;
  }
}

@media (max-width: 820px) {
  .shell,
  .login-shell {
    width: min(100vw - 44px, 100%);
  }

  .shell {
    padding-top: 14px;
  }

  .grid.two,
  .grid.three,
  .component-grid,
  .stat-grid,
  .info-grid,
  .print-summary-grid,
  .print-cost-band,
  .print-notes-grid {
    grid-template-columns: 1fr;
  }

  .main-nav {
    flex-direction: column;
    align-items: stretch;
  }

  .nav-links {
    width: 100%;
  }

  .nav-btn {
    flex: 1 1 auto;
  }

  .section-heading {
    flex-direction: column;
    align-items: stretch;
  }

  .login-panel-head,
  .brand-ribbon {
    flex-direction: column;
    align-items: stretch;
  }

  .brand-stage {
    min-height: 250px;
  }

  .stage-frame {
    width: 100%;
    margin-left: 0;
  }

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

  .stage-block-tall {
    grid-row: auto;
    min-height: 140px;
  }

  .data-table {
    min-width: 660px;
  }
}

@media (max-width: 560px) {
  .shell,
  .login-shell {
    width: min(100vw - 28px, 100%);
    padding-inline: 4px;
  }

  .intro-panel,
  .main-nav,
  .page-grid > .panel,
  .stack > .panel,
  .content-grid > .panel,
  .content-grid > aside.panel,
  .stat-card,
  .info-card,
  .login-panel,
  .login-brand {
    padding: 18px;
  }

  .topbar h1,
  .login-brand h1 {
    font-size: 2rem;
  }

  .login-logo {
    width: 200px;
    max-width: 72%;
  }

  .brand-ribbon span {
    width: 100%;
    justify-content: center;
  }

  .brand-stage {
    min-height: 220px;
  }

  .stage-frame {
    padding: 18px;
  }

  .stage-title {
    font-size: 1.32rem;
  }

  .login-panel .primary {
    min-height: 50px;
  }

  .data-table {
    min-width: 560px;
  }

  .toast {
    right: 12px;
    left: 12px;
    bottom: 12px;
    max-width: none;
  }
}

@media print {
  :root {
    color-scheme: light;
  }

  body {
    background: #ffffff;
  }

  body * {
    visibility: hidden;
  }

  .print-sheet,
  .print-sheet * {
    visibility: visible;
  }

  .shell,
  .content,
  .page-grid {
    padding: 0;
    margin: 0;
    width: 100%;
    max-width: none;
    background: #ffffff;
  }

  .page-grid > :not(.print-sheet) {
    display: none !important;
  }

  .print-sheet {
    display: block;
    margin: 0;
    padding: 6mm 11mm 12mm;
    color: #0f172a;
    background: #ffffff;
  }

  .print-sheet-header {
    padding-bottom: 14px;
  }

  .print-title-block {
    padding: 16px 0 18px;
  }

  .print-sheet-header,
  .print-title-block,
  .print-summary-grid,
  .print-cost-band,
  .print-notes-grid,
  .print-table-wrap {
    break-inside: avoid;
  }

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

  .print-cost-band {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

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

  .print-table th {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  @page {
    size: A4 portrait;
    margin: 5mm 6mm 7mm;
  }
}
