/* Corner Booth: old New York coffee-shop feel. Accent/highlight colors are set from config in app.js. */
:root {
  --bg: #f5efe4;
  --card: #fbf8f2;
  --ink: #3b2a20;
  --muted: #7c6a5c;
  --line: #e2d6c3;
  --accent: #2f4a3a;
  --accent-soft: #e4ebe5;
  --brass: #b08d57;
  --serif: Georgia, "Times New Roman", Times, serif;
  --warn: #b5541c;
  --warn-soft: #fbe9dc;
  --soon: #9a7410;
  --soon-soft: #fbf2d6;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(60, 40, 10, .06), 0 4px 14px rgba(60, 40, 10, .05);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 .5rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
a { color: var(--accent); word-break: break-word; }
.small { font-size: .85rem; }
.muted { color: var(--muted); }
.error { color: var(--warn); }

#app { max-width: 1080px; margin: 0 auto; padding: 0 16px 40px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 18px 0 10px; }
.site-name { font-family: var(--serif); font-size: 1.7rem; color: var(--accent); letter-spacing: .02em; margin: 0; }
.tagline { font-family: var(--serif); font-style: italic; color: var(--muted); font-size: .95rem; margin: 2px 0 0; }
.topbar { border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.top-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.tabs { display: flex; gap: 6px; padding: 6px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; }
.tabs a { flex: 1; text-align: center; padding: 9px 8px; border-radius: 10px; text-decoration: none; color: var(--ink); font-weight: 500; font-size: .95rem; white-space: nowrap; }
.tabs a:hover { background: var(--accent-soft); }
.tabs a[aria-current="page"] { background: var(--accent); color: #fbf8f2; box-shadow: inset 0 -2px 0 var(--brass); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.stack > * + * { margin-top: 14px; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }

.stat { text-align: center; }
.stat .num { font-family: var(--serif); font-size: 2.2rem; font-weight: 700; color: var(--accent); line-height: 1.1; }
.card.stat { border-top: 3px solid var(--brass); }
.stat.alert .num { color: var(--warn); }

input, select, textarea { font: inherit; color: inherit; background: #fffdf9; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; width: 100%; }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, .tabs a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
label { display: block; font-size: .9rem; font-weight: 500; }
label > input, label > select, label > textarea { margin-top: 4px; font-weight: 400; }

.btn { font: inherit; font-size: .92rem; border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: 8px 14px; border-radius: 999px; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--warn); }
.btn.sm { padding: 4px 10px; font-size: .82rem; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.done { text-decoration: line-through; color: var(--muted); }

.pill { display: inline-block; font-size: .75rem; padding: 2px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 600; white-space: nowrap; }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.soon { background: var(--soon-soft); color: var(--soon); }
.pill.brass { background: #f2e7d3; color: #7d5f2e; }
.pill.plain { background: #ece3d4; color: var(--muted); }

.contact.overdue { border-left: 5px solid var(--warn); background: #fffaf6; }
.contact.soon { border-left: 5px solid var(--soon); }
.contact .meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .88rem; color: var(--muted); margin: 6px 0; }
.contact .notes { white-space: pre-wrap; font-size: .92rem; margin: 6px 0 0; }

.empty { text-align: center; padding: 28px 16px; color: var(--muted); border: 2px dashed var(--line); border-radius: var(--radius); }
.empty strong { display: block; color: var(--ink); margin-bottom: 4px; }

.resource .body { white-space: pre-wrap; background: #f3ecdf; border-left: 3px solid var(--brass); border-radius: 8px; padding: 10px; font-size: .92rem; margin: 8px 0; }

.mood { columns: 3 220px; column-gap: 14px; }
.mood > * { break-inside: avoid; margin-bottom: 14px; }
.mood img { width: 100%; display: block; border-radius: 10px; }
.mood .quote { font-family: var(--serif); font-size: 1.15rem; font-style: italic; border-left: 3px solid var(--brass); }
.mood figure { margin: 0; }

.chart svg { width: 100%; height: auto; display: block; }
.dots { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; }
.dots span { aspect-ratio: 1; border-radius: 4px; background: #e9dfcf; }
.dots span.on { background: var(--accent); }

dialog { border: 0; border-radius: var(--radius); padding: 0; width: min(560px, 94vw); box-shadow: 0 10px 40px rgba(0,0,0,.2); background: var(--card); color: var(--ink); }
dialog::backdrop { background: rgba(40, 30, 20, .35); }
#dialog-form { padding: 18px; display: grid; gap: 12px; max-height: 88vh; overflow: auto; }

.lock { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; background: var(--bg); }
.lock-card { width: min(360px, 100%); display: grid; gap: 10px; text-align: center; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(120px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: .9rem; transition: transform .25s, opacity .25s; z-index: 10; max-width: 92vw; opacity: 0; visibility: hidden; pointer-events: none; }
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; visibility: visible; }
.foot { text-align: center; margin-top: 30px; }

/* Phones: tabs become a tidy 3x2 grid; header stacks. */
@media (max-width: 640px) {
  #app { padding: 0 12px 32px; }
  .tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; }
  .tabs a { padding: 8px 4px; font-size: .85rem; }
  .site-name { font-size: 1.35rem; }
  .top-actions .btn { padding: 6px 10px; font-size: .82rem; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .stat .num { font-size: 1.8rem; }
  .mood { columns: 2 140px; }
}
#forgot-help { text-align: left; }
#forgot-help p { margin: 6px 0; }
