/* =========================================================
   App shell — My Account & Admin dashboard
   ========================================================= */

.page-hero--compact { min-height: clamp(260px, 36vh, 340px); }
.page-hero--compact .page-hero__inner { padding-bottom: 64px; }

/* Auth card */
.auth-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 440px); gap: clamp(28px, 5vw, 72px); align-items: center; }
@media (max-width: 900px) { .auth-wrap { grid-template-columns: 1fr; } }
.auth-card { padding: clamp(22px, 3vw, 34px); }
.auth-card .tabs { width: 100%; }
.auth-card .tab { flex: 1; }
.or { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-size: 13px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.btn--google { --bg: #fff; --fg: var(--ink); --bd: var(--line-2); }
.btn--google:hover { --bd: var(--brand-900); box-shadow: none; }
.perk { display: flex; gap: 14px; align-items: flex-start; }
.perk + .perk { margin-top: 18px; }

/* Account / dashboard layout */
.app { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 28px; align-items: start; }
@media (max-width: 960px) { .app { grid-template-columns: 1fr; } }
.side-nav { position: sticky; top: calc(var(--header-h) + var(--topbar-h) + 16px); display: grid; gap: 4px; padding: 10px; }
.side-nav a, .side-nav button { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: var(--r); font-weight: 600; font-size: 14.5px; color: var(--ink-2); text-align: left; width: 100%; transition: background-color .2s, color .2s; }
.side-nav a:hover, .side-nav button:hover { background: var(--mist); color: var(--ink); }
.side-nav a[aria-current="page"] { background: var(--brand-900); color: #fff; }
.side-nav a[aria-current="page"] .icon { color: var(--accent-400); }
.side-nav .badge { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--accent-500); color: var(--brand-950); font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.side-nav hr { border: 0; height: 1px; background: var(--line); margin: 8px 4px; }
@media (max-width: 960px) {
  .side-nav { position: static; display: flex; overflow-x: auto; gap: 6px; padding: 6px; scrollbar-width: none; }
  .side-nav::-webkit-scrollbar { display: none; }
  .side-nav a, .side-nav button { white-space: nowrap; width: auto; padding: 9px 14px; }
  .side-nav hr { display: none; }
}

.panel-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.panel-head h2 { font-family: var(--f-display); font-weight: 800; letter-spacing: -.02em; font-size: clamp(26px, 3vw, 34px); }
.panel-head p { color: var(--ink-3); font-size: 14.5px; margin-top: 4px; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.stat { padding: 18px 20px; border-radius: var(--r-lg); background: var(--paper); border: 1px solid var(--line); position: relative; overflow: hidden; }
.stat__label { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); display: flex; align-items: center; gap: 8px; }
.stat__value { font-family: var(--f-display); font-weight: 800; letter-spacing: -.02em; font-size: 30px; line-height: 1.1; margin-top: 8px; font-variant-numeric: tabular-nums; }
.stat__sub { font-size: 12.5px; color: var(--ink-3); margin-top: 4px; }
.stat--brand { background: var(--brand-900); border-color: var(--brand-900); color: #fff; }
.stat--brand .stat__label, .stat--brand .stat__sub { color: rgba(255, 255, 255, .6); }
.stat--brand .stat__value { color: var(--accent-200); }
.up { color: var(--green); } .down { color: var(--red); }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--paper); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; padding: 12px 14px; background: var(--ivory); border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color .15s; }
.table tbody tr:hover { background: #f6fbfa; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .actions { text-align: right; white-space: nowrap; }
.table td small { color: var(--ink-3); display: block; }
.table-empty { padding: 36px; text-align: center; color: var(--ink-3); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .input, .toolbar .select { min-height: 42px; padding-top: 8px; padding-bottom: 8px; width: auto; font-size: 14px; }
.toolbar .grow { flex: 1; min-width: 200px; }

.status { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; text-transform: capitalize; white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status--paid, .status--answered, .status--formed, .status--closed { background: var(--green-50); color: var(--green); }
.status--pending, .status--open, .status--gathering { background: #fff4dc; color: #8a5a00; }
.status--pledged { background: var(--blue-50); color: var(--blue); }
.status--failed, .status--cancelled, .status--refunded { background: var(--red-50); color: var(--red); }

/* Threads / chat */
.threads { display: grid; grid-template-columns: 320px minmax(0, 1fr); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--paper); overflow: hidden; min-height: 520px; }
@media (max-width: 860px) { .threads { grid-template-columns: 1fr; } .threads.is-reading .thread-list { display: none; } .threads:not(.is-reading) .thread-view { display: none; } }
.thread-list { border-right: 1px solid var(--line); overflow-y: auto; max-height: 640px; }
.thread-item { display: block; width: 100%; text-align: left; padding: 14px 16px; border-bottom: 1px solid var(--line); transition: background-color .15s; }
.thread-item:hover { background: var(--ivory); }
.thread-item.is-active { background: var(--accent-50); }
.thread-item b { display: flex; justify-content: space-between; gap: 8px; font-size: 14.5px; }
.thread-item p { font-size: 13px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.thread-item .unread { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-500); display: inline-block; flex: none; margin-top: 6px; }
.thread-view { display: flex; flex-direction: column; min-width: 0; }
.thread-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.bubbles { flex: 1; padding: 20px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; max-height: 460px; background: var(--ivory); }
.bubble { max-width: 78%; padding: 12px 16px; border-radius: 18px; font-size: 14.5px; line-height: 1.55; white-space: pre-wrap; word-wrap: break-word; }
.bubble small { display: block; font-size: 11.5px; opacity: .6; margin-top: 6px; }
.bubble--me { align-self: flex-end; background: var(--brand-900); color: #fff; border-bottom-right-radius: 6px; }
.bubble--them { align-self: flex-start; background: var(--paper); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.composer { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--line); align-items: flex-end; }
.composer .textarea { min-height: 48px; max-height: 160px; resize: none; }

/* Q&A */
.qa { padding: 20px 22px; }
.qa + .qa { margin-top: 12px; }
.qa__q { font-weight: 600; white-space: pre-wrap; }
.qa__a { margin-top: 14px; padding: 14px 16px; border-radius: var(--r); background: var(--accent-50); border: 1px solid var(--accent-200); white-space: pre-wrap; }
.qa__a b { display: flex; align-items: center; gap: 8px; color: var(--accent-700); font-size: 13px; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 6px; }

/* Charts */
.chart { width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--f-body); font-size: 11px; fill: var(--ink-3); }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .bar-a { fill: var(--brand-700); }
.chart .bar-b { fill: var(--accent-500); }
.chart rect { transition: opacity .2s; }
.chart rect:hover { opacity: .8; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.hbar { display: grid; gap: 10px; }
.hbar__row { display: grid; grid-template-columns: 150px 1fr auto; gap: 12px; align-items: center; font-size: 13.5px; }
.hbar__track { height: 10px; border-radius: 10px; background: var(--mist); overflow: hidden; }
.hbar__fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand-700), var(--brand-600)); }
.hbar--accent .hbar__fill { background: linear-gradient(90deg, var(--accent-600), var(--accent-400)); }
.hbar__row span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Admin shell */
body.admin { background: #eef5f4; }
.admin-shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100svh; }
.admin-side { position: sticky; top: 0; height: 100svh; overflow-y: auto; background: var(--brand-950); color: rgba(255, 255, 255, .78); padding: 18px 14px; display: flex; flex-direction: column; gap: 4px; background-image: radial-gradient(120% 40% at 0% 0%, rgba(43, 191, 136, .14), transparent 60%); }
.admin-side .brand { padding: 4px 8px 18px; color: #fff; }
.admin-side__group { font-family: var(--f-caps); font-size: 10.5px; letter-spacing: .22em; color: rgba(255, 255, 255, .4); padding: 16px 12px 6px; }
.admin-side a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; font-size: 14px; font-weight: 600; transition: background-color .2s, color .2s; }
.admin-side a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.admin-side a[aria-current="page"] { background: rgba(201, 161, 91, .16); color: var(--accent-200); }
.admin-side a[aria-current="page"] .icon { color: var(--accent-400); }
.admin-side .badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent-500); color: var(--brand-950); font-size: 11.5px; font-weight: 700; display: grid; place-items: center; }
.admin-side__foot { margin-top: auto; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, .08); display: grid; gap: 8px; }
.admin-main { min-width: 0; grid-column: 2; grid-row: 1; }
.admin-side { grid-column: 1; grid-row: 1; }
.admin-scrim { display: none; }
.admin-top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 14px clamp(16px, 3vw, 32px); background: rgba(238, 245, 244, .9); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.admin-top h1 { font-family: var(--f-display); font-weight: 800; letter-spacing: -.02em; font-size: 21px; }
.admin-top .who { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.admin-content { padding: clamp(18px, 3vw, 32px); display: grid; gap: 22px; }
.admin-burger { display: none; }
@media (max-width: 1000px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-main { grid-column: 1; }
  .admin-side { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 120; transform: translateX(-100%); transition: transform .4s var(--ease); }
  .admin-shell.nav-open .admin-side { transform: none; box-shadow: var(--shadow-3); }
  .admin-burger { display: inline-grid; }
  .admin-scrim { position: fixed; inset: 0; background: rgba(5, 42, 54, .45); z-index: 110; }
  .admin-shell.nav-open .admin-scrim { display: block; }
}
.cols { display: grid; gap: 22px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols--3-2 { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
@media (max-width: 1100px) { .cols, .cols--3-2 { grid-template-columns: 1fr; } }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h3 { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-head h3 svg { flex: none; width: 18px; height: 18px; color: var(--brand-700); }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); font-size: 14px; }
.list-row:first-child { border-top: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .grow small { display: block; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.switch { position: relative; display: inline-block; vertical-align: middle; width: 42px; height: 24px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; z-index: 1; margin: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line-2); transition: background-color .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .25s var(--ease); }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent-500); outline-offset: 2px; }
.preset-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.preset-chips .chip button { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; margin-right: -4px; color: var(--ink-3); }
.preset-chips .chip button:hover { background: var(--line); color: var(--ink); }
.dropzone { border: 2px dashed var(--line-2); border-radius: var(--r-lg); padding: 28px; text-align: center; background: var(--ivory); transition: border-color .2s, background-color .2s; cursor: pointer; }
.dropzone.is-over { border-color: var(--brand-900); background: var(--paper); }
.progress { height: 8px; border-radius: 8px; background: var(--mist); overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand-700), var(--accent-500)); transition: width .2s; }
.sched-edit { display: grid; gap: 8px; }
.sched-edit__row { display: grid; grid-template-columns: 130px 120px 150px minmax(0, 1fr) minmax(0, 1fr) 40px; gap: 8px; align-items: center; }
.sched-edit__row .input, .sched-edit__row .select { min-height: 40px; padding: 8px 10px; font-size: 14px; }
.sched-edit__row .select { padding-right: 30px; background-position: right 8px center; }
@media (max-width: 900px) { .sched-edit__row { grid-template-columns: 1fr 1fr; } }
.gate { min-height: 100svh; display: grid; place-items: center; padding: 20px; background: var(--brand-950); position: relative; overflow: hidden; }
.gate .card { position: relative; z-index: 2; width: min(460px, 100%); }

@media print {
  .admin-side, .admin-top, .site-header, .site-footer, .dock, .toolbar, .no-print, .side-nav, .page-hero { display: none !important; }
  .admin-shell, .app { display: block; }
  body, body.admin { background: #fff; }
  .card { box-shadow: none; }
}

/* Top sponsor line: 5-week booking calendar */
.tl-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.tl-dow { font-size: 11px; font-weight: 700; color: var(--muted); text-align: center; padding-bottom: 2px; }
.tl-day { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 54px; padding: 6px 8px; border-radius: 10px; border: 1px solid var(--line); background: #fff; text-align: start; cursor: pointer; font: inherit; color: var(--ink); transition: border-color .2s, background .2s; min-width: 0; }
.tl-day:hover { border-color: var(--brand-700); }
.tl-day b { font-size: 12.5px; }
.tl-day small { font-size: 11px; line-height: 1.2; color: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.tl-day.is-booked { background: linear-gradient(135deg, #0f5f79, #12875a); border-color: transparent; color: #fff; }
.tl-day.is-pending { background: #fff4dc; border-color: #f0dcae; color: #8a5a00; }
.tl-day.is-today { box-shadow: 0 0 0 2px var(--accent-200, #a6e3c8); }
@media (max-width: 640px) { .tl-day { min-height: 44px; padding: 5px; } .tl-day small { display: none; } }

/* Account → Notifications */
.notif-channels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.notif-table { padding: 6px 0; overflow: hidden; }
.notif-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) 64px 64px; gap: 14px; align-items: center; padding: 14px 20px; border-top: 1px solid var(--line); }
.notif-row:first-child { border-top: 0; }
.notif-row small { display: block; color: var(--ink-3); font-size: 13px; margin-top: 2px; }
.notif-row .switch { justify-self: center; }
.notif-row--head { padding-block: 8px; font-size: 11.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); background: var(--mist); }
.notif-row--head span:nth-child(n+3) { text-align: center; }
.notif-extra { margin: 0 20px 14px 74px; padding: 14px 16px; border-radius: 14px; background: var(--mist); border: 1px solid var(--line); }
.notif-extra .check { font-size: 14px; }
@media (max-width: 640px) {
  .notif-channels { grid-template-columns: 1fr; }
  .notif-row { grid-template-columns: minmax(0, 1fr) 52px 52px; padding: 12px 14px; gap: 10px; }
  .notif-row > .icon-tile, .notif-row--head > span:first-child { display: none; }
  .notif-extra { margin: 0 14px 12px; }
}

/* Phones: stack every multi-column form / panel, even ones with column counts set inline */
@media (max-width: 640px) {
  .admin-content .form-row, .modal .form-row, .admin-content .cols, .modal .cols { grid-template-columns: 1fr !important; }
  .admin-content [data-tpls] { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  .panel-head { flex-wrap: wrap; gap: 12px; }
  .panel-head > * { min-width: 0; }
  .card-head { gap: 8px; }
  .admin-content .toolbar { flex-wrap: wrap; }
  .admin-content .toolbar > * { flex: 1 1 140px; }
}

/* ---------- My Account on phones ---------- */
@media (max-width: 640px) {
  .page-hero--account { min-height: 0; }
  .page-hero--account .page-hero__inner { padding-top: calc(var(--header-h) + var(--topbar-h) + 28px); padding-bottom: 28px; }
  .page-hero--account .page-hero__title { font-size: 34px; }
  .page-hero--account .page-hero__lead, .page-hero--account .slider-ui { display: none; }
  .page-hero--account + .section { padding-top: 18px; }

  /* Section menu: all options visible as an icon grid */
  .app { gap: 16px; }
  .side-nav { display: grid !important; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; padding: 8px; overflow: visible; }
  .side-nav a, .side-nav button { position: relative; flex-direction: column; justify-content: center; gap: 4px; padding: 10px 2px; min-height: 64px; white-space: normal; text-align: center; font-size: 11.5px; line-height: 1.15; width: 100%; border-radius: 12px; }
  .side-nav a .icon, .side-nav button .icon { width: 20px; height: 20px; }
  .side-nav .badge { position: absolute; top: 4px; right: 6px; margin: 0; min-width: 18px; height: 18px; font-size: 11px; padding: 0 5px; }
  .side-nav hr { display: none; }

  /* Numbers: compact 2 × 2 */
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 14px; }
  .stat__label { font-size: 11.5px; }
  .stat__value { font-size: 26px; }
  .stat__sub { font-size: 12px; }
  #acct-panel .panel-head { gap: 10px; }
  #acct-panel .panel-head h2 { font-size: 24px; }
  #acct-panel .panel-head .row { width: 100%; }
  #acct-panel .panel-head .row > .btn { flex: 1; justify-content: center; }
}
@media (max-width: 640px) {
  /* Donations: one card per gift instead of a wide table */
  #acct-panel .table-wrap { overflow: visible; border: 0; background: none; }
  #acct-panel .table, #acct-panel .table tbody { display: block; width: 100%; }
  #acct-panel .table thead { display: none; }
  #acct-panel .table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "desc amount" "date status" "method actions"; gap: 4px 12px; padding: 14px 16px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); }
  #acct-panel .table td { display: block; padding: 0; border: 0; text-align: start; min-width: 0; }
  #acct-panel .table td:nth-child(1) { grid-area: date; color: var(--ink-3); font-size: 13px; }
  #acct-panel .table td:nth-child(2) { grid-area: desc; font-weight: 700; }
  #acct-panel .table td:nth-child(3) { grid-area: method; color: var(--ink-3); font-size: 13px; }
  #acct-panel .table td:nth-child(4) { grid-area: status; justify-self: end; }
  #acct-panel .table td:nth-child(5) { grid-area: amount; justify-self: end; font-size: 17px; }
  #acct-panel .table td:nth-child(6) { grid-area: actions; justify-self: end; display: flex; gap: 6px; }
  #acct-panel .table td.table-empty { grid-column: 1 / -1; grid-area: auto; text-align: center; }
  #acct-panel .table tr:has(.table-empty) { display: block; }
}

/* Bulk actions bar above a table (shown when rows are ticked) */
.bulk { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; margin-bottom: 12px; border-radius: 12px; background: var(--mist); border: 1px solid var(--line); }
.bulk[hidden] { display: none; }
.bulk > b { margin-right: auto; }
