* { box-sizing: border-box; }

/* Always reserve space for the vertical scrollbar, even on pages/tabs short
   enough not to need one. Without this, switching between a tall view (has
   a scrollbar) and a short one (doesn't) shifts the whole page a few pixels
   left/right as the scrollbar appears/disappears -- feels like a jump/jank,
   most noticeable when switching portfolio tabs on index.html.
   scrollbar-gutter is the modern fix; overflow-y: scroll is a fallback for
   browsers that don't support it yet. */
html {
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

:root {
  --bg: #F7F3EC;
  --surface: #FFFFFF;
  --surface-2: #FBF8F3;
  --border: #ECE6D9;
  --text: #1C1C28;
  --text-muted: #6E6B78;
  --text-dim: #A4A0AC;

  --ink: #1C1C28;
  --ink-soft: #2E2C3A;

  --mustard: #F5B942;
  --mustard-soft: #FCE7B8;
  --mint: #62C9A6;
  --mint-soft: #CDEFE1;
  --rose: #F0819C;
  --rose-soft: #FBDCE3;
  --btc: #F7931A;
  --btc-soft: #FCE1BA;
  --sky: #6FB1F5;
  --sky-soft: #D7E9FD;

  --gain: #2FAE66;
  --gain-soft: #DEF3E6;
  --loss: #EF5B5B;
  --loss-soft: #FCE1E1;
}

body {
  margin: 0;
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--ink); }
h1, h2, h3 { font-family: 'Poppins', sans-serif; letter-spacing: -0.01em; }

/* ---------- Login page ---------- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, var(--mustard-soft) 0%, var(--bg) 45%);
}
.login-glow {
  position: absolute;
  top: -25%;
  left: 50%;
  transform: translateX(-50%);
  width: 620px;
  height: 620px;
  background: radial-gradient(circle, rgba(245, 185, 66, 0.35) 0%, transparent 65%);
  filter: blur(20px);
  pointer-events: none;
}
.login-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 44px 40px 34px;
  width: 380px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(28, 28, 40, 0.12);
}
.back-link {
  position: absolute;
  top: 18px;
  left: 22px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  text-decoration: none;
}
.back-link:hover { color: var(--ink); }
.login-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--mustard), #E8A222);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 10px 24px rgba(245, 185, 66, 0.45);
}
.login-card h1 { margin: 0 0 4px; font-size: 22px; font-weight: 800; }
.subtitle { color: var(--text-muted); font-size: 13.5px; margin-bottom: 26px; font-weight: 500; }
.login-card form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.login-card label { font-size: 12.5px; color: var(--text-muted); display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
.login-card input {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.login-card input:focus {
  outline: none;
  border-color: var(--mustard);
  box-shadow: 0 0 0 4px var(--mustard-soft);
}
.login-card button {
  margin-top: 8px;
  padding: 13px;
  border-radius: 999px;
  border: none;
  background: var(--ink);
  color: white;
  font-weight: 700;
  cursor: pointer;
  font-size: 14.5px;
  font-family: inherit;
  letter-spacing: 0.01em;
  transition: transform 0.12s, box-shadow 0.15s, background 0.15s;
}
.login-card button:hover { background: var(--ink-soft); box-shadow: 0 10px 24px rgba(28,28,40,0.25); transform: translateY(-1px); }
.login-card button:active { transform: translateY(0); }
.hint { margin-top: 22px; font-size: 11.5px; color: var(--text-dim); line-height: 1.5; font-weight: 500; }
.error { color: var(--loss); font-size: 13px; min-height: 18px; margin: 2px 0 0; font-weight: 600; }

.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 13px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: #ffffff;
  color: #1f1f1f;
  font-weight: 700;
  font-size: 14.5px;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
  transition: box-shadow 0.15s, transform 0.12s, border-color 0.15s;
}
.google-btn:hover { box-shadow: 0 10px 22px rgba(28,28,40,0.15); border-color: #c7c7c7; transform: translateY(-1px); }
.google-btn:active { transform: translateY(0); }
.google-btn svg { flex-shrink: 0; }

/* ---------- Dashboard ---------- */
.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 14px 28px;
  background: rgba(247, 243, 236, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
}
/* Left/right columns are equal (1fr each) so the middle nav column always
   sits at the true center of the header, no matter how much wider one side's
   content (e.g. the avatar+name button) is than the other's. */
.brand { display: flex; align-items: center; gap: 10px; justify-self: start; min-width: 0; text-decoration: none; }
.brand-mark {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--mustard), #E8A222);
  font-size: 16px;
  box-shadow: 0 6px 16px rgba(245, 185, 66, 0.4);
}
.topbar h1 { font-size: 18px; margin: 0; font-weight: 800; color: var(--ink); }
.topbar-right { display: flex; align-items: center; gap: 12px; justify-self: end; min-width: 0; }
.last-updated { font-size: 12px; color: var(--text-dim); font-weight: 500; }
.user-info {
  font-size: 12.5px;
  background: var(--mustard-soft);
  padding: 7px 14px;
  border-radius: 999px;
  color: #8A5A0A;
  font-weight: 700;
}
.hidden { display: none !important; }

/* ---------- Shared site header (center nav + user menu) ---------- */
.topbar-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
}
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}
.nav-link:hover { background: var(--surface); color: var(--ink); }
.nav-link.active { background: var(--ink); color: white; }

.nav-dropdown { position: relative; }
.nav-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 999px;
  border: none;
  background: transparent;
  font-size: 13.5px;
  font-weight: 700;
  font-family: inherit;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}
.nav-dropdown-toggle:hover, .nav-dropdown.open .nav-dropdown-toggle { background: var(--surface); color: var(--ink); }
.nav-dropdown-caret { font-size: 9px; transition: transform 0.15s; }
.nav-dropdown.open .nav-dropdown-caret { transform: rotate(180deg); }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 190px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(28,28,40,0.16);
  padding: 6px;
  z-index: 40;
}
.nav-dropdown:not(.open) .dropdown-menu,
.user-menu:not(.open) .dropdown-menu { display: none; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
  text-align: left;
}
.dropdown-item:hover { background: var(--surface-2); }
.dropdown-divider { height: 1px; background: var(--border); margin: 6px 4px; }

.user-menu { position: relative; }
.user-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 6px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  max-width: 200px;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.user-menu-btn:hover { border-color: var(--ink); }
.user-menu.open .user-menu-btn { border-color: var(--ink); box-shadow: 0 0 0 3px var(--mustard-soft); }
.user-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--mustard-soft);
}
.user-avatar-fallback {
  width: 26px; height: 26px;
  border-radius: 50%;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--mustard), #E8A222);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; color: white;
}
.user-menu-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu .dropdown-menu { left: auto; right: 0; transform: none; min-width: 210px; }
.user-menu-points {
  padding: 8px 12px 4px;
  font-size: 11.5px;
  color: var(--text-dim);
  font-weight: 600;
}

main { padding: 28px 28px 60px; max-width: 1200px; margin: 0 auto; }

.viewer-banner {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 18px;
  margin-bottom: 20px;
  display: inline-block;
}

.summary-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
.summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 18px 20px;
  box-shadow: 0 8px 24px rgba(28,28,40,0.05);
  transition: transform 0.15s, box-shadow 0.15s;
}
.summary-card:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(28,28,40,0.08); }
.summary-card .label { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; font-weight: 600; }
.summary-card .value { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; }

/* ---------- Tabs ---------- */
.tabs-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s, transform 0.12s, box-shadow 0.15s;
}
.tab-btn:hover { transform: translateY(-1px); border-color: var(--tab-accent, var(--mustard)); }
.tab-btn.active {
  background: var(--tab-accent-soft, var(--mustard-soft));
  border-color: var(--tab-accent, var(--mustard));
  color: var(--ink);
  box-shadow: 0 8px 20px rgba(28,28,40,0.08);
}
.tab-icon { font-size: 15px; }
.tab-pnl { font-size: 11.5px; font-weight: 800; padding: 2px 9px; border-radius: 999px; background: rgba(255,255,255,0.55); }
.tab-btn:not(.active) .tab-pnl.gain { background: var(--gain-soft); color: var(--gain); }
.tab-btn:not(.active) .tab-pnl.loss { background: var(--loss-soft); color: var(--loss); }
.tab-count { font-size: 11px; font-weight: 600; color: var(--text-muted); }
.tab-btn.active .tab-count { color: var(--ink); opacity: 0.7; }
.tab-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: var(--surface);
  border-color: var(--border);
  color: var(--text-muted);
}
.tab-btn:disabled:hover { transform: none; border-color: var(--border); }

/* ---------- Tab panel ---------- */
.hero-card {
  border-radius: 26px;
  padding: 26px 28px;
  margin-bottom: 18px;
  background: var(--tab-accent-soft, var(--mustard-soft));
  border: 1px solid rgba(28,28,40,0.06);
  color: var(--ink);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  box-shadow: 0 16px 36px rgba(28,28,40,0.07);
}
.hero-left { display: flex; align-items: center; gap: 14px; }
.hero-icon {
  width: 52px; height: 52px;
  border-radius: 16px;
  background: var(--tab-accent, var(--mustard));
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  box-shadow: 0 8px 18px rgba(28,28,40,0.15);
}
.hero-title { font-size: 19px; font-weight: 800; margin: 0; color: var(--ink); }
.hero-desc { font-size: 12.5px; font-weight: 600; color: var(--text-muted); margin-top: 2px; }
.hero-pnl { text-align: right; }
.hero-pnl .hero-pnl-value { font-size: 26px; font-weight: 800; line-height: 1.1; }
.hero-pnl .hero-pnl-value.neutral { color: var(--text-muted); }
.hero-pnl .hero-pnl-label { font-size: 11.5px; font-weight: 700; color: var(--text-muted); margin-top: 2px; }

.panel-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px 18px;
  box-shadow: 0 8px 22px rgba(28,28,40,0.05);
}
.stat-card .label { font-size: 11.5px; color: var(--text-muted); margin-bottom: 8px; font-weight: 600; }
.stat-card .value { font-size: 19px; font-weight: 800; letter-spacing: -0.01em; }

.panel-body {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 18px;
  align-items: start;
}

.chart-card, .table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: 0 10px 28px rgba(28,28,40,0.06);
  overflow: hidden;
}
.chart-card { padding: 22px; }
.chart-card-title { font-size: 12.5px; font-weight: 700; color: var(--text-muted); margin-bottom: 14px; }
.chart-wrap { position: relative; height: 200px; }
.chart-legend { margin-top: 16px; display: flex; flex-direction: column; gap: 9px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 500; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.legend-symbol { font-weight: 700; flex: 1; }
.legend-share { color: var(--text-muted); font-weight: 600; }

.table-card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.table-card-header h2 { margin: 0; font-size: 16px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.table-card-header .pf-desc { font-size: 12px; color: var(--text-dim); margin-top: 3px; font-weight: 500; }
.table-scroll { overflow-x: auto; }

.empty-state { color: var(--text-dim); font-size: 13px; font-weight: 500; text-align: center; padding: 30px 10px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 13px 16px; text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th {
  color: var(--text-dim);
  font-weight: 700;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}
tbody tr { border-bottom: 1px solid var(--surface-2); transition: background 0.12s; }
tbody tr:hover { background: var(--surface-2); }
.symbol-cell { font-weight: 800; color: var(--ink); }

.pnl-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12.5px;
}
.gain { color: var(--gain); }
.loss { color: var(--loss); }
.neutral { color: var(--text-dim); }
td .pnl-pill.gain { background: var(--gain-soft); }
td .pnl-pill.loss { background: var(--loss-soft); }
td .pnl-pill.neutral { background: var(--surface-2); }

.actions-cell { display: flex; gap: 6px; justify-content: flex-end; }
.icon-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.icon-btn:hover { border-color: var(--ink); color: var(--ink); background: white; }

.empty-row td { text-align: center; color: var(--text-dim); padding: 30px; font-weight: 500; }

.btn-primary, .btn-secondary {
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.15s, background 0.15s, border-color 0.15s;
}
.btn-primary {
  background: var(--ink);
  color: white;
}
.btn-primary:hover { background: var(--ink-soft); box-shadow: 0 10px 22px rgba(28,28,40,0.22); transform: translateY(-1px); }
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover { border-color: var(--ink); }
.btn-label { margin-left: 2px; }
.panel-cta { margin: 18px 24px 22px; }

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(28, 28, 40, 0.45);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--surface);
  border-radius: 26px;
  padding: 32px;
  width: 380px;
  box-shadow: 0 28px 64px rgba(28,28,40,0.25);
}
.modal h2 { margin: 0 0 18px; font-size: 17px; font-weight: 800; }
.modal form { display: flex; flex-direction: column; gap: 13px; }
.modal label { font-size: 12.5px; color: var(--text-muted); display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
.modal input {
  padding: 11px 13px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}
.modal input:focus { outline: none; border-color: var(--mustard); box-shadow: 0 0 0 4px var(--mustard-soft); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

.site-footer {
  text-align: center;
  padding: 24px;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 500;
}

/* ---------- Symbol suggestions dropdown ---------- */
.symbol-input-wrap { position: relative; }
.suggestions-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-height: 220px;
  overflow-y: auto;
  z-index: 200;
  box-shadow: 0 16px 36px rgba(28,28,40,0.15);
}
.suggestions-dropdown.hidden { display: none; }
.suggestion-item {
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.suggestion-item:hover, .suggestion-item.active {
  background: var(--surface-2);
}
.suggestion-symbol { font-weight: 800; color: var(--ink); }
.suggestion-meta { font-size: 11px; color: var(--text-dim); font-weight: 500; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggestion-name { font-size: 12px; color: var(--text-muted); font-weight: 500; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0 8px; }
.suggestion-empty { padding: 10px 14px; font-size: 12px; color: var(--text-dim); font-weight: 500; }

@media (max-width: 900px) {
  .summary-bar { grid-template-columns: repeat(2, 1fr); }
  .panel-body { grid-template-columns: 1fr; }
  .panel-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  main { padding: 18px 16px; }
  table { font-size: 12px; }
  th, td { padding: 10px; }
  .summary-bar { grid-template-columns: 1fr 1fr; }
  .btn-label { display: none; }
  .tab-btn { padding: 9px 13px; font-size: 12px; }
  .tab-name { display: none; }
  .hero-card { padding: 20px; }
  .hero-pnl { text-align: left; }
}

/* ---------- Today's purchases page ---------- */
.today-date-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0 0 20px;
}
.today-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}
.today-item {
  background: rgba(255,255,255,0.6);
  border-radius: 14px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.today-item-symbol { font-weight: 800; color: var(--ink); font-size: 14px; }
.today-item-detail { font-size: 13px; color: var(--text-muted); font-weight: 600; }
.today-item-note { font-size: 12px; color: var(--text-dim); font-weight: 500; font-style: italic; }

/* ---------- Trade page: type toggle + transaction rows ---------- */
.type-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}
.type-toggle-btn {
  flex: 1;
  padding: 10px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.type-toggle-btn.buy.active { background: var(--gain-soft); border-color: var(--gain); color: var(--gain); }
.type-toggle-btn.sell.active { background: var(--loss-soft); border-color: var(--loss); color: var(--loss); }

.tx-reason { text-align: left; color: var(--text-muted); font-weight: 500; max-width: 220px; white-space: normal; }
.tx-time { color: var(--text-dim); font-weight: 500; font-size: 12px; }

/* ---------- Date filter (trade page) ---------- */
.date-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.date-filter label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-muted);
}
.date-filter input[type="date"] {
  padding: 9px 12px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
}
.date-filter input[type="date"]:focus {
  outline: none;
  border-color: var(--mustard);
  box-shadow: 0 0 0 4px var(--mustard-soft);
}

/* ---------- Live chat / donate page ---------- */
.success { color: var(--gain); font-size: 13px; min-height: 18px; margin: 6px 0 0; font-weight: 600; }

/* generic form styling reused by the donate + chat-composer + admin-grant forms
   (same look as .modal form, but not nested inside a modal overlay) */
.table-card form { display: flex; flex-direction: column; gap: 13px; }
.table-card form label { font-size: 12.5px; color: var(--text-muted); display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
.table-card form input,
.table-card form textarea,
.table-card form select {
  padding: 11px 13px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
}
.table-card form input:focus,
.table-card form textarea:focus,
.table-card form select:focus {
  outline: none;
  border-color: var(--mustard);
  box-shadow: 0 0 0 4px var(--mustard-soft);
}
.table-card form button[type="submit"] { align-self: flex-start; }
.table-card form input[type="range"] {
  padding: 0;
  border: none;
  background: transparent;
  accent-color: var(--mustard);
}

.amount-picker { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.amount-btn {
  padding: 9px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.amount-btn:hover { border-color: var(--mustard); }
.amount-btn.active { background: var(--mustard-soft); border-color: var(--mustard); color: #8A5A0A; }

.qr-result {
  margin-top: 20px;
  padding: 22px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
}
.qr-result img { width: 200px; height: 200px; border-radius: 14px; background: white; padding: 10px; box-shadow: 0 8px 22px rgba(28,28,40,0.08); }
.qr-amount { font-weight: 800; font-size: 15px; margin: 12px 0 4px; }

/* Two columns on desktop: PromptPay QR on the left, slip upload on the
   right -- previously everything (QR + auto-verify box + mobile-upload box)
   stacked in one column and could show several QR-shaped images at once,
   which read as cluttered/confusing. Stacks back to one column on mobile. */
.qr-slip-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: stretch;
}
@media (max-width: 640px) {
  .qr-slip-grid { grid-template-columns: 1fr; }
}
.qr-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 16px;
  background: var(--surface);
  border-radius: 16px;
}
.qr-col-label { font-size: 11.5px; font-weight: 800; letter-spacing: 0.02em; color: var(--text-dim); text-transform: uppercase; }

/* ---------- Donate flow (live.html) ---------- */
.live-status-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  margin-bottom: 18px;
}
.live-status-pill {
  flex-shrink: 0;
  font-size: 12.5px;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: 999px;
}
.live-status-pill.offline { background: var(--loss-soft); color: #A23030; }
.live-status-pill.online { background: var(--gain-soft); color: #1F7A46; }
.live-status-text { font-size: 12.5px; color: var(--text-muted); font-weight: 600; }

.method-picker { display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0 16px; }
.method-btn {
  flex: 1 1 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  border-radius: 16px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, transform 0.12s;
}
.method-btn:hover { border-color: var(--mustard); transform: translateY(-1px); }
.method-btn.active { background: var(--ink); color: white; border-color: var(--ink); }
.method-icon { font-size: 17px; }

.method-section { margin-top: 4px; }
.method-section.hidden { display: none; }
.donate-cta { width: 100%; margin-top: 4px; }

/* Whole card is clickable (opens the native file picker) and auto-submits
   the moment a file is chosen/dropped -- no separate "verify" button
   anymore, see live.js. */
.slip-dropzone {
  flex: 1;
  width: 100%;
  min-height: 168px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1.5px dashed var(--border);
  border-radius: 16px;
  padding: 20px 16px;
  text-align: center;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, transform 0.12s;
}
.slip-dropzone:hover { border-color: var(--mustard); background: var(--mustard-soft); }
.slip-dropzone.dragover { border-color: var(--mustard); background: var(--mustard-soft); transform: scale(1.01); }
.slip-dropzone.uploading { cursor: default; opacity: 0.65; pointer-events: none; }
.slip-dropzone-icon { font-size: 32px; line-height: 1; }
.slip-dropzone-title { font-size: 13px; color: var(--text); font-weight: 700; }
.slip-dropzone-hint { font-size: 11.5px; color: var(--text-muted); font-weight: 500; }
.slip-dropzone input[type="file"] { display: none; }

.mobile-upload-trigger { margin-top: 12px; }

/* ---------- Mobile-upload handoff modal ---------- */
.mobile-upload-modal { text-align: center; width: 320px; }
.mobile-upload-modal img { width: 200px; height: 200px; border-radius: 14px; background: white; padding: 10px; box-shadow: 0 8px 22px rgba(28,28,40,0.08); margin: 14px auto 4px; }
.mobile-upload-countdown { font-size: 12px; font-weight: 700; color: var(--text-dim); margin-top: 6px; }

.donate-status-box {
  margin-top: 16px;
  text-align: center;
  padding: 22px;
  border-radius: 18px;
  background: var(--surface-2);
  font-weight: 700;
  font-size: 14px;
}
.donate-status-box.success { background: var(--gain-soft); color: #1F7A46; }
.donate-status-box.hidden { display: none; }
.spinner {
  width: 26px; height: 26px;
  margin: 0 auto 10px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--mustard);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.my-donations { display: flex; flex-direction: column; gap: 8px; }
.donation-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: var(--surface-2);
  border-radius: 14px;
  font-size: 13px;
  font-weight: 600;
}
.admin-donation-row { justify-content: space-between; }
.admin-donation-row .actions-cell { margin-left: auto; }
.donation-row.pinned { background: var(--mustard-soft); border: 1px solid var(--mustard); }
.pin-badge { font-size: 11.5px; font-weight: 800; color: #8A5A0A; }

.type-toggle-btn.lang-th.active { background: var(--sky-soft); border-color: var(--sky); color: #1C5C8A; }
.type-toggle-btn.lang-en.active { background: var(--mustard-soft); border-color: var(--mustard); color: #8A5A0A; }

.char-counter { text-align: right; font-size: 11.5px; color: var(--text-dim); font-weight: 600; margin-top: -4px; }

.two-col-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: start;
}
@media (max-width: 900px) {
  .two-col-grid { grid-template-columns: 1fr; }
}

/* ---------- Admin panel tabs ---------- */
.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
  border-bottom: 2px solid var(--surface-2);
  padding-bottom: 0;
}
.admin-tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  background: transparent;
  border-radius: 14px 14px 0 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dim);
  cursor: pointer;
  transform: translateY(2px);
}
.admin-tab-btn:hover { color: var(--ink); background: var(--surface-2); }
.admin-tab-btn.active {
  color: #8A5A0A;
  background: var(--mustard-soft);
  border-bottom: 2px solid var(--mustard);
}
.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #EF5B5B;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}
.tab-badge.hidden { display: none; }
.admin-tab-panel.hidden { display: none; }

/* ---------- Unified message list status badge ---------- */
.msg-status-badge { font-size: 11px; font-weight: 800; padding: 3px 10px; border-radius: 999px; }
.msg-status-badge.queued { background: var(--mustard-soft); color: #8A5A0A; }
.msg-status-badge.played { background: #E4F5E9; color: #1F8A4C; }

/* ---------- Banned-word chips (admin "คำหยาบ" tab) ---------- */
.word-chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.word-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 14px;
  background: var(--surface-2);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}
.word-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 999px;
  background: #FCE1E1;
  color: #C23B3B;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  line-height: 1;
}
.word-chip-remove:hover { background: #EF5B5B; color: #fff; }

/* ---------- "ข้อความที่รอขึ้นจอ" queue-position badge ---------- */
.queue-position-badge {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--mustard-soft);
  color: #8A5A0A;
  white-space: nowrap;
}
.queue-position-badge.next { background: #E4F5E9; color: #1F8A4C; }

/* ---------- Data tables (admin message list, "รายการโดเนทของฉัน") ---------- */
.table-scroll { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.admin-table th,
.admin-table td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--surface-2);
  white-space: nowrap;
}
.admin-table td.table-cell-message { white-space: normal; min-width: 220px; max-width: 420px; }
.admin-table th {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 2px solid var(--surface-2);
}
.admin-table tbody tr:hover { background: var(--surface-2); }
.admin-table tbody tr.pinned-row { background: var(--mustard-soft); }
.admin-table tbody tr.pinned-row:hover { background: var(--mustard-soft); }
.admin-table td .tx-time { display: block; margin-top: 2px; font-size: 11.5px; color: var(--text-dim); font-weight: 600; }
.admin-table td.actions-cell { display: table-cell; white-space: nowrap; }
.admin-table td.actions-cell .icon-btn { margin-right: 6px; }
