/* ─── Variables ─────────────────────────────────────────────── */
:root {
  --red:     #C41E1E;
  --navy:    #04375A;
  --white:   #FFFFFF;
  --bg:      #F4F6FA;
  --card:    #FFFFFF;
  --border:  #E2E8F0;
  --text:    #1A2332;
  --muted:   #64748B;
  --success: #16A34A;
  --warning: #D97706;
  --danger:  #DC2626;
  --nav-h:   62px;
  --radius:  12px;
  --shadow:  0 1px 3px rgba(0,0,0,0.07), 0 4px 14px rgba(0,0,0,0.07);
}

/* ─── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; }
button { cursor: pointer; font-family: inherit; }

/* ─── Navigation ─────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--navy);
  height: var(--nav-h);
  box-shadow: 0 2px 10px rgba(0,0,0,0.22);
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.nav-brand {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.65rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
  flex-shrink: 0;
}
.brand-primary { color: var(--white); }
.brand-accent   { color: var(--red); }

.nav-links {
  display: flex;
  list-style: none;
  gap: 0.2rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.nav-links::-webkit-scrollbar { display: none; }
.nav-link {
  font-weight: 500;
  font-size: 0.875rem;
  color: rgba(255,255,255,0.72);
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.nav-link:hover  { color: var(--white); background: rgba(255,255,255,0.12); }
.nav-link.active { color: var(--white); background: var(--red); }

/* ─── Layout ─────────────────────────────────────────────────── */
.main { padding: 2rem 0 5rem; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ─── Page header / month nav ────────────────────────────────── */
.page-header {
  max-width: 1100px;
  margin: 0 auto 1.5rem;
  padding: 0 1.5rem;
}
.month-nav {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}
.month-label {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2.4rem;
  color: var(--navy);
  letter-spacing: 0.04em;
  min-width: 230px;
  text-align: center;
  line-height: 1;
}
.btn-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  color: var(--navy);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  flex-shrink: 0;
}
.btn-nav:hover {
  background: var(--red);
  border-color: var(--red);
  color: var(--white);
}

/* ─── Stat cards ─────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.375rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  box-shadow: var(--shadow);
}
.stat-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.stat-value {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2.1rem;
  letter-spacing: 0.02em;
  line-height: 1;
}

/* colour helpers */
.text-red     { color: var(--red); }
.text-navy    { color: var(--navy); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger  { color: var(--danger); }
.text-muted   { color: var(--muted); }

/* ─── Card shell ─────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 1rem 1.375rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.05rem;
  letter-spacing: 0.07em;
  color: var(--navy);
}

/* ─── Budget progress card ───────────────────────────────────── */
.budget-progress-card { }
.pct-badge {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.5rem;
  letter-spacing: 0.04em;
  color: var(--red);
}
.progress-body { padding: 1.125rem 1.375rem 1.375rem; }
.progress-track {
  height: 14px;
  background: var(--border);
  border-radius: 7px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 7px;
  background: var(--red);
  width: 0%;
  transition: width 0.7s cubic-bezier(.25,.8,.25,1),
              background 0.4s ease;
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}

/* ─── Chart ──────────────────────────────────────────────────── */
.chart-wrap {
  padding: 1.25rem 1.375rem 1.5rem;
  height: 490px;
  position: relative;
}

/* ─── Breakdown table ────────────────────────────────────────── */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.breakdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.breakdown-table th {
  padding: 0.7rem 1.25rem;
  text-align: left;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
  background: var(--bg);
}
.breakdown-table td {
  padding: 0.8rem 1.25rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.breakdown-table tbody tr:last-child td { border-bottom: none; }
.breakdown-table tbody tr:hover td     { background: #F8FAFC; }
.align-right { text-align: right; }

.cat-cell {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.cat-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}
.cat-name { font-weight: 500; }
.cat-cell-indent { padding-left: 0.4rem; }

.bucket-row td {
  background: var(--bg);
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--navy);
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
}
.bucket-row:hover td { background: var(--bg) !important; }
.bucket-target { color: var(--muted); font-weight: 600; text-transform: none; letter-spacing: normal; font-size: 0.78rem; }
.bucket-spent  { color: var(--red);   font-weight: 600; text-transform: none; letter-spacing: normal; font-size: 0.78rem; }
.target-note {
  display: block;
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--muted);
}

/* Budget-by-section progress bars (dashboard) */
.bucket-progress-list {
  padding: 1.1rem 1.25rem 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}
.bucket-progress-row:last-child { margin-bottom: 0; }
.bucket-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.4rem;
  gap: 0.75rem;
}
.bucket-progress-name {
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--navy);
  white-space: nowrap;
}
.bucket-progress-figures {
  font-size: 0.82rem;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}
.bucket-progress-figures strong { color: var(--navy); font-weight: 600; }
.bucket-progress-figures.is-over strong { color: #B91C1C; }
.bucket-progress-track {
  height: 9px;
  border-radius: 6px;
  background: var(--bg);
  overflow: hidden;
}
.bucket-progress-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.4s ease;
}
.bucket-progress-over-note {
  margin-top: 0.3rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: #B91C1C;
}

.amount-cell { font-variant-numeric: tabular-nums; font-weight: 500; }
.pct-cell    { font-variant-numeric: tabular-nums; color: var(--muted); }

.mini-track {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  width: 140px;
  margin: 0 auto;
}
.mini-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
}

.table-empty { text-align: center; padding: 2.5rem !important; color: var(--muted); }
.table-loading { text-align: center; padding: 2.5rem !important; color: var(--muted); }

/* ─── Coming soon ────────────────────────────────────────────── */
.coming-soon-wrap {
  max-width: 1100px;
  margin: 5rem auto;
  padding: 0 1.5rem;
  text-align: center;
}
.coming-soon-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 3.5rem;
  letter-spacing: 0.04em;
  color: var(--navy);
}
.coming-soon-sub {
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 1rem;
}

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .main { padding: 1.25rem 0 3.5rem; }

  .page-header { margin-bottom: 1.25rem; }
  .month-label { font-size: 1.9rem; min-width: 190px; }

  .stat-value { font-size: 1.7rem; }
  .container  { gap: 1rem; }
  .chart-wrap { height: 430px; }

  .hide-mobile { display: none; }

  .nav-link { padding: 0.4rem 0.65rem; font-size: 0.8rem; }
  .nav-brand { font-size: 1.45rem; }
}

@media (max-width: 480px) {
  .month-label { font-size: 1.6rem; min-width: 170px; }
  .stat-value  { font-size: 1.5rem; }
  .stat-card   { padding: 1rem 1.125rem; }
  .chart-wrap  { height: 400px; }
}

/* ─── Utility ────────────────────────────────────────────────── */
.hidden        { display: none !important; }
.align-center  { text-align: center; }
.fw-600        { font-weight: 600; }

/* ─── CPL: Hero cards ────────────────────────────────────────── */
.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
.hero-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem 2rem 1.625rem;
  position: relative;
  overflow: hidden;
}
.hero-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 5px;
}
.hero-cpl::before   { background: var(--red); }
.hero-leads::before { background: var(--navy); }

.hero-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 0.625rem;
}
.hero-value {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 4.5rem;
  letter-spacing: 0.02em;
  line-height: 1;
}
.hero-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.75rem;
}

/* ─── CPL: stat column variants ─────────────────────────────── */
.stat-grid-3 { grid-template-columns: repeat(3, 1fr); }
.stat-grid-5 { grid-template-columns: repeat(5, 1fr); }

/* ─── CPL: Channel table extras ─────────────────────────────── */
.chan-name  { font-weight: 500; }
.card-badge { font-size: 0.75rem; font-weight: 500; color: var(--muted); }

/* ─── CPL: Trend chart ───────────────────────────────────────── */
.chart-trend { height: 320px; }

/* ─── CPL: Channel CPL breakdown two-column grid ─────────────── */
.breakdown-groups {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

/* ─── CPL: Data entry tabs ───────────────────────────────────── */
.tab-group { display: flex; gap: 0.375rem; }
.tab-btn {
  padding: 0.375rem 0.875rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--muted);
  transition: all 0.15s;
  cursor: pointer;
  font-family: inherit;
}
.tab-btn:hover  { border-color: var(--navy); color: var(--navy); }
.tab-btn.active { background: var(--navy); border-color: var(--navy); color: white; }

/* ─── CPL: Entry table ───────────────────────────────────────── */
.entry-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.entry-table th {
  padding: 0.65rem 0.75rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border-bottom: 1.5px solid var(--border);
  background: var(--bg);
  white-space: nowrap;
}
.entry-table th:first-child { text-align: left; padding-left: 1.25rem; }
.entry-table td {
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid var(--border);
  text-align: center;
}
.entry-table td:first-child { padding-left: 1.25rem; text-align: left; }
.entry-table tbody tr:last-child td { border-bottom: none; }
.entry-table tbody tr:hover td      { background: #f8fafc; }

.entry-channel-name { font-weight: 500; font-size: 0.875rem; }

.entry-input {
  width: 72px;
  padding: 0.35rem 0.5rem;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.875rem;
  text-align: center;
  background: white;
  color: var(--text);
  transition: border-color 0.15s;
  -moz-appearance: textfield;
}
.entry-input::-webkit-outer-spin-button,
.entry-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.entry-input:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(4,55,90,0.1); }
.entry-spend { width: 95px; }

.entry-ql {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.5rem;
  color: var(--navy);
  letter-spacing: 0.02em;
}

.entry-footer {
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border);
  background: var(--bg);
  gap: 1rem;
}
.entry-hint { font-size: 0.75rem; color: var(--muted); }

.btn-save {
  padding: 0.6rem 1.5rem;
  background: var(--red);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}
.btn-save:hover    { background: #a31919; }
.btn-save:active   { transform: scale(0.97); }
.btn-save:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.save-success {
  margin: 0 1.5rem 1.25rem;
  padding: 0.7rem 1rem;
  background: #ecfdf5;
  border: 1px solid #6ee7b7;
  border-radius: 8px;
  color: #065f46;
  font-size: 0.875rem;
  font-weight: 500;
}

/* ─── CPL: CSV panel ─────────────────────────────────────────── */
.csv-panel { padding: 1.25rem 1.5rem 1.5rem; }
.csv-help {
  margin-bottom: 1rem;
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.65;
}
.csv-help p + p { margin-top: 0.375rem; }
.csv-help code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.45em;
  font-size: 0.82em;
  color: var(--text);
}
.csv-textarea {
  width: 100%;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.8rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  resize: vertical;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.15s;
}
.csv-textarea:focus { outline: none; border-color: var(--navy); background: white; }
.csv-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.75rem;
}
.btn-outline {
  padding: 0.5rem 1.25rem;
  background: white;
  border: 1.5px solid var(--navy);
  border-radius: 8px;
  color: var(--navy);
  font-weight: 600;
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-outline:hover { background: var(--navy); color: white; }
.csv-status { font-size: 0.82rem; color: var(--muted); }

/* ─── CPL Responsive ─────────────────────────────────────────── */
@media (max-width: 900px) {
  .stat-grid-3 { grid-template-columns: repeat(3, 1fr); }
  .stat-grid-5 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  .hero-grid        { grid-template-columns: 1fr; }
  .hero-value       { font-size: 3.5rem; }
  .hero-card        { padding: 1.5rem; }
  .stat-grid-3      { grid-template-columns: 1fr 1fr; }
  .stat-grid-5      { grid-template-columns: repeat(3, 1fr); }
  .chart-trend      { height: 260px; }
  .breakdown-groups { grid-template-columns: 1fr; }
  .entry-footer { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
}

@media (max-width: 480px) {
  .hero-value  { font-size: 3rem; }
  .stat-grid-5 { grid-template-columns: 1fr 1fr; }
  .entry-input { width: 58px; font-size: 0.8rem; }
  .entry-spend { width: 75px; }
}

/* ─── Admin page ─────────────────────────────────────────────── */
.admin-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem 5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.admin-hdr { margin-bottom: 0.125rem; }
.admin-page-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2.2rem;
  color: var(--navy);
  letter-spacing: 0.05em;
}

/* Inline month nav (inside card-header) */
.admin-month-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.admin-month-label {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.25rem;
  color: var(--navy);
  letter-spacing: 0.04em;
  min-width: 120px;
  text-align: center;
}
.btn-nav-sm { width: 32px; height: 32px; }

/* Admin table (spend entry) */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.admin-table th {
  padding: 0.6rem 1rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border-bottom: 1.5px solid var(--border);
  background: var(--bg);
  white-space: nowrap;
}
.admin-table th:first-child { text-align: left; }
.admin-table td {
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--border);
}
.admin-table td:first-child { padding-left: 1rem; }
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover td { background: #f8fafc; }

/* Admin footer bar (save row) */
.admin-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  align-items: center;
  gap: 0.875rem;
}
.inline-feedback {
  font-size: 0.82rem;
  color: var(--success);
  font-weight: 500;
}

/* Admin inputs & selects */
.adm-input {
  padding: 0.35rem 0.5rem;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.875rem;
  background: white;
  color: var(--text);
  transition: border-color 0.15s;
  -moz-appearance: textfield;
}
.adm-input::-webkit-outer-spin-button,
.adm-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.adm-input:focus  { outline: none; border-color: var(--navy); }
.adm-input-lg     { width: 190px; }
.adm-input-md     { width: 110px; }
.adm-input-sm     { width: 80px; }
.adm-input-xs     { width: 65px; }
.adm-input-num    { width: 100px; text-align: center; }

.adm-select {
  padding: 0.35rem 0.4rem;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.875rem;
  background: white;
  color: var(--text);
  cursor: pointer;
}
.adm-select:focus    { outline: none; border-color: var(--navy); }
.adm-select-md       { min-width: 175px; }
.adm-select-sm       { min-width: 70px; }

/* Add subscription form */
.add-sub-area {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.add-sub-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.btn-add {
  padding: 0.4rem 1rem;
  background: var(--navy);
  color: white;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.btn-add:hover    { background: #032d4a; }
.btn-add:disabled { opacity: 0.55; cursor: not-allowed; }

.add-sub-feedback {
  margin-top: 0.5rem;
  font-size: 0.82rem;
  font-weight: 500;
}
.add-sub-feedback.success { color: var(--success); }
.add-sub-feedback.error   { color: var(--danger); }

/* Subscription list */
.row-inactive td { opacity: 0.45; }
.status-badge {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.status-active   { background: #ecfdf5; color: #065f46; }
.status-inactive { background: #f1f5f9; color: var(--muted); }

.btn-deactivate {
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: white;
  color: var(--muted);
  font-size: 0.75rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-deactivate:hover { border-color: var(--red); color: var(--red); }

/* Note text */
.admin-note {
  padding: 0.5rem 1rem 0.75rem;
  font-size: 0.75rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

/* Settings */
.settings-body { padding: 1.25rem; }
.settings-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.settings-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

/* Admin responsive */
@media (max-width: 768px) {
  .admin-page { padding: 1.25rem 1rem 3rem; }
  .add-sub-fields { gap: 0.375rem; }
  .adm-input-lg { width: 150px; }
  .adm-select-md { min-width: 140px; }
}

/* ─── Team read-only banner ──────────────────────────────────── */
.team-banner {
  background: var(--navy);
  color: rgba(255,255,255,0.7);
  font-size: 0.78rem;
  text-align: center;
  padding: 0.4rem 1rem;
  letter-spacing: 0.03em;
}
.team-banner strong { color: rgba(255,255,255,0.95); font-weight: 600; }

/* ─── Receipts ───────────────────────────────────────────────── */

/* Upload card */
.upload-body { padding: 1.5rem; }

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  text-align: center;
  outline: none;
}
.drop-zone:hover,
.drop-zone:focus,
.drop-zone.drag-over {
  border-color: var(--navy);
  background: #f0f5fa;
}
.drop-icon {
  width: 48px;
  height: 48px;
  color: var(--muted);
  margin-bottom: 0.25rem;
}
.drop-label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}
.drop-sub {
  font-size: 0.82rem;
  color: var(--muted);
}
.upload-error {
  margin-top: 0.875rem;
  color: var(--danger);
  font-size: 0.875rem;
  font-weight: 500;
}

/* Loading card */
.loading-body {
  padding: 3rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}
.loading-msg {
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 500;
}
.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--border);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Review card */
.review-body { padding: 1.5rem; }

.file-type-badge {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.badge-image, .badge-img { background: #e0f2fe; color: #0369a1; }
.badge-pdf              { background: #fef3c7; color: #92400e; }

.file-preview-wrap {
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.receipt-thumb {
  max-width: 120px;
  max-height: 120px;
  border-radius: 8px;
  border: 1px solid var(--border);
  object-fit: cover;
}
.pdf-placeholder {
  width: 80px;
  height: 80px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

/* Review form grid */
.review-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.form-group-wide { grid-column: 1 / -1; }

.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}
.review-input,
.review-select {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  background: white;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.review-input:focus,
.review-select:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(4,55,90,0.1);
}

/* Filename preview */
.filename-preview-wrap {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
}
.filename-preview-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.3rem;
}
.filename-preview {
  display: block;
  font-size: 0.82rem;
  color: var(--text);
  word-break: break-all;
  line-height: 1.5;
}

/* Review action buttons */
.review-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Success card */
.success-body {
  padding: 3rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
}
.success-icon {
  width: 56px;
  height: 56px;
  background: var(--success);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  font-weight: 700;
}
.success-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}
.success-details {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.875rem 1.25rem;
  width: 100%;
  max-width: 560px;
  text-align: left;
}
.success-row {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.3rem 0;
  font-size: 0.875rem;
}
.success-row:not(:last-child) { border-bottom: 1px solid var(--border); }
.success-row span { font-weight: 600; color: var(--muted); min-width: 70px; flex-shrink: 0; }
.success-row code { font-size: 0.82rem; word-break: break-all; color: var(--text); }

/* History table — filename cell */
.filename-cell {
  font-size: 0.78rem;
  color: var(--muted);
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* File badge in history */
.file-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

/* Category dot */
.cat-cell { display: flex; align-items: center; gap: 0.45rem; }
.cat-dot  {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Receipts responsive */
@media (max-width: 640px) {
  .review-grid { grid-template-columns: 1fr; }
  .form-group-wide { grid-column: 1; }
  .drop-zone { padding: 2rem 1rem; }
  .filename-cell { max-width: 140px; }
}

/* ── Receipt file availability (added with the cloud migration) ── */
.filename-cell a {
  color: var(--navy);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.filename-cell a:hover { color: var(--red); }

.file-missing {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: #F1F5F9;
  color: #64748B;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  vertical-align: middle;
  white-space: nowrap;
}

/* ─── Row edit button ────────────────────────────────────────── */
.row-edit {
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--navy);
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 10px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.row-edit:hover { background: var(--navy); border-color: var(--navy); color: #fff; }

/* ─── Monthly export ─────────────────────────────────────────── */
.export-row { padding: 18px 22px 22px; }
.export-help { color: var(--muted); font-size: 0.88rem; line-height: 1.55; margin-bottom: 14px; }
.export-help code {
  background: var(--bg); border: 1px solid var(--border); border-radius: 4px;
  padding: 1px 6px; font-size: 0.85em;
}
.export-controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.export-controls .input-field { max-width: 240px; }
.export-status { margin-top: 10px; font-size: 0.83rem; color: var(--muted); min-height: 1.2em; }

/* ─── Modals ─────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(10, 20, 35, 0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-backdrop[hidden] { display: none; }

.modal-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 20px 50px rgba(0,0,0,0.28);
  width: 100%; max-width: 560px;
  max-height: calc(100vh - 40px);
  display: flex; flex-direction: column;
}
.modal-narrow { max-width: 420px; }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
}
.modal-close {
  background: none; border: none; cursor: pointer;
  font-size: 1.6rem; line-height: 1; color: var(--muted); padding: 0 4px;
}
.modal-close:hover { color: var(--text); }

.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-body .field { display: block; margin-bottom: 14px; }
.modal-body .field-row { display: flex; gap: 14px; }
.modal-body .field-row .field { flex: 1; }
.modal-body .field-label {
  display: block; font-size: 0.78rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--muted); margin-bottom: 5px;
}

.modal-note { font-size: 0.83rem; color: var(--muted); line-height: 1.5; }
.modal-error {
  margin-top: 10px; font-size: 0.86rem; color: var(--danger);
  background: #FEF2F2; border: 1px solid #FECACA;
  border-radius: 8px; padding: 9px 12px;
}
.modal-error[hidden] { display: none; }

.modal-footer {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 16px 22px; border-top: 1px solid var(--border);
}
.modal-footer-right { display: flex; gap: 10px; margin-left: auto; }

.btn-danger {
  font: inherit; font-weight: 600; font-size: 0.9rem;
  color: var(--danger); background: none;
  border: 1px solid #FECACA; border-radius: 8px;
  padding: 9px 16px; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:disabled { opacity: 0.6; cursor: default; }

@media (max-width: 520px) {
  .modal-body .field-row { flex-direction: column; gap: 0; }
  .modal-footer { flex-direction: column-reverse; align-items: stretch; }
  .modal-footer-right { margin-left: 0; }
  .modal-footer button { width: 100%; }
}

/* ─── Month nav at the start of tracking ─────────────────────── */
.btn-nav:disabled,
.btn-nav-disabled {
  opacity: 0.28;
  cursor: default;
  pointer-events: none;
}
