/* Tax Planner, agoodun.com
   Brand tokens, type stack and component shapes follow BRAND.md and the
   other agoodun.com apps. The shell is wider than BRAND.md's 440px
   because the monthly grid needs the room; on a phone the grid scrolls
   sideways with the month column pinned. */

:root {
  --color-primary: #ce0f69;
  --color-secondary-teal: #009ca6;
  --color-secondary-purple: #68478d;
  --color-tertiary-gold: #ffb81c;
  --color-tertiary-black: #000000;

  /* Actual figures read teal, estimates gold (darkened to hold up as
     text), money owed pink: the one thing that needs doing. */
  --state-under: var(--color-secondary-teal);
  --state-at: #b07400; /* the gold, darkened to hold up as text */
  --state-over: var(--color-primary);

  --state-under-soft: rgba(0, 156, 166, 0.1);
  --state-at-soft: rgba(255, 184, 28, 0.18);
  --state-over-soft: rgba(206, 15, 105, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Several classes below set `display`, which has equal specificity to
   the UA [hidden] rule and would silently win by source order, leaving
   "hidden" elements visible. Force it explicitly. */
[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 24px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f4f5f7;
  color: var(--color-tertiary-black);
}

a {
  color: inherit;
}

/* ---------------------------------------------------------------------
   App shell / nav
   --------------------------------------------------------------------- */

.app-shell {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.app-shell.wide {
  max-width: 900px;
}

/* The matrix earns the extra width: every person is a column, and a
   column that has to be scrolled to is a column nobody looks at. */
.app-shell.widest {
  max-width: 1180px;
}

.nav-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: #ffffff;
  border-radius: 16px;
  padding: 14px 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
}

.nav-context {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.nav-app-name {
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.nav-link {
  font-size: 0.88rem;
  font-weight: 600;
  color: #6b7280;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
  background: #f4f5f7;
  color: var(--color-tertiary-black);
}

.nav-link.active {
  color: var(--color-primary);
  background: rgba(206, 15, 105, 0.08);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-email {
  font-size: 0.8rem;
  color: #6b7280;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-logout {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: #6b7280;
  background: none;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.nav-logout:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
}

/* ---------------------------------------------------------------------
   Cards
   --------------------------------------------------------------------- */

.card {
  width: 100%;
  background: #ffffff;
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
}

.card.accent {
  border-top: 6px solid transparent;
  border-image: linear-gradient(
    90deg,
    var(--color-primary),
    var(--color-secondary-teal),
    var(--color-secondary-purple),
    var(--color-tertiary-gold)
  );
  border-image-slice: 1;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.page-title {
  margin-bottom: 4px;
}

h1 {
  font-size: 1.5rem;
  margin-bottom: 4px;
}

h2 {
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.subtitle {
  font-size: 0.9rem;
  color: #6b7280;
  line-height: 1.4;
}

.status {
  font-size: 0.9rem;
  color: #6b7280;
  text-align: center;
  padding: 40px 0;
}

.status.error {
  color: var(--color-primary);
}

.section-heading {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-primary);
  margin-bottom: 10px;
}

/* ---------------------------------------------------------------------
   Headline stats
   --------------------------------------------------------------------- */

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

.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  border-radius: 10px;
  background: #f9fafb;
  min-width: 0;
}

.stat-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-primary);
}

.stat-value {
  font-size: 1.3rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.stat-value.positive {
  color: var(--color-secondary-teal);
}

.stat-value.negative {
  color: var(--color-primary);
}

.stat-value.warning {
  color: var(--state-at);
}

.stat-note {
  font-size: 0.78rem;
  color: #6b7280;
  line-height: 1.35;
}



.pill {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.pill-actual {
  color: var(--state-under);
  background: var(--state-under-soft);
}

.pill-estimate {
  color: var(--state-at);
  background: var(--state-at-soft);
}

.pill-muted {
  color: #6b7280;
  background: #f4f5f7;
}

.mode-switch {
  display: inline-flex;
  background: #f4f5f7;
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}

.mode-option {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: #6b7280;
  background: none;
  border: none;
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.mode-option:hover {
  color: var(--color-tertiary-black);
}

.mode-option.active {
  background: #ffffff;
  color: var(--color-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}


/* ---------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------- */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 22px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  color: #ffffff;
  background: var(--color-primary);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: box-shadow 0.15s ease;
  text-decoration: none;
}

.btn-primary:hover {
  box-shadow: 0 0 0 3px rgba(206, 15, 105, 0.12);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: default;
  box-shadow: none;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 20px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--color-tertiary-black);
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s ease;
  text-decoration: none;
}

.btn-secondary:hover {
  border-color: var(--color-primary);
}

.btn-secondary.small {
  padding: 7px 12px;
  font-size: 0.82rem;
}

.btn-text {
  display: inline-block;
  padding: 6px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: #6b7280;
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.15s ease;
  text-decoration: none;
}

.btn-text:hover {
  color: var(--color-tertiary-black);
}

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

/* Square, quiet, and the same size as a tap target ought to be. Used for
   the role reorder arrows, where a word would be longer than the control
   it labels. */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  font-size: 0.95rem;
  font-family: inherit;
  color: #6b7280;
  background: #f9fafb;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.btn-icon:hover:not(:disabled) {
  background: rgba(206, 15, 105, 0.1);
  color: var(--color-primary);
}

.btn-icon:disabled {
  opacity: 0.35;
  cursor: default;
}

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

.btn-row.centred {
  justify-content: center;
  margin-top: 16px;
}

.modal-actions {
  margin-top: 20px;
  align-items: center;
}

.btn-primary.danger {
  background: var(--color-primary);
}

.header-actions {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

/* ---------------------------------------------------------------------
   Forms
   --------------------------------------------------------------------- */

.input-group {
  margin-bottom: 20px;
}

.input-group:last-child {
  margin-bottom: 0;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: #374151;
}

.field-hint {
  font-size: 0.78rem;
  color: #6b7280;
  margin-top: 6px;
  line-height: 1.4;
}

.text-input,
.text-select {
  display: block;
  width: 100%;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--color-tertiary-black);
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.text-input:focus,
.text-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(206, 15, 105, 0.12);
}

.text-select {
  cursor: pointer;
}

.form-error {
  margin-top: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-primary);
}

.panel-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ---------------------------------------------------------------------
   Auth gate
   --------------------------------------------------------------------- */

.auth-landing {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  margin: 40px auto;
}

.hero-copy {
  width: 100%;
  max-width: 480px;
  text-align: center;
}

.hero-copy h1 {
  font-size: 1.8rem;
  margin-bottom: 10px;
}

.hero-tagline {
  font-size: 1rem;
  color: #6b7280;
  line-height: 1.5;
  margin-bottom: 22px;
}

.hero-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.hero-features li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.9rem;
  color: #374151;
  line-height: 1.4;
}

.hero-features li::before {
  content: "✓";
  flex-shrink: 0;
  color: var(--color-secondary-teal);
  font-weight: 700;
}

.auth-shell {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

/* Shown when the "are you already signed in?" check didn't come back in
   time. It explains a delay rather than reporting a failure, because
   nothing has actually failed yet, the answer may still arrive. */
.auth-notice {
  margin-bottom: 20px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--state-at-soft);
}

.auth-notice p {
  font-size: 0.85rem;
  line-height: 1.45;
  color: #374151;
}

.auth-notice .btn-text {
  padding: 6px 0 0;
  color: var(--state-at);
}

/* ---------------------------------------------------------------------
   Empty states
   --------------------------------------------------------------------- */

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: #6b7280;
}

.empty-state p {
  font-size: 0.9rem;
  margin-top: 6px;
}

/* ---------------------------------------------------------------------
   Modal
   --------------------------------------------------------------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 50;
}

.modal-card {
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  background: #ffffff;
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}

.modal-card h2 {
  margin-bottom: 6px;
}

.modal-card .subtitle {
  margin-bottom: 20px;
}

/* ---------------------------------------------------------------------
   Explainer
   --------------------------------------------------------------------- */

.explainer {
  width: 100%;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.explainer summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 24px;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--color-tertiary-black);
}

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

.explainer summary:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
}

.explainer summary::after {
  content: "";
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-right: 2px solid #6b7280;
  border-bottom: 2px solid #6b7280;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

.explainer[open] summary::after {
  transform: rotate(-135deg);
}

.explainer[open] summary {
  border-bottom: 1px solid #f0f1f3;
}

.explainer-content {
  padding: 4px 24px 24px;
}

.explainer-content h2 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-primary);
  margin-top: 18px;
  margin-bottom: 6px;
}

.explainer-content h2:first-child {
  margin-top: 0;
}

.explainer-content p {
  font-size: 0.9rem;
  line-height: 1.55;
  color: #374151;
}

/* ---------------------------------------------------------------------
   Powered by
   --------------------------------------------------------------------- */

.powered-by a {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #6b7280;
  font-size: 0.85rem;
  transition: color 0.15s ease;
}

.powered-by a:hover {
  color: var(--color-tertiary-black);
}

.powered-by-logo {
  width: 20px;
  height: 20px;
  border-radius: 5px;
}

.powered-by strong {
  color: var(--color-primary);
  font-weight: 700;
}

/* ---------------------------------------------------------------------
   Narrow screens
   --------------------------------------------------------------------- */

/* ---------------------------------------------------------------------
   Tax Planner: shared pieces
   --------------------------------------------------------------------- */

/* The grid page needs the most room: the grid and its live totals sit
   side by side. */
.app-shell.widest {
  max-width: 1240px;
}

.disclaimer {
  width: 100%;
  font-size: 0.82rem;
  line-height: 1.45;
  color: #374151;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--state-at-soft);
}

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

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

.toolbar-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #6b7280;
}

.save-status {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-secondary-teal);
}

.save-status.error {
  color: var(--color-primary);
}

.muted {
  color: #6b7280;
}

.num {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.two-up {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
}

.two-up > .card {
  min-width: 0;
}

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

.field-grid .input-group {
  margin-bottom: 0;
}

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

.money-input {
  position: relative;
}

.money-input::before {
  content: "£";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #6b7280;
  font-size: 0.95rem;
  pointer-events: none;
}

.money-input .text-input {
  padding-left: 26px;
  font-variant-numeric: tabular-nums;
}

.suffix-input {
  position: relative;
}

.suffix-input::after {
  content: attr(data-suffix);
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #6b7280;
  font-size: 0.9rem;
  pointer-events: none;
}

.suffix-input .text-input {
  padding-right: 30px;
  font-variant-numeric: tabular-nums;
}

.text-input.invalid {
  border-color: var(--color-primary);
  background: var(--state-over-soft);
}

.subsection + .subsection {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #f0f1f3;
}

.check-line {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f9fafb;
  font-size: 0.85rem;
  line-height: 1.5;
  color: #374151;
}

.check-line strong {
  font-variant-numeric: tabular-nums;
}

.warn-box {
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--state-over-soft);
  font-size: 0.85rem;
  line-height: 1.5;
  color: #374151;
  margin-bottom: 18px;
}

.warn-box strong {
  color: var(--color-primary);
}

.source-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  word-break: break-all;
}

.source-list a {
  color: var(--color-secondary-teal);
}

textarea.text-input {
  resize: vertical;
  min-height: 70px;
  line-height: 1.45;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #374151;
  margin: 0;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
}

/* ---------------------------------------------------------------------
   Results
   --------------------------------------------------------------------- */

.result-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.result-head h2 {
  margin: 0;
}

.figure-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.figure-table th,
.figure-table td {
  padding: 8px 0;
  border-bottom: 1px solid #f0f1f3;
  vertical-align: top;
}

.figure-table th {
  font-weight: 600;
  text-align: left;
  color: #374151;
}

.figure-table thead th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  padding-top: 0;
}

.figure-table td + td,
.figure-table th + th {
  padding-left: 12px;
}

.figure-table .num {
  text-align: right;
}

.figure-table .sub th {
  font-weight: 400;
  padding-left: 12px;
  color: #6b7280;
}

.figure-table .total th,
.figure-table .total td {
  font-weight: 700;
  border-bottom: none;
  border-top: 2px solid #e5e7eb;
}

.figure-table .owed td {
  color: var(--color-primary);
}

.figure-table + .section-heading,
.figure-table + .check-line + .section-heading {
  margin-top: 22px;
}

.source-tag {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
}

.source-tag.estimated {
  color: var(--state-at);
}

.source-tag.confirmed,
.source-tag.entered {
  color: var(--state-under);
}

.empty-note {
  font-size: 0.88rem;
  color: #6b7280;
  line-height: 1.5;
  padding: 12px 0;
}

/* ---------------------------------------------------------------------
   Monthly grid
   --------------------------------------------------------------------- */

.grid-layout {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  align-items: start;
}

.grid-card {
  padding: 20px;
}

.grid-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -4px;
  padding: 0 4px;
}

.month-grid {
  width: 100%;
  min-width: 660px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.85rem;
}

.month-grid th,
.month-grid td {
  padding: 4px 4px;
  border-bottom: 1px solid #f0f1f3;
  background: #ffffff;
}

.month-grid thead th {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  text-align: right;
  padding-bottom: 8px;
  vertical-align: bottom;
  line-height: 1.3;
}

.month-grid thead th:first-child,
.month-grid thead th.left {
  text-align: left;
}

/* The month stays put while the figures scroll under it on a phone. */
.month-grid .month-cell {
  position: sticky;
  left: 0;
  z-index: 1;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
  padding-right: 10px;
}

.month-grid .month-cell span {
  display: block;
  font-size: 0.7rem;
  font-weight: 400;
  color: #6b7280;
}

/* The label is pinned like the month column, so it stays readable when
   the row scrolls sideways. */
.month-grid .year-row th span {
  position: sticky;
  left: 8px;
}

.month-grid .year-row th {
  background: #f9fafb;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-primary);
  text-align: left;
  padding: 10px 8px;
}

.month-grid .total-row td,
.month-grid .total-row th {
  font-weight: 700;
  background: #f9fafb;
  border-bottom: 2px solid #e5e7eb;
  padding: 10px 8px;
}

.month-grid .total-row th {
  position: sticky;
  left: 0;
  z-index: 1;
  text-align: left;
}

.cell-input {
  width: 100%;
  min-width: 84px;
  padding: 8px 8px;
  font-family: inherit;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--color-tertiary-black);
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cell-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(206, 15, 105, 0.12);
}

.cell-input.invalid {
  border-color: var(--color-primary);
  background: var(--state-over-soft);
}

.row-estimate .cell-input:not(:placeholder-shown) {
  background: #fffbf0;
  border-style: dashed;
}

.status-toggle {
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  min-width: 72px;
}

.status-toggle.actual {
  color: var(--state-under);
  background: var(--state-under-soft);
}

.status-toggle.estimate {
  color: var(--state-at);
  background: var(--state-at-soft);
}

.row-saving .month-cell {
  color: #6b7280;
}

.row-error .month-cell {
  color: var(--color-primary);
}

/* Live totals beside the grid. */
.live-panel {
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.live-panel .card {
  padding: 20px;
}

.live-year + .live-year {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #f0f1f3;
}

.live-year .figure-table {
  font-size: 0.82rem;
}

.live-year .figure-table th,
.live-year .figure-table td {
  padding: 5px 0;
}

/* ---------------------------------------------------------------------
   Narrow screens
   --------------------------------------------------------------------- */

@media (max-width: 1100px) {
  .grid-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .live-panel {
    position: static;
  }
}

@media (max-width: 720px) {
  body {
    padding: 16px;
  }

  .card {
    padding: 22px;
  }

  .grid-card {
    padding: 14px;
  }

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

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

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

  .nav-email {
    display: none;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------------------------------------------------------------------
   Payments
   --------------------------------------------------------------------- */

.date-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.pay-table {
  min-width: 440px;
}

.pay-table td,
.pay-table thead th + th {
  width: 22%;
}

.source-line {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  margin-top: 2px;
}

.source-line.estimated {
  color: var(--state-at);
}

.source-line.confirmed,
.source-line.entered {
  color: var(--state-under);
}

.figure-table .saving-row th,
.figure-table .saving-row td {
  border-bottom: none;
  font-weight: 700;
  color: var(--color-secondary-teal);
}

.figure-table .saving-row .source-line {
  color: #6b7280;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.75rem;
}

#past .figure-table {
  margin-bottom: 8px;
}

/* ---------------------------------------------------------------------
   Before versus after
   --------------------------------------------------------------------- */

.compare-note {
  margin-bottom: 14px;
}

.compare-note .btn-text {
  display: block;
  padding: 6px 0 0;
  color: var(--color-primary);
}

.delta {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  margin-top: 1px;
}

.delta.up {
  color: var(--color-primary);
}

.delta.down {
  color: var(--color-secondary-teal);
}

.delta.neutral {
  color: #6b7280;
}

.compare-table + .live-year,
.empty-note + .live-year {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #f0f1f3;
}

.last-change {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f9fafb;
  border-left: 4px solid var(--color-secondary-purple);
  font-size: 0.82rem;
  line-height: 1.45;
  color: #374151;
}

.last-change ul {
  list-style: none;
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.last-change .delta {
  display: inline;
  margin-left: 6px;
}

.left-out {
  background: #f9fafb;
  border-left: 4px solid var(--color-tertiary-gold);
}

.left-out a {
  color: var(--color-secondary-teal);
}

.field-hint .delta {
  display: inline;
  margin-left: 4px;
}

/* ---------------------------------------------------------------------
   Documents
   --------------------------------------------------------------------- */

.doc-list {
  display: flex;
  flex-direction: column;
  margin-top: 14px;
}

.doc-item {
  padding: 14px 0;
  border-top: 1px solid #f0f1f3;
}

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

.doc-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.9rem;
  min-width: 0;
}

.doc-title .pill {
  padding: 3px 10px;
  font-size: 0.72rem;
}

.pill-over {
  color: var(--state-over);
  background: var(--state-over-soft);
}

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

.btn-primary.small {
  padding: 7px 12px;
  font-size: 0.82rem;
}

.doc-why {
  margin-top: 6px;
  font-size: 0.8rem;
  color: #6b7280;
  line-height: 1.45;
}

.doc-history {
  list-style: none;
  margin-top: 6px;
  font-size: 0.8rem;
  color: #374151;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.doc-history .btn-text {
  font-size: 0.75rem;
  padding: 0 0 0 6px;
}

.doc-guide {
  margin-top: 8px;
  font-size: 0.82rem;
}

.doc-guide summary {
  cursor: pointer;
  color: var(--color-secondary-teal);
  font-weight: 600;
  font-size: 0.78rem;
}

.doc-guide dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 14px;
  margin-top: 8px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f9fafb;
  line-height: 1.45;
}

.doc-guide dt {
  font-weight: 600;
  color: #374151;
}

.doc-guide dd {
  color: #374151;
}

.guide-note {
  width: 100%;
}

.modal-card.wide-modal {
  max-width: 640px;
}

.mismatch {
  margin: 12px 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--state-over-soft);
  font-size: 0.92rem;
  line-height: 1.5;
  font-weight: 600;
  color: #374151;
}

.claude-notes {
  margin: 0 0 14px 18px;
  font-size: 0.82rem;
  line-height: 1.5;
  color: #374151;
}

.proposal-table td:first-child {
  width: 28px;
}

.proposal-table input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
}

.proposal-table .cell-input {
  min-width: 110px;
  padding-left: 24px;
}

@media (max-width: 720px) {
  .doc-guide dl {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .doc-guide dd {
    margin-bottom: 6px;
  }
}

/* ---------------------------------------------------------------------
   Adding files
   --------------------------------------------------------------------- */

.add-files {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.btn-primary.big {
  padding: 15px 30px;
  font-size: 1rem;
}

#dropZone.dragging-over {
  outline: 3px dashed var(--color-primary);
  outline-offset: -10px;
}

.file-list {
  list-style: none;
  margin-top: 12px;
  display: flex;
  flex-direction: column;
}

.file-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid #f0f1f3;
  font-size: 0.88rem;
}

.file-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-state .btn-text {
  color: var(--color-primary);
  padding: 0 0 0 8px;
}

.file-state .ok {
  color: var(--color-secondary-teal);
  font-weight: 700;
}

.file-state .bad {
  color: var(--color-primary);
}

.needed-person + .needed-person {
  margin-top: 16px;
}

.needed-items {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.needed-items li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 0;
  border-top: 1px solid #f0f1f3;
  font-size: 0.9rem;
}

.needed-items li:first-child {
  border-top: none;
}

#neededCard h2,
#filesCard h2 {
  margin-bottom: 10px;
}

.checklist-head .result-head {
  margin-bottom: 6px;
}

.file-tag {
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.choice-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.choice-list .btn-secondary {
  justify-content: flex-start;
  padding: 14px 18px;
  font-size: 0.95rem;
}

@media (max-width: 720px) {
  .file-list li {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }
}

/* ---------------------------------------------------------------------
   Figures the calculation needs
   --------------------------------------------------------------------- */

.needs-summary {
  margin-top: 10px;
  font-size: 0.92rem;
  font-weight: 600;
  color: #374151;
}

.need-year {
  margin-top: 18px;
}

.need {
  padding: 12px 0;
  border-top: 1px solid #f0f1f3;
}

.need-head {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: baseline;
  font-size: 0.92rem;
}

.need-tick {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #d1d5db;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  align-self: center;
}

.state-done .need-tick,
.state-none .need-tick {
  border-color: var(--color-secondary-teal);
  background: var(--color-secondary-teal);
  color: #ffffff;
}

.state-partial .need-tick {
  border-color: var(--color-tertiary-gold);
  background: linear-gradient(90deg, var(--color-tertiary-gold) 50%, transparent 50%);
}

.state-missing .need-tick {
  border-color: var(--color-primary);
}

.state-optional .need-tick,
.state-ongoing .need-tick {
  border-style: dashed;
}

.need-label {
  font-weight: 600;
}

.need-value {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.state-missing .need-value {
  color: var(--color-primary);
  font-weight: 700;
}

.state-partial .need-value {
  color: var(--state-at);
  font-weight: 700;
}

.state-optional .need-value,
.state-ongoing .need-value {
  color: #6b7280;
}

.need-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 4px 0 0 30px;
  font-size: 0.8rem;
  color: #6b7280;
}

.need-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.need-actions .btn-text {
  color: var(--color-secondary-teal);
  padding: 4px;
}

.need .doc-guide {
  margin-left: 30px;
}

.place-list {
  list-style: none;
  margin-top: 8px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f9fafb;
  display: flex;
  flex-direction: column;
  gap: 10px;
  line-height: 1.45;
}

.place-list .who {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-secondary-teal);
  margin-left: 4px;
}

.place-where,
.place-why {
  display: block;
  color: #374151;
}

.place-why {
  color: #6b7280;
  font-style: italic;
}

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

.spend-list {
  list-style: none;
  margin-top: 8px;
  padding: 8px 14px;
  border-radius: 10px;
  background: #f9fafb;
}

.spend-list li {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 0.85rem;
}

@media (max-width: 720px) {
  .spend-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .spend-grid .stat {
    padding: 12px;
  }

  .spend-grid .stat-value {
    font-size: 1.05rem;
  }
}
