/* Judith Inn — shared styles. Plain, solid surfaces; no blur, no gradients. */

:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #efede8;
  --text: #1d1c1a;
  --muted: #6b6862;
  --border: #e2dfd8;
  --accent: #2f5d50;
  --accent-hover: #264d42;
  --on-accent: #ffffff;
  --accent-soft: #e5eeea;
  --danger: #b3261e;
  --done: #6b6862;
  --radius: 14px;
  --radius-lg: 20px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "New York", "Iowan Old Style", Georgia, "Times New Roman", serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141413;
    --surface: #1e1d1b;
    --surface-2: #282724;
    --text: #f1efea;
    --muted: #a19d95;
    --border: #33312d;
    --accent: #84bba8;
    --accent-hover: #97c8b6;
    --on-accent: #10201b;
    --accent-soft: #1f3330;
    --danger: #f2817a;
    --done: #a19d95;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
svg { display: block; }

.app {
  min-height: 100%;
  padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right))
           max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
}

/* ───────── type ───────── */
.brand {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: 0.01em;
}
h1 { font-family: var(--serif); font-weight: 600; font-size: 34px; line-height: 1.15; margin: 0; }
h2 { font-size: 20px; font-weight: 600; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 15px; }

/* ───────── buttons ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 22px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  font-weight: 600;
  transition: background-color .15s, border-color .15s, opacity .15s;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.block { width: 100%; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn.quiet:has(svg) { padding-left: 4px; }
.btn.quiet { border-color: transparent; background: transparent; color: var(--muted); padding: 0 12px; }
.btn.quiet:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { color: var(--danger); }

.icon-btn {
  width: 48px; height: 48px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.icon-btn.primary:disabled { opacity: .4; cursor: default; }
.icon-btn.recording { background: var(--danger); border-color: var(--danger); color: #fff; }
.icon-btn svg { width: 22px; height: 22px; }

/* ───────── forms ───────── */
.field {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 18px;
  outline: none;
  transition: border-color .15s;
}
.field:focus { border-color: var(--accent); }
textarea.field { resize: none; min-height: 140px; line-height: 1.45; }

/* ───────── cards & lists ───────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 24px; height: 24px; padding: 0 7px;
  border-radius: 12px;
  background: var(--accent); color: var(--on-accent);
  font-size: 14px; font-weight: 700;
}
.pill {
  display: inline-flex; align-items: center;
  height: 26px; padding: 0 10px; border-radius: 13px;
  font-size: 14px; font-weight: 600;
  background: var(--accent-soft); color: var(--accent);
}
.pill.done { background: var(--surface-2); color: var(--done); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  height: 40px; padding: 0 16px;
  border-radius: 20px; border: 1px solid var(--border);
  background: var(--surface); font-size: 16px;
}
.chip:hover { background: var(--surface-2); }

/* ───────── chat ───────── */
.chat {
  display: flex; flex-direction: column;
  height: 100%; min-height: 0;
}
.chat-log {
  flex: 1; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px;
  padding: 20px 4px;
  -webkit-overflow-scrolling: touch;
}
.msg-row { display: flex; flex-direction: column; align-items: flex-start; }
.msg-row.mine { align-items: flex-end; }
.bubble {
  max-width: min(78%, 560px);
  padding: 11px 15px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg-row.mine .bubble { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.msg-meta { font-size: 13px; color: var(--muted); margin: 3px 8px 8px; }
.day-sep { align-self: center; font-size: 13px; color: var(--muted); margin: 10px 0 6px; }
.chat-note { align-self: center; font-size: 14px; color: var(--muted); text-align: center; margin: 10px 0; }

.voice {
  display: flex; align-items: center; gap: 10px;
  min-width: 190px; background: none; border: 0; padding: 0;
  color: inherit; text-align: left;
}
.voice .play {
  width: 36px; height: 36px; flex: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent);
}
.msg-row.mine .voice .play { background: rgba(255,255,255,.2); color: inherit; }
@media (prefers-color-scheme: dark) { .msg-row.mine .voice .play { background: rgba(0,0,0,.15); } }
.voice .play svg { width: 16px; height: 16px; }
.voice .track { flex: 1; height: 4px; border-radius: 2px; background: color-mix(in srgb, currentColor 25%, transparent); position: relative; overflow: hidden; }
.voice .track i { position: absolute; inset: 0 auto 0 0; width: 0; background: currentColor; }
.voice .len { font-size: 14px; font-variant-numeric: tabular-nums; opacity: .8; }
.voice + .text { margin-top: 6px; }

.composer {
  display: flex; align-items: flex-end; gap: 10px;
  padding-top: 12px;
}
.composer .field {
  flex: 1; min-height: 48px; max-height: 160px;
  padding: 11px 16px; border-radius: 24px; resize: none;
}
.rec-bar {
  flex: 1; display: flex; align-items: center; gap: 12px;
  min-height: 48px; padding: 0 16px; border-radius: 24px;
  background: var(--surface); border: 1px solid var(--border);
}
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: pulse 1.2s infinite; }
.rec-time { font-variant-numeric: tabular-nums; font-weight: 600; }
@keyframes pulse { 50% { opacity: .3; } }

/* ───────── misc ───────── */
.center-screen {
  min-height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
}
.toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--text); color: var(--bg);
  padding: 12px 20px; border-radius: 12px; font-size: 16px;
  z-index: 50; max-width: calc(100% - 32px); text-align: center;
}
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
