/* Marblehead Rotary Club app - shared styles. Light and dark from the same tokens. */
:root {
  color-scheme: light dark;
  --rotary-blue: #17458f;
  --rotary-gold: #f7a81b;

  --page: #f9f9f7;
  --surface: #fcfcfb;
  --text: #0b0b0b;
  --text-secondary: #52514e;
  --muted: #898781;
  --hairline: #e1e0d9;
  --border: rgba(11, 11, 11, 0.1);
  --accent: var(--rotary-blue);
  --accent-ink: #ffffff;
  --link: #1c5cab;
  --danger: #d03b3b;
  --good: #006300;
  --warning-bg: #fff6e0;
  --warning-ink: #6b4a00;
  --error-bg: #fdecec;
  --error-ink: #8a1f1f;
  --success-bg: #e8f6e8;
  --success-ink: #0f5a0f;
  --info-bg: #eaf1fb;
  --info-ink: #163d73;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #0d0d0d;
    --surface: #1a1a19;
    --text: #ffffff;
    --text-secondary: #c3c2b7;
    --muted: #898781;
    --hairline: #2c2c2a;
    --border: rgba(255, 255, 255, 0.1);
    --accent: #2f63b5;
    --link: #86b6ef;
    --danger: #e66767;
    --good: #0ca30c;
    --warning-bg: #2e2510;
    --warning-ink: #f2d38a;
    --error-bg: #3a1a1a;
    --error-ink: #f2a3a3;
    --success-bg: #14301a;
    --success-ink: #9ee0a5;
    --info-bg: #16233a;
    --info-ink: #b7d3f6;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
main { flex: 1; }
a { color: var(--link); }
h1 { font-size: 1.75rem; line-height: 1.2; margin: 1.5rem 0 0.5rem; }
h2 { font-size: 1.15rem; margin: 0 0 0.75rem; }
h3 { font-size: 1rem; margin: 1.25rem 0 0.25rem; }
p { margin: 0.5rem 0; }
.lede { color: var(--text-secondary); font-size: 1.05rem; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; }
.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.container.narrow { max-width: 640px; }

.site-header { border-bottom: 3px solid var(--rotary-gold); background: var(--surface); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: 0.01em; }
.brand-logo { width: 30px; height: 30px; flex: none; }
.brand-sub { color: var(--text-secondary); font-weight: 400; }
.site-footer { margin-top: 3rem; padding: 1.25rem 0; border-top: 1px solid var(--hairline); color: var(--muted); font-size: 0.875rem; }
.site-footer a { color: var(--text-secondary); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.btn {
  display: inline-block;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 14px;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  line-height: 1.3;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--hairline); }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: 0.6; cursor: default; }

.form label { display: block; font-weight: 600; margin-bottom: 4px; }
.form input[type="password"], .form input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--page);
  color: var(--text);
  font: inherit;
  margin-bottom: 12px;
}
.notice, .error { border-radius: 8px; padding: 10px 12px; }
.notice { background: var(--warning-bg); color: var(--warning-ink); }
.error { background: var(--error-bg); color: var(--error-ink); }
.notice:empty, .error:empty { display: none; }

/* Legal pages */
.legal h2 { margin-top: 1.75rem; }
.legal ol, .legal ul { padding-left: 1.4rem; }
.legal li { margin: 0.25rem 0; }

/* Dashboard */
.connection { margin-top: 2rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.connection .status { margin: 0; color: var(--text-secondary); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.message { border-radius: 8px; padding: 10px 12px; margin: 20px 0 0; background: var(--info-bg); color: var(--info-ink); }
.message.error { background: var(--error-bg); color: var(--error-ink); }
.message.success { background: var(--success-bg); color: var(--success-ink); }

.controls { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: end; margin: 20px 0 8px; }
.control { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; color: var(--text-secondary); }
.control select, .control input[type="range"] { font: inherit; color: var(--text); }
.control select { padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.segmented { border: 0; padding: 0; margin: 0; }
.segmented legend { padding: 0; margin-bottom: 4px; }
.segmented label { display: inline-flex; align-items: center; gap: 4px; margin-right: 12px; color: var(--text); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 12px 0 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.tile-label { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.tile-value { font-size: 1.6rem; font-weight: 700; }
.tile-value.negative, .num.negative { color: var(--danger); }

.warnings { background: var(--warning-bg); color: var(--warning-ink); border-radius: 8px; padding: 10px 12px; margin-bottom: 16px; }
.warnings ul { margin: 4px 0 0; padding-left: 1.2rem; }

.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.chart-wrap { position: relative; height: 340px; }
.empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); margin: 0; text-align: center; padding: 16px; }
.acct-table { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: 0.9rem; }
.acct-table th { text-align: left; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--hairline); padding: 6px 4px; }
.acct-table td { padding: 6px 4px; border-bottom: 1px solid var(--hairline); vertical-align: top; }
.acct-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.acct-table tr.total td { font-weight: 700; border-bottom: 0; }
.chip { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: baseline; }

@media (max-width: 480px) {
  .chart-wrap { height: 300px; }
  .tile-value { font-size: 1.35rem; }
}

/* Report tabs */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--hairline); margin: 20px 0 0; }
.tab {
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--rotary-gold); }

/* Line-item event report */
.report-card h2 { margin-bottom: 4px; }
.table-wrap { overflow-x: auto; margin-top: 8px; }
.txn-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.txn-table th, .txn-table td { padding: 6px 8px; border-bottom: 1px solid var(--hairline); text-align: left; vertical-align: top; }
.txn-table th { color: var(--muted); font-weight: 600; white-space: nowrap; }
.txn-table th.num, .txn-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.txn-table td.date { white-space: nowrap; }
.txn-table th.date { width: 12%; }
.txn-table th.type { width: 15%; }
.txn-table th.name { width: 24%; }
.txn-table th.memo { width: 36%; }
.txn-table th.num { width: 13%; }
.txn-table td.memo { overflow-wrap: anywhere; }
.txn-table tr.group-head td { background: var(--page); font-weight: 700; padding-top: 12px; }
.txn-table tr.empty-row td { color: var(--muted); font-style: italic; }
.txn-table tr.subtotal td { font-weight: 600; }
.txn-table tr.total td { font-weight: 700; border-top: 2px solid var(--muted); }
.txn-table tr.net td { font-weight: 700; font-size: 1rem; border-bottom: 0; padding-top: 12px; }

/* Phone layout for the line-item report: no sideways scrolling. The script leaves the
   Type and Name cells out and shortens dates; the header cells are hidden here so the
   columns disappear entirely, and the description wraps onto as many lines as it needs. */
@media (max-width: 640px) {
  .table-wrap { overflow-x: visible; }
  .txn-table th.type, .txn-table th.name { display: none; }
  .txn-table th.date { width: 4.5em; }
  .txn-table th.memo { width: auto; }
  .txn-table th.num { width: 6.5em; }
  .txn-table td.memo { white-space: normal; }
}
