/* Turnover Target Tracker — agoodun.com
   Brand tokens, type stack and component shapes follow BRAND.md and the
   other agoodun.com apps, so this sits alongside them without redoing
   the look per app. */

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

* {
  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;
}

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

.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);
}

/* Inside a project the bar carries the project's identity on the left and
   its pages on the right, so you always know which project you're in. */

.nav-bar-project {
  justify-content: flex-start;
  gap: 20px;
}

.nav-bar-project .nav-links {
  flex: 1;
}

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

.nav-back {
  font-size: 0.82rem;
  font-weight: 600;
  color: #6b7280;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s ease;
}

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

.nav-divider {
  width: 1px;
  height: 20px;
  background: #e5e7eb;
  flex-shrink: 0;
}

.nav-project-name {
  font-size: 1rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-app-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-tertiary-black);
  white-space: nowrap;
}

.nav-project-select {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-tertiary-black);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 4px 6px;
  max-width: 200px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.nav-project-select:hover {
  background: #f4f5f7;
}

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

/* ---------------------------------------------------------------------
   Project cards (the home page)
   --------------------------------------------------------------------- */

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  width: 100%;
}

/* The whole tile is the link, so it needs to look and behave like one. */
.project-card {
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.project-card:hover {
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.project-card:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

.project-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.project-card-head h2 {
  font-size: 1.25rem;
  margin-bottom: 2px;
}

.project-card-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.project-figures {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 12px;
}

.project-amount {
  font-size: 1.6rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.project-amount-note {
  font-size: 0.85rem;
  color: #6b7280;
}

.project-card-links {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.project-card-links .btn-secondary {
  flex: 1;
  padding: 9px 14px;
  font-size: 0.85rem;
}

/* ---------------------------------------------------------------------
   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);
}

/* ---------------------------------------------------------------------
   Financial year navigator
   --------------------------------------------------------------------- */

.year-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 18px 0 24px;
}

.year-label {
  font-size: 1.05rem;
  font-weight: 700;
  min-width: 118px;
  text-align: center;
}

/* ---------------------------------------------------------------------
   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-note {
  font-size: 0.78rem;
  color: #6b7280;
  line-height: 1.35;
}

/* The target is edited in place rather than behind a toggle, matching
   how the month figures behave — one editing idiom across the app. */
.stat-input-wrap {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.stat-currency {
  font-size: 1.3rem;
  font-weight: 700;
  color: #6b7280;
}

.stat-input {
  width: 100%;
  min-width: 0;
  font-family: inherit;
  font-size: 1.3rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--color-tertiary-black);
  background: transparent;
  border: none;
  border-bottom: 1px dashed #d1d5db;
  padding: 0 0 2px;
  transition: border-color 0.15s ease;
}

.stat-input::placeholder {
  font-size: 1rem;
  font-weight: 600;
  color: #9ca3af;
}

.stat-input:focus {
  outline: none;
  border-bottom-color: var(--color-primary);
}

/* ---------------------------------------------------------------------
   Progress toward target
   --------------------------------------------------------------------- */

.progress-wrap {
  margin-top: 22px;
}

.progress-track {
  width: 100%;
  height: 10px;
  border-radius: 6px;
  overflow: hidden;
  background: #e5e7eb;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary-purple));
  transition: width 0.25s ease;
}

.progress-fill.complete {
  background: linear-gradient(90deg, var(--color-secondary-teal), var(--color-tertiary-gold));
}

.progress-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  font-size: 0.8rem;
  color: #6b7280;
}

.progress-legend .positive {
  color: var(--color-secondary-teal);
  font-weight: 600;
}

.progress-legend .negative {
  color: var(--color-primary);
  font-weight: 600;
}

/* ---------------------------------------------------------------------
   Focused month comparison
   --------------------------------------------------------------------- */

.month-nav {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 18px 0 20px;
}

.month-label {
  font-size: 1.05rem;
  font-weight: 700;
  min-width: 160px;
  text-align: center;
}

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

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

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

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

.compare-value.muted {
  color: #6b7280;
}

/* A month with no figure yet reads as an absence, not a zero. */
.compare-value.pending {
  font-size: 1rem;
  font-weight: 600;
  color: #9ca3af;
}

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

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

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

/* ---------------------------------------------------------------------
   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-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);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  font-size: 0.95rem;
  color: #6b7280;
  background: #f9fafb;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

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

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

.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;
}

.project-select {
  width: auto;
  min-width: 160px;
  max-width: 240px;
  padding: 10px 12px;
  font-weight: 600;
}

.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;
}

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

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

/* ---------------------------------------------------------------------
   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;
}

/* ---------------------------------------------------------------------
   Tables
   --------------------------------------------------------------------- */

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

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

.data-table th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #6b7280;
  padding: 0 14px 10px;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #f0f1f3;
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tfoot td {
  padding: 14px;
  border-top: 2px solid #e5e7eb;
  border-bottom: none;
}

.col-amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.col-change {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-weight: 600;
  color: #6b7280;
}

.col-change .positive {
  color: var(--color-secondary-teal);
}

.col-change .negative {
  color: var(--color-primary);
}

.cell-strong {
  font-weight: 600;
}

.cell-muted {
  color: #6b7280;
}

.cell-note {
  display: block;
  margin-top: 2px;
  font-size: 0.78rem;
  font-style: italic;
  color: #6b7280;
}

.cell-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  white-space: nowrap;
}

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

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

/* ---------------------------------------------------------------------
   Turnover table — every month is editable in place
   --------------------------------------------------------------------- */

.turnover-table .month-name-btn {
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-tertiary-black);
  background: none;
  border: none;
  padding: 4px 0;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.turnover-table .month-name-btn:hover {
  color: var(--color-primary);
}

.turnover-table .month-row.focused {
  background: rgba(206, 15, 105, 0.05);
}

/* The month in progress can't have a final figure yet — flagged rather
   than hidden, so it's obvious why its box is empty. */
.turnover-table .month-row.current .month-name-btn::after {
  content: " · in progress";
  font-weight: 400;
  font-style: italic;
  color: #9ca3af;
}

.turnover-table .month-row.future .month-name-btn {
  color: #9ca3af;
}

.amount-field {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #f9fafb;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.amount-field:focus-within {
  border-color: var(--color-primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(206, 15, 105, 0.12);
}

.amount-currency {
  font-size: 0.85rem;
  color: #6b7280;
}

.amount-input {
  width: 100px;
  font-family: inherit;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--color-tertiary-black);
  background: transparent;
  border: none;
  outline: none;
  padding: 0;
}

/* ---------------------------------------------------------------------
   Section headings inside a card
   --------------------------------------------------------------------- */

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

.section-header h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.divider {
  height: 1px;
  background: #f0f1f3;
  margin: 24px 0;
}

.label-optional {
  font-weight: 400;
  font-style: italic;
  color: #9ca3af;
}

/* A month with no line items reads as an absence, not a zero. */
.cell-empty {
  color: #d1d5db;
}

/* ---------------------------------------------------------------------
   Pillars and buckets
   --------------------------------------------------------------------- */

.pillar-card + .pillar-card {
  margin-top: 20px;
}

.bucket-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.bucket-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px 7px 14px;
  border-radius: 999px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  font-size: 0.85rem;
}

.bucket-name {
  font-weight: 600;
}

.chip-btn {
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b7280;
  background: none;
  border: none;
  padding: 2px 4px;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.chip-btn:hover {
  background: #ffffff;
  color: var(--color-tertiary-black);
}

.chip-btn.danger {
  font-size: 1rem;
  line-height: 1;
}

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

.bucket-add {
  display: flex;
  gap: 10px;
  align-items: center;
}

.bucket-add .text-input {
  flex: 1;
  min-width: 0;
}

/* ---------------------------------------------------------------------
   Line items
   --------------------------------------------------------------------- */

.line-item-table td {
  vertical-align: middle;
}

/* Bucket tags on a line item. Neutral rather than colour-coded: an item
   can carry one per pillar, and colouring them would imply a grouping
   that doesn't hold across pillars. */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  margin: 2px 2px 2px 0;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--color-secondary-purple);
  background: rgba(104, 71, 141, 0.1);
}

/* ---------------------------------------------------------------------
   Breakdown
   --------------------------------------------------------------------- */

/* The brand's result-row pattern, as used across the agoodun apps: a
   coloured dot, a label with a secondary line, and a right-aligned
   amount. The dot's colour is set inline per bucket. */

.results {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 10px;
  background: #f9fafb;
}

.result-label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.result-label > div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.result-title {
  font-size: 0.95rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-percent {
  font-size: 0.8rem;
  color: #6b7280;
}

.result-amount {
  font-size: 1.15rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bar {
  display: flex;
  width: 100%;
  height: 10px;
  border-radius: 6px;
  overflow: hidden;
  background: #e5e7eb;
}

.bar-segment {
  height: 100%;
}

#breakdownBar {
  height: 10px;
}

#breakdownBar .bar-segment:first-child {
  border-top-left-radius: 6px;
  border-bottom-left-radius: 6px;
}

#breakdownBar .bar-segment:last-child {
  border-top-right-radius: 6px;
  border-bottom-right-radius: 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);
}

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

/* ---------------------------------------------------------------------
   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;
}

/* ---------------------------------------------------------------------
   Footer credit
   --------------------------------------------------------------------- */

.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;
}

/* ---------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------- */

@media (max-width: 760px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

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

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

  .nav-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .nav-user {
    justify-content: space-between;
  }

  .nav-bar-project {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .nav-context {
    justify-content: flex-start;
  }

  .nav-app-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-tertiary-black);
  white-space: nowrap;
}

.nav-project-select {
    max-width: none;
    flex: 1;
  }

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

  .nav-email {
    max-width: none;
  }

  .card {
    padding: 20px;
  }

  .card-header {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .card-header .header-actions {
    width: 100%;
  }

  .header-actions .btn-primary,
  .header-actions .project-select {
    width: 100%;
    max-width: none;
  }

  .data-table td,
  .data-table th,
  .data-table tfoot td {
    padding-left: 8px;
    padding-right: 8px;
  }

  .amount-input {
    width: 84px;
  }

  .section-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .section-header .btn-primary {
    width: 100%;
  }

  .bucket-add {
    flex-direction: column;
    align-items: stretch;
  }

  .month-label {
    min-width: 0;
    flex: 1;
  }
}

@media (max-width: 420px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }
}
