/* Live Process Studio — Architectural Daylight + Dark Studio design system.
   Single-elevation hairline surfaces, zero-pill metadata, 60-30-10 color budget,
   Plus Jakarta Sans display/UI + IBM Plex Mono tabular numerals. */

:root {
  color-scheme: light;
  --bg: #f7f9fc;
  --surface: #ffffff;
  --surface-2: #f0f4f8;
  --surface-hover: #e8eef6;
  --line: rgba(10, 37, 64, 0.08);
  --line-strong: rgba(10, 37, 64, 0.15);
  --ink: #0a2540;
  --ink-2: #334155;
  --muted: #52637a;
  --faint: #7b8ca3;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: rgba(79, 70, 229, 0.075);
  --accent-line: rgba(79, 70, 229, 0.28);
  --ok: #0f766e;
  --ok-soft: rgba(15, 118, 110, 0.08);
  --ok-line: rgba(15, 118, 110, 0.26);
  --warn: #b45309;
  --warn-soft: rgba(180, 83, 9, 0.08);
  --warn-line: rgba(180, 83, 9, 0.26);
  --danger: #be123c;
  --danger-soft: rgba(190, 18, 60, 0.08);
  --you-bg: #eef2ff;
  --you-line: rgba(79, 70, 229, 0.22);
  --agent-bg: #ffffff;
  --agent-line: rgba(10, 37, 64, 0.09);
  --glass-bg: rgba(255, 255, 255, 0.86);
  --dot-grid: rgba(10, 37, 64, 0.055);
  --shadow-xs: 0 1px 1px rgba(10, 37, 64, 0.03), 0 1px 2px rgba(10, 37, 64, 0.04);
  --shadow-sm: 0 1px 2px rgba(10, 37, 64, 0.05), 0 4px 12px -2px rgba(10, 37, 64, 0.04);
  --shadow-card-hover: 0 6px 16px -4px rgba(10, 37, 64, 0.09), 0 2px 5px -1px rgba(10, 37, 64, 0.04);
  --shadow-composer: 0 2px 6px rgba(10, 37, 64, 0.04), 0 10px 28px -10px rgba(10, 37, 64, 0.1);
  --shadow-composer-focus: 0 0 0 3px rgba(79, 70, 229, 0.12), 0 10px 28px -10px rgba(79, 70, 229, 0.18);
  --shadow-popover: 0 20px 50px -12px rgba(10, 37, 64, 0.24), 0 4px 14px -4px rgba(10, 37, 64, 0.08);
  --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0e17;
  --surface: #101624;
  --surface-2: #172033;
  --surface-hover: #1e2a42;
  --line: rgba(148, 163, 184, 0.13);
  --line-strong: rgba(148, 163, 184, 0.24);
  --ink: #f8fafc;
  --ink-2: #cbd5e1;
  --muted: #94a3b8;
  --faint: #64748b;
  --accent: #818cf8;
  --accent-hover: #a5b4fc;
  --accent-soft: rgba(129, 140, 248, 0.12);
  --accent-line: rgba(129, 140, 248, 0.34);
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.1);
  --ok-line: rgba(52, 211, 153, 0.3);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.1);
  --warn-line: rgba(251, 191, 36, 0.32);
  --danger: #fb7185;
  --danger-soft: rgba(251, 113, 133, 0.12);
  --you-bg: #172038;
  --you-line: rgba(129, 140, 248, 0.3);
  --agent-bg: #101624;
  --agent-line: rgba(148, 163, 184, 0.13);
  --glass-bg: rgba(16, 22, 36, 0.84);
  --dot-grid: rgba(148, 163, 184, 0.07);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.32);
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.36);
  --shadow-card-hover: 0 8px 20px -4px rgba(0, 0, 0, 0.45);
  --shadow-composer: 0 4px 16px rgba(0, 0, 0, 0.34);
  --shadow-composer-focus: 0 0 0 3px rgba(129, 140, 248, 0.16), 0 8px 24px rgba(0, 0, 0, 0.42);
  --shadow-popover: 0 24px 54px rgba(0, 0, 0, 0.65);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

[data-theme="dark"] body {
  letter-spacing: 0.008em;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button,
a {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* --- Root Shell -------------------------------------------------------------- */
.studio-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  background: var(--bg);
}

/* --- Top Bar Contract: 1 row, 3 zones, frosted glass ------------------------- */
.studio-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  height: 58px;
  padding: 0 24px;
  background: var(--glass-bg);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  z-index: 20;
}

.studio-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.025em;
  white-space: nowrap;
  flex-shrink: 0;
}

.studio-brand-mark {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  width: 26px;
  height: 26px;
  padding: 5.5px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--accent) 0%, #6366f1 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 1px 3px rgba(79, 70, 229, 0.28);
}

[data-theme="dark"] .studio-brand-mark {
  background: linear-gradient(135deg, #6366f1 0%, #818cf8 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 6px rgba(99, 102, 241, 0.35);
}

.studio-brand-mark span {
  width: 3px;
  border-radius: 2px;
  background: #ffffff;
}
.studio-brand-mark span:nth-child(1) { height: 6px; opacity: 0.72; }
.studio-brand-mark span:nth-child(2) { height: 13px; }
.studio-brand-mark span:nth-child(3) { height: 9px; opacity: 0.88; }

.studio-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  min-width: 0;
}

.studio-nav-link {
  position: relative;
  background: none;
  border: 0;
  padding: 6px 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 160ms ease;
}

.studio-nav-link:hover,
.studio-nav-link.is-active {
  color: var(--ink);
}

.studio-nav-link.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
}

.studio-hd-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.name-input {
  width: 144px;
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  font-size: 13px;
  color: var(--ink);
  transition: border-color 160ms ease, background 160ms ease;
}

.name-input::placeholder {
  color: var(--faint);
}

.name-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}

.user-bar {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.user-bar a {
  color: var(--muted);
  text-decoration: none;
}

.user-bar a:hover {
  color: var(--ink);
  text-decoration: underline;
}

.mockflag {
  font-size: 11px;
  color: var(--warn);
  font-weight: 600;
  white-space: nowrap;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease, transform 100ms ease;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--line-strong);
}

.icon-btn:active {
  transform: scale(0.96);
}

/* --- Buttons ----------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease, transform 120ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 150ms ease;
}

@media (hover: hover) {
  .btn:hover:not(:disabled) {
    background: var(--surface-2);
    border-color: var(--line-strong);
  }
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.btn.primary {
  background: var(--accent);
  border-color: transparent;
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 1px 2px rgba(79, 70, 229, 0.3);
}

[data-theme="dark"] .btn.primary {
  color: #090d16;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 1px 4px rgba(129, 140, 248, 0.32);
}

@media (hover: hover) {
  .btn.primary:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24), 0 4px 12px -2px rgba(79, 70, 229, 0.38);
  }
}

.btn.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
  box-shadow: none;
}

.btn.ghost:hover:not(:disabled) {
  color: var(--ink);
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.btn.stop {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
}

.btn.finish-opt.save-ok {
  background: var(--ok-soft);
  border-color: var(--ok-line);
  color: var(--ok);
}

.btn.finish-opt.pulse-save {
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* --- Mobile Pane Tabs (Native iOS Inset Segmented Control, Hidden on Desktop) */
.mobile-pane-bar {
  display: none;
  align-items: center;
  height: 46px;
  padding: 5px 14px;
  background: var(--glass-bg);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  z-index: 15;
}

.mobile-pane-track {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  width: 100%;
  padding: 3px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.mobile-tab {
  height: 30px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.mobile-tab.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-xs);
}

/* --- Split-Stage Workspace (1440px Desktop Presence) ------------------------- */
.studio-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(380px, 0.85fr);
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

/* --- Left Pane: Conversation ------------------------------------------------- */
.studio-chat-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--bg);
}

.chat-subbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 44px;
  padding: 6px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  flex-shrink: 0;
}

.chat-subbar-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-subbar-meta b {
  color: var(--ink);
  font-weight: 600;
}

.chat-subbar-sep {
  color: var(--line-strong);
}

.chat-subbar-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.text-action {
  background: none;
  border: 0;
  padding: 4px 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  border-radius: 6px;
  transition: color 150ms ease, background 150ms ease;
}

.text-action:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.text-action.danger:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

.session-history {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.session-history select {
  height: 30px;
  max-width: 220px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  font-size: 12px;
  color: var(--ink);
  cursor: pointer;
}

.status-strip {
  padding: 0 24px;
  flex-shrink: 0;
}

.save-status,
.activity-status {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-family: var(--font-sans);
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink-2);
  transition: opacity 180ms ease, transform 180ms ease;
}

.save-status--saving,
.activity-status--progress {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
}

.save-status--success {
  border-color: var(--ok-line);
  background: var(--ok-soft);
  color: var(--ok);
}

.save-status--error,
.activity-status--error {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}

.activity-status--warn {
  border-color: var(--warn-line);
  background: var(--warn-soft);
  color: var(--warn);
}

/* --- Transcript & Zero-Friction Welcome Stage -------------------------------- */
.transcript-wrap {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 24px 28px 20px;
  scroll-behavior: smooth;
}

.transcript {
  max-width: 720px;
  margin: 0 auto;
}

.transcript-empty {
  padding: 20px 0 12px;
  transition: opacity 200ms ease, transform 200ms ease;
}

.transcript-empty.is-leaving {
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
}

.welcome-kicker {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.welcome-title {
  margin: 0 0 14px;
  font-size: clamp(26px, 2.7vw, 34px);
  line-height: 1.18;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
  text-wrap: balance;
  max-width: 22ch;
}

.welcome-lead {
  margin: 0 0 28px;
  max-width: 58ch;
  font-size: 15px;
  line-height: 1.65;
  color: var(--muted);
}

.welcome-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  padding: 20px 0;
  margin-bottom: 26px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.welcome-step-num {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

.welcome-step strong {
  display: block;
  margin-bottom: 3px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.welcome-step span {
  display: block;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.starter-heading {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.starter-prompts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.starter-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
  text-align: left;
  box-shadow: var(--shadow-xs);
  transition: border-color 160ms ease, background 160ms ease, box-shadow 180ms ease, transform 160ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.starter-arrow {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: var(--faint);
  transition: transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1), color 160ms ease;
}

@media (hover: hover) {
  .starter-btn:hover {
    border-color: var(--accent-line);
    background: var(--surface);
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-1px);
  }
  .starter-btn:hover .starter-arrow {
    color: var(--accent);
    transform: translateX(3px);
  }
}

.starter-btn:active {
  transform: scale(0.99);
}

.welcome-privacy {
  margin: 0;
  font-size: 12px;
  color: var(--faint);
}

/* --- Chat Turns -------------------------------------------------------------- */
.turn {
  margin-bottom: 20px;
  animation: fadeUp 200ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(5px); }
}

.turn-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.turn.you .turn-row {
  justify-content: flex-end;
}

.agent-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}

.agent-mark .mark-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.turn-card {
  max-width: min(86%, 64ch);
  padding: 13px 16px;
  border-radius: 12px;
  border: 1px solid var(--agent-line);
  background: var(--agent-bg);
}

.turn.you .turn-card {
  background: var(--you-bg);
  border-color: var(--you-line);
}

.turn.brief .turn-card {
  max-width: 100%;
  border-color: var(--accent-line);
  background: var(--surface);
}

.turn-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
  font-size: 11px;
  color: var(--faint);
}

.turn-label {
  font-weight: 600;
  color: var(--muted);
}

.bubble {
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--ink);
  word-wrap: break-word;
}

.bubble p { margin: 0 0 10px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble ul,
.bubble ol { margin: 6px 0 10px; padding-left: 20px; }
.bubble li { margin: 4px 0; }
.bubble code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface-2);
}
.bubble pre {
  overflow-x: auto;
  padding: 12px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.bubble pre code { padding: 0; background: none; }
.bubble a { color: var(--accent); text-decoration: underline; }

.user-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.user-images img {
  max-width: 160px;
  max-height: 110px;
  border-radius: 7px;
  border: 1px solid var(--line);
  object-fit: cover;
}

.user-evidence {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.evidence-chip {
  font-weight: 500;
  color: var(--ink-2);
}

.brief-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

/* Typing dots */
.typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  vertical-align: middle;
}
.typing i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted);
  animation: typingPulse 1.1s infinite ease-in-out;
}
.typing i:nth-child(2) { animation-delay: 0.16s; }
.typing i:nth-child(3) { animation-delay: 0.32s; }
@keyframes typingPulse {
  0%, 80%, 100% { opacity: 0.25; }
  40% { opacity: 1; }
}
.typing-label {
  font-size: 12px;
  color: var(--muted);
  margin-right: 6px;
}

/* --- Frontier Answer Sheet (Upgraded Clean Hairline Layout) ------------------ */
.answer-sheet {
  margin: 12px 0 22px 40px;
  padding: 16px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  animation: fadeUp 200ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.as-hd {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
}

.as-meter {
  height: 3px;
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 14px;
}

.as-meter i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

.as-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.as-row {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 4px 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  transition: border-color 150ms ease, background 150ms ease;
}

.as-row.answered {
  border-color: var(--ok-line);
  background: var(--ok-soft);
}

.as-row.skipped {
  border-color: var(--warn-line);
  background: var(--warn-soft);
}

.as-idx {
  font-size: 12px;
  font-weight: 600;
  color: var(--faint);
  padding-top: 1px;
}

.as-q {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.45;
}

.as-state {
  margin-left: 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

.as-controls {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.as-chip {
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
  text-align: left;
  transition: border-color 150ms ease, background 150ms ease;
}

.as-chip:hover {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.as-np {
  color: var(--accent);
  font-weight: 600;
  margin-right: 4px;
}

.as-input {
  flex: 1 1 200px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  font-size: 13px;
  color: var(--ink);
}

.as-input:focus {
  outline: none;
  border-color: var(--accent);
}

.as-skip {
  background: none;
  border: 0;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.as-skip:hover {
  color: var(--ink);
}

.as-ft {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.as-hint {
  font-size: 12px;
  color: var(--muted);
}

/* --- Executive Handoff Card in Transcript ------------------------------------ */
.handoff-card {
  margin: 16px 0;
  padding: 20px 22px;
  border: 1px solid var(--ok-line);
  border-radius: 12px;
  background: var(--surface);
  animation: fadeUp 220ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.handoff-card--draft {
  border-color: var(--warn-line);
}

.handoff-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.handoff-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
}

.handoff-impact,
.handoff-draft-note {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-2);
}

.handoff-meta {
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--muted);
}

.handoff-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* --- Composer & Quick Effort/Tool Helper ------------------------------------- */
.composer-panel {
  position: relative;
  padding: 12px 24px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  flex-shrink: 0;
}

.composer-inner {
  max-width: 720px;
  margin: 0 auto;
}

.dictate-rail {
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid var(--accent-line);
  border-radius: 8px;
  background: var(--accent-soft);
  font-size: 12px;
}
.dictate-rail ol { margin: 6px 0 0; padding-left: 18px; }
.dictate-rail li { margin: 2px 0; color: var(--ink-2); }

.screen-share-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding: 8px 12px;
  border: 1px solid var(--accent-line);
  border-radius: 8px;
  background: var(--accent-soft);
  font-size: 12px;
}

.screen-share-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.screen-share-hint {
  color: var(--muted);
  font-size: 11px;
}
.screen-share-hint.warn {
  color: var(--warn);
}

.attach-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.attach-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--bg);
  font-size: 12px;
}

.attach-item img {
  width: 44px;
  height: 32px;
  object-fit: cover;
  border-radius: 4px;
}

.attach-item button {
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 0 2px;
}

.attach-item button:hover {
  color: var(--danger);
}

.attach-xray {
  color: var(--muted);
  font-size: 11px;
}

/* Quick-tap cadence/effort/tools helper popover */
.quick-helper {
  margin-bottom: 10px;
  padding: 14px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--bg);
  animation: fadeUp 160ms ease both;
}

.quick-helper-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.quick-helper-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.qh-group-label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.qh-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.qh-opt {
  height: 32px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.qh-opt.is-selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

[data-theme="dark"] .qh-opt.is-selected {
  color: #0b0f17;
}

.quick-helper-ft {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.qh-preview {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-composer);
  transition: border-color 160ms ease, box-shadow 180ms ease, background 160ms ease;
}

.composer:focus-within {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: var(--shadow-composer-focus);
}

.composer-tools {
  display: flex;
  align-items: center;
  gap: 2px;
}

.composer-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, transform 100ms ease;
}

.composer-icon:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.composer-icon:active {
  transform: scale(0.95);
}

.composer-icon.on,
.composer-icon.live,
.composer-icon.has-files {
  background: var(--accent-soft);
  color: var(--accent);
}

#input {
  flex: 1 1 auto;
  min-height: 38px;
  max-height: 150px;
  padding: 8px 6px;
  border: 0;
  background: transparent;
  resize: none;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink);
}

#input:focus {
  outline: none;
}

#input::placeholder {
  color: var(--faint);
}

.composer-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.composer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 9px;
  font-size: 12px;
  color: var(--muted);
}

.composer-foot-left,
.composer-foot-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.composer-kbd-hint {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--faint);
}

.composer-kbd-hint kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 19px;
  padding: 0 5px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--bg);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
}

.seg {
  display: inline-flex;
  align-items: center;
  padding: 2px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.seg button {
  height: 26px;
  padding: 0 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.seg button.on {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.action-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.action-link:hover {
  color: var(--accent);
}

/* --- Right Pane: Live Process Blueprint Canvas ------------------------------- */
.studio-blueprint-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--surface);
  border-left: 1px solid var(--line);
}

.bp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 6px 24px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.bp-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}

.bp-status {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.bp-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 20px 24px 28px;
  background-image: radial-gradient(var(--dot-grid) 1px, transparent 1px);
  background-size: 20px 20px;
}

/* Impact KPI Strip — flat grid with hairline dividers, tabular-nums */
.bp-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
  margin-bottom: 20px;
}

.bp-metric {
  padding-right: 12px;
}

.bp-metric + .bp-metric {
  padding-left: 14px;
  border-left: 1px solid var(--line);
}

.bp-metric-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.bp-metric-value {
  display: block;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--ink);
}

.bp-metric-sub {
  display: block;
  font-size: 11px;
  color: var(--faint);
  margin-top: 2px;
}

/* Empty Blueprint State */
.bp-empty {
  padding: 6px 0;
}

.bp-empty-lead {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
}

.bp-skeleton-flow {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 22px;
}

.bp-skel-node {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  position: relative;
}

.bp-skel-node:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 32px;
  bottom: -10px;
  width: 1px;
  background: var(--line-strong);
}

.bp-skel-index {
  width: 23px;
  height: 23px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  flex-shrink: 0;
}

.bp-skel-copy strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.bp-skel-copy span {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
}

/* Dropzone inside Blueprint */
.bp-dropzone {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease, transform 150ms ease;
  cursor: pointer;
}

.bp-dropzone-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--accent);
  flex-shrink: 0;
  transition: background 150ms ease, transform 150ms ease;
}

.bp-dropzone-copy {
  min-width: 0;
}

.bp-dropzone:hover,
.bp-dropzone.is-dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: var(--shadow-sm);
}

.bp-dropzone:hover .bp-dropzone-icon,
.bp-dropzone.is-dragover .bp-dropzone-icon {
  background: var(--surface);
  transform: translateY(-1px);
}

.bp-dropzone strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 3px;
}

.bp-dropzone span {
  display: block;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

/* Workflow Blueprint Blocks */
.bp-section {
  margin-bottom: 24px;
}

.bp-section-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.bp-loop {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.bp-loop:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.bp-loop-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.bp-loop-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.bp-loop-meta {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 12px;
}

.bp-loop-meta .state-ready { color: var(--ok); font-weight: 600; }
.bp-loop-meta .state-awaiting { color: var(--accent); font-weight: 600; }
.bp-loop-meta .state-draft { color: var(--warn); font-weight: 600; }

.bp-loop-summary {
  margin: 0 0 14px;
  font-size: 13.5px;
  color: var(--ink-2);
  line-height: 1.55;
}

/* Visual Flow Graph Nodes */
.bp-flow {
  display: flex;
  flex-direction: column;
  margin: 0 0 14px;
}

.bp-node {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 10px;
  margin: 0 -10px;
  border-radius: 8px;
  transition: background 140ms ease;
}

.bp-node--clickable {
  cursor: pointer;
}

.bp-node--clickable:hover {
  background: var(--bg);
}

.bp-node:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 21px;
  top: 32px;
  bottom: -8px;
  width: 1px;
  background: var(--line-strong);
}

.bp-node-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.bp-node--trigger .bp-node-dot {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
}

.bp-node--checkpoint .bp-node-dot {
  border-color: var(--ok-line);
  background: var(--ok-soft);
  color: var(--ok);
}

.bp-node-body {
  flex: 1;
  min-width: 0;
}

.bp-node-kicker {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--faint);
  margin-bottom: 1px;
}

.bp-node-text {
  display: block;
  font-size: 13.5px;
  color: var(--ink);
  line-height: 1.45;
}

.bp-node-edit {
  font-size: 11px;
  color: var(--accent);
  opacity: 0;
  transition: opacity 140ms ease;
  white-space: nowrap;
  padding-top: 2px;
}

.bp-node--clickable:hover .bp-node-edit {
  opacity: 1;
}

.bp-tools-line {
  margin: 0 0 12px;
  font-size: 12.5px;
  color: var(--muted);
}

.bp-tools-line strong {
  color: var(--ink-2);
  font-weight: 600;
}

/* Open Questions with 1-Click Copy for Role */
.bp-openq-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.bp-openq-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--warn-line);
  border-radius: 8px;
  background: var(--warn-soft);
}

.bp-openq-text {
  font-size: 13px;
  color: var(--ink);
  line-height: 1.45;
}

.bp-openq-role {
  display: block;
  margin-top: 3px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--warn);
}

.bp-copy-btn {
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.bp-copy-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Evidence & Grounding List */
.bp-evidence-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bp-evidence-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  font-size: 12.5px;
}

.bp-evidence-name {
  color: var(--ink);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bp-evidence-state {
  font-size: 11.5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.bp-evidence-state.is-ok { color: var(--ok); font-weight: 600; }
.bp-evidence-state.is-wait { color: var(--muted); }

/* Said-vs-Seen Grounding & Clarifications */
.bp-grounding-box {
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--bg);
}

.bp-grounding-summary {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.5;
}

.bp-clarify-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  margin-top: 8px;
  border: 1px solid var(--warn-line);
  border-radius: 8px;
  background: var(--warn-soft);
  font-size: 12.5px;
}

.bp-clarify-item strong {
  color: var(--ink);
}

.bp-clarify-diff {
  color: var(--ink-2);
  line-height: 1.45;
}

/* --- On-Demand "Jak to działa?" Dialog --------------------------------------- */
.welcome-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.56);
  backdrop-filter: blur(4px);
}

.welcome-alert {
  width: 100%;
  max-width: 540px;
  padding: 24px 26px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-popover);
}

.welcome-alert .hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.welcome-alert h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.welcome-alert .close {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
}

.welcome-alert .close:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.welcome-alert p,
.welcome-alert ul {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-2);
}

.welcome-tools {
  margin: 14px 0;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--line);
}

.welcome-tools-hd {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.welcome-tools ul {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
}

.welcome-alert .note {
  font-size: 12.5px;
  color: var(--muted);
}

.welcome-alert .actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

/* --- Responsive Breakpoints (Dedicated Mobile Architecture) ------------------ */
@media (max-width: 1024px) {
  .studio-hd {
    gap: 16px;
    padding: 0 16px;
  }
  .studio-nav {
    gap: 16px;
  }
  .studio-workspace {
    grid-template-columns: 1fr;
  }
  .mobile-pane-bar {
    display: flex;
  }
  .studio-workspace[data-mobile-pane="chat"] .studio-blueprint-pane {
    display: none;
  }
  .studio-workspace[data-mobile-pane="blueprint"] .studio-chat-pane {
    display: none;
  }
  .studio-blueprint-pane {
    border-left: 0;
  }
}

@media (max-width: 720px) {
  /* Single-row 52px frosted header + 46px inset switcher = 98px (11.6% of 844px) */
  .studio-hd {
    height: 52px;
    padding: 0 14px;
    gap: 10px;
  }
  .studio-nav {
    gap: 14px;
  }
  .studio-nav-link {
    font-size: 13.5px;
  }
  .studio-nav-link.is-active,
  #howItWorks,
  .name-input,
  .user-bar {
    display: none !important;
  }
  .icon-btn {
    width: 40px;
    height: 40px;
  }
  .chat-subbar {
    min-height: 38px;
    padding: 4px 14px;
    gap: 8px;
  }
  .transcript-wrap {
    padding: 12px 14px 12px;
  }
  .transcript-empty {
    padding: 6px 0 8px;
  }
  .welcome-kicker {
    margin-bottom: 6px;
    font-size: 12px;
  }
  .welcome-title {
    font-size: 22px;
    margin-bottom: 8px;
    max-width: none;
  }
  .welcome-lead {
    font-size: 13.5px;
    line-height: 1.5;
    margin-bottom: 14px;
  }
  .welcome-steps {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 12px 0;
    margin-bottom: 14px;
  }
  .welcome-step {
    display: grid;
    grid-template-columns: 24px 1fr;
    column-gap: 8px;
    align-items: baseline;
  }
  .welcome-step-num {
    margin: 0;
    grid-row: 1 / span 2;
  }
  .welcome-step strong {
    font-size: 13px;
    margin-bottom: 1px;
  }
  .welcome-step span {
    font-size: 12px;
  }
  .starter-prompts {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .starter-btn {
    min-height: 46px;
    padding: 10px 13px;
    font-size: 13.5px;
  }
  .composer-panel {
    padding: 8px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  }
  .composer {
    flex-wrap: wrap;
    row-gap: 4px;
    padding: 8px 10px;
    border-radius: 16px;
  }
  /* Prevent iOS Safari zoom on focus (>= 16px) and avoid 1-line clipping */
  #input,
  .as-input {
    font-size: 16px;
  }
  #input {
    order: 1;
    flex: 1 0 100%;
    width: 100%;
    min-height: 40px;
    line-height: 1.4;
    padding: 6px 4px;
  }
  .composer-tools {
    order: 2;
    gap: 2px;
  }
  .composer-icon {
    width: 44px;
    height: 44px;
  }
  .composer-actions {
    order: 3;
    margin-left: auto;
  }
  .composer-actions .btn {
    min-height: 44px;
    padding: 0 18px;
    border-radius: 10px;
  }
  .composer-kbd-hint {
    display: none;
  }
  .composer-foot {
    margin-top: 8px;
  }
  .seg button {
    height: 32px;
    padding: 0 12px;
  }
  .action-link {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
  }
  .answer-sheet {
    margin-left: 0;
    padding: 14px;
  }
  .as-chip,
  .as-skip {
    min-height: 40px;
  }
  .composer-icon.screen {
    display: none;
  }
  /* Native Mobile Bottom Sheet for Quick Helper */
  .quick-helper {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    z-index: 50;
    border-radius: 20px 20px 0 0;
    border-bottom: 0;
    padding: 12px 18px calc(18px + env(safe-area-inset-bottom, 0px));
    background: var(--surface);
    box-shadow: 0 -12px 40px rgba(10, 37, 64, 0.22);
    max-height: 82dvh;
    overflow-y: auto;
    animation: sheetUp 220ms cubic-bezier(0.16, 1, 0.3, 1) both;
  }
  .quick-helper::before {
    content: "";
    display: block;
    width: 36px;
    height: 4px;
    border-radius: 99px;
    background: var(--line-strong);
    margin: 0 auto 12px;
  }
  .qh-opt {
    min-height: 40px;
    padding: 0 13px;
    font-size: 13px;
  }
  .quick-helper-ft .btn {
    min-height: 44px;
  }
  /* Native Mobile Bottom Sheet for "Jak to działa?" */
  .welcome-overlay {
    align-items: end;
    padding: 0;
  }
  .welcome-alert {
    max-width: none;
    border-radius: 20px 20px 0 0;
    border-bottom: 0;
    padding: 12px 20px calc(22px + env(safe-area-inset-bottom, 0px));
    max-height: 86dvh;
    overflow-y: auto;
    animation: sheetUp 240ms cubic-bezier(0.16, 1, 0.3, 1) both;
  }
  .welcome-alert::before {
    content: "";
    display: block;
    width: 36px;
    height: 4px;
    border-radius: 99px;
    background: var(--line-strong);
    margin: 0 auto 12px;
  }
  .welcome-alert .actions .btn {
    width: 100%;
    min-height: 46px;
  }
  .bp-body {
    padding: 16px 16px calc(24px + env(safe-area-inset-bottom, 0px));
  }
}

@keyframes sheetUp {
  from { opacity: 0.4; transform: translateY(28px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
