/* Website Helper: one stylesheet for every page.
   Built for people who don't like computers: big text, big buttons, high contrast,
   every button labeled with words, nothing that only appears on hover. */

:root {
  --bg: #fbf7f2;
  --surface: #ffffff;
  --surface-2: #f5efe7;
  --text: #1c1917;
  --text-2: #57534e;
  --border: #e3d9cd;
  --border-strong: #c9bba9;

  --primary: #c2410c;
  --primary-dark: #9a3412;
  --primary-soft: #ffedd5;
  --go: #15803d;
  --go-dark: #166534;
  --go-soft: #dcfce7;
  --team: #1d4ed8;
  --team-soft: #eff6ff;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --warn-soft: #fef3c7;

  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(28, 25, 23, 0.06), 0 4px 16px rgba(28, 25, 23, 0.06);
  --tap: 56px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

html { font-size: 19px; -webkit-text-size-adjust: 100%; }
html[data-size='large'] { font-size: 22px; }
html[data-size='xl'] { font-size: 25px; }

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; }
h1 { font-size: 1.75rem; letter-spacing: -0.01em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 0.75em; }
a { color: var(--primary-dark); font-weight: 600; }
[hidden] { display: none !important; }

:focus-visible { outline: 4px solid #f59e0b; outline-offset: 2px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  min-height: var(--tap);
  padding: 0.55em 1.2em;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit; font-weight: 700; font-size: 1rem;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn .icon { font-size: 1.2em; line-height: 1; }

.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-go { background: var(--go); border-color: var(--go); color: #fff; }
.btn-go:hover { background: var(--go-dark); border-color: var(--go-dark); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-quiet { border-color: transparent; background: transparent; }
.btn-quiet:hover { background: var(--surface-2); }
.btn-small { min-height: 44px; padding: 0.35em 0.9em; font-size: 0.9rem; }
.btn-wide { width: 100%; }
.btn.recording { background: var(--danger); border-color: var(--danger); color: #fff; }

input, textarea, select {
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--surface);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.6em 0.8em;
  width: 100%;
}
input:focus, textarea:focus, select:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
label { display: block; font-weight: 700; margin: 0.9em 0 0.35em; }
.hint { color: var(--text-2); font-size: 0.9rem; }

/* ---------- top bar ---------- */

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 1rem;
  background: var(--surface);
  border-bottom: 2px solid var(--border);
}
.topbar .brand { flex: 1; min-width: 0; }
.topbar .brand strong { display: block; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .brand span { color: var(--text-2); font-size: 0.85rem; }
.topbar .actions { display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: flex-end; }
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.6em; height: 1.6em; padding: 0 0.4em;
  border-radius: 999px; background: var(--primary); color: #fff; font-size: 0.8rem;
}

/* ---------- chat layout ---------- */

.chat-page { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 1.25rem 1rem 2rem; }
.chat-inner { max-width: 820px; margin: 0 auto; }

.welcome { padding: 0.5rem 0 1rem; }
.welcome h1 { font-size: 1.8rem; }
.welcome .lede { font-size: 1.1rem; color: var(--text-2); max-width: 40em; }

.prompt-grid {
  display: grid; gap: 0.75rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  margin: 1rem 0;
}
.prompt-card {
  display: flex; align-items: flex-start; gap: 0.75rem;
  min-height: 84px;
  padding: 0.9rem 1rem;
  text-align: left;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  font: inherit; color: var(--text);
  cursor: pointer;
}
.prompt-card:hover { border-color: var(--primary); background: #fffaf5; }
.prompt-card .icon { font-size: 1.8rem; line-height: 1; }
.prompt-card strong { display: block; font-size: 1.02rem; }
.prompt-card span { display: block; color: var(--text-2); font-size: 0.88rem; margin-top: 0.15em; }

/* messages */
.msg { display: flex; flex-direction: column; margin: 0 0 1.1rem; }
.msg .who { font-size: 0.85rem; font-weight: 700; color: var(--text-2); margin: 0 0 0.3rem 0.2rem; }
.bubble {
  max-width: min(640px, 92%);
  padding: 0.8rem 1.05rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 2px solid var(--border);
  white-space: pre-wrap; word-wrap: break-word;
}
.msg.owner { align-items: flex-end; }
.msg.owner .who { margin-right: 0.2rem; }
.msg.owner .bubble { background: var(--primary-soft); border-color: #fdba74; }
.msg.team .bubble { background: var(--team-soft); border-color: #93c5fd; }
.msg.team .who { color: var(--team); }

.thumbs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; white-space: normal; }
.thumb {
  position: relative;
  width: 132px; height: 100px;
  border-radius: var(--radius-sm); overflow: hidden;
  border: 2px solid var(--border-strong); background: #000;
  padding: 0; cursor: pointer;
}
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .tag {
  position: absolute; left: 6px; bottom: 6px;
  background: rgba(0, 0, 0, 0.72); color: #fff;
  font-size: 0.72rem; font-weight: 700; padding: 2px 7px; border-radius: 6px; white-space: nowrap;
}
.thumb .play {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 2rem; color: #fff; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}
.thumb-wrap { display: inline-block; }
.thumb-wrap .remove {
  position: absolute; top: 4px; right: 4px;
  width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: rgba(0, 0, 0, 0.75); color: #fff; font-size: 1rem; cursor: pointer;
}

.quick-replies { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.6rem; }
.chip {
  min-height: 48px; padding: 0.4em 1em;
  border-radius: 999px; border: 2px solid var(--primary);
  background: var(--surface); color: var(--primary-dark);
  font: inherit; font-weight: 700; font-size: 0.95rem; cursor: pointer;
}
.chip:hover { background: var(--primary-soft); }

/* the "here's what I'll send" card */
.proposal {
  max-width: min(640px, 96%);
  margin-top: 0.6rem;
  border: 3px solid var(--go);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.proposal header { background: var(--go-soft); padding: 0.7rem 1rem; font-weight: 800; color: var(--go-dark); }
.proposal .body { padding: 0.9rem 1rem 1rem; }
.proposal h3 { font-size: 1.2rem; margin-bottom: 0.3rem; }
.proposal ul { margin: 0.4rem 0 0.6rem; padding-left: 1.2em; color: var(--text-2); }
.proposal .where { color: var(--text-2); font-size: 0.92rem; }
.proposal .buttons { display: grid; gap: 0.5rem; margin-top: 0.8rem; }
.proposal.sent { border-color: var(--border-strong); }
.proposal.sent header { background: var(--surface-2); color: var(--text-2); }
.proposal.changed { opacity: 0.6; border-color: var(--border); }
.proposal.preview .preview-shot { display: block; max-width: 320px; margin: 0.6rem auto; border: 1px solid var(--border-strong); border-radius: 12px; overflow: hidden; background: #fff; }
.proposal.preview .preview-shot img { display: block; width: 100%; height: auto; }
.proposal.preview a.btn { text-decoration: none; margin-bottom: 0.4rem; }
.proposal.preview.live header,
.proposal.preview.approved header { background: var(--surface-2); color: var(--text-2); }
.proposal.preview.superseded,
.proposal.preview.cancelled { opacity: 0.6; border-color: var(--border); }
.proposal.changed header { background: var(--surface-2); color: var(--text-2); }

.typing { display: inline-flex; gap: 6px; align-items: center; color: var(--text-2); }
.typing i { width: 9px; height: 9px; border-radius: 50%; background: var(--text-2); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: 0.2s; }
.typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

/* ---------- composer ---------- */

.composer { background: var(--surface); border-top: 2px solid var(--border); padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom)); }
.composer-inner { max-width: 820px; margin: 0 auto; }
.tools { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.tools .btn { flex: 1 1 auto; }
.tray { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.6rem; }
.send-row { display: flex; gap: 0.5rem; align-items: flex-end; }
.send-row textarea { resize: none; min-height: var(--tap); max-height: 40vh; line-height: 1.4; }
.send-row .btn { flex: 0 0 auto; }
.listening-note { color: var(--danger); font-weight: 700; margin: 0 0 0.5rem; }

/* ---------- dialogs ---------- */

dialog {
  width: min(960px, calc(100vw - 1rem));
  max-height: calc(100dvh - 1rem);
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
dialog::backdrop { background: rgba(28, 25, 23, 0.6); }
dialog.small { width: min(560px, calc(100vw - 1rem)); }
.dialog-head {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.9rem 1.1rem; border-bottom: 2px solid var(--border);
  position: sticky; top: 0; background: var(--surface); z-index: 2;
}
.dialog-head h2 { flex: 1; margin: 0; font-size: 1.25rem; }
.dialog-body { padding: 1rem 1.1rem 1.2rem; }
.dialog-foot {
  display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: flex-end;
  padding: 0.9rem 1.1rem; border-top: 2px solid var(--border);
  position: sticky; bottom: 0; background: var(--surface);
}
.dialog-foot .btn { flex: 1 1 200px; }

/* markup editor */
.markup-tools { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.6rem; }
.markup-tools .btn[aria-pressed='true'] { background: var(--primary); border-color: var(--primary); color: #fff; }
.swatch { width: var(--tap); height: var(--tap); border-radius: var(--radius-sm); border: 3px solid var(--border-strong); cursor: pointer; }
.swatch[aria-pressed='true'] { border-color: var(--text); box-shadow: 0 0 0 3px #fff inset; }
.canvas-wrap { position: relative; background: #2b2724; border-radius: var(--radius-sm); overflow: hidden; text-align: center; }
.canvas-wrap canvas { max-width: 100%; max-height: 50vh; touch-action: none; cursor: crosshair; display: block; margin: 0 auto; }
.text-entry { position: absolute; z-index: 3; width: 16em; font-weight: 700; border-width: 3px; }

/* site viewer + recorder */
.site-frame-wrap { position: relative; border: 3px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; background: #fff; }
.site-frame-wrap iframe { width: 100%; height: 58vh; border: 0; display: block; }
.site-frame-wrap.recording { border-color: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }
.rec-bar {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  padding: 0.7rem 0.9rem; margin-bottom: 0.7rem;
  border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--danger); font-weight: 800;
}
.rec-dot { width: 16px; height: 16px; border-radius: 50%; background: var(--danger); animation: blink 1.2s infinite; }
.big-choices { display: grid; gap: 0.6rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); margin: 0.8rem 0; }
.big-choices .btn { min-height: 72px; font-size: 1.05rem; }

.video-review video { width: 100%; max-height: 52vh; background: #000; border-radius: var(--radius-sm); }
.notes-list { list-style: none; padding: 0; margin: 0.8rem 0 0; }
.notes-list li {
  display: flex; gap: 0.7rem; align-items: center;
  padding: 0.6rem; margin-bottom: 0.5rem;
  border: 2px solid var(--border); border-radius: var(--radius-sm);
}
.notes-list img { width: 96px; height: 64px; object-fit: cover; border-radius: 8px; flex: 0 0 auto; }
.notes-list .time { font-weight: 800; color: var(--primary-dark); }
.notes-list .text { flex: 1; min-width: 0; }

.progress { height: 18px; border-radius: 999px; background: var(--surface-2); overflow: hidden; border: 2px solid var(--border); }
.progress > i { display: block; height: 100%; width: 0; background: var(--go); transition: width 0.2s; }

.notice { padding: 0.8rem 1rem; border-radius: var(--radius-sm); background: var(--warn-soft); border: 2px solid #fcd34d; margin: 0.7rem 0; }
.notice.error { background: var(--danger-soft); border-color: #fca5a5; }
.notice.ok { background: var(--go-soft); border-color: #86efac; }

/* requests list */
.req-list { list-style: none; margin: 0; padding: 0; }
.req-list li { padding: 0.8rem 0; border-bottom: 2px solid var(--border); }
.req-list li:last-child { border-bottom: 0; }
.status-pill { display: inline-block; padding: 0.15em 0.7em; border-radius: 999px; font-weight: 800; font-size: 0.85rem; }
.status-new { background: var(--primary-soft); color: var(--primary-dark); }
.status-working { background: var(--warn-soft); color: #92400e; }
.status-done { background: var(--go-soft); color: var(--go-dark); }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%);
  z-index: 100; max-width: calc(100vw - 2rem);
  padding: 0.9rem 1.3rem; border-radius: var(--radius-sm);
  background: var(--text); color: #fff; font-weight: 700; box-shadow: var(--shadow);
}

/* ---------- simple centered pages (sign in, HighLevel) ---------- */

.center-page { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 1.25rem; }
.card {
  width: min(560px, 100%);
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.6rem;
  box-shadow: var(--shadow);
}
.card .big-icon { font-size: 3rem; line-height: 1; margin-bottom: 0.5rem; }
.card form .btn { margin-top: 1rem; }
.code-box {
  display: flex; gap: 0.5rem; align-items: center; margin: 0.6rem 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.95rem;
}
.code-box code { flex: 1; padding: 0.6em 0.8em; background: var(--surface-2); border-radius: 8px; word-break: break-all; }

.short { display: none; }

@media (max-width: 640px) {
  html { font-size: 18px; }
  html[data-size='large'] { font-size: 21px; }
  html[data-size='xl'] { font-size: 24px; }
  .long { display: none; }
  .short { display: inline; }
  .topbar { flex-wrap: wrap; padding: 0.5rem 0.75rem; }
  .topbar .brand { flex: 1 1 100%; }
  .topbar .brand span { display: none; }
  .topbar .actions { flex: 1 1 100%; justify-content: flex-start; }
  .topbar .actions .btn { flex: 1 1 0; padding: 0.3em 0.5em; }
  .composer { padding: 0.6rem 0.75rem calc(0.6rem + env(safe-area-inset-bottom)); }
  .tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 0.4rem; }
  .tools .btn { flex-direction: column; gap: 0.1em; min-height: 64px; padding: 0.35em 0.3em; font-size: 0.85rem; }
  .send-row .btn { padding: 0.55em 0.9em; }
  .welcome h1 { font-size: 1.5rem; }
  .site-frame-wrap iframe { height: 50vh; }
}

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