:root {
  color-scheme: light;
  --bg: #f6f6f5; --surface: #fff; --panel: #f2f2f1; --ink: #202020;
  --muted: #787876; --line: #e5e5e3; --line-strong: #cececb;
  --primary: #252525; --on-primary: #fff; --hover: #eaeae8;
  --disabled: #a0a09d; --shadow: 0 4px 24px #00000004;
  font-family: Inter, "Noto Sans Thai", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 13px; color: var(--ink); background: var(--bg);
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #151515; --surface: #1c1c1c; --panel: #242424; --ink: #eaeae8;
  --muted: #999995; --line: #303030; --line-strong: #484846;
  --primary: #e5e5e1; --on-primary: #191919; --hover: #30302e;
  --disabled: #686865; --shadow: 0 4px 24px #00000015;
}
* { box-sizing: border-box; }
[hidden], .team-details { display: none !important; }
body { margin: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
h1, h2, h3, p { margin: 0; }
button, input, a { -webkit-tap-highlight-color: transparent; }
button, input { font: inherit; }
button, .preview-links a { min-height: 34px; border: 1px solid var(--line); border-radius: 7px; padding: 7px 11px; background: var(--surface); color: var(--ink); font-size: 12px; font-weight: 400; white-space: nowrap; }
button { cursor: pointer; transition: background .15s, border-color .15s; }
button:hover:not(:disabled), .preview-links a:hover { background: var(--hover); border-color: var(--line-strong); }
button:disabled { color: var(--disabled); background: var(--panel); border-color: var(--line); cursor: not-allowed; }
button.btn-primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
button.btn-primary:hover:not(:disabled) { opacity: .85; background: var(--primary); }
button.btn-primary:disabled { background: var(--panel); color: var(--disabled); border-color: var(--line); }
:where(button, a, input, summary):focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
input { width: 100%; min-width: 0; min-height: 36px; border: 1px solid var(--line); border-radius: 7px; padding: 8px 11px; background: var(--surface); color: var(--ink); }
input::placeholder { color: var(--muted); opacity: .8; }
a { color: inherit; text-decoration: none; }
.muted { color: var(--muted); }
.top { min-height: 76px; padding: 14px 26px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); background: var(--surface); flex-shrink: 0; }
.top-brand, .top-actions, .status-group { display: flex; align-items: center; }
.top-brand { gap: 12px; }
.brand-mark { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 10px; background: var(--primary); color: var(--on-primary); font-size: 27px; font-weight: 500; letter-spacing: -3px; padding-right: 3px; }
.title-group h1 { font-size: 16px; font-weight: 500; letter-spacing: -.6px; }
.title-group h1 span { font-weight: 300; }
.title-group p { font-size: 10px; color: var(--muted); letter-spacing: .5px; margin-top: 3px; }
.project-name { padding-left: 22px; margin-left: 14px; border-left: 1px solid var(--line); font-size: 12px; }
.top-actions { gap: 8px; }
.status-group { gap: 7px; margin-right: 8px; }
.pill { font-size: 10px; color: var(--muted); white-space: nowrap; }
.pill-rev { font-family: ui-monospace, monospace; border: 1px solid var(--line); padding: 4px 6px; border-radius: 4px; }
.pill-status::before { content: ""; display: inline-block; width: 5px; height: 5px; background: currentColor; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.icon-button { width: 34px; padding: 7px; display: grid; place-items: center; }
.workspace { flex: 1; display: grid; grid-template-columns: 400px minmax(0, 1fr); min-height: 0; }
.chat-aside { min-height: 0; min-width: 0; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--surface); overflow: hidden; }
.phone-frame { display: flex; flex-direction: column; min-height: 0; flex: 1; overflow: hidden; }
.chat-header { padding: 16px 20px; display: flex; align-items: center; gap: 10px; flex-shrink: 0; border-bottom: 1px solid var(--line); }
.bot-avatar { width: 32px; height: 32px; border: 1px solid var(--line); background: var(--panel); display: grid; place-items: center; border-radius: 9px; font-size: 22px; letter-spacing: -2px; }
.bot-meta { flex: 1; }
.bot-meta h2 { font-size: 13px; font-weight: 500; }
.bot-meta p { font-size: 10px; color: var(--muted); margin-top: 3px; }
.channel-pill { font-size: 9px; color: var(--muted); border: 1px solid var(--line); padding: 4px 7px; border-radius: 5px; }
.chat-intro { padding: 17px 26px 18px; }
.eyebrow { font-size: 9px; font-weight: 500; letter-spacing: 1.7px; color: var(--muted); }
.chat-intro h3 { font-weight: 400; font-size: 28px; line-height: 1.45; letter-spacing: -.8px; margin: 12px 0 10px; }
.chat-intro h3 span { color: var(--muted); font-weight: 300; }
.chat-intro p { font-size: 12px; color: var(--muted); line-height: 1.85; }
.voice-chips { padding: 0 24px 14px; }
.chips-label { font-size: 10px; color: var(--muted); margin-bottom: 8px; }
.chips-scroller { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.chip { font-size: 10px; border-radius: 6px; min-height: 29px; padding: 5px 9px; }
.log { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 24px 20px; display: flex; flex-direction: column; gap: 16px; scrollbar-gutter: stable; }
.bubble { flex: 0 0 auto; max-width: 94%; padding: 11px 13px; border-radius: 10px; font-size: 12px; line-height: 1.85; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.agent { background: var(--panel); align-self: flex-start; border-bottom-left-radius: 3px; }
.bubble.user { background: var(--primary); color: var(--on-primary); align-self: flex-end; border-bottom-right-radius: 3px; }
.bubble-actions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.bubble-btn { font-size: 10px; min-height: 28px; padding: 4px 8px; }
.voice-tag { display: block; color: var(--muted); font-size: 10px; }
.ai-chat-composer { flex-shrink: 0; padding: 14px 16px 18px; background: var(--surface); border-top: 1px solid var(--line); }
.ai-input-wrapper { display: flex; gap: 8px; align-items: center; padding: 7px 8px 7px 12px; border: 1px solid var(--line-strong); border-radius: 11px; background: var(--surface); box-shadow: var(--shadow); }
.ai-input-wrapper:focus-within { border-color: var(--ink); }
#command { flex: 1; border: 0; background: transparent; padding: 4px 0; outline: none; font-size: 12px; }
.btn-ai-send { width: 31px; min-height: 31px; padding: 0; font-size: 20px; flex-shrink: 0; }
.ai-composer-hint { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 9px; color: var(--muted); padding: 9px 2px 0; }
kbd { font-family: inherit; white-space: nowrap; font-size: 9px; }
.grok-details { border-top: 1px solid var(--line); flex-shrink: 0; }
.grok-details summary { display: flex; align-items: center; gap: 10px; padding: 16px 24px; cursor: pointer; font-size: 12px; list-style: none; }
.grok-details summary::-webkit-details-marker { display: none; }
.connection-mark { border: 1px solid var(--line); border-radius: 7px; width: 29px; height: 29px; display: grid; place-items: center; font-size: 18px; }
.grok-details small { display: block; font-size: 10px; color: var(--muted); margin-top: 3px; }
.details-chevron { margin-left: auto; color: var(--muted); }
.grok-content { padding: 0 24px 16px; }
.grok-content label { display: flex; justify-content: space-between; gap: 6px; font-size: 10px; margin-bottom: 7px; }
#session-label { color: var(--muted); }
.token-row { display: flex; gap: 6px; }
#grok-session { font-family: ui-monospace, monospace; font-size: 10px; background: var(--panel); }
#copy-grok-session { font-size: 10px; }
.grok-content p { color: var(--muted); font-size: 9px; margin-top: 7px; }
.permissions { padding: 15px 24px 20px; border-top: 1px solid var(--line); flex-shrink: 0; }
.permissions-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.permissions h2 { font-size: 10px; font-weight: 400; color: var(--muted); }
.permissions-heading span { font-size: 9px; color: var(--muted); }
.permission-options { display: flex; gap: 5px; flex-wrap: wrap; }
.permission-options button { font-size: 9px; min-height: 27px; padding: 4px 8px; }
.stage-main { min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 25px 26px 0; }
.preview-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding-bottom: 20px; }
.preview-heading h2 { margin-top: 7px; font-size: 17px; font-weight: 400; letter-spacing: -.5px; }
.preview-heading h2 span { font-size: 11px; color: var(--muted); margin-left: 8px; letter-spacing: 0; }
.preview-links { display: flex; gap: 7px; }
.preview-links a { font-size: 10px; display: inline-flex; align-items: center; gap: 10px; }
.preview-shell { flex: 1; min-height: 0; display: flex; flex-direction: column; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); overflow: hidden; box-shadow: var(--shadow); }
.browser-bar { padding: 10px 13px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.url-bar { display: flex; align-items: center; gap: 8px; min-width: 0; }
.status-dot { width: 5px; height: 5px; background: var(--muted); border-radius: 50%; flex-shrink: 0; }
.url-text { color: var(--muted); font-size: 10px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.url-badge { border: 1px solid var(--line); padding: 3px 6px; border-radius: 4px; font-size: 9px; }
.preview-mode-actions, .device-switch { display: flex; gap: 4px; align-items: center; }
.btn-device, .btn-replace-toggle { font-size: 10px; min-height: 29px; padding: 5px 8px; background: transparent; border-color: transparent; color: var(--muted); }
.device-switch { padding: 2px; background: var(--panel); border-radius: 6px; gap: 0; }
.device-switch .btn-device { min-height: 25px; }
.btn-device.active, .btn-replace-toggle.active { background: var(--surface); border-color: var(--line); color: var(--ink); }
.replace-bar { padding: 13px; border-bottom: 1px solid var(--line); background: var(--surface); flex-shrink: 0; }
.replace-main-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.replace-badge-title { font-size: 10px; color: var(--muted); }
.replace-inputs { display: flex; align-items: center; gap: 7px; flex: 1 1 310px; min-width: 0; }
.input-wrap { flex: 1; min-width: 0; display: flex; align-items: center; gap: 5px; }
.input-wrap input { font-size: 11px; min-height: 32px; background: var(--bg); }
.replace-arrow { color: var(--muted); }
.find-count-badge { flex-shrink: 0; font-size: 9px; color: var(--ink); }
.replace-buttons { display: flex; gap: 5px; margin-left: auto; }
.replace-buttons button { min-height: 30px; font-size: 10px; padding: 5px 8px; }
.replace-matches-list { padding: 10px; background: var(--panel); border-radius: 6px; margin-top: 10px; max-height: 130px; overflow: auto; }
.matches-header { font-size: 10px; color: var(--muted); margin-bottom: 7px; }
.matches-items { display: flex; flex-wrap: wrap; gap: 5px; }
.match-chip { font-size: 10px; border: 1px solid var(--line); border-radius: 5px; padding: 5px 7px; background: var(--surface); cursor: pointer; overflow-wrap: anywhere; }
.match-chip.selected { border-color: var(--ink); }
.match-chip-badge { color: var(--muted); margin-right: 6px; }
.stage { flex: 1; min-height: 0; padding: 12px; background: var(--panel); display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; overflow: auto; }
.stage.compare { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 5px; overflow: hidden; background: var(--surface); width: 100%; }
.pane.mobile-view { max-width: 390px; margin-inline: auto; }
.pane-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.pane-title { font-size: 10px; }
.pane-sub { color: var(--muted); font-size: 9px; }
iframe { width: 100%; flex: 1; min-height: 0; border: 0; background: #fff; color-scheme: light; }
.workspace-footer { min-height: 36px; display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 9px; color: var(--muted); }
#warnings:empty { display: none; }
#warnings { margin: 0 20px 15px; padding: 11px; font-size: 11px; line-height: 1.7; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--panel); max-height: 110px; overflow: auto; }
.voice-incoming-banner { padding: 12px 26px; background: var(--panel); border-bottom: 1px solid var(--line-strong); align-items: center; justify-content: space-between; gap: 16px; }
.banner-content, .banner-actions { display: flex; gap: 10px; align-items: center; }
.banner-content { flex-wrap: wrap; font-size: 11px; }
.banner-content span { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
@media (max-height: 850px) and (min-width: 901px) { .chat-intro { padding-top: 5px; padding-bottom: 12px; } .chat-intro h3 { font-size: 23px; margin: 6px 0; } .chat-intro p { display: none; } .chat-header { padding-top: 17px; } }
@media (max-width: 1180px) { .project-name { display: none; } .stage-main { padding: 20px 16px 0; } .preview-heading { align-items: flex-start; } .preview-links { flex-direction: column; } .preview-links a { min-height: 27px; padding: 4px 8px; } .url-badge { display: none; } .pane-sub { display: none; } }
@media (max-width: 900px) { body { height: auto; min-height: 100dvh; overflow: auto; } .top { padding: 14px 18px; flex-wrap: wrap; gap: 14px; } .top-actions { flex-wrap: wrap; } .workspace { grid-template-columns: 1fr; } .chat-aside { border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; } .phone-frame { flex: none; height: clamp(480px, 78dvh, 760px); } .log { min-height: 0; } .chat-intro { padding-top: 5px; } .chat-intro h3 { font-size: 25px; margin: 7px 0; } .chat-intro p { display: none; } .stage-main { min-height: 760px; padding: 24px 18px 0; } .preview-shell { flex: none; min-height: 650px; } .stage { min-height: 480px; } iframe { min-height: 440px; } .stage.compare { grid-template-columns: 1fr; } .voice-incoming-banner { flex-wrap: wrap; } }
@media (max-width: 480px) { .top-actions { width: 100%; gap: 6px; } .status-group { margin-right: auto; } .pill-rev { display: none; } .top-actions button { font-size: 10px; padding: 6px 8px; } .preview-heading { gap: 8px; } .preview-heading h2 { font-size: 15px; } .preview-heading h2 span { display: block; margin: 4px 0 0; } .browser-bar { flex-wrap: wrap; } .url-bar { width: 100%; } .preview-mode-actions { width: 100%; } .device-switch { margin-left: auto; } .replace-badge-title { width: 100%; } .replace-inputs { flex-basis: 100%; } .replace-buttons { width: 100%; justify-content: flex-end; } .stage-main { padding-inline: 12px; } .stage { padding: 6px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }

.voice-incoming-banner:not([hidden]) { display:flex; }
.stage.mobile-view .pane { max-width:390px; margin-inline:auto; }
.history-list { display:flex; flex-wrap:wrap; gap:6px; padding:12px 20px; }
#theme-toggle { width:auto; min-width:82px; font-size:10px; }
.bubble p { white-space:pre-wrap; }
.bubble-actions { display:flex; flex-wrap:wrap; gap:6px; margin-top:10px; }
.grok-content code { font-size:10px; }

.has-messages .chat-intro { display:none; }
#log:empty { display:flex; }
#history button { font-size:11px; }

.ai-chat-composer { margin-top:auto; }

/* Secondary controls live in a dialog, leaving the conversation full height. */
.chat-tools-toggle { display:grid; place-items:center; width:34px; padding:6px; color:var(--muted); border-color:transparent; background:transparent; }
.chat-tools-dialog { width:min(440px, calc(100vw - 32px)); max-height:85dvh; padding:0; border:1px solid var(--line-strong); border-radius:16px; background:var(--surface); color:var(--ink); box-shadow:0 24px 80px #0003; overflow:auto; }
.chat-tools-dialog::backdrop { background:#0006; backdrop-filter:blur(3px); }
.chat-tools-heading { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:16px 20px; border-bottom:1px solid var(--line); }
.chat-tools-heading h2 { font-size:14px; font-weight:500; }
.chat-tools-heading button { width:32px; padding:6px; border-color:transparent; background:transparent; }
.chat-tools-dialog .voice-chips { padding:20px; }
.chat-tools-dialog .chips-label { font-size:12px; font-weight:500; color:var(--ink); margin-bottom:12px; }
.chat-tools-dialog .chips-scroller { flex-wrap:wrap; overflow:visible; padding:0; }
.chat-tools-dialog .grok-details summary { padding:16px 20px; }
.chat-tools-dialog .grok-content { padding:0 20px 18px; }
.chat-tools-dialog .model-status { margin:0 0 12px; font-size:11px; }
.chat-tools-dialog .permissions { padding:16px 20px 20px; }
.ai-chat-composer { margin-top:0; }

.location-proposal { flex:0 0 auto; padding:16px; border:1px solid var(--line-strong); border-radius:12px; background:var(--surface); }
.location-proposal h3 { font-size:13px; font-weight:500; margin-bottom:14px; }
.proposal-target + .proposal-target { border-top:1px solid var(--line); margin-top:14px; padding-top:14px; }
.proposal-target h4 { font-size:12px; font-weight:500; margin:0 0 5px; }
.proposal-location, .proposal-note { font-size:10px; color:var(--muted); line-height:1.7; margin:5px 0 10px; }
.proposal-value { display:grid; grid-template-columns:26px minmax(0,1fr); gap:8px; font-size:12px; line-height:1.7; overflow-wrap:anywhere; margin:8px 0; }
.proposal-value > span:first-child { color:var(--muted); font-size:10px; }
.proposal-actions { display:flex; flex-wrap:wrap; gap:6px; border-top:1px solid var(--line); padding-top:14px; margin-top:14px; }
.proposal-target button, .proposal-actions button { font-size:11px; }
.preview-links { flex-wrap:wrap; }
.time-machine-dialog { width:min(1080px, calc(100vw - 32px)); max-height:90dvh; padding:0; border:1px solid var(--line-strong); border-radius:16px; background:var(--surface); color:var(--ink); box-shadow:0 24px 80px #0003; overflow:auto; }
.time-machine-dialog::backdrop { background:#0006; backdrop-filter:blur(3px); }
.time-machine-dialog .chat-tools-heading p { font-size:11px; color:var(--muted); margin-top:5px; }
.time-machine-body { display:grid; grid-template-columns:250px minmax(0,1fr); height:min(60dvh,560px); min-height:320px; }
.time-machine-body .history-list { display:flex; flex-direction:column; flex-wrap:nowrap; gap:8px; overflow:auto; padding:16px; border-right:1px solid var(--line); }
.history-version { text-align:left; white-space:normal; line-height:1.7; font-size:11px; }
.history-version.is-selected { border-color:var(--ink); background:var(--panel); }
.version-preview { min-width:0; min-height:0; display:flex; flex-direction:column; }
.version-preview-heading { display:flex; gap:12px; align-items:center; justify-content:space-between; padding:12px 16px; font-size:11px; border-bottom:1px solid var(--line); }
.version-preview-heading a { white-space:nowrap; text-decoration:underline; }
.time-machine-footer { display:flex; gap:20px; align-items:center; justify-content:space-between; padding:16px 20px; border-top:1px solid var(--line); }
.time-machine-footer p { font-size:11px; line-height:1.7; color:var(--muted); }
@media (max-width:650px) { .time-machine-body { grid-template-columns:1fr; height:65dvh; grid-template-rows:120px minmax(0,1fr); } .time-machine-body .history-list { border-right:0; border-bottom:1px solid var(--line); } .time-machine-footer { flex-wrap:wrap; gap:10px; } }

.version-preview iframe { min-height:0; }
.binding-details { margin-top:8px; font-size:10px; color:var(--muted); line-height:1.7; }
.binding-details summary { cursor:pointer; }
.proposal-target > button { margin:4px 4px 4px 0; }
