:root {
  --charcoal: #2B2420;
  --charcoal-soft: #4A4038;
  --charcoal-faint: #8A8074;
  --sand: #D9C7B4;
  --sand-deep: #C4AE93;
  --sand-tint: #EFE6D8;
  --page-bg: #F5EEE4;
  --card: #FFFFFF;
  --border: #E7DDCE;
  --green: #3F7A52;
  --green-bg: #E3EFE4;
  --amber: #A9762E;
  --amber-bg: #F3E7CC;
  --red: #B0453A;
  --red-bg: #F5DEDA;
  --red-deep: #93392A;
  --celebrate-accent: #B8863B;
  --celebrate-track: #EAD9BD;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 24px;
  --shadow-sm: 0 1px 2px rgba(43, 36, 32, 0.06), 0 1px 1px rgba(43, 36, 32, 0.04);
  --shadow-md: 0 8px 20px rgba(43, 36, 32, 0.08), 0 2px 6px rgba(43, 36, 32, 0.05);
  --shadow-lg: 0 20px 44px rgba(43, 36, 32, 0.14), 0 4px 12px rgba(43, 36, 32, 0.06);
  --t-fast: 180ms ease;
  --t-med: 220ms ease;
  --sidebar-w: 240px;
  --sidebar-bg: #3D3327;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--page-bg);
  color: var(--charcoal);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Native [hidden] must always win over class-based `display` rules
   (e.g. .login-screen / .modal-overlay set display:flex), otherwise an
   element toggled via el.hidden stays laid out and can block clicks. */
[hidden] { display: none !important; }

h1, h2, h3, .display {
  font-family: 'Fraunces', Georgia, serif;
  color: var(--charcoal);
  margin: 0;
}

.hidden { display: none !important; }

button { font-family: inherit; }

.btn, .nav-link, .row-icon-btn, .modal-close, .sidebar-logout, td.editable-cell, .hamburger {
  cursor: pointer;
}

/* ============ Buttons / Inputs ============ */
.btn {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.86rem;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), opacity var(--t-fast), transform 100ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--charcoal); color: var(--sand-tint); }
.btn-primary:hover:not(:disabled) { background: #3a322b; }

.btn-secondary { background: var(--sand); color: var(--charcoal); }
.btn-secondary:hover:not(:disabled) { background: var(--sand-deep); }

.btn-ghost { background: transparent; color: var(--charcoal-soft); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--sand-tint); }

.btn-danger { background: var(--red); color: #FBF7F0; }
.btn-danger:hover:not(:disabled) { background: var(--red-deep); }

.btn-block { width: 100%; }

.btn-sm { padding: 6px 12px; font-size: 0.78rem; border-radius: 7px; }

.input, select.input, textarea.input {
  width: 100%;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  color: var(--charcoal);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.input:focus, select.input:focus, textarea.input:focus {
  outline: none;
  border-color: var(--charcoal-soft);
  box-shadow: 0 0 0 3px rgba(43, 36, 32, 0.08);
}
textarea.input { resize: vertical; min-height: 64px; }

.field-label {
  display: block;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--charcoal-faint);
  margin-bottom: 6px;
}

.field-error {
  font-size: 0.8rem;
  color: var(--red);
  margin-top: 8px;
  font-weight: 500;
}

/* ============ Login screen ============ */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--page-bg);
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px 34px 34px;
  text-align: center;
}

.login-mark { width: 42px; height: 42px; color: var(--charcoal); margin-bottom: 14px; }

.login-title { font-size: 1.6rem; font-weight: 700; margin-bottom: 6px; }

.login-sub { color: var(--charcoal-faint); font-size: 0.88rem; margin: 0 0 26px; }

#loginForm { text-align: left; }
#loginForm .btn { margin-top: 18px; }

/* ============ App shell ============ */
.app-shell { min-height: 100vh; }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(43, 36, 32, 0.45);
  z-index: 39;
  opacity: 0;
  transition: opacity var(--t-med);
}
.sidebar-overlay.visible { display: block; opacity: 1; }

.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: #EFE7DA;
  display: flex;
  flex-direction: column;
  z-index: 40;
  padding: 24px 16px;
  transition: transform var(--t-med);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 26px;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(239, 231, 218, 0.12);
}
.sidebar-mark { width: 28px; height: 28px; flex-shrink: 0; color: var(--sand); }
.sidebar-wordmark { font-family: 'Fraunces', serif; font-weight: 700; font-size: 1.1rem; color: #FBF7F0; line-height: 1.2; }

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: rgba(239, 231, 218, 0.72);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.nav-link:hover { background: rgba(239, 231, 218, 0.06); color: #FBF7F0; }
.nav-link.active { background: rgba(217, 199, 180, 0.14); color: #FBF7F0; font-weight: 600; }

.nav-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  color: rgba(239, 231, 218, 0.55);
  transition: color var(--t-fast);
}
.nav-link:hover .nav-icon { color: #FBF7F0; }
.nav-link.active .nav-icon { color: var(--sand); }

.sidebar-logout {
  background: transparent;
  border: 1px solid rgba(239, 231, 218, 0.16);
  color: rgba(239, 231, 218, 0.65);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.sidebar-logout:hover { background: rgba(239, 231, 218, 0.08); color: #FBF7F0; }

.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--page-bg);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-title { font-size: 1.3rem; font-weight: 600; }

.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 34px;
  height: 34px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
}
.hamburger span {
  display: block;
  width: 16px;
  height: 2px;
  background: var(--charcoal);
  margin: 0 auto;
  transition: transform var(--t-fast), opacity var(--t-fast);
}

.page-container { padding: 28px 32px 80px; flex: 1; width: 100%; max-width: 1520px; margin: 0 auto; }

/* No transform here: any non-none transform on an ancestor corrupts
   position:sticky's offset calculation for descendants (it sits between
   the sticky element and its scrolling ancestor) — this broke the sticky
   table header. Opacity-only still reads as a quick, deliberate transition. */
.page { display: none; opacity: 0; }
.page.page-active { display: block; }
.page.page-visible { opacity: 1; transition: opacity var(--t-med); }

/* ============ Dashboard ============ */
.section-state {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  padding: 70px 20px;
  color: var(--charcoal-soft);
}
.section-state.visible { display: flex; }
.section-state .state-icon { width: 40px; height: 40px; color: var(--charcoal-faint); }
.section-state h3 { font-size: 1.1rem; font-weight: 600; }
.section-state p { font-size: 0.88rem; max-width: 340px; margin: 0; }

/* Skeleton loading state renders full-width block placeholders instead of
   the centered icon+text layout used for errors. */
.section-state.skeleton-mode.visible { display: block; text-align: left; padding: 0; gap: 0; }

.skeleton-block, .skeleton-row {
  position: relative;
  overflow: hidden;
  background: var(--sand-tint);
}
.skeleton-block::after, .skeleton-row::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }

.skeleton-dashboard { display: flex; flex-direction: column; gap: 24px; }
.skeleton-hero { height: 190px; border-radius: var(--radius-lg); }
.skeleton-kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.skeleton-kpi { height: 98px; border-radius: var(--radius-lg); }
.skeleton-lower-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; }
.skeleton-chart { height: 230px; border-radius: var(--radius-md); }
.skeleton-recent { height: 230px; border-radius: var(--radius-md); }

.skeleton-table { display: flex; flex-direction: column; gap: 10px; }
.skeleton-row { height: 46px; border-radius: var(--radius-sm); }

@media (max-width: 768px) {
  .skeleton-lower-grid { grid-template-columns: 1fr; }
}

/* ============ Empty states ============ */
.empty-state-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 34px 16px;
  color: var(--charcoal-faint);
}
.empty-state-block svg { color: var(--charcoal-faint); opacity: 0.7; }
.empty-state-block p { margin: 0; font-size: 0.88rem; }

.progress-hero {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 36px 32px;
  display: flex;
  align-items: center;
  gap: 40px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  transition: background var(--t-med), border-color var(--t-med), box-shadow var(--t-med);
}

/* Celebration state stays on a light background (a gradient-bordered card
   respecting border-radius needs the transparent-border + dual-background
   trick, since border-image ignores border-radius). */
.progress-hero.goal-reached {
  border: 3px solid transparent;
  background-image: linear-gradient(135deg, #FFFFFF 0%, #F4E9D9 100%), linear-gradient(120deg, var(--sand-deep) 0%, var(--charcoal) 100%);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  box-shadow: var(--shadow-lg);
}

.ring-wrap { position: relative; width: 190px; height: 190px; flex-shrink: 0; }
.ring-wrap svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--sand-tint); stroke-width: 15; transition: stroke var(--t-med); }
.ring-progress {
  fill: none;
  stroke: var(--charcoal);
  stroke-width: 15;
  stroke-linecap: round;
  transition: stroke-dashoffset 900ms cubic-bezier(0.65, 0, 0.35, 1), stroke var(--t-med);
}
.progress-hero.goal-reached .ring-track { stroke: var(--celebrate-track); }
.progress-hero.goal-reached .ring-progress { stroke: var(--celebrate-accent); }

.ring-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-text .big-num { font-family: 'Fraunces', serif; font-weight: 700; font-size: 2.6rem; line-height: 1; transition: color var(--t-med); }
.ring-text .of-goal { font-size: 0.8rem; color: var(--charcoal-soft); margin-top: 5px; font-weight: 500; transition: color var(--t-med); }
.progress-hero.goal-reached .ring-text .of-goal { color: var(--celebrate-accent); font-weight: 700; }

.progress-copy { max-width: 340px; }
.progress-copy .eyebrow { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--charcoal-faint); margin-bottom: 8px; transition: color var(--t-med); }
.progress-copy h2 { font-size: 1.4rem; font-weight: 600; margin-bottom: 8px; line-height: 1.25; transition: color var(--t-med); }
.progress-copy p { font-size: 0.9rem; color: var(--charcoal-soft); line-height: 1.55; margin: 0; transition: color var(--t-med); }
.progress-hero.goal-reached .progress-copy .eyebrow { color: var(--celebrate-accent); }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }

.kpi-card {
  position: relative;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 22px 22px 20px;
  transition: box-shadow var(--t-fast), transform var(--t-fast);
  animation: kpiEnter 320ms ease both;
}
.kpi-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--sand-deep);
}
.kpi-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.kpi-card:nth-child(1) { animation-delay: 0ms; }
.kpi-card:nth-child(2) { animation-delay: 60ms; }
.kpi-card:nth-child(3) { animation-delay: 120ms; }
.kpi-card:nth-child(4) { animation-delay: 180ms; }

.kpi-icon { position: absolute; top: 20px; right: 20px; width: 18px; height: 18px; color: var(--sand-deep); opacity: 0.8; }

.kpi-label { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--charcoal-faint); margin-bottom: 9px; max-width: calc(100% - 30px); }
.kpi-value { font-family: 'Fraunces', serif; font-size: 1.9rem; font-weight: 700; }
.kpi-value.kpi-negative { color: var(--red); }

@keyframes kpiEnter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.dash-lower-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; align-items: start; }
.expense-charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; margin-bottom: 24px; }

.chart-card, .recent-card, .placeholder-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 22px 22px 18px;
}

.card-heading { font-family: 'Fraunces', serif; font-weight: 600; font-size: 1.05rem; margin-bottom: 16px; }

.chart-canvas-wrap { position: relative; height: 230px; }

.recent-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 2px;
  border-bottom: 1px solid var(--border);
}
.recent-item:last-child { border-bottom: none; }
.recent-name { font-size: 0.88rem; font-weight: 600; color: var(--charcoal); }

.name-cell { display: flex; align-items: center; gap: 9px; }
.avatar-initials {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--sand);
  color: var(--charcoal);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  flex-shrink: 0;
}

/* ============ Badges ============ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 11px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-neutral { background: var(--sand-tint); color: var(--charcoal-soft); }
.badge-type { background: var(--sand); color: var(--charcoal); gap: 5px; }
.badge-type svg { flex-shrink: 0; }

/* ============ Bookings toolbar ============ */
.bookings-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.toolbar-filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search-input { width: 240px; max-width: 300px; }
.filter-label-inline { font-size: 0.82rem; font-weight: 500; color: var(--charcoal-soft); white-space: nowrap; }
.select-input { width: auto; min-width: 160px; }
#customMonthInput { width: auto; min-width: 150px; }

/* ============ Table ============ */
.table-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

/* The table scrolls inside its own bounded box so the sticky header can
   stick to top:0 of THIS box directly, instead of being coordinated against
   the separately-sticky page topbar — two independent sticky elements kept
   drifting out of sync (a measured-offset gap let scrolled rows peek
   through). A self-contained scroll container is the standard, reliable
   pattern for sticky grid headers. */
.table-scroll { overflow: auto; max-height: calc(100vh - 260px); }

table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.85rem; min-width: 1100px; }

thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--charcoal-faint);
  background: var(--sand-tint);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
th.amount { text-align: right; }
.actions-col { width: 96px; }

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--charcoal);
  vertical-align: middle;
  white-space: nowrap;
  transition: background var(--t-med), box-shadow var(--t-med);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover:not(.editing-row) td { background: rgba(43, 36, 32, 0.025); box-shadow: 0 1px 8px rgba(43, 36, 32, 0.07); }

tr.editing-row td { background: var(--sand-tint); box-shadow: 0 2px 10px rgba(43, 36, 32, 0.09); }

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

td.editable-cell { cursor: pointer; border-radius: 6px; }
td.editable-cell:hover:not(.editing-cell) { background: var(--sand-tint); }

.cell-input {
  width: 100%;
  min-width: 90px;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  padding: 6px 8px;
  border: 1px solid var(--charcoal-soft);
  border-radius: 6px;
  background: var(--card);
}
.cell-input:focus { outline: none; box-shadow: 0 0 0 3px rgba(43, 36, 32, 0.1); }

.cell-input-wrap { position: relative; }
.cell-input-icon {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  color: var(--charcoal-faint);
  pointer-events: none;
}
.cell-input.has-icon { padding-left: 28px; }

.row-actions { display: flex; gap: 8px; align-items: center; }
.row-icon-btn {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  color: var(--charcoal-soft);
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast), transform 100ms ease;
}
.row-icon-btn:hover:not(:disabled) { background: var(--sand-tint); color: var(--charcoal); }
.row-icon-btn:active:not(:disabled) { transform: scale(0.86); }
.row-icon-btn.save-btn:hover:not(:disabled) { background: var(--green-bg); color: var(--green); border-color: var(--green); }
.row-icon-btn.cancel-btn:hover:not(:disabled) { background: var(--red-bg); color: var(--red); border-color: var(--red); }
.row-icon-btn.delete-btn:hover:not(:disabled) { background: var(--red-bg); color: var(--red); border-color: var(--red); }
.row-icon-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.row-error { color: var(--red); font-size: 0.72rem; margin-top: 4px; max-width: 140px; }

tr.row-saved-flash { animation: rowSavedFlash 900ms ease; }
@keyframes rowSavedFlash {
  0% { background: var(--green-bg); }
  100% { background: transparent; }
}

tr.row-enter { animation: rowEnter 260ms ease both; }
@keyframes rowEnter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.empty-row td { padding: 0; }
.empty-row:hover { background: transparent; }

/* ============ Placeholder (Expenses) ============ */
.placeholder-card { text-align: center; padding: 64px 30px; max-width: 460px; margin: 0 auto; }
.placeholder-icon { width: 46px; height: 46px; color: var(--charcoal-faint); margin: 0 auto 18px; }
.placeholder-card h2 { font-size: 1.3rem; margin-bottom: 10px; }
.placeholder-card p { color: var(--charcoal-soft); font-size: 0.9rem; line-height: 1.6; margin: 0; }

/* ============ Modal ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(43, 36, 32, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 60;
  opacity: 0;
  transition: opacity var(--t-med);
}
.modal-overlay.open { opacity: 1; }

.modal {
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  transform: translateY(10px) scale(0.98);
  transition: transform var(--t-med);
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }

.modal.modal-sm { max-width: 400px; }
.confirm-message { font-size: 0.92rem; color: var(--charcoal-soft); line-height: 1.55; margin: 0; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 1.15rem; font-weight: 600; }
.modal-close {
  width: 30px; height: 30px;
  border-radius: 8px;
  border: none;
  background: transparent;
  font-size: 1.3rem;
  line-height: 1;
  color: var(--charcoal-soft);
  cursor: pointer;
}
.modal-close:hover { background: var(--sand-tint); }

.modal-body { padding: 20px 24px; overflow-y: auto; }

.paste-box {
  background: var(--sand-tint);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 22px;
}
.paste-row { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 10px; }
.paste-row .field-error { margin-top: 0; margin-right: auto; }

.booking-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-field { display: flex; flex-direction: column; }
.form-field.span-2 { grid-column: 1 / -1; }

.modal-error { padding: 0 24px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 18px 24px;
  border-top: 1px solid var(--border);
}

/* ============ Toast ============ */
.toast {
  position: fixed;
  bottom: 26px;
  right: 26px;
  background: var(--charcoal);
  color: #FBF7F0;
  padding: 13px 20px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 0.86rem;
  font-weight: 500;
  z-index: 80;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--t-med), transform var(--t-med);
}
.toast.error { background: var(--red); }
.toast.visible { opacity: 1; transform: translateY(0); }

/* ============ Responsive ============ */
@media (max-width: 768px) {
  .hamburger { display: flex; }

  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }

  .main { margin-left: 0; }

  .page-container { padding: 20px 16px 60px; }
  .topbar { padding: 14px 16px; }

  .progress-hero { flex-direction: column; text-align: center; padding: 28px 22px; }
  .progress-copy { text-align: center; }

  .dash-lower-grid { grid-template-columns: 1fr; }
  .expense-charts-grid { grid-template-columns: 1fr; }

  .booking-form { grid-template-columns: 1fr; }

  /* Table -> stacked cards */
  .table-scroll { max-height: none; overflow: visible; }
  table { min-width: 0; }
  thead { display: none; }
  tbody, tr, td { display: block; width: 100%; }
  tbody tr {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    padding: 6px 4px;
    box-shadow: var(--shadow-sm);
  }
  tbody tr:hover { background: var(--card); }
  tbody td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid var(--border);
    padding: 10px 12px;
    text-align: right;
    white-space: normal;
  }
  tbody tr td:last-child { border-bottom: none; }
  tbody td::before {
    content: attr(data-label);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--charcoal-faint);
    text-align: left;
    flex-shrink: 0;
  }
  td.amount { text-align: right; }
  .actions-col, td.actions-cell { justify-content: flex-end; }
  .row-actions { justify-content: flex-end; width: 100%; }
}

@media (max-width: 480px) {
  .ring-wrap { width: 160px; height: 160px; }
  .ring-text .big-num { font-size: 2.1rem; }
  .kpi-value { font-size: 1.6rem; }
  .login-card { padding: 32px 24px 28px; }
}
