/* ─────────────────────────────────────────────────────
   styles.css  –  Fatora Daily Log
   ───────────────────────────────────────────────────── */

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

:root {
  --ink:        #0f1117;
  --paper:      #f5f3ee;
  --cream:      #ece9e2;
  --gold:       #c9a84c;
  --gold-light: #f0d98a;
  --gold-bg:    #fff9ec;
  --teal:       #1a6b6b;
  --teal-light: #d0eeee;
  --red:        #c94c4c;
  --red-light:  #fde8e8;
  --muted:      #8a8680;
  --card:       #ffffff;
  --shadow-sm:  0 1px 4px rgba(15,17,23,0.06);
  --shadow:     0 2px 16px rgba(15,17,23,0.08);
  --shadow-lg:  0 8px 40px rgba(15,17,23,0.14);
  --radius:     14px;
  --radius-lg:  20px;
  --radius-xl:  24px;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ── Screens ─────────────────────────────────────────── */
.screen { display: none; min-height: 100vh; flex-direction: column; animation: fadeUp .35s cubic-bezier(.22,1,.36,1) both; }
.screen.active { display: flex; }

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

/* ══════════════════════════════════════════════════════
   AUTH
══════════════════════════════════════════════════════ */
.auth-bg {
  flex: 1; display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: var(--ink); position: relative; overflow: hidden;
}
.auth-bg::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 55% 45% at 15% 85%, rgba(201,168,76,.22) 0%, transparent 65%),
    radial-gradient(ellipse 50% 55% at 85% 15%, rgba(26,107,107,.24) 0%, transparent 65%);
  pointer-events: none;
}
.auth-card {
  position: relative; z-index: 1;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  backdrop-filter: blur(28px);
  border-radius: var(--radius-xl);
  padding: 56px 48px 48px;
  width: 100%; max-width: 400px; margin: 24px;
  text-align: center;
}
.logo-mark {
  width: 60px; height: 60px;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 28px;
  font-family: 'Syne', sans-serif; font-weight: 800; font-size: 26px;
  color: var(--ink); box-shadow: 0 8px 24px rgba(201,168,76,.3);
}
.auth-title {
  font-family: 'Syne', sans-serif; font-weight: 800; font-size: 28px;
  color: #fff; margin-bottom: 10px; letter-spacing: -.5px;
}
.auth-sub { font-size: 15px; color: rgba(255,255,255,.45); margin-bottom: 40px; line-height: 1.5; }

.btn-google {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 12px;
  background: #fff; border: none; border-radius: var(--radius);
  padding: 15px 20px; font-family: 'DM Sans', sans-serif;
  font-size: 15px; font-weight: 500; color: var(--ink);
  cursor: pointer; transition: transform .15s, box-shadow .2s; margin-bottom: 24px;
}
.btn-google:hover  { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(0,0,0,.28); }
.btn-google:active { transform: translateY(0); }
.btn-google:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.google-icon { width: 20px; height: 20px; flex-shrink: 0; }
.auth-note { font-size: 12px; color: rgba(255,255,255,.28); line-height: 1.6; }

.spinner {
  width: 16px; height: 16px; border: 2px solid rgba(0,0,0,.12);
  border-top-color: var(--ink); border-radius: 50%;
  animation: spin .65s linear infinite; display: inline-block; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════
   TOPBAR
══════════════════════════════════════════════════════ */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px; background: var(--card);
  border-bottom: 1px solid var(--cream);
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-sm);
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-logo {
  font-family: 'Syne', sans-serif; font-weight: 800; font-size: 20px;
  color: var(--ink); letter-spacing: -.5px; display: flex; align-items: center; gap: 8px;
}
.topbar-logo span { color: var(--gold); }
.admin-label {
  font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  background: var(--ink); color: #fff; padding: 3px 8px; border-radius: 6px;
}
.back-btn {
  background: none; border: 1.5px solid var(--cream); border-radius: 100px;
  padding: 7px 16px; font-size: 13px; color: var(--muted); cursor: pointer;
  font-family: 'DM Sans', sans-serif; transition: border-color .2s, color .2s;
}
.back-btn:hover { border-color: var(--ink); color: var(--ink); }

.role-badge {
  font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 100px; display: inline-block;
}
.role-badge.user  { background: var(--cream); color: var(--muted); }
.role-badge.admin { background: var(--ink); color: #fff; }

/* ── User avatar + dropdown ──────────────────────────── */
.user-menu-wrap { position: relative; }
.user-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--teal), #2d9a9a);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: #fff;
  cursor: pointer; overflow: hidden; flex-shrink: 0;
  border: 2px solid var(--card); box-shadow: var(--shadow-sm);
  transition: box-shadow .2s;
}
.user-avatar:hover { box-shadow: 0 0 0 3px rgba(26,107,107,.2); }
.avatar-img { width: 100%; height: 100%; object-fit: cover; }

.user-menu {
  position: absolute; top: calc(100% + 10px); right: 0;
  background: var(--card); border: 1px solid var(--cream);
  border-radius: var(--radius-lg); padding: 6px; min-width: 220px;
  box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none;
  transform: translateY(-8px) scale(.97);
  transition: opacity .2s, transform .2s; z-index: 100;
}
.user-menu.open { opacity: 1; pointer-events: all; transform: translateY(0) scale(1); }
.user-menu-header {
  padding: 12px 14px 14px; border-bottom: 1px solid var(--cream); margin-bottom: 4px;
}
.user-menu-name  { font-weight: 600; font-size: 14px; color: var(--ink); }
.user-menu-email { font-size: 12px; color: var(--muted); margin-top: 3px; word-break: break-all; }
.user-menu-item {
  display: block; width: 100%; background: none; border: none;
  padding: 10px 14px; border-radius: 8px;
  text-align: left; font-family: 'DM Sans', sans-serif;
  font-size: 14px; color: var(--ink); cursor: pointer; transition: background .15s;
}
.user-menu-item:hover { background: var(--paper); }
.user-menu-item.danger { color: var(--red); }
.user-menu-item.danger:hover { background: var(--red-light); }

/* ══════════════════════════════════════════════════════
   MAIN CONTENT
══════════════════════════════════════════════════════ */
.main-content, .admin-content {
  flex: 1; padding: 32px 28px 64px;
  max-width: 960px; width: 100%; margin: 0 auto;
}

/* ── Cards ───────────────────────────────────────────── */
.card {
  background: var(--card); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); overflow: hidden; margin-bottom: 24px;
}
.card-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; padding: 24px 24px 20px; flex-wrap: wrap;
}
.card-title {
  font-family: 'Syne', sans-serif; font-size: 18px; font-weight: 700; color: var(--ink);
}
.card-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* ── Buttons ─────────────────────────────────────────── */
.btn-primary {
  background: var(--ink); color: #fff; border: none; border-radius: var(--radius);
  padding: 12px 22px; font-family: 'Syne', sans-serif; font-size: 14px; font-weight: 700;
  cursor: pointer; transition: background .2s, transform .15s, box-shadow .2s;
  white-space: nowrap; flex-shrink: 0;
}
.btn-primary:hover { background: var(--teal); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(26,107,107,.25); }
.btn-primary:disabled {
  background: var(--cream); color: var(--muted);
  cursor: not-allowed; transform: none; box-shadow: none;
}

/* ══════════════════════════════════════════════════════
   ENTRY FORM  (single row)
══════════════════════════════════════════════════════ */
.entry-single-wrap {
  padding: 8px 24px 24px;
}

.entry-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--paper); border-radius: var(--radius);
  padding: 16px 20px; flex-wrap: wrap;
}

.entry-who {
  display: flex; align-items: center; gap: 10px;
  flex: 1; min-width: 140px;
}

.entry-avatar-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--gold); flex-shrink: 0;
}

.entry-name {
  font-family: 'Syne', sans-serif;
  font-size: 15px; font-weight: 700; color: var(--ink);
}

.value-input-large {
  width: 160px;
  background: var(--card); border: 1.5px solid var(--cream);
  border-radius: var(--radius); padding: 12px 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 18px; font-weight: 500; color: var(--ink);
  outline: none; transition: border-color .2s, background .2s;
  text-align: center;
}
.value-input-large:focus { border-color: var(--gold); background: var(--gold-bg); }
.value-input-large::placeholder { color: var(--muted); font-size: 15px; font-weight: 400; }
.value-input-large:disabled {
  background: var(--cream); color: var(--muted);
  border-color: var(--cream); cursor: not-allowed;
}

.entry-locked-note {
  margin: 10px 20px 4px;
  font-size: 13px; color: var(--teal);
  display: flex; align-items: center; gap: 6px;
}
.entry-locked-note.warning { color: #8a6a00; }

/* ── Date picker in entry form ───────────────────────── */
.entry-date-control {
  display: flex; flex-direction: column; gap: 4px;
}
.entry-date-label-small {
  font-size: 10px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted);
}
.date-picker {
  background: var(--card); border: 1.5px solid var(--cream);
  border-radius: var(--radius); padding: 10px 14px;
  font-family: 'DM Sans', sans-serif; font-size: 14px;
  color: var(--ink); outline: none;
  transition: border-color .2s, background .2s;
  font-weight: 500;
}
.date-picker:focus { border-color: var(--gold); background: var(--gold-bg); }

/* ── Compact day-columns table (user history) ────────── */
.history-table.compact { min-width: auto; }
.history-table.compact .th-day {
  padding: 8px 6px; min-width: 36px;
  text-align: center;
  font-size: 11px; font-weight: 600;
  color: var(--muted); background: var(--paper);
  border-bottom: 1px solid var(--cream);
}
.history-table.compact .td-value {
  padding: 12px 6px; min-width: 36px;
  font-size: 13px;
}
.history-table.compact .th-total {
  position: sticky; right: 0;
  border-left: 2px solid var(--gold-light);
}
.history-table.compact .td-month-total {
  position: sticky; right: 0;
  border-left: 2px solid var(--gold-light);
  min-width: 80px;
}

/* ── Leaderboard ─────────────────────────────────────── */
.leaderboard-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 28px;
  overflow: hidden;
}
.leaderboard-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--cream);
  background: linear-gradient(135deg, var(--gold-bg), var(--card));
}
.leaderboard-title {
  font-family: 'Syne', sans-serif;
  font-size: 18px; font-weight: 700; color: var(--ink);
}
.leaderboard-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }

.leaderboard-list {
  display: flex; flex-direction: column;
}
.leaderboard-row {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--cream);
  transition: background .15s;
}
.leaderboard-row:last-child { border-bottom: none; }
.leaderboard-row:hover { background: var(--paper); }
.leaderboard-row.gold { background: linear-gradient(90deg, rgba(201,168,76,.12), transparent); }
.leaderboard-row.silver { background: linear-gradient(90deg, rgba(150,150,150,.10), transparent); }
.leaderboard-row.bronze { background: linear-gradient(90deg, rgba(184,115,51,.12), transparent); }

.lb-rank {
  font-family: 'Syne', sans-serif;
  font-size: 22px; font-weight: 800;
  min-width: 50px; text-align: center;
  color: var(--muted);
}
.leaderboard-row.gold   .lb-rank,
.leaderboard-row.silver .lb-rank,
.leaderboard-row.bronze .lb-rank { font-size: 28px; }

.lb-user { flex: 1; min-width: 0; }
.lb-name {
  font-weight: 600; font-size: 15px; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lb-email {
  font-size: 12px; color: var(--muted);
  margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.lb-stats { text-align: right; flex-shrink: 0; }
.lb-total {
  font-family: 'Syne', sans-serif;
  font-size: 22px; font-weight: 800;
  color: var(--ink); line-height: 1;
}
.leaderboard-row.gold   .lb-total { color: var(--gold); }
.leaderboard-row.silver .lb-total { color: #777; }
.leaderboard-row.bronze .lb-total { color: #b87333; }
.lb-days {
  font-size: 11px; color: var(--muted);
  margin-top: 4px; text-transform: uppercase; letter-spacing: .05em;
}

/* ── Person name + email in admin table ──────────────── */
.td-person { 
  padding: 13px 20px;
  position: sticky; left: 0; background: var(--card); z-index: 1;
  display: flex; flex-direction: column; gap: 2px;
  min-width: 160px; border-right: 1px solid var(--cream);
}
.history-table tbody tr:hover .td-person { background: #fafaf8; }
.person-name  { font-weight: 600; font-size: 14px; color: var(--ink); }
.person-email { font-size: 11px; color: var(--muted); }

/* ══════════════════════════════════════════════════════
   HISTORY TABLE  (dates as columns)
══════════════════════════════════════════════════════ */
.table-scroll { overflow-x: auto; }

.history-table {
  width: 100%; border-collapse: collapse; font-size: 14px;
  min-width: 400px;
}

/* Simple (user) history table — vertical Date | Count list */
.history-table.simple {
  min-width: 0;
  width: 100%;
}
.history-table.simple .th-person,
.history-table.simple .td-date-cell {
  min-width: 0;
  padding: 12px 20px;
  text-align: left;
  width: auto;
}
.history-table.simple .th-date,
.history-table.simple .td-value {
  padding: 12px 20px;
  text-align: right;
  width: 100px;
  white-space: nowrap;
}
.history-table.simple .td-value {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 16px;
}
.history-table.simple .td-sum-label {
  text-align: left;
}
.history-table.simple .td-grand-total {
  text-align: right;
}

/* Compact calendar-style table (dates 1-31 as columns) */
.history-table.compact { min-width: 0; }
.history-table.compact .th-day {
  padding: 8px 4px;
  min-width: 32px;
  text-align: center;
  font-size: 11px; font-weight: 600;
  color: var(--muted); background: var(--paper);
  border-bottom: 1px solid var(--cream);
}
.history-table.compact .td-value {
  padding: 12px 4px;
  min-width: 32px;
  font-size: 13px;
}
.history-table.compact .th-total {
  padding: 8px 12px;
  text-align: center;
  font-size: 11px; font-weight: 700;
  background: var(--gold-bg);
  border-bottom: 1px solid var(--cream);
  border-left: 2px solid var(--gold-light);
  color: var(--ink);
  letter-spacing: .07em; text-transform: uppercase;
  white-space: nowrap;
}
.history-table.compact .td-month-total {
  padding: 12px 12px;
  text-align: center;
  background: var(--gold-bg);
  border-left: 2px solid var(--gold-light);
  font-family: 'Syne', sans-serif;
  font-weight: 700; font-size: 14px;
  color: var(--ink);
  white-space: nowrap;
}

/* Clickable cells in current month */
.td-value.clickable {
  cursor: pointer;
  background: var(--gold-bg);
  transition: background .15s, transform .1s;
  position: relative;
}
.td-value.clickable:hover {
  background: var(--gold-light);
  transform: scale(1.05);
}
.td-value.clickable:active { transform: scale(.95); }

.history-table thead tr { background: var(--paper); }

.th-person {
  padding: 11px 20px; text-align: left;
  font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); border-bottom: 1px solid var(--cream);
  position: sticky; left: 0; background: var(--paper); z-index: 2;
  white-space: nowrap; min-width: 120px;
}

.th-date {
  padding: 11px 16px; text-align: center;
  font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted); border-bottom: 1px solid var(--cream); white-space: nowrap;
}

.th-edit {
  padding: 11px 12px;
  border-bottom: 1px solid var(--cream);
  background: var(--paper);
  width: 90px;
}

.history-table tbody tr { border-bottom: 1px solid var(--cream); transition: background .12s; }
.history-table tbody tr:last-child { border-bottom: none; }
.history-table tbody tr:hover { background: #fafaf8; }

.td-person {
  padding: 13px 20px;
  position: sticky; left: 0; background: var(--card); z-index: 1;
  display: flex; align-items: center; gap: 10px;
  min-width: 120px; border-right: 1px solid var(--cream);
}
.history-table tbody tr:hover .td-person { background: #fafaf8; }

.td-value {
  padding: 13px 16px; text-align: center;
  font-family: 'Syne', sans-serif; font-weight: 600; font-size: 14px;
}
.td-value.has-value { color: var(--ink); }
.td-value.empty-value { color: var(--muted); }
.dash { font-weight: 300; font-size: 16px; }

.td-date-cell {
  padding: 13px 20px;
  font-size: 14px; color: var(--ink);
  background: var(--card);
  white-space: nowrap;
}
.history-table tbody tr:hover .td-date-cell { background: #fafaf8; }

/* Edit button cell */
.td-edit-cell {
  padding: 8px 12px; text-align: center;
}

.edit-btn {
  background: none;
  border: 1.5px solid var(--cream);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px; font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  color: var(--ink);
  cursor: pointer;
  transition: border-color .2s, color .2s, background .2s;
}
.edit-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-bg);
}

.locked-mini {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.month-badge.locked-badge {
  background: var(--cream); color: var(--muted);
}

.empty-history {
  padding: 40px 24px; text-align: center;
  font-size: 14px; color: var(--muted);
}

/* ── Month blocks ────────────────────────────────────── */
.month-block { margin-bottom: 28px; }
.month-block:last-child { margin-bottom: 0; }

.month-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px 12px;
  border-bottom: 1px solid var(--cream);
  background: var(--paper);
}
.month-header.current { background: var(--gold-bg); }

.month-label {
  font-family: 'Syne', sans-serif;
  font-size: 14px; font-weight: 700; color: var(--ink);
}
.month-badge {
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  background: var(--gold); color: var(--ink);
  padding: 3px 10px; border-radius: 100px;
}

/* ── Monthly total column ────────────────────────────── */
.th-total {
  padding: 11px 16px; text-align: center;
  font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink); border-bottom: 1px solid var(--cream);
  background: var(--gold-bg); white-space: nowrap;
  border-left: 2px solid var(--gold-light);
}

.td-month-total {
  padding: 13px 16px; text-align: center;
  font-family: 'Syne', sans-serif; font-weight: 700; font-size: 14px;
  background: var(--gold-bg);
  border-left: 2px solid var(--gold-light);
}
.td-month-total.has-value { color: var(--ink); }
.td-month-total.empty-value { color: var(--muted); }

/* ── Sum / daily total row ───────────────────────────── */
.sum-row { background: var(--paper); border-top: 2px solid var(--cream); }
.sum-row:hover { background: var(--paper) !important; }

.td-sum-label {
  padding: 12px 20px;
  font-family: 'Syne', sans-serif; font-size: 12px; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase; color: var(--muted);
  position: sticky; left: 0; background: var(--paper); z-index: 1;
  border-right: 1px solid var(--cream);
}

.td-sum {
  padding: 12px 16px; text-align: center;
  font-family: 'Syne', sans-serif; font-weight: 600; font-size: 13px;
  color: var(--teal);
}

.td-grand-total {
  padding: 12px 16px; text-align: center;
  font-family: 'Syne', sans-serif; font-weight: 800; font-size: 15px;
  color: var(--teal); background: var(--teal-light);
  border-left: 2px solid var(--teal);
}

/* ══════════════════════════════════════════════════════
   ADMIN
══════════════════════════════════════════════════════ */
.admin-name-input {
  width: 100%; background: var(--paper); border: 1.5px solid var(--cream);
  border-radius: 10px; padding: 9px 12px;
  font-family: 'DM Sans', sans-serif; font-size: 14px; color: var(--ink);
  outline: none; transition: border-color .2s;
}
.admin-name-input:focus { border-color: var(--gold); background: var(--gold-bg); }

.td-slot {
  font-family: 'Syne', sans-serif; font-weight: 700;
  color: var(--muted); font-size: 13px; text-align: center;
}

.admin-btn {
  border: none; border-radius: 8px; padding: 8px 16px;
  font-size: 13px; font-weight: 500; font-family: 'DM Sans', sans-serif;
  cursor: pointer; transition: opacity .15s, transform .1s;
}
.admin-btn:hover  { opacity: .85; transform: translateY(-1px); }
.admin-btn:active { transform: translateY(0); }
.admin-btn.save-name { background: var(--ink); color: #fff; }

.admin-user-block { margin-bottom: 32px; }
.admin-user-block:last-child { margin-bottom: 0; }
.admin-user-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 24px 12px;
  border-bottom: 1px solid var(--cream);
}
.admin-user-email { font-weight: 600; font-size: 14px; color: var(--ink); }

.loading-cell {
  text-align: center; padding: 48px 24px;
  color: var(--muted); font-size: 14px;
}

/* ══════════════════════════════════════════════════════
   TOAST
══════════════════════════════════════════════════════ */
.toast {
  position: fixed; top: 20px; left: 50%;
  transform: translateX(-50%) translateY(-70px);
  background: var(--ink); color: #fff;
  border-radius: 100px; padding: 12px 24px;
  font-size: 14px; font-weight: 500; z-index: 200;
  white-space: nowrap; pointer-events: none;
  transition: transform .35s cubic-bezier(.22,1,.36,1);
  box-shadow: var(--shadow-lg);
}
.toast.show  { transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--red); }

/* ══════════════════════════════════════════════════════
   HISTORY GRID — 2 columns on desktop, 1 on mobile
══════════════════════════════════════════════════════ */
#history-wrap {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  align-items: start;
}

@media (max-width: 768px) {
  #history-wrap {
    grid-template-columns: 1fr;
  }
}

/* ══════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .topbar { padding: 12px 16px; }
  .main-content, .admin-content { padding: 20px 16px 60px; }
  .card-header { padding: 18px 16px 14px; }
  .entry-table tbody td { padding: 10px 16px; }
  .value-input { width: 100px; }
  .btn-primary { padding: 11px 16px; font-size: 13px; }
  .th-person, .td-person { min-width: 130px; padding: 10px 16px; }
}