/* The website's look (src/styles/global.css): black header, brand red, Poppins.
   Poppins has no Cyrillic, so Russian text is set in Montserrat, the closest geometric face that has it. */
@font-face { font-family: "Site"; font-weight: 400; font-display: swap; src: url("/fonts/Poppins-Regular-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Site"; font-weight: 400; font-display: swap; src: url("/fonts/Poppins-Regular.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Site"; font-weight: 400; font-display: swap; src: url("/fonts/montserrat-cyrillic-400.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Site"; font-weight: 500; font-display: swap; src: url("/fonts/Poppins-Medium-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Site"; font-weight: 500; font-display: swap; src: url("/fonts/Poppins-Medium.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Site"; font-weight: 500; font-display: swap; src: url("/fonts/montserrat-cyrillic-500.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Site"; font-weight: 600; font-display: swap; src: url("/fonts/Poppins-SemiBold-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Site"; font-weight: 600; font-display: swap; src: url("/fonts/Poppins-SemiBold.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Site"; font-weight: 600; font-display: swap; src: url("/fonts/montserrat-cyrillic-600.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Site"; font-weight: 700; font-display: swap; src: url("/fonts/Poppins-Bold-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Site"; font-weight: 700; font-display: swap; src: url("/fonts/Poppins-Bold.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Site"; font-weight: 700; font-display: swap; src: url("/fonts/montserrat-cyrillic-700.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }

:root {
  --brand-red: #D2051E;
  --brand-black: #0A0A0A;
  --bg: #F8F8F8;
  --surface: #FFFFFF;
  --surface-2: #F0F0F0;
  --text: #111827;
  --text-2: #6B7280;
  --text-3: #9CA3AF;
  --line: #E2E2E2;
  --line-strong: #D1D5DB;
  --accent: var(--brand-red);
  --accent-hover: #B0041A;
  --accent-soft: #FDECEE;
  --accent-text: #FFFFFF;
  --ok: #15803D;
  --ok-soft: #E8F5EC;
  --bad: #B0041A;
  --bad-soft: #FDECEE;
  --warn: #B45309;
  --warn-soft: #FEF3C7;
  --owner-bubble: var(--brand-black);
  --owner-text: #FFFFFF;
  --shadow: 0 1px 2px rgb(10 10 10 / .04), 0 4px 14px rgb(10 10 10 / .06);
  --shadow-lg: 0 14px 40px rgb(10 10 10 / .2);
  --radius: 16px;
  --radius-sm: 12px;
  --nav-h: 64px;
  --font: "Site", ui-sans-serif, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- controls ---------- */

.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: var(--radius-sm); border: 1px solid transparent; font-weight: 700; font-size: 15px; white-space: nowrap; transition: background .15s, border-color .15s, opacity .15s; text-decoration: none; }
.button svg.icon { width: 18px; height: 18px; }
.button.primary { background: var(--accent); color: var(--accent-text); box-shadow: 0 6px 16px rgb(210 5 30 / .22); }
.button.primary:hover:not(:disabled) { background: var(--accent-hover); }
.button.secondary { background: var(--surface); border-color: var(--line-strong); color: var(--text); }
.button.secondary:hover:not(:disabled) { background: var(--surface-2); }
.button.ghost { background: transparent; color: var(--text-2); }
.button.ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.button.small { min-height: 36px; padding: 0 12px; font-size: 14px; }
.button.wide { width: 100%; }
.button:disabled { opacity: .45; }
.icon-button { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: var(--radius-sm); border: none; background: transparent; color: var(--text-2); }
.icon-button:hover { background: var(--surface-2); color: var(--text); }

input[type="text"], input[type="number"], input[type="password"], input:not([type]), textarea, select {
  width: 100%; min-height: 44px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input.changed, textarea.changed { border-color: var(--accent); background: var(--accent-soft); }
input[type="number"] { font-variant-numeric: tabular-nums; }

.field { display: grid; gap: 6px; }
.field > span:first-child { font-size: 14px; font-weight: 600; color: var(--text); }
.field .hint { font-size: 13px; color: var(--text-3); }
.form-error { margin: 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--bad-soft); color: var(--bad); font-size: 14px; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; cursor: pointer; }
.switch + .switch { border-top: 1px solid var(--line); }
.switch-text { display: grid; gap: 2px; }
.switch-text b { font-weight: 600; }
.switch-text small { color: var(--text-3); font-size: 13px; }
.switch input { appearance: none; flex: none; width: 46px; height: 28px; border-radius: 999px; background: var(--line-strong); position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .25); transition: transform .2s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(18px); }

.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border-radius: 11px; }
.segmented button { border: none; background: transparent; padding: 7px 14px; border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--text-2); }
.segmented button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / .1); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card > h2 { margin: 0 0 4px; font-size: 17px; font-weight: 700; }
.card > .card-sub { margin: 0 0 16px; color: var(--text-2); font-size: 14px; }
.stack { display: grid; gap: 14px; }
.stack-lg { display: grid; gap: 16px; align-content: start; }

/* ---------- login ---------- */

.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(900px 420px at 50% 0%, rgb(210 5 30 / .22), transparent 70%), var(--brand-black); }
.login-card { width: 100%; max-width: 380px; display: grid; gap: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 32px 28px; box-shadow: var(--shadow-lg); }
.login-logo { width: 72px; height: 72px; border-radius: 18px; background: var(--brand-black); justify-self: center; display: grid; place-items: center; }
.login-logo img { width: 44px; height: 44px; filter: brightness(0) invert(1); }
.login-card h1 { margin: 0; text-align: center; font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.login-sub { margin: -8px 0 4px; text-align: center; color: var(--text-2); font-size: 14px; }
.password { position: relative; display: block; }
.password input { padding-right: 48px; }
.password .icon-button { position: absolute; right: 2px; top: 2px; }

/* ---------- shell ---------- */

.shell { height: 100dvh; display: flex; flex-direction: column; }
.topbar { flex: none; display: flex; align-items: center; gap: 16px; height: 64px; padding: 0 20px; background: var(--brand-black); color: #fff; box-shadow: 0 4px 14px rgb(0 0 0 / .18); position: relative; z-index: 10; }
.brand { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.brand img { width: 36px; height: 36px; filter: brightness(0) invert(1); }
.brand span { font-size: 14px; font-weight: 600; line-height: 1.2; }
.brand b { display: block; color: var(--brand-red); font-weight: 700; }
.nav-top { display: flex; gap: 4px; flex: 1; justify-content: center; align-self: stretch; }
.nav-top button { display: inline-flex; align-items: center; gap: 8px; border: none; border-bottom: 2px solid transparent; background: transparent; color: #D1D5DB; padding: 0 12px; font-weight: 500; font-size: 14px; }
.nav-top button svg.icon { width: 18px; height: 18px; }
.nav-top button:hover { color: #fff; }
.nav-top button[aria-current="page"] { color: #fff; border-bottom-color: var(--brand-red); }
.topbar #logout { color: #D1D5DB; }
.topbar #logout:hover { color: #fff; background: rgb(255 255 255 / .08); }
.nav-bottom { display: none; }

.views { flex: 1; min-height: 0; position: relative; }
.view { height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.page { padding: 28px 20px 120px; }
.page > * { max-width: 1080px; margin-left: auto; margin-right: auto; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-head h1 { margin: 0 0 6px; font-size: 28px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.page-head h1::before { content: ""; display: block; width: 40px; height: 3px; background: var(--brand-red); margin-bottom: 14px; }
.page-head p { margin: 0; color: var(--text-2); max-width: 620px; }

@media (max-width: 760px) {
  .topbar { height: 56px; padding: 0 8px 0 16px; justify-content: space-between; }
  .nav-top { display: none; }
  #logout .label { display: none; }
  .nav-bottom { display: grid; grid-template-columns: repeat(6, 1fr); flex: none; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--line); }
  .nav-bottom button { display: grid; justify-items: center; align-content: center; gap: 3px; border: none; background: transparent; color: var(--text-3); font-size: 11px; font-weight: 600; padding: 6px 2px; }
  .nav-bottom button svg.icon { width: 22px; height: 22px; }
  .nav-bottom button[aria-current="page"] { color: var(--accent); box-shadow: inset 0 2px 0 var(--accent); }
  .page { padding: 20px 16px 120px; }
  .page-head { flex-direction: column; gap: 12px; margin-bottom: 16px; }
  .page-head h1 { font-size: 22px; }
  .card { padding: 16px; border-radius: 12px; }
}

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

.chat-view { display: flex; flex-direction: column; overflow: hidden; }
.chat-scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 24px 16px 8px; }
.messages { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.row { display: flex; gap: 10px; align-items: flex-start; }
.row.owner { justify-content: flex-end; }
.avatar { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.avatar svg.icon { width: 17px; height: 17px; }
.bubble { max-width: min(600px, 86%); overflow-wrap: anywhere; }
.row.owner > div { max-width: min(600px, 86%); display: grid; justify-items: end; }
.row.owner .bubble { max-width: none; background: var(--owner-bubble); color: var(--owner-text); padding: 10px 14px; border-radius: 18px 18px 4px 18px; white-space: pre-wrap; }
.row.assistant .bubble { padding-top: 5px; }
.time { display: block; margin-top: 4px; font-size: 12px; color: var(--text-3); }
.row.owner .time { text-align: right; }
.typing { display: inline-flex; gap: 4px; padding: 12px 0; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); animation: blink 1.2s infinite both; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.welcome { text-align: center; padding: 24px 8px 8px; display: grid; gap: 10px; justify-items: center; }
.welcome .avatar { width: 52px; height: 52px; }
.welcome .avatar svg.icon { width: 26px; height: 26px; }
.welcome h2 { margin: 6px 0 0; font-size: 22px; font-weight: 700; }
.welcome p { margin: 0; color: var(--text-2); max-width: 480px; }
.suggestions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; width: 100%; margin-top: 14px; }
.suggestions button { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 14px; color: var(--text); box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.suggestions button:hover { border-color: var(--accent); transform: translateY(-1px); }
.suggestions button small { display: block; color: var(--text-3); font-size: 12px; margin-bottom: 2px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
@media (max-width: 560px) { .suggestions { grid-template-columns: 1fr; } }

.change { margin-top: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.change-body { padding: 14px 16px; display: grid; gap: 8px; }
.change-label { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); }
.change-label svg.icon { width: 14px; height: 14px; }
.change-title { font-weight: 700; font-size: 16px; line-height: 1.35; }
.change ul { margin: 0; padding-left: 18px; color: var(--text-2); display: grid; gap: 4px; }
.change-links { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.change-preview { display: grid; gap: 10px; padding: 0 16px 14px; }
.change-preview img { width: 100%; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.change-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--surface-2); }
.change-status { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 14px; font-weight: 600; }
.change-status svg.icon { width: 17px; height: 17px; }
.change-status.applied { background: var(--ok-soft); color: var(--ok); }
.change-status.rejected { background: var(--surface-2); color: var(--text-3); }
.change-status.failed { background: var(--bad-soft); color: var(--bad); }

.composer { flex: none; padding: 8px 16px 12px; background: linear-gradient(transparent, var(--bg) 30%); }
.composer-box { max-width: 760px; margin: 0 auto; display: flex; align-items: flex-end; gap: 8px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 22px; padding: 6px 6px 6px 16px; box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s; }
.composer-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.composer-box textarea { flex: 1; border: none; background: transparent; box-shadow: none; resize: none; min-height: 40px; max-height: 180px; padding: 9px 0; }
.composer-box textarea:focus { box-shadow: none; }
.send { flex: none; width: 40px; height: 40px; border-radius: 50%; border: none; background: var(--accent); color: var(--accent-text); display: grid; place-items: center; transition: background .15s, opacity .15s; }
.send:disabled { opacity: .35; }
.composer-hint { max-width: 760px; margin: 6px auto 0; text-align: center; font-size: 12px; color: var(--text-3); }

/* ---------- markdown ---------- */

.doc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 32px; box-shadow: var(--shadow); }
@media (max-width: 760px) { .doc { padding: 18px 16px; } }
.markdown { overflow-wrap: anywhere; }
.markdown > :first-child { margin-top: 0; }
.markdown > :last-child { margin-bottom: 0; }
.markdown h1 { font-size: 24px; letter-spacing: -.02em; line-height: 1.25; margin: 0 0 14px; }
.markdown h2 { font-size: 19px; letter-spacing: -.01em; margin: 28px 0 10px; padding-top: 20px; border-top: 1px solid var(--line); }
.markdown h3 { font-size: 16px; margin: 20px 0 8px; }
.markdown p { margin: 10px 0; }
.markdown ul, .markdown ol { margin: 8px 0; padding-left: 22px; }
.markdown li { margin: 4px 0; }
.markdown li::marker { color: var(--text-3); }
.markdown strong { font-weight: 700; }
.markdown code { font-family: var(--mono); font-size: .88em; background: var(--surface-2); padding: 2px 6px; border-radius: 6px; }
.markdown pre { background: var(--surface-2); padding: 12px; border-radius: 10px; overflow-x: auto; }
.markdown pre code { background: none; padding: 0; }
.markdown blockquote { margin: 10px 0; padding: 4px 14px; border-left: 3px solid var(--accent); color: var(--text-2); background: var(--surface-2); border-radius: 0 8px 8px 0; }
.markdown table { border-collapse: collapse; width: 100%; font-size: 14px; display: block; overflow-x: auto; }
.markdown th, .markdown td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.markdown hr { border: none; border-top: 1px solid var(--line); margin: 20px 0; }
.bubble.markdown p:first-child { margin-top: 0; }

.editor { display: grid; gap: 10px; }
.editor-switch { display: none; justify-self: start; }
.editor-panes { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; height: calc(100dvh - 300px); min-height: 420px; }
.editor-text { height: 100%; resize: none; font-family: var(--mono); font-size: 13.5px; line-height: 1.6; padding: 16px; border-radius: var(--radius); }
.editor-preview { height: 100%; overflow-y: auto; }
.editor-help { font-size: 13px; color: var(--text-3); }
.editor-help code { font-family: var(--mono); background: var(--surface-2); padding: 1px 5px; border-radius: 5px; color: var(--text-2); }
@media (max-width: 900px) {
  .editor-switch { display: inline-flex; }
  .editor-panes { grid-template-columns: 1fr; height: calc(100dvh - 330px); }
  .editor[data-pane="text"] .editor-preview, .editor[data-pane="preview"] .editor-text { display: none; }
}

/* ---------- prices ---------- */

.price-table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
table.price-table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 14px; }
.price-table th { font-weight: 600; color: var(--text-2); font-size: 13px; padding: 8px; text-align: center; white-space: nowrap; border-bottom: 1px solid var(--line); }
.price-table th.rowhead { text-align: left; color: var(--text); }
.price-table td { padding: 6px 4px; text-align: center; border-bottom: 1px solid var(--line); }
.price-table tr:last-child td, .price-table tr:last-child th { border-bottom: none; }
.price-table td.none { color: var(--text-3); }
.money { position: relative; display: inline-block; }
.money input { width: 104px; text-align: right; padding-right: 34px; min-height: 40px; }
.money::after { content: "Kč"; position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 13px; pointer-events: none; }
.money.times::after { content: "×"; }
.money.wide input { width: 100%; }
.money.wide { width: 100%; }
.price-list { display: grid; gap: 6px; }
.price-group { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.price-group summary { list-style: none; display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; font-weight: 600; cursor: pointer; }
.price-group summary::-webkit-details-marker { display: none; }
.price-group summary small { color: var(--text-3); font-weight: 500; }
.price-group[open] summary { border-bottom: 1px solid var(--line); background: var(--surface-2); }
.price-line { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 14px; }
.price-line + .price-line { border-top: 1px solid var(--line); }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px 20px; }
.fields .money input { width: 100%; }
.fields .money { width: 100%; }
.note { font-size: 13px; color: var(--text-3); margin: 10px 0 0; }

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

.layout-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.preview-card { position: sticky; top: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; display: grid; gap: 12px; }
.preview-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.preview-body { position: relative; background: var(--surface-2); border-radius: 10px; padding: 10px; min-height: 300px; display: grid; place-items: center; }
.preview-body img { width: 100%; height: auto; display: block; border-radius: 4px; box-shadow: 0 2px 10px rgb(0 0 0 / .12); background: #fff; cursor: zoom-in; }
.preview-body.loading img { opacity: .5; transition: opacity .2s; }
.preview-status { margin: 0; font-size: 13px; color: var(--text-3); text-align: center; min-height: 1.4em; }
.skeleton { width: 100%; aspect-ratio: 1 / 1.414; border-radius: 4px; background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (max-width: 960px) {
  .layout-grid { grid-template-columns: 1fr; }
  .preview-card { position: static; order: -1; }
}

.choices { display: grid; gap: 8px; }
.choice { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 12px; cursor: pointer; transition: border-color .15s, background .15s; }
.choice:hover { border-color: var(--text-3); }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice input { appearance: none; flex: none; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-strong); margin: 0; display: grid; place-items: center; }
.choice input:checked { border-color: var(--accent); }
.choice input:checked::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.choice-text { flex: 1; display: grid; gap: 1px; }
.choice-text b { font-weight: 600; }
.choice-text small { color: var(--text-3); font-size: 13px; }
.choice-example { font-family: var(--mono); font-size: 15px; font-weight: 600; background: var(--surface); border: 1px solid var(--line); padding: 4px 10px; border-radius: 8px; white-space: nowrap; }
.number-result { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); }
.number-result span { color: var(--text-2); font-size: 14px; }
.number-result b { font-family: var(--mono); font-size: 20px; letter-spacing: .01em; }
.warning { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--text-2); }
.warning svg.icon { width: 16px; height: 16px; color: var(--accent); margin-top: 2px; }
.color-row { display: flex; gap: 8px; flex-wrap: wrap; }
.color-row button { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line-strong); }
.color-row button[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--accent); }

/* ---------- history ---------- */

.timeline { display: grid; gap: 0; max-width: 760px; }
.event { display: grid; grid-template-columns: 36px 1fr auto; gap: 14px; align-items: start; padding: 14px 4px; border-bottom: 1px solid var(--line); background: none; border-left: none; border-right: none; border-top: none; text-align: left; width: 100%; color: inherit; border-radius: 0; }
.event:hover { background: var(--surface-2); }
.event-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); }
.event-icon svg.icon { width: 18px; height: 18px; }
.event-icon.assistant { background: var(--accent-soft); color: var(--accent); }
.event-title { font-weight: 600; line-height: 1.35; }
.event-meta { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.event-chevron { color: var(--text-3); align-self: center; }
.day { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); padding: 20px 4px 4px; }
.day:first-child { padding-top: 0; }

/* ---------- status ---------- */

.status-banner { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.status-banner > div { flex: 1; display: grid; gap: 2px; }
.status-banner b { font-size: 17px; font-weight: 700; }
.status-banner span:not(.status-banner-icon) { color: var(--text-2); font-size: 14px; }
.status-banner-icon { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); }
.status-banner.ok .status-banner-icon { background: var(--ok-soft); color: var(--ok); }
.status-banner.warn .status-banner-icon { background: var(--warn-soft); color: var(--warn); }
.status-banner.bad { border-color: var(--accent); }
.status-banner.bad .status-banner-icon { background: var(--bad-soft); color: var(--bad); }
.status-list { padding: 4px 20px; }
.status-row { display: flex; gap: 14px; padding: 16px 0; }
.status-row + .status-row { border-top: 1px solid var(--line); }
.status-icon { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-black); color: #fff; }
.status-icon svg.icon { width: 19px; height: 19px; }
.status-text { flex: 1; min-width: 0; }
.status-name { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 700; }
.status-text p { margin: 4px 0 0; color: var(--text); font-size: 14px; }
.status-text small { display: block; margin-top: 2px; color: var(--text-3); font-size: 13px; }
.pill { flex: none; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.reauth { margin-top: 10px; }
.status-text .reauth + small { margin-top: 6px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.stat { display: grid; gap: 2px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); }
.stat b { font-size: 22px; font-weight: 700; }
.stat span { font-size: 13px; color: var(--text-2); line-height: 1.3; }
.failing { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--text); text-decoration: none; font-weight: 600; }
.failing span { flex: 1; }
.failing:hover { border-color: var(--accent); }
@media (max-width: 760px) {
  .status-banner { flex-wrap: wrap; }
  .status-banner .button { width: 100%; }
  .status-list { padding: 0 16px; }
}

/* ---------- sheet (dialog) ---------- */

.sheet { width: min(760px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 0; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); display: none; flex-direction: column; overflow: hidden; }
.sheet[open] { display: flex; }
.sheet::backdrop { background: rgb(0 0 0 / .45); backdrop-filter: blur(2px); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 14px 14px 20px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { margin: 0; font-size: 17px; line-height: 1.3; }
.sheet-body { padding: 16px 20px; overflow-y: auto; flex: 1; }
.sheet-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--surface-2); }
.sheet-actions:empty { display: none; }
.sheet.zoom { width: min(1100px, calc(100vw - 16px)); }
.sheet.zoom .sheet-body { padding: 8px; background: var(--surface-2); }
.sheet.zoom img { width: 100%; display: block; background: #fff; border-radius: 6px; }
@media (max-width: 760px) {
  .sheet { width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: 18px 18px 0 0; border-bottom: none; }
  .sheet-actions { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
}

.diff { font-family: var(--mono); font-size: 12.5px; line-height: 1.55; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.diff div { white-space: pre-wrap; overflow-wrap: anywhere; padding: 1px 12px 1px 28px; position: relative; }
.diff div::before { position: absolute; left: 10px; color: var(--text-3); }
.diff .add { background: var(--ok-soft); }
.diff .add::before { content: "+"; color: var(--ok); }
.diff .del { background: var(--bad-soft); }
.diff .del::before { content: "−"; color: var(--bad); }
.diff .gap { color: var(--text-3); text-align: center; padding: 2px; background: var(--surface-2); }
.lead { margin: 0 0 14px; color: var(--text-2); }
details.more summary { cursor: pointer; color: var(--text-2); font-size: 14px; font-weight: 600; padding: 6px 0; }

/* ---------- save bar, toast ---------- */

.savebar { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 20; display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 18px; background: var(--brand-black); color: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); animation: rise .2s ease-out; max-width: calc(100vw - 24px); }
.savebar-text { font-size: 14px; font-weight: 600; margin-right: 8px; }
.savebar-text .short { display: none; }
.savebar .button.ghost { color: #D1D5DB; }
.savebar .button.ghost:hover { background: rgb(255 255 255 / .1); color: #fff; }
@media (max-width: 760px) {
  .savebar { bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 10px); left: 12px; right: 12px; transform: none; max-width: none; }
  .savebar-text { flex: 1; font-size: 13px; white-space: nowrap; }
  .savebar-text .long { display: none; } .savebar-text .short { display: inline; }
  .savebar .button { padding-inline: 12px; }
}
@keyframes rise { from { opacity: 0; transform: translate(-50%, 10px); } }
@media (max-width: 760px) { @keyframes rise { from { opacity: 0; } } }

.toast { position: fixed; left: 50%; top: 16px; transform: translateX(-50%); z-index: 50; display: flex; align-items: center; gap: 8px; background: var(--brand-black); color: #fff; padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 600; width: max-content; max-width: calc(100vw - 32px); animation: drop .2s ease-out; }
.toast.error { background: var(--bad); color: #fff; }
.toast svg.icon { width: 18px; height: 18px; }
@keyframes drop { from { opacity: 0; transform: translate(-50%, -8px); } }

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