:root {
  color-scheme: light;
  --base: #FBF8F3;
  --card: #FFFFFF;
  --glass: rgba(255, 255, 255, 0.72);
  --line: #E6E3DD;
  --ink: #121316;
  --ink-muted: #4F535C;
  --ink-faint: #6A6F79;
  --on-ink: #FFFFFF;
  --select: #0F9E6E;
  --handle: #3DF5B0;
  --glow-mint: #7DF2C8;
  --glow-sky: #8FD3FF;
  --glow-peach: #FFC59E;
  --glow-lemon: #FFE98A;
  --success: #0B7A55;
  --danger: #B4381A;
  --mark: #FFF2B8;
  --accent-text: #0B7A55;
  --base-0: rgba(251, 248, 243, 0);
  --header-bg: rgba(251, 248, 243, 0.82);
  --hover: rgba(18, 19, 22, 0.05);
  --ink-hover: #2A2C31;
  --card-hover: #F4F2EE;
  --field: #FFFFFF;
  --field-line: #D9D5CE;
  --chip-bg: #F2F3F5;
  --ink-body: #2B2D33;
  --th: #F6F4F0;
  --ok-bg: #E6F7F0;
  --err-bg: #FCEBE5;
  --f-mint: #E6FBF3;
  --f-sky: #E9F6FF;
  --f-peach: #FFF0E5;
  --f-lemon: #FFF8D9;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%234F535C' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");

  --sans: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 20px;
  --radius-pill: 999px;
  --shadow-card: 0 1px 2px rgba(18, 19, 22, 0.06), 0 12px 32px rgba(18, 19, 22, 0.08);
  --shadow-window: 0 2px 4px rgba(18, 19, 22, 0.05), 0 24px 60px rgba(18, 19, 22, 0.14);
  --max: 1160px;
}

/* Night (dark) theme: an explicit choice wins; otherwise follow the system setting. */
:root[data-mode="dark"] {
    color-scheme: dark;
    --base: #17181B; --card: #1F2024; --glass: rgba(31, 32, 36, 0.72); --line: #2F3137;
    --ink: #F4F5F7; --ink-muted: #A3A8B4; --ink-faint: #8D93A1; --on-ink: #121316;
    --select: #3DF5B0; --handle: #3DF5B0; --accent-text: #3DF5B0;
    --glow-mint: #14513F; --glow-sky: #173E5E; --glow-peach: #5A3522; --glow-lemon: #4D4521;
    --success: #7BE3A6; --danger: #F08A6A; --mark: #4A3F12;
    --base-0: rgba(23, 24, 27, 0); --header-bg: rgba(23, 24, 27, 0.86); --hover: rgba(255, 255, 255, 0.06);
    --ink-hover: #D9DBE0; --card-hover: #26272C; --field: #232428; --field-line: #3A3C43; --chip-bg: #27282D;
    --ink-body: #D5D8DE; --th: #232428; --ok-bg: #12392C; --err-bg: #3D1F17;
    --f-mint: #12302A; --f-sky: #12263A; --f-peach: #33231A; --f-lemon: #2F2A16;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.35);
    --shadow-window: 0 2px 4px rgba(0, 0, 0, 0.4), 0 24px 60px rgba(0, 0, 0, 0.5);
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23A3A8B4' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
  :root:not([data-mode="light"]) {
    color-scheme: dark;
    --base: #17181B; --card: #1F2024; --glass: rgba(31, 32, 36, 0.72); --line: #2F3137;
    --ink: #F4F5F7; --ink-muted: #A3A8B4; --ink-faint: #8D93A1; --on-ink: #121316;
    --select: #3DF5B0; --handle: #3DF5B0; --accent-text: #3DF5B0;
    --glow-mint: #14513F; --glow-sky: #173E5E; --glow-peach: #5A3522; --glow-lemon: #4D4521;
    --success: #7BE3A6; --danger: #F08A6A; --mark: #4A3F12;
    --base-0: rgba(23, 24, 27, 0); --header-bg: rgba(23, 24, 27, 0.86); --hover: rgba(255, 255, 255, 0.06);
    --ink-hover: #D9DBE0; --card-hover: #26272C; --field: #232428; --field-line: #3A3C43; --chip-bg: #27282D;
    --ink-body: #D5D8DE; --th: #232428; --ok-bg: #12392C; --err-bg: #3D1F17;
    --f-mint: #12302A; --f-sky: #12263A; --f-peach: #33231A; --f-lemon: #2F2A16;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.35);
    --shadow-window: 0 2px 4px rgba(0, 0, 0, 0.4), 0 24px 60px rgba(0, 0, 0, 0.5);
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23A3A8B4' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  }
}
body, .site-header, .site-footer, .form-card, .plan, .faq details, .composer, .window, .feature, .input, .textarea, .select, .aside-card, .steps li { transition: background-color .25s ease, border-color .25s ease, color .25s ease; }

/* Theme switch (slider) */
.theme-switch { display: inline-flex; align-items: center; min-height: 44px; padding: 0; border: 0; background: none; cursor: pointer; color: var(--ink); }
.theme-switch .track { position: relative; width: 58px; height: 32px; border-radius: var(--radius-pill); background: var(--chip-bg); border: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 8px; transition: background-color .25s ease, border-color .25s ease; }
.theme-switch .track svg { position: relative; z-index: 1; color: var(--ink-faint); }
.theme-switch .knob { position: absolute; z-index: 2; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--card); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28); display: flex; align-items: center; justify-content: center; transition: transform .22s cubic-bezier(.3, .7, .4, 1); }
.theme-switch .knob svg { color: var(--ink); }
.theme-switch .knob .k-moon { display: none; }
.theme-switch[aria-checked="true"] .knob { transform: translateX(26px); }
.theme-switch[aria-checked="true"] .knob .k-sun { display: none; }
.theme-switch[aria-checked="true"] .knob .k-moon { display: block; }
.theme-switch:hover .track { border-color: var(--ink-faint); }

/* ---------- Builder app ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--base); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--ink); }
:focus-visible { outline: 2px solid var(--select); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
.logo-box { stroke: currentColor; }
.logo-dot { fill: var(--select); }

.app { height: 100%; display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); }

/* Top bar */
.topbar { flex-shrink: 0; height: 60px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); background: var(--header-bg); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); position: relative; z-index: 5; }
.logo { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; font-size: 17px; letter-spacing: -0.02em; text-decoration: none; color: var(--ink); flex-shrink: 0; }
.crumb { color: var(--ink-faint); }
.name-input { min-width: 0; width: min(320px, 34vw); height: 36px; padding: 0 10px; border-radius: var(--radius-sm); border: 1px solid transparent; background: transparent; font-weight: 600; }
.name-input:hover { border-color: var(--line); }
.name-input:focus { outline: none; border-color: var(--select); background: var(--card); }
.grow { flex: 1; }
.badge { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: var(--radius-pill); background: var(--f-lemon); color: var(--ink); white-space: nowrap; }
.credits { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border-radius: var(--radius-pill); border: 1px solid var(--line); background: var(--glass); font-size: 13px; color: var(--ink-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.credits strong { color: var(--ink); font-weight: 600; }
.credits.low strong { color: var(--danger); }
@media (max-width: 640px) { .crumb, .credits .lbl { display: none; } .name-input { width: 40vw; } }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: var(--radius-md); border: 1px solid transparent; font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; transition: background-color .15s, transform .1s; }
.btn:active { transform: scale(0.98); }
.btn-ink { background: var(--ink); color: var(--on-ink); }
.btn-ink:hover { background: var(--ink-hover); }
.btn-line { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn-line:hover { background: var(--card-hover); }
.btn-ghost { background: transparent; color: var(--ink-muted); }
.btn-ghost:hover { background: var(--hover); color: var(--ink); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); border: 1px solid transparent; background: transparent; color: var(--ink-muted); cursor: pointer; }
.icon-btn:hover { background: var(--hover); color: var(--ink); }

/* Home */
.home { flex: 1; overflow-y: auto; }
.home-hero { padding: 64px max(16px, env(safe-area-inset-right, 0px)) 56px max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; align-items: center; gap: 20px; text-align: center;
  background:
    radial-gradient(42% 60% at 12% 100%, var(--glow-mint), transparent 70%),
    radial-gradient(40% 60% at 50% 110%, var(--glow-sky), transparent 70%),
    radial-gradient(38% 60% at 90% 90%, var(--glow-peach), transparent 70%),
    radial-gradient(34% 50% at 78% 10%, var(--glow-lemon), transparent 72%),
    var(--base); }
.home-hero h1 { margin: 0; font-size: clamp(34px, 6vw, 56px); line-height: 1.02; font-weight: 700; letter-spacing: -0.045em; text-wrap: balance; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.chips button { min-height: 34px; padding: 0 14px; border-radius: var(--radius-pill); border: 1px solid var(--line); background: var(--glass); font-size: 13px; cursor: pointer; }
.chips button:hover { background: var(--card); }
.projects { max-width: 1100px; margin: 0 auto; padding: 40px max(16px, env(safe-area-inset-right, 0px)) 64px max(16px, env(safe-area-inset-left, 0px)); }
.projects h2 { font-size: 18px; margin: 0 0 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.pcard { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 18px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); text-decoration: none; color: var(--ink); min-width: 0; }
.pcard:hover { border-color: var(--ink-faint); }
.pcard b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 36px; }
.pcard span { font-size: 13px; color: var(--ink-faint); }
.pcard .del { position: absolute; top: 10px; right: 10px; }
.empty { color: var(--ink-faint); font-size: 14px; }

/* Composer (shared) */
.composer { width: 100%; max-width: 720px; text-align: left; border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--card); padding: 14px 14px 10px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow-card); }
.composer:focus-within { border-color: var(--select); }
.composer textarea { width: 100%; resize: none; border: 0; background: transparent; font-size: 16px; line-height: 1.5; padding: 2px 4px; min-height: 48px; max-height: 220px; }
.composer textarea:focus { outline: none; }
.composer textarea::placeholder { color: var(--ink-faint); }
.crow { display: flex; align-items: center; gap: 8px; }
.tier-unused { height: 34px; padding: 0 30px 0 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--field) var(--chevron) no-repeat right 10px center; appearance: none; -webkit-appearance: none; font-size: 13px; font-weight: 500; color: var(--ink-muted); cursor: pointer; }
.est { font-size: 12px; color: var(--ink-faint); white-space: nowrap; font-variant-numeric: tabular-nums; }
.send { width: 40px; height: 40px; flex-shrink: 0; border-radius: 12px; border: 0; background: var(--ink); color: var(--on-ink); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.send:hover { background: var(--ink-hover); }
.send[disabled] { opacity: .45; cursor: not-allowed; }

/* Workspace */
.workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(320px, 400px) minmax(0, 1fr); }
.chat { min-height: 0; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--base); }
.msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 92%; font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--ink); color: var(--on-ink); padding: 10px 14px; border-radius: 16px 16px 4px 16px; white-space: pre-wrap; }
.msg.ai { align-self: flex-start; display: flex; gap: 10px; }
.msg.ai .mark { width: 26px; height: 26px; flex-shrink: 0; border-radius: 8px; background: var(--card); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; }
.msg.ai .body { display: flex; flex-direction: column; gap: 6px; padding-top: 2px; }
.msg.ai p { margin: 0; white-space: pre-wrap; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--ink-faint); align-items: center; }
.meta button { padding: 0; border: 0; background: none; color: var(--ink-muted); font-size: 12px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.msg.err .body p { color: var(--danger); }
.thinking { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-muted); }
.dots i { display: inline-block; width: 6px; height: 6px; margin-right: 3px; border-radius: 50%; background: var(--select); animation: bob 1s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes bob { 0%, 80%, 100% { transform: translateY(0); opacity: .4; } 40% { transform: translateY(-4px); opacity: 1; } }
.welcome { color: var(--ink-muted); font-size: 14px; border: 1px dashed var(--line); border-radius: 14px; padding: 14px; }
.chat .composer { max-width: none; margin: 0 12px 12px; width: auto; box-shadow: none; }
.ainote { font-size: 11px; color: var(--ink-faint); text-align: center; margin: -4px 0 10px; padding: 0 14px; text-wrap: balance; }

.stage { min-width: 0; min-height: 0; display: flex; flex-direction: column; position: relative;
  background-color: var(--base); background-image: radial-gradient(var(--line) 1px, transparent 1px); background-size: 22px 22px; }
.stagebar { flex-shrink: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--header-bg); }
.seg { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--chip-bg); border: 1px solid var(--line); gap: 2px; }
.seg button { height: 30px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-muted); font-size: 13px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.free { font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 2px 6px; border-radius: 6px; background: var(--f-mint); color: var(--accent-text); }
.frame-wrap { flex: 1; min-height: 0; overflow: auto; display: flex; justify-content: center; padding: 18px; }
/* Preview as a Mac window */
.mac { width: 100%; height: 100%; min-height: 420px; display: flex; flex-direction: column; border-radius: 12px; overflow: hidden;
  background: #FFFFFF; border: 1px solid rgba(0,0,0,.12);
  box-shadow: 0 0 0 .5px rgba(0,0,0,.06), 0 24px 60px -18px rgba(18,19,22,.35), 0 8px 20px -10px rgba(18,19,22,.2);
  transition: width .25s ease; }
.mac.tablet { width: 820px; max-width: 100%; }
.mac.phone { width: 390px; max-width: 100%; }
.mac-bar { flex-shrink: 0; height: 38px; display: flex; align-items: center; gap: 10px; padding: 0 14px;
  background: linear-gradient(#F6F5F3, #ECEAE6); border-bottom: 1px solid rgba(0,0,0,.1); }
.mac-dots { display: inline-flex; gap: 8px; flex: 1 1 0; }
.mac-dots i { width: 12px; height: 12px; border-radius: 50%; box-shadow: inset 0 0 0 .5px rgba(0,0,0,.18); }
.mac-dots i:nth-child(1) { background: #FF5F57; }
.mac-dots i:nth-child(2) { background: #FEBC2E; }
.mac-dots i:nth-child(3) { background: #28C840; }
.mac-url { flex: 0 1 340px; min-width: 0; height: 24px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 7px; background: rgba(0,0,0,.055); color: #5B5D63; font-size: 12px; font-weight: 500; }
.mac-url span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mac-spacer { flex: 1 1 0; }
.mac .frame { flex: 1; width: 100%; min-height: 0; border: 0; border-radius: 0; background: #FFFFFF; display: block; }
:root[data-mode="dark"] .mac { border-color: rgba(255,255,255,.12); box-shadow: 0 24px 60px -18px rgba(0,0,0,.7); }
:root[data-mode="dark"] .mac-bar { background: linear-gradient(#2D2E33, #25262A); border-bottom-color: rgba(0,0,0,.5); }
:root[data-mode="dark"] .mac-url { background: rgba(255,255,255,.08); color: #A9ABB2; }
@media (prefers-color-scheme: dark) {
  :root:not([data-mode="light"]) .mac { border-color: rgba(255,255,255,.12); box-shadow: 0 24px 60px -18px rgba(0,0,0,.7); }
  :root:not([data-mode="light"]) .mac-bar { background: linear-gradient(#2D2E33, #25262A); border-bottom-color: rgba(0,0,0,.5); }
  :root:not([data-mode="light"]) .mac-url { background: rgba(255,255,255,.08); color: #A9ABB2; }
}
.mac.phone .mac-dots i { width: 10px; height: 10px; }
.mac.phone .mac-dots { gap: 6px; }

/* Mobile tabs */
.tabs { display: none; }
@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .tabs { display: flex; gap: 4px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--header-bg); }
  .tabs button { flex: 1; height: 36px; border-radius: 9px; border: 1px solid var(--line); background: transparent; font-weight: 600; font-size: 14px; color: var(--ink-muted); cursor: pointer; }
  .tabs button[aria-selected="true"] { background: var(--card); color: var(--ink); }
  .chat { border-right: 0; }
  .workspace[data-tab="chat"] .stage { display: none; }
  .workspace[data-tab="preview"] .chat { display: none; }
  .frame-wrap { padding: 10px; }
  .stage-body { flex-direction: column; }
  .devices { display: none !important; }
}

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 50; max-width: min(520px, calc(100% - 32px)); padding: 12px 16px; border-radius: 12px; background: var(--ink); color: var(--on-ink); font-size: 14px; box-shadow: var(--shadow-window); }
.toast.err { background: #B4381A; color: #FFFFFF; }

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

/* AI level picker */
.picker { position: relative; }
.pk-btn { height: 36px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--field); display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer; }
.pk-btn:hover { border-color: var(--ink-faint); }
.pk-btn[aria-expanded="true"] { border-color: var(--select); }
.pk-btn svg { color: var(--ink-faint); transition: transform .15s; }
.pk-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.pk-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.pk-dot.fast { background: #2BBF8A; } .pk-dot.balanced { background: #3A9BE8; } .pk-dot.max { background: #E8652B; }
.pk-menu { position: absolute; left: 0; bottom: calc(100% + 8px); width: 320px; max-width: calc(100vw - 32px); background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-window); padding: 6px; z-index: 30; outline: none; }
.picker.down .pk-menu { bottom: auto; top: calc(100% + 8px); }
.pk-head { padding: 8px 10px 6px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); }
.pk-opt { display: flex; gap: 12px; align-items: flex-start; padding: 10px; border-radius: 11px; cursor: pointer; }
.pk-opt .pk-dot { margin-top: 5px; }
.pk-opt.active { background: var(--hover); }
.pk-opt[data-locked="true"] { cursor: pointer; }
.pk-opt[data-locked="true"] .pk-text b { color: var(--ink-faint); }
.pk-opt[data-locked="true"] .pk-text small { opacity: .6; }
.pk-text { flex: 1; min-width: 0; }
.pk-text b { display: block; font-size: 14px; font-weight: 600; }
.pk-rec { display: inline-block; margin-left: 7px; padding: 1px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 700; line-height: 1.5; vertical-align: 1px; color: var(--cta-ink); background: linear-gradient(135deg, var(--cta-a), var(--cta-b)); }
.pk-text small { display: block; font-size: 12px; line-height: 1.45; color: var(--ink-muted); margin-top: 1px; }
.pk-end { flex-shrink: 0; align-self: center; color: var(--accent-text); }
.pk-lock { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--chip-bg); color: var(--ink-muted); }
.pk-foot { margin: 4px 4px 2px; padding: 8px 8px 4px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-faint); }

/* ---------- v2: levels, accounts, billing, publishing ---------- */
.logo-word { display: inline; }
@media (max-width: 520px) { .logo-word { display: none; } }

/* Level bars (Low, Medium, High, Maximum) */
.bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; flex-shrink: 0; }
.bars i { width: 3px; border-radius: 1px; background: var(--line); }
.bars i:nth-child(1) { height: 5px; } .bars i:nth-child(2) { height: 8px; } .bars i:nth-child(3) { height: 11px; } .bars i:nth-child(4) { height: 14px; }
.bars.l1 i:nth-child(-n+1), .bars.l2 i:nth-child(-n+2), .bars.l3 i:nth-child(-n+3), .bars.l4 i:nth-child(-n+4) { background: var(--bar-color); }
.bars.l1 { --bar-color: #2BBF8A; } .bars.l2 { --bar-color: #3A9BE8; } .bars.l3 { --bar-color: #8B6CF0; } .bars.l4 { --bar-color: #E8652B; }
.pk-opt .bars { margin-top: 3px; }

/* Forms (shared) */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; }
.hint { font-size: 12px; color: var(--ink-faint); }
.input { width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--field-line); background: var(--field); color: var(--ink); font-size: 15px; }
.input:focus { outline: none; border-color: var(--select); box-shadow: 0 0 0 3px rgba(15, 158, 110, .18); }
.input:disabled { color: var(--ink-muted); background: var(--chip-bg); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--ink-muted); }
.check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--ink); flex-shrink: 0; }
.form-error { margin: 0; font-size: 13px; color: var(--danger); background: var(--err-bg); border-radius: 10px; padding: 10px 12px; }
.form-ok { margin: 0; font-size: 13px; color: var(--success); background: var(--ok-bg); border-radius: 10px; padding: 10px 12px; }
.btn-lg { min-height: 46px; font-size: 15px; width: 100%; }
.btn-danger { background: #B4381A; color: #FFFFFF; }
.btn-danger:hover { background: #962D14; }
.danger-text { color: var(--danger); }

/* Auth */
.auth { flex: 1; overflow-y: auto; display: flex; align-items: center; justify-content: center; padding: 40px max(16px, env(safe-area-inset-right, 0px)) 40px max(16px, env(safe-area-inset-left, 0px));
  background: radial-gradient(40% 50% at 10% 90%, var(--glow-mint), transparent 70%), radial-gradient(40% 50% at 92% 85%, var(--glow-peach), transparent 70%), radial-gradient(40% 40% at 80% 10%, var(--glow-lemon), transparent 72%), radial-gradient(35% 35% at 15% 15%, var(--glow-sky), transparent 72%), var(--base); }
.auth-card { width: 100%; max-width: 420px; background: var(--card); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-window); padding: 32px 28px; }
.auth-mark { display: flex; justify-content: center; margin-bottom: 14px; color: var(--ink); }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-form h1 { margin: 0; text-align: center; font-size: 26px; letter-spacing: -0.03em; }
.auth-sub { margin: -8px 0 4px; text-align: center; color: var(--ink-muted); font-size: 14px; }
.auth-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--ink-muted); }
.auth-links a { color: var(--ink); font-weight: 600; }

/* Top bar extras */
.credits { text-decoration: none; }
.credits:hover { border-color: var(--ink-faint); }
.live-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--success); }
.live-tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #16A36F; }
.usermenu { position: relative; }
.avatar { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--f-mint); color: var(--ink); font-weight: 700; font-size: 13px; cursor: pointer; }
.avatar:hover { border-color: var(--ink-faint); }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-window); padding: 6px; z-index: 40; display: flex; flex-direction: column; }
.menu-head { padding: 10px 10px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: flex; flex-direction: column; min-width: 0; }
.menu-head b { font-size: 14px; } .menu-head span { font-size: 12px; color: var(--ink-faint); overflow: hidden; text-overflow: ellipsis; }
.menu a, .menu button { display: flex; align-items: center; min-height: 38px; padding: 0 10px; border-radius: 9px; border: 0; background: none; font-size: 14px; color: var(--ink); text-decoration: none; text-align: left; cursor: pointer; }
.menu a:hover, .menu button:hover, .menu a:focus-visible, .menu button:focus-visible { background: var(--hover); }

/* Publish popover */
.publish-wrap { position: relative; }
.popover { position: absolute; right: 0; top: calc(100% + 10px); width: 360px; max-width: calc(100vw - 32px); background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-window); padding: 18px; z-index: 40; display: flex; flex-direction: column; gap: 10px; }
.popover h2 { margin: 0; font-size: 17px; }
.pop-sub, .pop-note { margin: 0; font-size: 13px; color: var(--ink-muted); }
.pop-note { font-size: 12px; color: var(--ink-faint); }
.slug-row { display: flex; align-items: center; border: 1px solid var(--field-line); border-radius: 10px; background: var(--field); overflow: hidden; }
.slug-row:focus-within { border-color: var(--select); }
.slug-post { padding: 0 12px 0 0 !important; }
.slug-pre { padding: 0 2px 0 12px; color: var(--ink-faint); font-family: var(--mono); font-size: 13px; white-space: nowrap; }
.slug-input { flex: 1; min-width: 0; height: 42px; border: 0; background: transparent; font-family: var(--mono); font-size: 14px; padding: 0 12px 0 0; }
.slug-input:focus { outline: none; }
.slug-msg { margin: 0; min-height: 18px; font-size: 12px; color: var(--ink-faint); }
.slug-msg.ok { color: var(--success); } .slug-msg.bad { color: var(--danger); }
.pub-live { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--ok-bg); }
.pub-live a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 600; color: var(--success); }
.dot-live { width: 8px; height: 8px; border-radius: 50%; background: #16A36F; flex-shrink: 0; }
.pop-actions { display: flex; align-items: center; gap: 8px; }

/* Editor extras */
.elabel { display: block; font-size: 12px; font-weight: 600; color: var(--ink-muted); margin-bottom: 6px; }
.upload-btn { cursor: pointer; }

/* Pages (billing, account) */
.page { flex: 1; overflow-y: auto; }
.page-inner { max-width: 1000px; margin: 0 auto; padding: 36px max(16px, env(safe-area-inset-right, 0px)) 64px max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 18px; }
.page-inner.narrow { max-width: 640px; }
.page-head h1 { margin: 0 0 10px; font-size: clamp(28px, 4vw, 36px); letter-spacing: -0.035em; }
.test-banner { margin: 0; font-size: 14px; color: var(--ink); background: var(--f-lemon); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 22px; }
.card h2 { margin: 0; font-size: 18px; }
.kicker { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); }
.cur-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.current h2 { font-size: 28px; letter-spacing: -0.03em; }
.cur-credits { display: flex; align-items: baseline; gap: 8px; }
.cur-credits strong { font-size: 40px; font-weight: 700; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.cur-credits span { color: var(--ink-muted); }
.meter { height: 8px; border-radius: 99px; background: var(--chip-bg); margin: 16px 0 10px; overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: 99px; background: var(--select); transition: width .3s; }
.cur-note { margin: 0; font-size: 13px; color: var(--ink-muted); }
.sub-h { margin: 14px 0 0; font-size: 18px; }
.plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.plan { display: flex; flex-direction: column; gap: 12px; }
.plan.is-current { border: 2px solid var(--ink); }
.plan .price { display: flex; align-items: baseline; gap: 6px; }
.plan .price b { font-size: 34px; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.plan .price span { color: var(--ink-muted); font-size: 14px; }
.plan ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; color: var(--ink-muted); }
.plan li::before { content: "✓"; color: var(--accent-text); font-weight: 700; margin-right: 8px; }
.plan .btn { margin: 2px 0 4px; }
.plan .btn + .btn { margin-top: -4px; }
.plan ul.plan-main { color: var(--ink); font-weight: 600; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.plan .plan-lead { margin: 0; font-size: 13px; font-weight: 700; color: var(--ink); }
.plan .plan-small { margin: auto 0 0; padding-top: 4px; font-size: 12.5px; color: var(--ink-faint); }
.cur-pill { align-self: flex-start; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 3px 8px; border-radius: 99px; background: var(--ink); color: var(--on-ink); }
.packs { display: flex; justify-content: space-between; align-items: center; gap: 18px; flex-wrap: wrap; }
.packs p { margin: 6px 0 0; color: var(--ink-muted); font-size: 14px; }
.pack-buy { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.stepper { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.stepper output { min-width: 34px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.pack-total { font-size: 14px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th { font-size: 12px; color: var(--ink-faint); font-weight: 600; background: var(--th); }
.table tr:last-child td { border-bottom: 0; }
.table td.num { font-variant-numeric: tabular-nums; }
.form-card { display: flex; flex-direction: column; gap: 14px; }
.form-card.danger { border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.form-card .note { margin: 0; font-size: 13px; color: var(--ink-muted); }
@media (max-width: 860px) { .plans { grid-template-columns: 1fr; } }

/* Modal */
.modal-back { position: fixed; inset: 0; z-index: 60; background: rgba(10, 11, 13, .45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { width: 100%; max-width: 420px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-window); padding: 22px; }
.modal h2 { margin: 0 0 8px; font-size: 18px; }
.modal p { margin: 0 0 18px; color: var(--ink-muted); font-size: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Projects grid extras */
.pcard .tag-live { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--success); }
.pcard .tag-live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #16A36F; }
@media (max-width: 640px) { .devices, #reload-btn { display: none !important; } .popover { position: fixed; left: 16px; right: 16px; top: 120px; width: auto; } }
@media (max-width: 640px) {
  .topbar { gap: 8px; }
  .badge, .live-tag { display: none !important; }
  .name-input { flex: 1 1 auto; width: auto; min-width: 0; }
  .topbar .grow { flex: 0 0 0; }
}

/* Project cards with thumbnails */
.pcard { padding: 0; gap: 0; overflow: hidden; transition: border-color .15s, box-shadow .15s, transform .15s; }
.pcard:hover { box-shadow: var(--shadow-card); transform: translateY(-1px); }
.thumb { position: relative; aspect-ratio: 16 / 10; overflow: hidden; border-bottom: 1px solid var(--line); background: linear-gradient(135deg, color-mix(in srgb, var(--tint) 55%, var(--card)), var(--card)); }
.thumb iframe { position: absolute; top: 0; left: 0; width: 1280px; height: 800px; border: 0; background: #FFFFFF; transform: scale(var(--s, .22)); transform-origin: 0 0; pointer-events: none; }
.thumb-empty { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; font-weight: 500; color: var(--ink-muted); }
.pc-body { display: flex; align-items: center; gap: 2px; padding: 12px 8px 12px 14px; }
.pc-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pcard .pc-body b { padding-right: 0; }
.pcard .del { position: static; }
.pcard .star svg { fill: none; }
.pcard .star.on { color: #E5A800; }
.pcard .star.on svg { fill: #F5B400; stroke: #E5A800; }
@media (hover: hover) {
  .pcard .del, .pcard .star:not(.on) { opacity: 0; transition: opacity .15s; }
  .pcard:hover .del, .pcard:hover .star, .pcard .del:focus-visible, .pcard .star:focus-visible { opacity: 1; }
}

/* All projects page */
.page-inner.wide { max-width: 1160px; }
.page-head.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.page-head.row h1 { margin: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; }
.search { flex: 1 1 260px; display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 12px; border-radius: 11px; border: 1px solid var(--field-line); background: var(--field); color: var(--ink-faint); }
.search:focus-within { border-color: var(--select); }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 14px; color: var(--ink); }
.sort select { height: 42px; padding: 0 34px 0 12px; border-radius: 11px; border: 1px solid var(--field-line); background: var(--field) var(--chevron) no-repeat right 10px center; appearance: none; -webkit-appearance: none; font-size: 14px; cursor: pointer; }

/* ===== Project workspace (calm split) ===== */
:root { --bubble: #ECE8E1; }
:root[data-mode="dark"] { --bubble: #2C2D32; }
@media (prefers-color-scheme: dark) { :root:not([data-mode="light"]) { --bubble: #2C2D32; } }
@media (min-width: 901px) { .workspace { grid-template-columns: minmax(340px, 420px) minmax(0, 1fr); } }
.chat { background: var(--base); }
.msgs { padding: 22px 20px; gap: 18px; }
.msg.user { background: var(--bubble); color: var(--ink); }
.sugg { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 14px 10px; }
.sugg button { min-height: 30px; padding: 0 12px; border-radius: var(--radius-pill); border: 1px solid var(--line); background: var(--card); color: var(--ink-muted); font-size: 12.5px; cursor: pointer; }
.sugg button:hover { color: var(--ink); border-color: var(--ink-faint); }
.chat .composer { margin: 0 14px 12px; }
.stage { background:
    radial-gradient(36% 50% at 12% 100%, var(--glow-mint), transparent 70%),
    radial-gradient(34% 50% at 88% 100%, var(--glow-peach), transparent 70%),
    radial-gradient(30% 40% at 82% 0%, var(--glow-lemon), transparent 70%),
    var(--side-bg); }
.stage-body .frame-wrap { position: relative; padding: 24px 32px 88px; }
.topbar .publish-wrap .btn { min-height: 34px; }
@media (max-width: 900px) {
  .stage-body .frame-wrap { padding: 10px 10px 76px; }
  .sugg { margin: 0 12px 8px; }
}

/* ===== Device frames: Mac for desktop, phone and tablet bezels ===== */
.notch { display: none; }
.mac.phone, .mac.tablet { position: relative; border: 12px solid #0C0D0F; border-radius: 48px; background: #0C0D0F;
  box-shadow: 0 0 0 1px var(--line), 0 0 0 3px #2A2C31, 0 30px 70px -20px rgba(18, 19, 22, .45); }
.mac.phone .mac-bar, .mac.tablet .mac-bar { display: none; }
.mac.phone .frame, .mac.tablet .frame { border-radius: 36px; }
.mac.phone { width: 414px; height: min(100%, 860px); align-self: center; }
.mac.tablet { width: 844px; height: min(100%, 1100px); align-self: center; border-width: 14px; border-radius: 34px; }
.mac.tablet .frame { border-radius: 20px; }
.mac.phone .notch { display: block; position: absolute; top: 10px; left: 50%; transform: translateX(-50%); width: 112px; height: 30px; border-radius: 20px; background: #0C0D0F; z-index: 2; pointer-events: none; }
.mac.tablet .notch { display: block; position: absolute; top: -9px; left: 50%; transform: translateX(-50%); width: 6px; height: 6px; border-radius: 50%; background: #24262B; z-index: 2; pointer-events: none; }
.frame-wrap[data-device="phone"], .frame-wrap[data-device="tablet"] { align-items: center; }

/* ===== Code view ===== */
.code-view { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow-window); }
.code-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--line); background: var(--th); }
.code-file { display: inline-flex; align-items: center; gap: 6px; font: 500 13px var(--mono); }
.code-lines { font-size: 12px; color: var(--ink-faint); }
.code-body { flex: 1; min-height: 0; margin: 0; overflow: auto; padding: 14px 16px; font: 12.5px/1.6 var(--mono); color: var(--ink-body); white-space: pre; tab-size: 2; }
.code-note { margin: 0; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-faint); }

/* ===== Hide chat (expand preview) ===== */
@media (min-width: 901px) {
  .workspace.expanded { grid-template-columns: 0 minmax(0, 1fr); }
  .workspace.expanded .chat { visibility: hidden; overflow: hidden; border: 0; }
}
.expand-btn[aria-pressed="true"] { color: var(--accent-text); background: var(--hover); }
@media (max-width: 900px) { .expand-btn { display: none; } }

.sb-time, .sb-icons { display: none; }
.mac.phone .mac-bar { display: flex; position: relative; height: 46px; padding: 0 28px 0 34px; background: #0C0D0F; border: 0; color: #FFFFFF; justify-content: space-between; }
.mac.phone .mac-dots, .mac.phone .mac-url, .mac.phone .mac-spacer { display: none; }
.mac.phone .sb-time { display: block; font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.mac.phone .sb-icons { display: inline-flex; align-items: center; gap: 6px; }
.mac.phone .frame { border-radius: 0 0 36px 36px; }
.mac.phone .notch { top: 8px; }

/* ===== Capture an area ===== */
.capture-btn[aria-pressed="true"] { color: var(--accent-text); background: var(--f-mint); }
.attach { display: flex; align-items: center; gap: 10px; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--chip-bg); }
.attach img { width: 64px; height: 44px; object-fit: cover; object-position: top left; border-radius: 8px; border: 1px solid var(--line); background: #FFFFFF; cursor: zoom-in; flex-shrink: 0; }
.attach-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.attach-text b { font-size: 13px; }
.attach-text span { font-size: 12px; color: var(--ink-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg.user .msg-shot { display: block; max-width: 220px; max-height: 160px; border-radius: 10px; margin: 2px 0 8px; border: 1px solid var(--line); background: #FFFFFF; cursor: zoom-in; object-fit: cover; object-position: top left; }
.shot-view { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: max(24px, env(safe-area-inset-top, 0px)) 24px 24px; background: rgba(8, 9, 11, .72); cursor: zoom-out; }
.shot-view img { max-width: 100%; max-height: 100%; border-radius: 12px; box-shadow: var(--shadow-window); background: #FFFFFF; }
.clip { cursor: pointer; flex-shrink: 0; }

/* ===== Preview area: dock stays put, code view fits ===== */
.stage-body { position: relative; }
.stage-body .frame-wrap { overflow: hidden; }
.code-view { height: 100%; }

/* ===== Motion ===== */
@keyframes cv-view-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes cv-pop-in { from { opacity: 0; transform: translateY(6px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes cv-pop-up { from { opacity: 0; transform: translateY(-6px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes cv-msg-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes cv-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes cv-toast-in { from { opacity: 0; transform: translate(-50%, 12px) scale(.96); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes cv-shimmer { from { background-position: -200% 0; } to { background-position: 200% 0; } }
@media (prefers-reduced-motion: no-preference) {
  .home:not([hidden]), .page:not([hidden]), .auth:not([hidden]) { animation: cv-view-in .32s cubic-bezier(.2, .8, .2, 1) both; }
  .workspace:not([hidden]) .chat, .workspace:not([hidden]) .stage { animation: cv-fade .3s ease both; }
  .msg.enter { animation: cv-msg-in .34s cubic-bezier(.2, .8, .2, 1) both; }
  .menu:not([hidden]), .popover:not([hidden]) { animation: cv-pop-up .18s cubic-bezier(.2, .8, .2, 1) both; transform-origin: top right; }
  .menu.up:not([hidden]), .pk-menu:not([hidden]) { animation: cv-pop-in .18s cubic-bezier(.2, .8, .2, 1) both; transform-origin: bottom left; }
  .modal-back:not([hidden]) { animation: cv-fade .18s ease both; }
  .modal-back:not([hidden]) .modal { animation: cv-pop-in .22s cubic-bezier(.2, .8, .2, 1) both; }
  .toast:not([hidden]) { animation: cv-toast-in .26s cubic-bezier(.2, .8, .2, 1) both; }
  .pcard { animation: cv-view-in .35s cubic-bezier(.2, .8, .2, 1) both; }
  .grid .pcard:nth-child(2) { animation-delay: .03s; } .grid .pcard:nth-child(3) { animation-delay: .06s; } .grid .pcard:nth-child(4) { animation-delay: .09s; }
  .grid .pcard:nth-child(5) { animation-delay: .12s; } .grid .pcard:nth-child(6) { animation-delay: .15s; }
  .shot-view { animation: cv-fade .18s ease both; } .shot-view img { animation: cv-pop-in .22s cubic-bezier(.2, .8, .2, 1) both; }
  .code-view:not([hidden]), .mac:not([hidden]) { animation: cv-fade .22s ease both; }

  .btn, .icon-btn, .seg button, .sugg button, .chips button, .send, .credits, .avatar, .su-btn, .pk-btn, .menu a, .menu button, .pcard {
    transition: background-color .16s ease, border-color .16s ease, color .16s ease, box-shadow .2s ease, transform .16s ease, opacity .16s ease; }
  .send:active, .btn:active, .icon-btn:active, .seg button:active { transform: scale(.94); }
  .composer { transition: border-color .2s ease, box-shadow .2s ease; }
  .composer:focus-within { box-shadow: 0 0 0 4px color-mix(in srgb, var(--select) 16%, transparent); }
  .mac { transition: width .32s cubic-bezier(.2, .8, .2, 1), height .32s cubic-bezier(.2, .8, .2, 1), border-radius .32s ease, border-width .32s ease, box-shadow .32s ease; }
  .frame { transition: opacity .25s ease; }
  .msgs { scroll-behavior: smooth; }
}
/* Preview loading: dim the old page and sweep a soft shimmer instead of flashing white */
.mac { position: relative; }
.mac.loading .frame { opacity: .45; }
.mac.loading::after { content: ""; position: absolute; left: 0; right: 0; top: 40px; height: 3px; z-index: 3; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--select), transparent); background-size: 50% 100%; background-repeat: no-repeat; animation: cv-shimmer 1s linear infinite; }
.mac.phone.loading::after, .mac.tablet.loading::after { top: 0; }
@media (prefers-reduced-motion: reduce) { .mac.loading::after { animation: none; background-size: 100% 100%; opacity: .5; } }
@media (max-width: 640px) { .app.in-project .topbar > .theme-switch { display: none; } }

/* =====================================================================
   DAYBREAK GLASS
   A sunrise sky behind everything, frosted glass panels floating on it,
   a pill menu at the top instead of a sidebar, and warm orange-to-gold
   for the main actions.
   ===================================================================== */
:root {
  --sky1: #CFE6FF; --sky2: #FFE3CC; --sky3: #FFF4DA;
  --sun: rgba(255, 176, 120, .55);
  --glass: rgba(255, 255, 255, .58); --glass-strong: rgba(255, 255, 255, .82); --glass-line: rgba(255, 255, 255, .85);
  --glass-shadow: 0 1px 0 rgba(255, 255, 255, .6) inset, 0 22px 50px -26px rgba(70, 45, 20, .38);
  --cta-a: #E8652B; --cta-b: #E5A800; --cta-ink: #FFFFFF;
  --side-bg: transparent;
}
:root[data-mode="dark"] {
  --sky1: #121A2E; --sky2: #2A1D2C; --sky3: #3A2417; --sun: rgba(232, 101, 43, .28);
  --glass: rgba(30, 31, 36, .55); --glass-strong: rgba(30, 31, 36, .86); --glass-line: rgba(255, 255, 255, .10);
  --glass-shadow: 0 1px 0 rgba(255, 255, 255, .05) inset, 0 26px 60px -26px rgba(0, 0, 0, .7);
}
@media (prefers-color-scheme: dark) { :root:not([data-mode="light"]) {
  --sky1: #121A2E; --sky2: #2A1D2C; --sky3: #3A2417; --sun: rgba(232, 101, 43, .28);
  --glass: rgba(30, 31, 36, .55); --glass-strong: rgba(30, 31, 36, .86); --glass-line: rgba(255, 255, 255, .10);
  --glass-shadow: 0 1px 0 rgba(255, 255, 255, .05) inset, 0 26px 60px -26px rgba(0, 0, 0, .7);
} }

/* Sky */
body { background: linear-gradient(180deg, var(--sky1) 0%, var(--sky2) 62%, var(--sky3) 100%) fixed; }
.app { position: relative; isolation: isolate; }
.app::before { content: ""; position: fixed; z-index: -1; left: 50%; bottom: -55vh; width: 120vmax; height: 110vh; transform: translateX(-50%); border-radius: 50%;
  background: radial-gradient(closest-side, var(--sun), transparent 72%); pointer-events: none; }
.glass, .chat, .auth-card, .page .card, .pcard, .composer, .popover, .menu, .modal, .pk-menu, .code-view {
  background: var(--glass); border: 1px solid var(--glass-line); box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: blur(20px) saturate(1.35); backdrop-filter: blur(20px) saturate(1.35); }
.popover, .menu, .modal, .pk-menu { background: var(--glass-strong); }

/* Main actions: warm gradient */
.cta, .send { background: linear-gradient(135deg, var(--cta-a), var(--cta-b)); color: var(--cta-ink); border: 0; }
.cta:hover, .send:hover { background: linear-gradient(135deg, #F07436, #EDB414); color: var(--cta-ink); }
.send { border-radius: 999px; box-shadow: 0 8px 18px -8px rgba(232, 101, 43, .7); }
.cta { border-radius: 999px; padding: 0 18px; box-shadow: 0 8px 18px -8px rgba(232, 101, 43, .7); }
.send[disabled] { background: linear-gradient(135deg, var(--cta-a), var(--cta-b)); }

/* ---------- Floating top bar ---------- */
.app > .topbar { height: 56px; margin: 16px 16px 0; padding: 0 8px 0 10px; gap: 6px; border-radius: 999px; border-bottom: 1px solid var(--glass-line); flex-shrink: 0; z-index: 20; }
.app.in-pages > .topbar, .app.in-auth > .topbar { align-self: center; width: max-content; max-width: calc(100% - 32px); padding-left: 16px; }
.app.in-pages > .topbar > .grow, .app.in-auth > .topbar > .grow, .app.in-pages .ptools-grow, .app.in-auth .ptools-grow { display: none; }
.app.in-auth > .topbar { gap: 14px; }
.topbar .logo { margin-right: 8px; font-size: 16px; }
.navlinks { display: flex; gap: 2px; }
.navlinks a { height: 38px; padding: 0 15px; display: inline-flex; align-items: center; border-radius: 999px; font-size: 14px; font-weight: 500; color: var(--ink-muted); text-decoration: none; }
.navlinks a:hover { color: var(--ink); background: var(--hover); }
.navlinks a[aria-current="page"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.app.in-pages .navlinks { margin-right: 6px; padding-right: 10px; border-right: 1px solid var(--line); }
.topbar .credits { background: transparent; border-color: transparent; }
.topbar .credits:hover { background: var(--hover); }
.back-btn { width: 38px; height: 38px; border-radius: 50%; background: var(--card); border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.topbar .name-input { font-size: 15px; font-weight: 700; width: min(240px, 22vw); }
.topbar .live-tag { white-space: nowrap; }
.publish-wrap { order: 5; }
.topbar .usermenu { order: 6; }
.topbar .publish-wrap .btn { min-height: 38px; }

/* preview tools inside the bar */
.ptools { display: flex; align-items: center; gap: 4px; }
.ptools .seg { border-radius: 999px; padding: 3px; background: var(--chip-bg); }
.ptools .seg button { border-radius: 999px; height: 30px; }
.ptools .seg button[data-device], .ptools .seg #view-site, .ptools .seg #view-code { width: 34px; padding: 0; justify-content: center; }
.ptools .icon-btn { border-radius: 999px; width: 36px; height: 36px; flex-shrink: 0; }
.ptools .icon-btn[disabled] { opacity: .4; cursor: not-allowed; }
.ptools .dock-sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; flex-shrink: 0; }
/* Keep their space so the Preview / Code / Files switch doesn't jump sideways */
.ptools.code-on .devices, .ptools.code-on #undo-btn, .ptools.code-on #capture-btn { visibility: hidden; pointer-events: none; }
.menu-theme { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 0 10px; font-size: 14px; }
.menu-theme .theme-switch { min-height: 40px; }
.menu-upgrade { color: var(--cta-a) !important; font-weight: 600; gap: 8px; }

/* ---------- Home ---------- */
.home { background: transparent; }
.home-hero { background: none !important; padding-top: clamp(48px, 9vh, 96px); padding-bottom: 28px; gap: 0; }
.home-hero h1 { margin-bottom: 28px; font-size: clamp(36px, 6vw, 68px); letter-spacing: -.05em; }
.grad { background: linear-gradient(90deg, #E8652B, #E5A800 50%, #0F9E6E); -webkit-background-clip: text; background-clip: text; color: transparent; }
.home .composer { max-width: 760px; border-radius: 28px; padding: 18px 18px 14px; }
.home .composer textarea { font-size: 17px; }
.chips.in-comp { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 6px; min-width: 0; }
.chips.in-comp button { min-height: 32px; padding: 0 12px; font-size: 12.5px; background: var(--card); border-color: var(--line); color: var(--ink-muted); }
.chips.in-comp button:hover { color: var(--ink); }
.home .crow { flex-wrap: wrap; }
.home .projects { max-width: 1120px; padding-top: 24px; }
.home .sec-head { justify-content: center; gap: 16px; }
.home .sec-head h2 { font-size: 15px; color: var(--ink-muted); font-weight: 600; }
.home .empty { text-align: center; }
.home .grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 22px; }
.home .grid .pcard { width: 240px; border-radius: 22px; padding: 10px; }
.home .grid .pcard .thumb { border-radius: 14px; border: 1px solid var(--line); }
.home .grid .pcard .pc-body { padding: 10px 2px 2px 6px; }
@media (prefers-reduced-motion: no-preference) {
  .home .grid .pcard:nth-child(4n+1) { rotate: -2.5deg; translate: 0 6px; }
  .home .grid .pcard:nth-child(4n+2) { rotate: 1.5deg; }
  .home .grid .pcard:nth-child(4n+3) { rotate: -1deg; translate: 0 4px; }
  .home .grid .pcard:nth-child(4n+4) { rotate: 2deg; translate: 0 8px; }
  .home .grid .pcard { transition: rotate .25s ease, translate .25s ease, box-shadow .2s ease; }
  .home .grid .pcard:hover { rotate: 0deg; translate: 0 -4px; }
}

/* ---------- Pages ---------- */
.page, .projects-page { background: transparent; }
.app.in-pages > main { margin: 0; border: 0; border-radius: 0; background: transparent; }
.pcard { border-radius: 20px; }
.pcard .thumb { border-bottom-color: var(--glass-line); }
.page .card { border-radius: 22px; }
.search, .sort select { background-color: var(--glass-strong); border-color: var(--glass-line); border-radius: 999px; }
.page-head .btn-ink { background: linear-gradient(135deg, var(--cta-a), var(--cta-b)); color: #fff; border-radius: 999px; }

/* ---------- Auth ---------- */
.auth { background: transparent; }
.auth-card { border-radius: 28px; }

/* ---------- Project workspace ---------- */
.app.in-project > .workspace { margin: 0; }
.workspace { gap: 16px; padding: 16px; background: transparent; }
@media (min-width: 901px) { .workspace { grid-template-columns: 380px minmax(0, 1fr); } }
.chat { border-radius: 28px; overflow: hidden; border-right: 1px solid var(--glass-line); }
.msgs { padding: 20px 16px; gap: 12px; }
.msg.ai .mark { display: none; }
.msg.user { background: var(--ink); color: var(--on-ink); border-radius: 18px 18px 6px 18px; padding: 10px 14px; }
.msg.user .msg-shot { border-color: rgba(255, 255, 255, .2); }
.msg.ai .body { background: var(--card); border: 1px solid var(--line); border-radius: 18px 18px 18px 6px; padding: 10px 14px; gap: 4px; max-width: 100%; }
.msg.ai .meta { font-size: 11.5px; }
.msg.err .body { border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.welcome { background: var(--card); border: 1px dashed var(--line); border-radius: 18px; }
.sugg { margin: 0 14px 10px; }
.sugg button { background: var(--card); border-radius: 999px; }
.chat .composer { margin: 0 12px 10px; border-radius: 22px; background: var(--card); border: 1px solid var(--line); box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
.ainote { margin-bottom: 10px; }
.stage { background: transparent !important; }
.stage-body .frame-wrap { padding: 0; }
.mac { border-radius: 18px; }
.mac:not(.phone):not(.tablet) { box-shadow: 0 30px 70px -30px rgba(60, 40, 20, .5); border: 1px solid var(--glass-line); }
.mac-bar { height: 40px; }
.code-view { border-radius: 18px; }
@media (min-width: 901px) {
  .workspace.expanded { grid-template-columns: 0 minmax(0, 1fr); gap: 0; }
}
.expand-btn[aria-pressed="true"] { color: var(--cta-a); }
.attach:not([hidden]) { animation: cv-pop-in .24s cubic-bezier(.2, .8, .2, 1) both; }

/* ---------- Phones ---------- */
@media (max-width: 900px) {
  .app > .topbar { margin: 10px 10px 0; }
  .app.in-project > .topbar { height: auto; flex-wrap: wrap; row-gap: 6px; padding: 8px; border-radius: 24px; }
  .app.in-project .ptools { order: 10; flex-basis: 100%; justify-content: center; overflow-x: auto; }
  .app.in-project .ptools-grow { display: none; }
  .ptools #expand-btn, .ptools .devices { display: none; }
  .topbar .name-input { width: auto; flex: 1 1 80px; }
  .workspace { padding: 10px; gap: 10px; }
  .tabs { background: var(--glass); border: 1px solid var(--glass-line); border-radius: 999px; padding: 4px; margin: 0; }
  .tabs button { border-radius: 999px; border: 0; }
  .chat, .mac { border-radius: 22px; }
}
@media (max-width: 640px) {
  .app.in-pages > .topbar { padding-left: 12px; gap: 2px; }
  .app.in-pages > .topbar > .theme-switch, .app.in-project > .topbar > .theme-switch { display: none; }
  .navlinks a { padding: 0 10px; font-size: 13px; }
  .app.in-pages .navlinks { padding-right: 4px; margin-right: 2px; }
  .topbar .logo { margin-right: 2px; }
}

/* restored layout rules */
.stage-body { flex: 1; min-height: 0; display: flex; position: relative; }
.stage-body .frame-wrap { flex: 1; min-width: 0; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.sec-head h2 { margin: 0 !important; }
.see-all { font-size: 14px; color: var(--ink-muted); text-decoration: none; }
.see-all:hover { color: var(--ink); text-decoration: underline; }
.home .sec-head { justify-content: center; }
/* your own messages: ink in light mode, warm glass in dark mode */
:root[data-mode="dark"] .msg.user { background: rgba(232, 101, 43, .2); color: var(--ink); border: 1px solid rgba(232, 101, 43, .35); }
@media (prefers-color-scheme: dark) { :root:not([data-mode="light"]) .msg.user { background: rgba(232, 101, 43, .2); color: var(--ink); border: 1px solid rgba(232, 101, 43, .35); } }


/* ===== Smoothness pass =====
   1. The sky sits on its own fixed layer instead of a fixed body background, which repainted the whole page on every scroll.
   2. Frosted blur is kept for the few big floating panels; cards in lists use a nearly solid glass instead (blur is the expensive part).
   3. Page changes cross-fade, drawn by the graphics card. */
body { background: var(--sky1); }
body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, var(--sky1) 0%, var(--sky2) 62%, var(--sky3) 100%); }
.app::before { will-change: transform; }
:root { --glass-solid: rgba(255, 255, 255, .86); }
:root[data-mode="dark"] { --glass-solid: rgba(30, 31, 36, .9); --glass-strong: rgba(28, 29, 34, .97); }
@media (prefers-color-scheme: dark) { :root:not([data-mode="light"]) { --glass-solid: rgba(30, 31, 36, .9); --glass-strong: rgba(28, 29, 34, .97); } }
:root:not([data-mode="dark"]) { --glass-strong: rgba(255, 255, 255, .96); }
@media (prefers-color-scheme: dark) { :root:not([data-mode="light"]):not([data-mode="dark"]) { --glass-strong: rgba(28, 29, 34, .97); } }
.pcard, .page .card, .code-view { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--glass-solid); }
.topbar, .chat, .composer, .auth-card { -webkit-backdrop-filter: blur(16px) saturate(1.3); backdrop-filter: blur(16px) saturate(1.3); }
.popover, .menu, .modal, .pk-menu { background: var(--glass-strong); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.chat .composer { -webkit-backdrop-filter: none; backdrop-filter: none; }
.pk-menu { overflow-y: auto; z-index: 60; overscroll-behavior: contain; }
.home .grid .pcard .thumb iframe { will-change: transform; }

/* View transitions */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .26s; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
html.vt .home:not([hidden]), html.vt .page:not([hidden]), html.vt .auth:not([hidden]) { animation: none; }
@media (prefers-reduced-motion: reduce) { ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; } }

/* ===== Smooth light/dark switch everywhere =====
   With reduced motion on, the theme gently cross-fades (fades don't move anything).
   Browsers without View Transitions blend every colour, including the sky, over half a second. */
@keyframes cv-fade-out { to { opacity: 0; } }
html.theme-fade::view-transition-old(root) { animation: cv-fade-out .4s ease both !important; }
html.theme-fade::view-transition-new(root) { animation: cv-fade .4s ease both !important; }
@property --sky1 { syntax: '<color>'; inherits: true; initial-value: #CFE6FF; }
@property --sky2 { syntax: '<color>'; inherits: true; initial-value: #FFE3CC; }
@property --sky3 { syntax: '<color>'; inherits: true; initial-value: #FFF4DA; }
@property --sun { syntax: '<color>'; inherits: true; initial-value: rgba(255, 176, 120, .55); }
html.theme-blend { transition: --sky1 .5s ease, --sky2 .5s ease, --sky3 .5s ease, --sun .5s ease !important; }
html.theme-blend body, html.theme-blend *, html.theme-blend *::before, html.theme-blend *::after {
  transition: background-color .5s ease, color .5s ease, border-color .5s ease, box-shadow .5s ease, fill .5s ease, stroke .5s ease, outline-color .5s ease !important; }
html.theme-blend .theme-switch .knob { transition: transform .22s cubic-bezier(.3, .7, .4, 1), background-color .5s ease !important; }

/* The switch knob was nearly invisible in dark mode: give it a lighter disc. */
:root[data-mode="dark"] .theme-switch .knob { background: #3A3C44; box-shadow: 0 1px 3px rgba(0, 0, 0, .5); }
@media (prefers-color-scheme: dark) { :root:not([data-mode="light"]) .theme-switch .knob { background: #3A3C44; box-shadow: 0 1px 3px rgba(0, 0, 0, .5); } }

/* The prompt box (and its level menu) always sits above the project postcards below it. */
.home-hero { position: relative; z-index: 5; }
.home .projects { position: relative; z-index: 1; }
.composer:has(.pk-menu:not([hidden])) { position: relative; z-index: 10; }
.pk-menu, .menu, .popover, .modal { background: var(--card); -webkit-backdrop-filter: none; backdrop-filter: none; }

/* Phones: on the project screen the credits pill hides so the project name has room (credits still show on every other page). */
@media (max-width: 640px) { .app.in-project > .topbar .credits { display: none; } }
.topbar .name-input { text-overflow: ellipsis; }
@media (max-width: 640px) { .topbar .name-input { font-size: 14px; padding: 0 6px; } }

/* Theme change: blocks fade out and lift back in (animated from the script); the sky/glows blend meanwhile. */
html.theme-sky { transition: --sky1 .5s ease, --sky2 .5s ease, --sky3 .5s ease, --sun .5s ease !important; }

/* ===== Motion is driven from the script now (page switches lift in block by block) ===== */
.home:not([hidden]), .page:not([hidden]), .auth:not([hidden]), .pcard,
.workspace:not([hidden]) .chat, .workspace:not([hidden]) .stage { animation: none; }

/* Sliding pill behind the active top-menu tab */
.navlinks { position: relative; }
.navlinks a { position: relative; z-index: 1; }
.navlinks a[aria-current="page"] { background: transparent; box-shadow: none; }
.nav-pill { position: absolute; left: 0; top: 0; height: 38px; width: 0; border-radius: 999px; background: var(--card); box-shadow: 0 1px 3px rgba(0, 0, 0, .1);
  opacity: 0; pointer-events: none; z-index: 0; transition: transform .38s cubic-bezier(.2, .8, .2, 1), width .38s cubic-bezier(.2, .8, .2, 1), opacity .2s ease; }
.nav-pill.instant { transition: none; }

/* Sliding pill on the phone Chat / Preview tabs */
@media (max-width: 900px) {
  .tabs { position: relative; }
  .tabs button { position: relative; z-index: 1; transition: color .25s ease; }
  .tabs button[aria-selected="true"] { background: transparent; }
  .tab-pill { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 6px); border-radius: 999px; background: var(--card); box-shadow: 0 1px 3px rgba(0, 0, 0, .1);
    transition: transform .36s cubic-bezier(.2, .8, .2, 1); }
  .workspace[data-tab="preview"] .tab-pill { transform: translateX(calc(100% + 4px)); }
}
.tab-pill { display: none; }
@media (max-width: 900px) { .tab-pill { display: block; } }

/* Card pictures */
.thumb-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top left; display: block; background: #FFFFFF; }

/* Several attached pictures */
.attach { flex-direction: column; align-items: stretch; gap: 6px; padding: 8px; }
.attach-list { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 2px 4px; }
.att { position: relative; flex: 0 0 auto; width: 74px; height: 54px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #FFFFFF; }
.att img { width: 100%; height: 100%; object-fit: cover; object-position: top left; display: block; cursor: zoom-in; }
.att-kind { position: absolute; left: 4px; bottom: 4px; padding: 1px 5px; border-radius: 5px; background: rgba(18, 19, 22, .72); color: #FFFFFF; font-size: 10px; font-weight: 600; pointer-events: none; }
.att-x { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; border: 0; padding: 0; display: grid; place-items: center; cursor: pointer;
  background: rgba(18, 19, 22, .72); color: #FFFFFF; opacity: .9; }
.att-x:hover { opacity: 1; background: rgba(18, 19, 22, .9); }
.att.loading { background: linear-gradient(90deg, var(--chip-bg), var(--card), var(--chip-bg)); background-size: 200% 100%; animation: cv-shimmer 1s linear infinite; }
.attach-meta { font-size: 12px; color: var(--ink-faint); padding: 0 2px; }
@media (prefers-reduced-motion: no-preference) { .att.new { animation: cv-pop-in .26s cubic-bezier(.2, .8, .2, 1) both; } }
.chat.dropping { outline: 2px dashed var(--select); outline-offset: -8px; }

/* Pictures inside a sent message */
.msg-shots { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 8px; }
.msg-shots .msg-shot { margin: 0; }
.msg-shots.many .msg-shot { width: 96px; height: 70px; max-width: none; max-height: none; }

/* Smooth preview scrolling: the top bar and chat panel only sit over the plain sky, where blurring
   changes almost nothing you can see, but it made the browser redraw them on every scroll of the preview.
   Same see-through glass, no blur. */
.topbar, .chat { -webkit-backdrop-filter: none; backdrop-filter: none; }
.chat { background: var(--glass); }
:root[data-mode="dark"] .nav-pill, :root[data-mode="dark"] .tab-pill { background: #2C2E35; }
@media (prefers-color-scheme: dark) { :root:not([data-mode="light"]) .nav-pill, :root:not([data-mode="light"]) .tab-pill { background: #2C2E35; } }

/* ===== Downloading ===== */
@media (prefers-reduced-motion: no-preference) { #download-btn[aria-pressed="true"] { background: var(--hover); color: var(--accent-text); }
.code-head a.btn { gap: 6px; text-decoration: none; }
.pop-dl { display: block; margin-top: 2px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 12px; text-align: left; font-size: 13px; color: var(--ink-muted); text-decoration: none; }
.pop-dl b { color: var(--ink); font-weight: 600; }
.pop-dl:hover { border-color: var(--ink-faint); }
/* File card in the chat */
.file-card { display: flex; align-items: center; gap: 10px; margin-top: 6px; padding: 8px 8px 8px 10px; border-radius: 14px; border: 1px solid var(--line); background: var(--glass-solid); max-width: 280px; }
.fc-ic { flex-shrink: 0; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #FFFFFF; background: linear-gradient(135deg, var(--cta-a), var(--cta-b)); }
.fc-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.fc-text b { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-text small { font-size: 11.5px; color: var(--ink-faint); }
.fc-dl { flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-muted); border: 1px solid var(--line); background: var(--card); transition: background-color .16s ease, color .16s ease; }
.fc-dl:hover { color: var(--ink); background: var(--hover); }

/* ===== Privacy policy and terms inside the app ===== */
.menu-sep { height: 1px; margin: 4px 6px; background: var(--line); }
.auth { flex-direction: column; gap: 14px; }
.auth-legal { display: flex; gap: 10px; margin: 0; font-size: 12.5px; color: var(--ink-faint); }
.auth-legal a { color: var(--ink-muted); text-decoration: none; }
.auth-legal a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.legal-back { display: inline-flex; align-self: flex-start; font-size: 13px; font-weight: 600; color: var(--ink-muted); text-decoration: none; }
.legal-back:hover { color: var(--ink); }
.legal-page .page-head h1 { margin: 0 0 10px; }
.legal-page .page-head p { margin: 0; max-width: 640px; color: var(--ink-muted); }
.legal-page .legal { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; align-items: start; }
.legal-page .toc { position: sticky; top: 8px; font-size: 13.5px; padding: 16px 18px; border-radius: 20px; background: var(--glass-solid); border: 1px solid var(--glass-line); box-shadow: var(--glass-shadow); }
.legal-page .toc p { margin: 0 0 8px; font-weight: 600; }
.legal-page .toc ol { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; color: var(--ink-faint); }
.legal-page .toc a { color: var(--ink-muted); text-decoration: none; }
.legal-page .toc a:hover { color: var(--ink); }
.legal-page .prose { min-width: 0; padding: 8px 32px 24px; border-radius: 24px; background: var(--glass-solid); border: 1px solid var(--glass-line); box-shadow: var(--glass-shadow); font-size: 15px; line-height: 1.65; }
.legal-page .prose h2 { font-size: 20px; letter-spacing: -0.02em; margin: 28px 0 10px; scroll-margin-top: 16px; }
.legal-page .prose h3 { font-size: 16px; margin: 20px 0 8px; }
.legal-page .prose p, .legal-page .prose ul, .legal-page .prose ol { margin: 0 0 12px; color: var(--ink-body); }
.legal-page .prose ul, .legal-page .prose ol { padding-left: 22px; }
.legal-page .prose li { margin-bottom: 5px; }
.legal-page .prose a { color: var(--accent-text); }
.legal-page .prose .table-wrap { margin: 0 0 14px; border-radius: 12px; background: var(--card); }
.legal-page .prose table { font-size: 13.5px; }
.legal-page .prose th, .legal-page .prose td { white-space: normal; vertical-align: top; }
.fill { background: var(--mark); color: var(--ink); padding: 0 4px; border-radius: 4px; }
@media (max-width: 860px) {
  .legal-page .legal { grid-template-columns: 1fr; gap: 14px; }
  .legal-page .toc { position: static; }
  .legal-page .prose { padding: 4px 18px 16px; }
}

/* ===== Files tab: the site's folders and files, each downloadable ===== */
.files-view { flex: 1; min-width: 0; min-height: 0; height: 100%; display: flex; flex-direction: column; border-radius: 18px; overflow: hidden;
  border: 1px solid var(--glass-line); background: var(--glass-solid); box-shadow: var(--glass-shadow); }
.fv-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.fv-title { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); }
.fv-title > svg { color: var(--cta-a); }
.fv-title span { display: flex; flex-direction: column; line-height: 1.25; }
.fv-title b { font-size: 15px; }
.fv-title small { font-size: 12px; color: var(--ink-faint); }
.fv-head .btn { gap: 6px; text-decoration: none; border-radius: 999px; }
.fv-head .cta { color: #FFFFFF; }
.fv-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(240px, 320px) minmax(0, 1fr); }
.fv-tree { overflow-y: auto; padding: 8px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 1px; }
.fv-row { position: relative; display: flex; align-items: center; border-radius: 10px; }
.fv-row:hover { background: var(--hover); }
.fv-row[aria-selected="true"] { background: color-mix(in srgb, var(--cta-a) 12%, transparent); }
.fv-pick { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 6px 0 calc(8px + var(--d, 0) * 18px); border: 0; background: none; text-align: left; cursor: pointer; color: var(--ink); }
.fv-folder .fv-pick { font-weight: 600; }
.fv-chev { display: inline-grid; place-items: center; width: 14px; margin-left: -18px; margin-right: 4px; color: var(--ink-faint); transition: transform .2s ease; }
.fv-pick[aria-expanded="true"] .fv-chev { transform: rotate(90deg); }
.fv-ic { flex-shrink: 0; display: inline-grid; place-items: center; color: var(--ink-muted); }
.fv-ic.k-folder { color: #E5A800; } .fv-ic.k-html { color: var(--cta-a); } .fv-ic.k-image { color: #3A9BE8; } .fv-ic.k-text { color: var(--ink-faint); }
.fv-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; font-family: var(--mono); }
.fv-folder .fv-name { font-family: var(--sans); }
.fv-size { flex-shrink: 0; font-size: 11.5px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.fv-dl { flex-shrink: 0; width: 30px; height: 30px; margin-right: 3px; border-radius: 8px; display: grid; place-items: center; color: var(--ink-faint); }
.fv-dl:hover { color: var(--ink); background: var(--card); }
.fv-detail { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.fd-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.fd-head .btn { gap: 6px; text-decoration: none; }
.fd-title { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.fd-title b { font-family: var(--mono); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fd-title small { font-size: 12px; color: var(--ink-faint); }
.fd-body { flex: 1; min-height: 0; overflow: auto; }
.fd-text { margin: 0; padding: 14px 16px; font: 12.5px/1.6 var(--mono); color: var(--ink-body); white-space: pre; tab-size: 2; }
.fd-img { display: block; max-width: calc(100% - 32px); max-height: calc(100% - 32px); margin: 16px auto; border-radius: 12px; border: 1px solid var(--line);
  background: repeating-conic-gradient(var(--chip-bg) 0 25%, var(--card) 0 50%) 0 0 / 16px 16px; }
.fv-empty { margin: auto; max-width: 320px; padding: 24px; text-align: center; color: var(--ink-muted); font-size: 14px; }
@media (max-width: 900px) {
  .fv-body { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .fv-tree { border-right: 0; border-bottom: 1px solid var(--line); max-height: 38vh; }
}
/* file card name opens the Files tab */
button.fc-text { border: 0; background: none; padding: 0; text-align: left; cursor: pointer; color: var(--ink); }
button.fc-text:hover b { text-decoration: underline; text-underline-offset: 3px; }

/* Help and legal group in the account menu */
.menu .menu-sub { justify-content: space-between; gap: 8px; width: 100%; }
.menu-sub svg { color: var(--ink-faint); transition: transform .2s ease; }
.menu-sub[aria-expanded="true"] svg { transform: rotate(180deg); }
.menu-subitems { display: flex; flex-direction: column; margin: 0 0 2px 10px; padding-left: 8px; border-left: 1px solid var(--line); }
.menu-subitems a { min-height: 34px; font-size: 13.5px; color: var(--ink-muted); }
.menu-subitems a:hover { color: var(--ink); }

/* Home greeting: "Good morning, name." big, with the question underneath */
.home-hero h1 { margin-bottom: 12px; font-size: clamp(38px, 6.4vw, 72px); line-height: 1.04; }
.grad.warm { background: linear-gradient(90deg, #E8652B, #E5A800); -webkit-background-clip: text; background-clip: text; color: transparent; }
.home-sub { margin: 0 0 30px; font-size: clamp(17px, 2vw, 20px); color: var(--ink-muted); letter-spacing: -0.01em; }

/* ===== Watching it build: thinking, steps, code and a live preview ===== */
.b-think { display: inline-flex; align-items: center; gap: 7px; align-self: flex-start; padding: 2px 4px 2px 0; border: 0; background: none; color: var(--ink-muted); font-size: 13px; font-weight: 600; cursor: pointer; }
.b-think:hover { color: var(--ink); }
.b-spark { display: inline-grid; place-items: center; color: var(--cta-a); }
.b-think.live .b-spark { animation: cv-spin 2.4s linear infinite; }
.b-think.live .b-label { background: linear-gradient(90deg, var(--ink-muted) 0%, var(--ink) 40%, var(--ink-muted) 80%); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: cv-shimmer 1.6s linear infinite; }
.b-time { font-weight: 500; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.b-chev { color: var(--ink-faint); transition: transform .2s ease; }
.b-think[aria-expanded="true"] .b-chev { transform: rotate(180deg); }
.b-thought { max-height: 168px; overflow-y: auto; margin: 2px 0 6px; padding: 2px 0 2px 12px; border-left: 2px solid var(--line); overscroll-behavior: contain; }
.b-thought p { margin: 0; font-size: 13px; line-height: 1.55; color: var(--ink-muted); white-space: pre-wrap; }
.msg.ai .b-think.done { margin-bottom: 2px; }
.build { display: flex; flex-direction: column; gap: 6px; min-width: 250px; }
.b-steps { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.b-steps li { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--ink-faint); transition: color .2s ease; }
.b-steps li.now { color: var(--ink); font-weight: 600; }
.b-steps li.done { color: var(--ink-muted); }
.b-dot { position: relative; flex-shrink: 0; width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--line); box-sizing: border-box; transition: background-color .2s ease, border-color .2s ease; }
.b-steps li.now .b-dot { border-color: var(--cta-a); border-top-color: transparent; animation: cv-spin .8s linear infinite; }
.b-steps li.done .b-dot { border-color: var(--select); background: var(--select); }
.b-steps li.done .b-dot::after { content: ""; position: absolute; left: 4.5px; top: 2px; width: 3px; height: 6px; border: solid #FFFFFF; border-width: 0 1.8px 1.8px 0; transform: rotate(45deg); }
.b-lines { margin-left: auto; padding-left: 10px; font-size: 12px; font-weight: 500; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.b-code { margin: 6px 0 0; height: 150px; overflow: hidden; padding: 10px 12px; border-radius: 12px; background: #15161A; color: #C9D1D9; font: 11.5px/1.55 var(--mono); white-space: pre; display: flex; flex-direction: column; justify-content: flex-end;
  -webkit-mask-image: linear-gradient(transparent, #000 40%); mask-image: linear-gradient(transparent, #000 40%); }
.msg.ai.building .body { width: 100%; }
@keyframes cv-spin { to { transform: rotate(360deg); } }

.mac .frame.live { position: absolute; left: 0; width: 100%; opacity: 0; z-index: 2; background: #FFFFFF; transition: opacity .25s ease; pointer-events: none; }
.mac .frame.live.front { opacity: 1; }
.mac.phone .frame.live { border-radius: 0 0 36px 36px; }
.mac.tablet .frame.live { border-radius: 20px; }
.live-tag-build { display: none; position: absolute; z-index: 3; right: 14px; bottom: 14px; align-items: center; gap: 7px; height: 30px; padding: 0 12px; border-radius: 999px;
  background: rgba(18, 19, 22, .82); color: #FFFFFF; font-size: 12.5px; font-weight: 600; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); }
.live-tag-build i { width: 7px; height: 7px; border-radius: 50%; background: var(--cta-a); animation: cv-pulse 1.2s ease-in-out infinite; }
.mac.building .live-tag-build { display: inline-flex; }
@keyframes cv-pulse { 0%, 100% { opacity: .35; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.15); } }
@media (prefers-reduced-motion: reduce) { .b-think.live .b-spark, .b-steps li.now .b-dot, .live-tag-build i, .b-think.live .b-label { animation: none; } .b-think.live .b-label { color: var(--ink); background: none; } }

/* ===== The real-steps timeline ===== */
.build { gap: 7px; }
.b-say { margin: 2px 0; font-size: 14px; line-height: 1.55; white-space: pre-wrap; color: var(--ink); }
.b-row { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--ink-muted); min-height: 22px; }
.b-row.now { color: var(--ink); font-weight: 600; }
.b-row.fail { color: var(--danger); }
.b-row .b-step { min-width: 0; }
.b-row .b-lines { margin-left: auto; padding-left: 10px; font-size: 12px; font-weight: 500; color: var(--ink-faint); white-space: nowrap; font-variant-numeric: tabular-nums; }
.b-row .b-dot { position: relative; flex-shrink: 0; width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--line); box-sizing: border-box; }
.b-row.now .b-dot { border-color: var(--cta-a); border-top-color: transparent; animation: cv-spin .8s linear infinite; }
.b-row.done .b-dot { border-color: var(--select); background: var(--select); }
.b-row.done .b-dot::after { content: ""; position: absolute; left: 4.5px; top: 2px; width: 3px; height: 6px; border: solid #FFFFFF; border-width: 0 1.8px 1.8px 0; transform: rotate(45deg); }
.b-row.fail .b-dot { border-color: var(--danger); background: var(--danger); }
.b-row.fail .b-dot::after { content: "!"; position: absolute; inset: 0; display: grid; place-items: center; color: #FFFFFF; font-size: 10px; font-weight: 800; }
.b-showdiff { margin-left: 8px; padding: 0; border: 0; background: none; font-size: 12px; font-weight: 600; color: var(--accent-text); cursor: pointer; white-space: nowrap; }
.b-diff { display: flex; flex-direction: column; gap: 6px; margin: 2px 0 4px; }
.b-hunk { border-radius: 10px; overflow: hidden; border: 1px solid var(--line); font: 11.5px/1.5 var(--mono); }
.b-hunk div { padding: 1px 10px; white-space: pre; overflow: hidden; text-overflow: ellipsis; }
.b-hunk .del { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--ink-body); }
.b-hunk .del::before { content: "− "; color: var(--danger); }
.b-hunk .add { background: color-mix(in srgb, var(--select) 14%, transparent); color: var(--ink-body); }
.b-hunk .add::before { content: "+ "; color: var(--select); }
.b-think.quiet .b-chev { display: none; }
.b-foot { margin-top: 4px; font-size: 11.5px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.b-foot.end { color: var(--ink-faint); }
.b-log { margin: 2px 0; }
.b-logbtn { display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none; font-size: 12.5px; font-weight: 600; color: var(--ink-muted); cursor: pointer; }
.b-logbtn[aria-expanded="true"] .b-chev { transform: rotate(180deg); }
.b-loglist { display: flex; flex-direction: column; gap: 5px; margin: 6px 0 4px; padding-left: 2px; }
.b-loglist .b-row { font-size: 12.5px; }
/* Stop button and chat mode */
.send.stop { background: var(--ink) !important; color: var(--on-ink); box-shadow: none; }
.send.stop:hover { background: var(--ink-hover) !important; }
.chat-mode { width: auto !important; padding: 0 10px; gap: 6px; border-radius: 999px !important; font-size: 12.5px; font-weight: 600; }
.chat-mode .cm-label { display: inline; }
.chat-mode[aria-pressed="true"] { background: color-mix(in srgb, #3A9BE8 16%, transparent); color: #2F7FC1; }
:root[data-mode="dark"] .chat-mode[aria-pressed="true"] { color: #8FC8FF; }
@media (prefers-color-scheme: dark) { :root:not([data-mode="light"]) .chat-mode[aria-pressed="true"] { color: #8FC8FF; } }
.chat .composer.chat-on, #new-form.chat-on { border-color: color-mix(in srgb, #3A9BE8 55%, var(--line)); }

/* Projects sort picker (custom menu, no native select) */
.sort { position: relative; }
.sort-btn { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px 0 16px; border-radius: 999px; border: 1px solid var(--glass-line); background: var(--glass-strong); color: var(--ink); font: 500 14px var(--font, inherit); cursor: pointer; white-space: nowrap; transition: background .15s; }
.sort-btn:hover { background: var(--hover); }
.sort-btn svg { color: var(--ink-faint); transition: transform .2s ease; }
.sort-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.sort-menu { min-width: 190px; left: 0; right: auto; }
@media (min-width: 700px) { .sort-menu { left: auto; right: 0; } }
.sort-menu button { justify-content: space-between; gap: 12px; }
.sort-menu button svg { color: var(--select, #0F9E6E); opacity: 0; }
.sort-menu button[aria-checked="true"] { font-weight: 600; }
.sort-menu button[aria-checked="true"] svg { opacity: 1; }

/* Code everywhere: one font (Geist Mono) and no ligatures, so "--" never turns into an arrow */
.code-body code, .fd-text code, .b-code code, .md .md-code pre code { font: inherit; }
.code-body, .fd-text, .b-code, .md .md-code pre, .md .md-ic, .slug-input, .slug-pre, .fv-name, .fd-title b { font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }
/* Step rows: the file name never breaks mid-word; extras wrap to the next line when space is short */
.b-row { flex-wrap: wrap; row-gap: 2px; }
.b-row .b-step { flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-row .b-showdiff { margin-left: 8px; }
.fv-head .fv-one { margin-right: 8px; }
@media (max-width: 560px) { .fv-head .fv-one { display: none; } }

.shot-x { position: absolute; top: max(16px, env(safe-area-inset-top, 0px)); right: 16px; width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(255,255,255,.25); background: rgba(18,19,22,.7); color: #FFFFFF; display: grid; place-items: center; cursor: pointer; }
.shot-x:hover { background: rgba(18,19,22,.92); }
.shot-x:focus-visible { outline: 2px solid #3DF5B0; outline-offset: 2px; }
#estimate.short { color: var(--danger); }

/* Pictures added in the Home prompt box */
.new-attach { margin: 2px 0 8px; }
.new-attach .att { width: 84px; height: 62px; }
#new-form.dropping { outline: 2px dashed var(--select); outline-offset: 4px; }
#new-form .clip { flex-shrink: 0; }

/* Logo: the Sunrise mark + lowercase "corvela" wordmark */
.logo-word { text-transform: lowercase; font-weight: 620; letter-spacing: -0.045em; font-size: 1.08em; }
.cv-mark { flex-shrink: 0; display: block; }

/* + menu in the message boxes */
.add-wrap { position: relative; display: inline-flex; flex-shrink: 0; }
.add-btn[aria-expanded="true"] { background: var(--hover); color: var(--ink); }
.add-btn svg { transition: transform .2s ease; }
.add-btn[aria-expanded="true"] svg { transform: rotate(45deg); }
.add-menu { left: 0; right: auto; top: calc(100% + 8px); min-width: 300px; max-width: calc(100vw - 48px); z-index: 45; }
.add-menu.up { top: auto; bottom: calc(100% + 8px); }
.add-menu .add-item { gap: 12px; width: 100%; min-height: 42px; font-size: 14.5px; }
.add-menu .add-item svg { color: var(--ink-muted); flex-shrink: 0; }
.add-menu .add-label { flex: 1; }
.add-menu .add-hint { font: 500 12px var(--mono); color: var(--ink-faint); font-variant-ligatures: none; }
.add-menu .quiet { color: var(--ink-muted); }
@media (hover: none) and (pointer: coarse) { .add-menu .add-hint { display: none; } }

/* File attachments (PDF, Word, text) */
.att.att-file { width: 168px; display: flex; align-items: center; gap: 9px; padding: 0 26px 0 9px; background: var(--card); }
.file-ext { flex-shrink: 0; display: grid; place-items: center; width: 34px; height: 38px; border-radius: 8px; background: #5B6170; color: #fff; font: 700 9.5px/1 var(--mono); letter-spacing: .02em; font-variant-ligatures: none; }
.file-ext.ext-pdf { background: #D9452B; } .file-ext.ext-docx { background: #2F62D6; }
.file-ext.ext-csv, .file-ext.ext-json, .file-ext.ext-xml { background: #0F8A62; } .file-ext.ext-md, .file-ext.ext-txt { background: #6B6F7A; }
.file-ext.ext-html, .file-ext.ext-htm, .file-ext.ext-css, .file-ext.ext-js { background: #B5671D; }
.att-ftext { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.att-fname { font-size: 12.5px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-fsize { font-size: 11px; color: var(--ink-faint); }
.att.att-file .att-x { background: var(--hover); color: var(--ink-muted); }
.msg-files { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.file-chip { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 5px 10px 5px 5px; border-radius: 10px; background: color-mix(in srgb, currentColor 14%, transparent); color: inherit; text-decoration: none; font-size: 12.5px; }
a.file-chip:hover { background: color-mix(in srgb, currentColor 22%, transparent); }
.file-chip .file-ext { width: 28px; height: 30px; border-radius: 6px; font-size: 8.5px; }
.file-chip .file-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.add-menu .add-limits { margin: 2px 10px 6px 39px; font-size: 11.5px; line-height: 1.45; color: var(--ink-faint); }

/* Billing: payments banner and plan actions */
.pay-banner { margin: 8px 0 0; padding: 10px 14px; border-radius: 14px; font-size: 14px; color: var(--ink-body, var(--ink)); background: color-mix(in srgb, #E5A800 14%, var(--card)); border: 1px solid color-mix(in srgb, #E5A800 32%, var(--line)); }
.pay-banner[hidden] { display: none; }
.cur-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.cur-actions[hidden] { display: none; }

.hp-field { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

/* "Copy the style of a website" */
.link-dlg-back { position: fixed; inset: 0; z-index: 75; display: grid; place-items: start center; padding: max(14vh, 24px) 16px 16px; background: rgba(18, 20, 28, .38); }
.link-dlg-back[hidden] { display: none; }
.link-dlg { width: 100%; max-width: 460px; display: flex; flex-direction: column; gap: 12px; padding: 22px; border-radius: 24px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-window); }
.link-dlg h2 { margin: 0; font-size: 19px; letter-spacing: -.01em; }
.link-dlg p { margin: 0; font-size: 14px; color: var(--ink-muted); line-height: 1.5; }
.link-dlg .form-error { color: var(--danger); }
.link-dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
@media (prefers-reduced-motion: no-preference) { .link-dlg-back:not([hidden]) .link-dlg { animation: cv-pop-in .22s cubic-bezier(.2, .8, .2, 1) both; } }
.link-sw { flex-shrink: 0; display: grid; grid-template-columns: repeat(2, 15px); gap: 2px; padding: 3px; border-radius: 8px; background: var(--hover); }
.link-sw i { width: 15px; height: 15px; border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.file-ext.ext-link { background: linear-gradient(135deg, #E8652B, #E5A800); font-size: 7.5px; }

/* Page picker for multi-page sites (above the preview) */
.page-pick { position: absolute; z-index: 6; top: 6px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-muted); }
.page-pick .pp-label, .page-pick .pp-count { display: none; }
.stage-body:has(.page-pick:not([hidden])) .mac:not(.tablet):not(.phone) .mac-url { visibility: hidden; }
.stage-body:has(.page-pick:not([hidden])) .frame-wrap[data-device="tablet"], .stage-body:has(.page-pick:not([hidden])) .frame-wrap[data-device="phone"] { padding-top: 46px; }
.page-pick[hidden] { display: none; }
.pp-btn { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px 0 14px; border-radius: 999px; border: 1px solid var(--glass-line, var(--line)); background: var(--glass-solid, var(--card)); color: var(--ink); font: 600 13.5px var(--font, inherit); cursor: pointer; box-shadow: 0 4px 14px -10px rgba(0,0,0,.35); }
.pp-btn:hover { background: var(--card); }
.pp-btn svg { color: var(--ink-faint); transition: transform .2s ease; }
.pp-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.pp-count { color: var(--ink-faint); font-size: 12.5px; }
.pp-menu { left: 50%; right: auto; transform: translateX(-50%); top: calc(100% + 6px); min-width: 230px; z-index: 30; }
.pp-menu button { justify-content: space-between; gap: 16px; }
.pp-menu button[aria-checked="true"] { font-weight: 600; background: var(--hover); }
.pp-file { font: 500 11.5px var(--mono); color: var(--ink-faint); font-variant-ligatures: none; }

/* A plan pointed at from a locked AI level */
.card.plan.is-wanted { border-color: var(--cta-a); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cta-a) 22%, transparent), var(--shadow-window, none); }
.cur-pill.want-pill { background: linear-gradient(135deg, var(--cta-a), var(--cta-b)); color: #fff; }
@media (prefers-reduced-motion: no-preference) { .card.plan.is-wanted { animation: cv-pop-in .4s cubic-bezier(.2, .8, .2, 1) both; } }

/* The AI note under the chat box links to the help page about mistakes */
.ainote a { color: inherit; text-decoration: none; }
.ainote a:hover { color: var(--ink-muted); text-decoration: underline; text-underline-offset: 2px; }

/* Monthly / yearly switch on Plan and billing */
.plans-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.plans-head .sub-h { margin-bottom: 0; }
.period-seg { display: inline-flex; padding: 4px; gap: 2px; border-radius: 999px; background: var(--glass, var(--card)); border: 1px solid var(--line); }
.period-seg button { min-height: 34px; padding: 0 14px; border-radius: 999px; border: 0; background: none; font: inherit; font-size: 13.5px; font-weight: 500; color: var(--ink-muted); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.period-seg button[aria-checked="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); font-weight: 600; }
.period-seg .save { font-size: 11.5px; font-weight: 700; color: var(--cta-a); }
.plan .price .was { color: var(--ink-faint); font-size: 18px; font-weight: 600; margin-right: 6px; }
.plan .price-note { margin: -2px 0 6px; font-size: 12.5px; color: var(--ink-muted); }

/* Invoices: ID, status labels, unpaid rows */
.inv-id-btn { background: none; border: 0; padding: 2px 4px; margin: -2px -4px; border-radius: 6px; font: 12.5px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink-muted); cursor: copy; }
.inv-id-btn:hover { background: var(--hover); color: var(--ink); }
.inv-status { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.inv-status.paid { background: var(--ok-bg); color: var(--success); }
.inv-status.due { background: color-mix(in srgb, #E8A21A 18%, transparent); color: #B86E00; }
.inv-status.off { background: var(--chip-bg); color: var(--ink-faint); }
:root[data-mode="dark"] .inv-status.due { color: #F5B544; }
@media (prefers-color-scheme: dark) { :root:not([data-mode="light"]) .inv-status.due { color: #F5B544; } }
.inv-unpaid td { background: color-mix(in srgb, #E8A21A 4%, transparent); }
#invoice-rows .btn-sm { padding: 5px 12px; min-height: 0; font-size: 12.5px; }
/* Hidden screen-reader labels (like the one in the Invoices table header) must stay inside their page,
   otherwise they make the whole window taller and it scrolls past the end. */
.page, .table-wrap { position: relative; }

/* Team projects */
.tag-team { display: inline-block; align-self: flex-start; margin-top: 4px; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: color-mix(in srgb, #635BFF 14%, transparent); color: #5148E0; }
:root[data-mode="dark"] .tag-team { color: #A6A1FF; }
@media (prefers-color-scheme: dark) { :root:not([data-mode="light"]) .tag-team { color: #A6A1FF; } }
.msg-by { align-self: flex-end; margin: 6px 4px -4px 0; font-size: 11.5px; font-weight: 600; color: var(--ink-faint); }
/* Edit text mode (type straight onto the preview) */
.type-btn[aria-pressed="true"] { color: var(--accent-text); background: var(--f-mint); }
.type-hint { position: absolute; left: 50%; top: 52px; transform: translateX(-50%); z-index: 5; max-width: calc(100% - 24px); padding: 8px 14px; border-radius: 999px; background: var(--ink); color: var(--on-ink); font-size: 13px; font-weight: 500; box-shadow: var(--shadow-card); pointer-events: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.type-hint[hidden] { display: none; }
.typing-mode iframe { outline: 2px solid var(--select); outline-offset: -2px; }
#mac { position: relative; }

/* Profile pictures */
.avatar.has-pic, .has-pic { padding: 0; overflow: hidden; }
.avatar-img, .has-pic > img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }

/* Request queue (requests typed while Corvela is working) */
.chat-queue { margin: 0 0 8px; padding: 8px; border-radius: 16px; border: 1px dashed var(--field-line); background: var(--chip-bg); display: flex; flex-direction: column; gap: 4px; }
.chat-queue[hidden] { display: none; }
.cq-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 2px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); }
.cq-go { border: 0; background: none; font: inherit; font-size: 12px; font-weight: 700; color: var(--accent-text); cursor: pointer; text-transform: none; letter-spacing: 0; padding: 2px 4px; }
.cq-item { display: flex; align-items: center; gap: 8px; padding: 6px 4px 6px 6px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); }
.cq-n { flex-shrink: 0; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--chip-bg); color: var(--ink-muted); }
.cq-t { flex: 1; min-width: 0; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cq-x { flex-shrink: 0; width: 26px; height: 26px; color: var(--ink-faint); }
@media (max-width: 480px) { #new-form .chat-mode { padding: 0; width: 36px !important; justify-content: center; } #new-form .chat-mode .cm-label { display: none; } }
