/* 3rd Act Apps — shared theme
   Extracted verbatim from the production To-Do List and Personal Finance
   (Bill Reminders) apps on 2026-10-18 so the Cloudflare builds
   (spend / todo / gifts) render with the SAME values, not a re-interpretation.
   Source: ts-spaces/to-do-list/client/src/theme.css and
   ts-spaces/bill-reminders/client/src/theme.css (identical core tokens;
   bill-reminders adds the semantic colors below the core block). */

:root {
  color-scheme: light dark;

  /* Core palette (identical in both source apps) */
  --bg: #f4f8fd;
  --surface: #ffffff;
  --text: #16283f;
  --dim: #647d99;
  --border: #d7e4f2;
  --accent: #1668c4;
  --accent-soft: #e1eefb;

  /* Semantic colors (from Personal Finance) */
  --amber: #d97706;
  --amber-soft: #fdf0dd;
  --green: #15803d;
  --green-soft: #dcf2e3;
  --pill-blue: #1668c4;
  --pill-green: #15803d;
  --red: #b3372c;
  --red-soft: #fae7e4;

  --radius: 12px;

  /* Type scale (identical in both source apps) */
  --text-xs: 12px;   --text-xs-lh: 16px;
  --text-sm: 14px;   --text-sm-lh: 20px;
  --text-base: 16px; --text-base-lh: 24px;
  --text-lg: 18px;   --text-lg-lh: 28px;
  --text-xl: 20px;   --text-xl-lh: 28px;
  --text-2xl: 24px;  --text-2xl-lh: 32px;
  --text-3xl: 30px;  --text-3xl-lh: 36px;

  --font-display: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --font-body: system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1524;
    --surface: #14253d;
    --text: #eaf2fc;
    --dim: #93a9c4;
    --border: #2a4160;
    --accent: #6db1f5;
    --accent-soft: #1d3a5c;
    --amber: #f0a840;
    --amber-soft: #3d2f14;
    --green: #4ade80;
    --green-soft: #14532d;
    --pill-blue: #2b7cd3;
    --pill-green: #1d9e4b;
    --red: #f0837a;
    --red-soft: #40201d;
  }
}

/* Base */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--text-base-lh);
  -webkit-font-smoothing: antialiased;
}
.font-display { font-family: var(--font-display); }

/* App header (both apps: display-font title, accent eyebrow labels) */
.app-header { padding: 20px 20px 8px; }
.app-title { font-family: var(--font-display); font-size: var(--text-2xl); line-height: var(--text-2xl-lh); margin: 0; }
.eyebrow { font-size: var(--text-sm); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); }

/* List rows (both apps: surface card rows, 12px radius, border, dim previews) */
.row {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.row + .row { margin-top: 8px; }
.row-title { font-size: var(--text-base); font-weight: 500; color: var(--text); overflow-wrap: anywhere; }
.row-preview { display: block; margin-top: 2px; font-size: var(--text-sm); line-height: 1.35; color: var(--dim); }
.row-meta { display: flex; align-items: center; gap: 12px; margin-top: 2px; font-size: var(--text-sm); color: var(--dim); }

/* Check-off circle (To-Do: 22px circle; checked = accent fill, white check) */
.check-circle {
  flex: none; width: 22px; height: 22px; border-radius: 9999px;
  border: 2px solid var(--border); background: transparent;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0; margin-top: 2px;
}
.check-circle.done { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Round icon buttons (header nav arrows etc.: 36–40px circles) */
.icon-btn {
  flex: none; width: 40px; height: 40px; border-radius: 9999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--accent);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.icon-btn:active { background: var(--accent-soft); }
.icon-btn.sm { width: 36px; height: 36px; }

/* Buttons (primary = accent fill white text; secondary = bordered) */
.btn-primary {
  border: none; border-radius: 8px; background: var(--accent); color: #fff;
  padding: 10px 16px; font-size: var(--text-base); font-weight: 600; cursor: pointer;
}
.btn-secondary {
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text);
  padding: 10px 16px; font-size: var(--text-base); font-weight: 600; cursor: pointer;
}

/* Pills (Personal Finance: subscription = blue "S", business = green "B") */
.pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9999px;
  font-size: 11px; font-weight: 700; color: #fff; vertical-align: middle;
}
.pill-blue { background: var(--pill-blue); }
.pill-green { background: var(--pill-green); }

/* Status labels that replace buttons (Personal Finance "Auto" label) */
.static-label { font-size: var(--text-sm); font-weight: 600; color: var(--dim); padding: 8px 4px; }

/* Centered modal (both apps: ~65% height detail sheet, 16px radius, dim backdrop) */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.5); padding: 16px;
}
.modal {
  display: flex; flex-direction: column; overflow: hidden;
  width: 100%; max-width: 32rem; max-height: 65vh;
  border-radius: 16px; background: var(--surface);
  box-shadow: 0 25px 50px -12px rgba(0,0,0,.25);
}
.modal-head { display: flex; align-items: flex-start; gap: 12px; border-bottom: 1px solid var(--border); padding: 20px 20px 16px; }
.modal-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 20px; }
.modal-label { font-size: var(--text-sm); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); margin: 16px 0 4px; }
.modal-label:first-child { margin-top: 0; }

/* Stat tiles (Gifts: three-across tappable summary boxes) */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 8px; text-align: center; cursor: pointer; border-top: 1px solid var(--border);
}
.tile:active { background: var(--accent-soft); }
.tile-value { font-family: var(--font-display); font-size: var(--text-2xl); line-height: var(--text-2xl-lh); }
.tile-label { font-size: var(--text-xs); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--dim); margin-top: 2px; }

/* Links inside content (accent, soft underline) */
a.content-link { color: var(--accent); font-weight: 500; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); text-underline-offset: 2px; }

/* Amounts / emphasis colors */
.amount-due { color: var(--amber); font-weight: 600; }
.amount-overdue { color: var(--red); font-weight: 600; }
.amount-ok { color: var(--green); font-weight: 600; }

/* Overlays rely on the hidden attribute; author display rules must never override it. */
[hidden]{display:none!important}

/* Form controls — ONE height for every text-like input in every app, forever.
   iOS renders native date/time inputs taller than text inputs; this block is
   the standing fix. Never style an individual form's inputs to a different
   height; change --control-h here if the fleet height ever changes. */
:root{--control-h:48px}
input[type="text"],input[type="number"],input[type="url"],input[type="email"],input[type="tel"],input[type="search"],input[type="password"],input[type="date"],input[type="time"],input[type="datetime-local"],select{
  height:var(--control-h);min-height:var(--control-h);box-sizing:border-box;
}
input[type="date"],input[type="time"],input[type="datetime-local"]{
  -webkit-appearance:none;appearance:none;display:flex;align-items:center;
}
input[type="date"]::-webkit-date-and-time-value,input[type="time"]::-webkit-date-and-time-value{text-align:left;margin:0}
input,select,textarea{min-width:0;max-width:100%}
