/* The client portal (Sites area). System fonts only: the page's security policy loads nothing from elsewhere.
 * Phone: one pane at a time, switched by the bar at the bottom. Wide screens: the list and the site side by side. */
:root {
  --navy: #111b2b; --panel: #172338; --panel-2: #1d2b44; --line: #2b3b58; --line-2: #3a4d70;
  --text: #f7f8fa; --soft: #d5dbe5; --muted: #9aa7bb; --accent: #7fb8ff; --ok: #6fd3a0; --okbg: #12301f; --bad: #ff8a80; --warn: #ffc56b;
  --hl: #22d0dc;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, system-ui, sans-serif;
  --top: 56px; --toggle: 64px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--navy); color: var(--text); font: 400 16px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; min-height: 100dvh; }
body.sheet-open { overflow: hidden; }
[hidden] { display: none !important; }
.in { width: 100%; max-width: 680px; margin: 0 auto; padding: 0 16px; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; }
.boot { text-align: center; color: var(--muted); padding: 40px 16px; }
.sub { color: var(--soft); margin: 0; font-size: 15px; }

.top { position: sticky; top: 0; z-index: 20; background: rgba(17, 27, 43, .97); border-bottom: 1px solid var(--line); }
.top .bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: var(--top); padding: 0 16px; }
.brand { margin: 0; font-weight: 700; font-size: 18px; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topnav { display: flex; align-items: center; gap: 16px; flex: none; }
.link { background: none; border: 0; padding: 8px 0; color: var(--accent); text-decoration: underline; cursor: pointer; font-size: 15px; min-height: 44px; display: inline-flex; align-items: center; }
.link:disabled { color: var(--muted); text-decoration: none; cursor: default; }

.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; background: var(--text); color: var(--navy); border: 0; border-radius: 10px; padding: 12px 18px; min-height: 48px; font-weight: 650; cursor: pointer; }
.btn.alt { background: transparent; color: var(--text); border: 1px solid var(--line-2); }
.btn.go { background: var(--ok); color: #0b2216; font-size: 17px; flex: 1 1 auto; }
.btn:disabled { background: var(--line); color: var(--muted); cursor: default; }
.btn:focus-visible, .link:focus-visible, .row:focus-visible, .choice:focus-visible, .toggle button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input, textarea, select { width: 100%; color: var(--text); background: #0d1522; border: 1px solid var(--line-2); border-radius: 10px; padding: 11px 12px; min-height: 48px; font-size: 16px; }
textarea { resize: vertical; line-height: 1.45; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
label { display: block; color: var(--soft); font-size: 14px; margin: 0 0 4px; }
.err { color: var(--bad); margin: 0; min-height: 1.4em; font-size: 15px; }
.count-line { margin: -4px 0 0; text-align: right; color: var(--muted); font-size: 13px; }
.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--warn); color: var(--warn); white-space: nowrap; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.signin { margin: 32px 0; display: grid; gap: 14px; }
.signin h1 { margin: 0; font-size: 26px; letter-spacing: -.02em; }
.signin p { margin: 0; color: var(--soft); }
.signin form { display: grid; gap: 10px; }

/* ---- layout -------------------------------------------------------------------------------------- */
.split { display: block; }
.pane.edits { padding: 16px 16px calc(var(--toggle) + 24px + env(safe-area-inset-bottom, 0px)); max-width: 680px; margin: 0 auto; }
.pane.site { display: none; position: fixed; top: var(--top); left: 0; right: 0; bottom: calc(var(--toggle) + env(safe-area-inset-bottom, 0px)); flex-direction: column; background: var(--navy); }
body.show-site .pane.edits { display: none; }
body.show-site .pane.site { display: flex; }

.toggle { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px)); background: rgba(17, 27, 43, .98); border-top: 1px solid var(--line); }
.toggle button { min-height: 48px; border-radius: 10px; border: 1px solid var(--line-2); background: transparent; color: var(--soft); font-weight: 650; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.toggle button[aria-pressed="true"] { background: var(--text); color: var(--navy); border-color: var(--text); }
.count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--hl); color: #062a2e; font-size: 13px; font-weight: 700; }

@media (min-width: 900px) {
  .split { display: grid; grid-template-columns: minmax(360px, 440px) minmax(0, 1fr); height: calc(100dvh - var(--top)); }
  .pane.edits { overflow-y: auto; max-width: none; margin: 0; padding: 18px 20px 32px; border-right: 1px solid var(--line); }
  .pane.site, body.show-site .pane.site { display: flex; position: static; flex-direction: column; }
  body.show-site .pane.edits { display: block; }
  .toggle { display: none; }
}

/* ---- the site pane ------------------------------------------------------------------------------- */
.sitebar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 14px; border-bottom: 1px solid var(--line); min-height: 48px; }
.status { margin: 0; font-size: 14px; color: var(--soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status.draft::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 8px; border: 2px dashed var(--hl); border-radius: 2px; vertical-align: -1px; }
.sitebar .link { white-space: nowrap; font-size: 14px; }
.frame { position: relative; flex: 1; min-height: 0; background: #fff; }
.frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
.fallback { position: absolute; inset: 0; display: grid; align-content: center; justify-items: start; gap: 12px; padding: 24px; background: var(--panel); color: var(--soft); }
.fallback p { margin: 0; max-width: 32em; }
.fallback .big { font-size: 19px; color: var(--text); font-weight: 650; }

/* ---- the edits pane ------------------------------------------------------------------------------ */
.changes { background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; padding: 16px; display: grid; gap: 12px; margin-bottom: 22px; }
.changes h2 { margin: 0; font-size: 18px; letter-spacing: -.01em; }
.changes.empty { border-color: var(--line); }
.changes.empty p { margin: 0; color: var(--soft); }
.changes:not(.empty) { border-color: rgba(34, 208, 220, .55); box-shadow: inset 4px 0 0 var(--hl); }
.changes-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.chgs { list-style: none; margin: 0; padding: 0; display: grid; }
.chg { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.chg:first-child { border-top: 0; padding-top: 0; }
.chg p { margin: 0; overflow-wrap: anywhere; }
.chg .k { font-weight: 650; font-size: 15px; }
.chg .grp { color: var(--muted); font-weight: 400; }
.chg .line { font-size: 15px; color: var(--soft); }
.chg .line s { color: var(--muted); }
.chg .line b { color: var(--text); font-weight: 600; }
.chg .by { font-size: 13px; color: var(--muted); }
.chg .warn { font-size: 14px; color: var(--warn); }
.chg.stale { background: rgba(255, 197, 107, .07); }
.row-acts { display: flex; flex-direction: column; align-items: flex-end; gap: 0; }
.row-acts .link { min-height: 36px; padding: 4px 0; }
.acts { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }

.find { margin: 0 0 16px; }
.find input { background: var(--panel); border-color: var(--line-2); padding-left: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aa7bb' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: 12px center; background-size: 20px; }
.find input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; width: 18px; height: 18px; cursor: pointer; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d5dbe5' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6 6 18'/%3E%3C/svg%3E") center / 18px no-repeat; }
.row .main span.grp { color: var(--accent); font-size: 13px; }
.list-h { margin: 6px 0 10px; font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.rows { list-style: none; margin: 0 0 22px; padding: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--panel); }
.rows li + li { border-top: 1px solid var(--line); }
.row { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 16px; min-height: 60px; background: none; border: 0; color: var(--text); text-align: left; cursor: pointer; }
.row:hover { background: var(--panel-2); }
.row .main { display: grid; gap: 2px; min-width: 0; }
.row .main b { font-weight: 650; }
.row .main span { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.row.edited { box-shadow: inset 4px 0 0 var(--hl); }
.row .tag { justify-self: start; margin-top: 4px; font-size: 12px; font-weight: 650; color: #062a2e !important; background: var(--hl); border-radius: 999px; padding: 1px 8px; }
.chev { color: var(--muted); font-size: 22px; line-height: 1; }
.rows .sub-h { padding: 12px 16px 4px; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); background: var(--navy); }
.row .main span.off { color: var(--warn); }
.dot { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 999px; background: var(--hl); color: #062a2e; font-weight: 700; font-size: 13px; }
.back { background: none; border: 0; color: var(--accent); padding: 6px 0 10px; min-height: 44px; cursor: pointer; font-size: 15px; }

/* ---- sheet (every editor) ---------------------------------------------------------------------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 40; background: rgba(5, 9, 16, .6); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-height: 92dvh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line-2); border-bottom: 0; border-radius: 18px 18px 0 0;
  padding: 16px 16px calc(18px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 12px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet h2 { margin: 0; font-size: 19px; letter-spacing: -.01em; }
.sheet form { display: grid; gap: 12px; }
.sheet .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choices { display: grid; gap: 8px; }
.choice { text-align: left; min-height: 54px; padding: 12px 16px; border-radius: 12px; border: 1px solid var(--line-2); background: transparent; color: var(--text); cursor: pointer; font-weight: 600; display: grid; gap: 2px; }
.choice.main { background: var(--text); color: var(--navy); border-color: var(--text); }
.choice small { font-weight: 400; color: var(--muted); font-size: 14px; }
@media (min-width: 900px) {
  .sheet-wrap { align-items: center; }
  .sheet { max-width: 560px; border-radius: 16px; border-bottom: 1px solid var(--line-2); padding: 20px; }
}
.item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: start; padding: 10px 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; padding-top: 0; }
.item .fields { display: grid; gap: 6px; }
.item .tools { display: flex; gap: 4px; }
.tool { width: 44px; height: 44px; border-radius: 8px; border: 1px solid var(--line-2); background: transparent; color: var(--text); cursor: pointer; font-size: 18px; line-height: 1; }
.thumb { width: 100%; max-height: 240px; object-fit: cover; border-radius: 8px; background: #000; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--toggle) + 16px + env(safe-area-inset-bottom, 0px)); z-index: 50;
  width: calc(100% - 32px); max-width: 520px; padding: 12px 16px; border-radius: 12px; background: var(--text); color: var(--navy); font-weight: 600; box-shadow: 0 12px 30px rgba(0, 0, 0, .45); }
.toast.bad { background: #3a1a1a; color: #ffd2cc; border: 1px solid rgba(255, 138, 128, .5); }
@media (min-width: 900px) { .toast { bottom: 24px; } }

/* ---- boot, sign-in code, requests ---------------------------------------------------------------- */
.boot p { margin: 0 auto 16px; max-width: 32em; }
.signin form.code { border-top: 1px solid var(--line); padding-top: 14px; }
.signin #code { letter-spacing: .25em; font-variant-numeric: tabular-nums; }
.reqs .req { padding: 12px 16px; display: grid; gap: 4px; }
.reqs .req p { margin: 0; overflow-wrap: anywhere; }
.req-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); }
.req-st { font-weight: 650; color: var(--warn); }
.req-st.done { color: var(--ok); }
.req-st.declined { color: var(--muted); }
.req-body { white-space: pre-line; color: var(--soft); font-size: 15px; }
.req-note { font-size: 14px; color: var(--text); }
