/* Client Hub: Isle of Wight Stock look (white, ink, sea blue, Playfair + Inter) */
@font-face { font-family: "Inter"; src: url("assets/fonts/inter-latin.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Playfair Display"; src: url("assets/fonts/playfair-latin.woff2") format("woff2"); font-weight: 400 900; font-display: swap; }
@font-face { font-family: "Playfair Display"; src: url("assets/fonts/playfair-latin-italic.woff2") format("woff2"); font-weight: 400 900; font-style: italic; font-display: swap; }

:root {
  --canvas: #F7F9FA; --surface: #FFFFFF; --ink: #14181F; --ink-soft: #4E5866;
  --accent: #0A6FB0; --accent-ink: #FFFFFF; --brand: #0B84CC; --tint: #DCF0FA; --mist: #EEF2F5;
  --line: #E1E7EC; --line-strong: #CDD6DE; --night: #0E141C;
  --ok: #1E7A4C; --ok-tint: #E2F4EA; --warn: #9A5B00; --warn-tint: #FFF2DC; --err: #B42318; --err-tint: #FDE8E6;
  --display: "Playfair Display", Georgia, serif; --text: "Inter", system-ui, -apple-system, sans-serif;
  --r-sm: 8px; --r-md: 14px; --r-lg: 22px;
  --shadow: 0 1px 2px hsl(212 40% 10% / .06), 0 8px 24px hsl(212 40% 10% / .06);
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--canvas); color: var(--ink); font: 400 15px/1.55 var(--text); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--display); font-weight: 500; letter-spacing: -.01em; line-height: 1.1; margin: 0 0 .6rem; }
a { color: var(--accent); }
p { margin: 0 0 .8rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.grow { flex: 1; }
.muted { color: var(--ink-soft); }
.small { font-size: .88rem; color: var(--ink-soft); margin-top: 1.2rem; }
.lede { color: var(--ink-soft); }
.hint { font-size: .85rem; color: var(--ink-soft); margin: -.2rem 0 .2rem; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- controls ---------- */
.field { width: 100%; font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: .7rem .85rem; transition: border-color 140ms var(--ease), box-shadow 140ms var(--ease); }
.field:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--tint); }
.field--sm { padding: .35rem 2rem .35rem .6rem; font-size: .88rem; width: auto; }
select.field { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%234E5866' stroke-width='1.6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .8rem center; padding-right: 2.2rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 44px; padding: 0 1.2rem; border: 1px solid var(--accent); border-radius: 999px; background: var(--accent); color: var(--accent-ink); font: 600 .95rem/1 var(--text); text-decoration: none; cursor: pointer; transition: background-color 140ms var(--ease), border-color 140ms var(--ease), transform 140ms var(--ease); }
.btn:hover { background: #085E96; border-color: #085E96; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn--ghost:hover { background: var(--mist); border-color: var(--line-strong); }
.btn--sm { min-height: 36px; padding: 0 .9rem; font-size: .86rem; }
.link { background: none; border: 0; padding: 0; font: inherit; font-size: .88rem; color: var(--accent); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
label { display: block; font-size: .88rem; font-weight: 600; }
label .field { margin-top: .35rem; font-weight: 400; }
.stack { display: grid; gap: 1rem; margin-top: 1.2rem; }
.flash { padding: .7rem .9rem; border-radius: var(--r-sm); font-size: .92rem; margin: 0 0 1rem; }
.flash--ok { background: var(--ok-tint); color: var(--ok); }
.flash--err { background: var(--err-tint); color: var(--err); }
.flash .field { margin-top: .5rem; font-size: .82rem; }
.tag { display: inline-block; font-size: .72rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; padding: .15rem .45rem; border-radius: 999px; background: var(--mist); color: var(--ink-soft); }
.count { display: inline-grid; place-items: center; min-width: 1.6rem; height: 1.6rem; padding: 0 .4rem; border-radius: 999px; background: var(--accent); color: #fff; font: 600 .8rem/1 var(--text); vertical-align: middle; margin-left: .3rem; }

/* ---------- wordmark ---------- */
.mark { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; text-decoration: none; color: var(--ink); flex: none; }
.mark img { height: 26px; width: auto; }
.mark span { font-family: var(--display); font-size: 7.5px; letter-spacing: .52em; padding-left: .52em; line-height: 1; }

/* ---------- sign-in card pages ---------- */
.is-card { min-height: 100svh; background: radial-gradient(120% 80% at 50% -10%, var(--tint), transparent 60%), var(--canvas); }
.card-page { min-height: 100svh; display: grid; place-content: center; padding: 32px 16px; }
.card { width: min(420px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 2rem 1.75rem 1.75rem; }
.card .mark { margin: 0 auto 1.6rem; display: flex; width: max-content; }
.card h1 { font-size: 2rem; }
.card .btn { width: 100%; }
.card-note { text-align: center; color: var(--ink-soft); font-size: .9rem; margin-top: 1.2rem; max-width: 420px; justify-self: center; }

/* ---------- top bar ---------- */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: .9rem; padding: 10px 16px; background: color-mix(in oklab, var(--canvas) 88%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.top form { margin: 0; }
.top__divider { width: 1px; height: 28px; background: var(--line-strong); }
.top__site { font-family: var(--display); font-size: 1.15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 30ch; }
.meter { display: flex; align-items: center; gap: .6rem; font-size: .85rem; color: var(--ink-soft); white-space: nowrap; }
.meter b { color: var(--ink); font-weight: 600; }
.meter__bar { width: 90px; height: 6px; border-radius: 99px; background: var(--mist); overflow: hidden; }
.meter__bar i { display: block; height: 100%; width: var(--fill, 0%); background: var(--brand); border-radius: inherit; transition: width 400ms var(--ease); }
.meter.is-full .meter__bar i { background: var(--warn); }

/* ---------- editor: chat + preview ---------- */
.is-app { height: 100svh; display: flex; flex-direction: column; overflow: hidden; }
.app { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(340px, 420px) 1fr; }
.chat { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-right: 1px solid var(--line); }
.chat__log { flex: 1; overflow-y: auto; padding: 1.4rem 1.1rem 1rem; display: flex; flex-direction: column; gap: .9rem; overscroll-behavior: contain; }
.hello h1 { font-size: 1.75rem; }
.hello p { color: var(--ink-soft); }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .4rem; }
.chip { border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); border-radius: 999px; padding: .45rem .8rem; font: 500 .85rem/1.2 var(--text); cursor: pointer; transition: background-color 140ms var(--ease), border-color 140ms var(--ease); }
.chip:hover { background: var(--tint); border-color: var(--brand); }
.msg { max-width: 92%; padding: .65rem .85rem; border-radius: 16px; white-space: pre-wrap; overflow-wrap: anywhere; animation: rise 260ms var(--ease) both; }
.msg--user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 5px; }
.msg--assistant { align-self: flex-start; background: var(--mist); border-bottom-left-radius: 5px; }
.msg--note { align-self: center; max-width: 100%; background: none; color: var(--ink-soft); font-size: .85rem; text-align: center; padding: 0; }
.thinking { display: inline-flex; gap: 5px; padding: .9rem; }
.thinking i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-soft); opacity: .35; animation: blink 1.2s infinite; }
.thinking i:nth-child(2) { animation-delay: .2s; } .thinking i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 40% { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.is-history > * { animation: none; }

.change { align-self: stretch; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; animation: rise 260ms var(--ease) both; }
.change__head { display: flex; align-items: center; gap: .5rem; padding: .6rem .85rem; border-bottom: 1px solid var(--line); font-size: .8rem; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--ink-soft); }
.change__head .state { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; background: var(--mist); }
.change[data-status="published"] .state { background: var(--ok-tint); color: var(--ok); }
.change[data-status="awaiting_review"] .state { background: var(--warn-tint); color: var(--warn); }
.change[data-status="discarded"], .change[data-status="rejected"], .change[data-status="reverted"] { opacity: .7; box-shadow: none; }
.change__body { padding: .7rem .85rem .2rem; display: grid; gap: .7rem; }
.diff { display: grid; gap: .25rem; font-size: .92rem; }
.diff__label { font-size: .75rem; font-weight: 600; color: var(--ink-soft); }
.diff del { color: var(--ink-soft); text-decoration-color: color-mix(in oklab, var(--err) 60%, transparent); background: var(--err-tint); border-radius: 4px; padding: .1rem .3rem; overflow-wrap: anywhere; }
.diff ins { text-decoration: none; background: var(--ok-tint); color: var(--ink); border-radius: 4px; padding: .1rem .3rem; overflow-wrap: anywhere; }
.change__note { margin: 0; padding: 0 .85rem .3rem; font-size: .84rem; color: var(--warn); }
.change__actions { display: flex; flex-wrap: wrap; gap: .5rem; padding: .7rem .85rem .85rem; }

.composer { display: flex; gap: .5rem; align-items: flex-end; padding: .8rem; border-top: 1px solid var(--line); background: var(--surface); }
.composer__input { resize: none; min-height: 46px; max-height: 180px; border-radius: 22px; padding: .7rem 1rem; line-height: 1.4; }
.composer__send { width: 46px; min-height: 46px; padding: 0; flex: none; }
.composer__send svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.preview { display: flex; flex-direction: column; min-height: 0; background: var(--mist); }
.preview__bar { display: flex; align-items: center; gap: .35rem; padding: .55rem .9rem; border-bottom: 1px solid var(--line); background: var(--canvas); font-size: .85rem; }
.preview__url { color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview__label { font-weight: 600; color: var(--warn); background: var(--warn-tint); padding: .15rem .55rem; border-radius: 999px; white-space: nowrap; }
.seg { border: 1px solid transparent; background: none; color: var(--ink-soft); border-radius: 999px; padding: .35rem .75rem; font: 500 .84rem/1.2 var(--text); text-decoration: none; cursor: pointer; }
.seg:hover { color: var(--ink); background: var(--surface); }
.seg.is-on { color: var(--ink); background: var(--surface); border-color: var(--line-strong); }
.preview__stage { flex: 1; min-height: 0; display: grid; padding: 14px; }
.preview__stage iframe { width: 100%; height: 100%; border: 1px solid var(--line); border-radius: var(--r-md); background: #fff; box-shadow: var(--shadow); justify-self: center; transition: width 300ms var(--ease); }
.preview__stage.is-phone iframe { width: 390px; max-width: 100%; border-radius: 28px; border-width: 8px; border-color: var(--night); }

/* ---------- admin ---------- */
.is-admin .admin { width: min(980px, calc(100vw - 32px)); margin: 1.5rem auto 4rem; display: grid; gap: 1.2rem; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.3rem 1.3rem 1.1rem; }
.panel h2 { font-size: 1.45rem; margin-bottom: 1rem; }
.item { border-top: 1px solid var(--line); padding: .9rem 0; display: grid; gap: .55rem; }
.item:first-of-type { border-top: 0; padding-top: 0; }
.item p { margin: 0; }
.item__meta { font-size: .86rem; color: var(--ink-soft); }
.item--job { border-left: 3px solid var(--brand); padding-left: .9rem; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; }
.row form { margin: 0; }
.grid-form { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: .8rem; align-items: end; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .75rem; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-soft); font-weight: 600; padding: 0 .6rem .5rem 0; border-bottom: 1px solid var(--line); }
.table td { padding: .6rem .6rem .6rem 0; border-bottom: 1px solid var(--line); vertical-align: middle; overflow-wrap: anywhere; }
.table form { margin: 0; }

/* ---------- phone: chat first, preview in a tab ---------- */
.tabs { display: none; }
@media (max-width: 820px) {
  .top { flex-wrap: wrap; gap: .5rem; padding: 8px 16px; }
  .top__divider { display: none; }
  .top__site { order: 3; flex-basis: 100%; font-size: 1rem; }
  .top__switch { order: 4; }
  .meter__label, .meter__bar { display: none; }
  .top .btn--sm { min-height: 34px; padding: 0 .7rem; font-size: .82rem; }
  .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .tabs { display: flex; gap: .3rem; padding: .5rem 16px; background: var(--canvas); border-bottom: 1px solid var(--line); }
  .app.show-preview .chat, .app:not(.show-preview) .preview { display: none; }
  .chat { border-right: 0; }
  .preview__stage { padding: 8px; }
  .preview__stage.is-phone iframe { border-width: 0; border-radius: var(--r-md); }
  .grid-form { grid-template-columns: 1fr; }
  .table thead { display: none; }
  .table tr { display: grid; padding: .5rem 0; border-bottom: 1px solid var(--line); }
  .table td { border: 0; padding: .1rem 0; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
