:root {
  --navy: #052b55;
  --navy-2: #063b70;
  --gold: #efaa22;
  --paper: #f5f7fb;
  --line: #d9e1ec;
  --text: #17243a;
  --muted: #66758a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background: var(--paper);
}

.placeholder-page {
  min-height: 100vh;
  background:
    linear-gradient(120deg, rgba(5, 43, 85, 0.88), rgba(23, 36, 58, 0.72)),
    url("https://images.unsplash.com/photo-1497366754035-f200968a6e72?auto=format&fit=crop&w=1800&q=80") center / cover;
  color: #fff;
}

.placeholder-shell {
  width: min(1120px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  align-items: center;
}

.placeholder-hero {
  max-width: 680px;
  padding: 48px 0;
}

.placeholder-brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
  font-size: 18px;
  font-weight: 800;
}

.placeholder-mark {
  width: 56px;
  height: 56px;
  border: 2px solid var(--gold);
  display: grid;
  place-items: center;
  color: var(--gold);
}

.placeholder-hero h1 {
  margin: 0 0 18px;
  color: #fff;
  font-size: 48px;
  line-height: 1.08;
}

.placeholder-hero p {
  max-width: 540px;
  margin: 0;
  color: #e6edf7;
  font-size: 20px;
  line-height: 1.5;
}

.topbar {
  min-height: 72px;
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 32px;
  border-bottom: 4px solid var(--gold);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border: 2px solid var(--gold);
  display: grid;
  place-items: center;
  font-weight: 800;
  color: var(--gold);
}

.brand-name {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-sub {
  font-size: 13px;
  color: #cdd8e8;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 28px auto 56px;
}

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  margin-bottom: 18px;
}

h1, h2, h3 {
  margin: 0 0 16px;
  color: var(--navy);
  letter-spacing: 0;
}

h1 {
  font-size: 26px;
}

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-title-row h1 {
  margin-bottom: 0;
}

.doc-link {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--navy);
  font-size: 14px;
  font-weight: 800;
  padding: 10px 12px;
  text-decoration: none;
  white-space: nowrap;
}

.sheets-link {
  border-color: rgba(52, 168, 83, 0.34);
  color: #174c2f;
  background: linear-gradient(135deg, rgba(232, 245, 236, 0.96), rgba(219, 239, 228, 0.96) 44%, rgba(241, 248, 233, 0.96));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.65);
}

.sheets-link:hover {
  border-color: rgba(52, 168, 83, 0.5);
  background: linear-gradient(135deg, rgba(224, 242, 229, 1), rgba(210, 234, 220, 1) 44%, rgba(235, 246, 226, 1));
}

.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.source-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--gold);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 14px;
  background: #fbfdff;
}

.source-card strong,
.source-card small,
.source-label {
  display: block;
}

.source-label {
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.source-card strong {
  color: var(--navy);
  font-size: 16px;
}

.source-card small {
  margin-top: 4px;
  color: var(--muted);
}

.ghost-link {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--navy);
  font-size: 14px;
  font-weight: 800;
  padding: 10px 12px;
  text-decoration: none;
  white-space: nowrap;
}

h2 {
  font-size: 22px;
}

h3 {
  font-size: 17px;
}

.load-grid, .field-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 220px auto;
  gap: 14px;
  align-items: end;
}

.connected-grid {
  grid-template-columns: minmax(260px, 420px) auto;
  justify-content: start;
}

.field-grid {
  grid-template-columns: 1fr 1fr 190px;
  align-items: start;
}

label span {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
}

input, select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--text);
  background: #fff;
  font-size: 14px;
}

input.needs-attention {
  border-color: #e7a6a6;
  background: #fff3f3;
}

button {
  height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  font-weight: 800;
  cursor: pointer;
}

button:disabled,
select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.primary {
  background: var(--gold);
  color: #1d2430;
}

.secondary {
  background: var(--navy);
  color: #fff;
}

.ghost {
  background: #eef3f8;
  color: var(--navy);
}

.hero-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.hero-panel p {
  margin: -8px 0 0;
  color: var(--muted);
}

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

.progress-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(5, 20, 38, 0.48);
}

.progress-overlay.is-visible {
  display: flex;
}

.progress-panel {
  width: min(460px, 100%);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 22px 60px rgba(5, 20, 38, 0.28);
  padding: 24px;
}

.progress-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: var(--navy);
  font-size: 18px;
  font-weight: 800;
}

.progress-bar {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef6;
  margin-top: 18px;
}

.progress-bar div {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--gold);
  transition: width 260ms ease;
}

.progress-panel p {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.edit-surface {
  opacity: 0.92;
}

.edit-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.edit-surface:not(.is-editing) input {
  pointer-events: none;
  background: #f8fafc;
}

.edit-surface:not(.is-editing) input.needs-attention {
  background: #fff3f3;
}

.totals {
  display: grid;
  grid-template-columns: 190px 190px minmax(260px, 1fr);
  gap: 12px;
  margin: 18px 0;
  align-items: stretch;
}

.totals div {
  border: 1px solid var(--line);
  border-left: 5px solid var(--gold);
  border-radius: 6px;
  padding: 12px 16px;
  min-width: 190px;
}

.totals span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.totals strong {
  display: block;
  margin-top: 4px;
  font-size: 24px;
  color: var(--navy);
}

.spell-card {
  border: 1px solid #bfe2c7;
  border-left: 5px solid #31a354;
  border-radius: 6px;
  padding: 12px 16px;
  background: #f3fbf5;
}

.spell-card.has-issues {
  border-color: #e7a6a6;
  border-left-color: #d75858;
  background: #fff3f3;
}

.spell-card.is-ok {
  border-color: #bfe2c7;
  border-left-color: #31a354;
  background: #f3fbf5;
}

.spell-card span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.spell-card strong {
  display: block;
  color: var(--navy);
  font-size: 18px;
  margin-top: 4px;
}

.spell-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.spell-card ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--text);
  font-size: 12px;
}

.spell-card li + li {
  margin-top: 5px;
}

.spell-card em {
  display: block;
  color: var(--muted);
  font-style: normal;
  margin-top: 2px;
}

.table-block {
  margin-top: 22px;
}

.service-table {
  display: grid;
  grid-template-columns: minmax(240px, 1.4fr) 160px minmax(220px, 1fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.service-table > * {
  border: 0;
  border-radius: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.service-table > *:nth-child(3n) {
  border-right: 0;
}

.service-table .head {
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
}

.messages {
  margin-bottom: 16px;
}

.message {
  padding: 12px 14px;
  border-radius: 6px;
  margin-bottom: 8px;
}

.message.success {
  background: #eaf8ee;
  color: #1f7a3f;
}

.message.error {
  background: #fff0ef;
  color: #a42b25;
}

.empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--muted);
}

.empty h2 {
  color: var(--navy);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(5, 43, 85, 0.08), rgba(239, 170, 34, 0.12)),
    var(--bg);
}

.login-shell {
  width: min(420px, calc(100vw - 32px));
}

.login-panel {
  display: grid;
  gap: 16px;
  padding: 32px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(5, 43, 85, 0.12);
}

.login-panel .brand-mark {
  width: 56px;
  height: 56px;
  font-size: 18px;
}

.login-panel h1 {
  margin: 0;
  color: var(--navy);
}

.login-panel p {
  margin: -10px 0 4px;
  color: var(--muted);
}

@media (max-width: 860px) {
  .load-grid, .field-grid, .service-table {
    grid-template-columns: 1fr;
  }

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

  .source-card,
  .panel-title-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .service-table .head {
    display: none;
  }

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