/* Final shared UI layer. Existing feature selectors and API-facing IDs stay intact. */
:root {
  --ui-ink: #16231d;
  --ui-muted: #617068;
  --ui-faint: #86928c;
  --ui-line: #dce3de;
  --ui-line-strong: #c9d4cd;
  --ui-canvas: #f3f5f1;
  --ui-paper: #fcfdfb;
  --ui-panel: #eef2ed;
  --ui-deep: #103e31;
  --ui-deep-2: #0b3026;
  --ui-accent: #17634c;
  --ui-acid: #c9ed71;
  --ui-acid-soft: #edf7d4;
  --ui-danger: #a23f3f;
  --ui-warning: #946313;
  --ui-success: #197252;
  --route-bar-height: 50px;
  --composer-height: 156px;
  --app-viewport-height: 100dvh;
  color: var(--ui-ink);
}

html { background: var(--ui-canvas); }
body { color: var(--ui-ink); text-rendering: optimizeLegibility; }
body, button, input, select, textarea { font-family: "IBM Plex Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif; }
button, a, input, select, textarea, summary { touch-action: manipulation; }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }

.skip-link {
  position: fixed;
  top: 7px;
  left: 12px;
  z-index: 200;
  transform: translateY(-150%);
  padding: 9px 13px;
  border-radius: 8px;
  color: #fff;
  background: var(--ui-deep);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { transform: translateY(0); }

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid rgba(23, 99, 76, .33);
  outline-offset: 2px;
}
.sidebar :where(a, button):focus-visible,
.global-route-bar :where(a, button):focus-visible {
  outline-color: var(--ui-acid);
}

.global-route-bar {
  position: relative;
  z-index: 70;
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  height: var(--route-bar-height);
  padding: 0 clamp(12px, 2.4vw, 28px);
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  color: #e8f0ec;
  background: var(--ui-deep-2);
}
.route-bar-brand {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  min-width: 184px;
  color: #fff;
  text-decoration: none;
}
.route-bar-brand > span {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 9px 9px 3px 9px;
  color: var(--ui-deep-2);
  background: var(--ui-acid);
  font-size: 12px;
  font-weight: 700;
}
.route-bar-brand strong { font-size: 13px; font-weight: 600; letter-spacing: -.02em; }
.route-bar-brand small {
  padding-left: 8px;
  border-left: 1px solid rgba(255, 255, 255, .2);
  color: #91aa9f;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 8px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.route-links {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
}
.route-links::-webkit-scrollbar { display: none; }
.route-links a {
  position: relative;
  flex: 0 0 auto;
  min-height: 34px;
  padding: 9px 11px 8px;
  border-radius: 8px;
  color: #adc0b8;
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.route-links a:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.route-links a[aria-current="page"] { color: var(--ui-deep-2); background: var(--ui-acid); }

body.workspace-app.has-route-bar,
body.page-app.has-route-bar {
  display: grid;
  grid-template-rows: var(--route-bar-height) minmax(0, 1fr);
  width: 100%;
  height: var(--app-viewport-height);
  min-height: 0;
  overflow: hidden;
  background: var(--ui-canvas);
}
.workspace-app.has-route-bar .app-frame,
.page-app.has-route-bar .page-shell {
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
  overflow: hidden;
}

/* Shared sidebar */
.sidebar {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: 21px 15px max(16px, env(safe-area-inset-bottom));
  background: var(--ui-deep);
}
.sidebar .brand { flex: 0 0 auto; }
.sidebar .nav-section {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.sidebar .history-list {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: rgba(255, 255, 255, .18) transparent;
  scrollbar-width: thin;
}
.sidebar .privacy-note { flex: 0 0 auto; }
.sidebar .sidebar-footer { flex: 0 0 auto; margin-top: auto; }
.history-empty {
  margin: 8px 7px;
  color: #8ea99e;
  font-size: 11px;
  line-height: 1.6;
}
.history-item { min-height: 43px; }
.history-empty p { margin: 0 0 8px; }
.history-retry {
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 8px;
  color: #d8e4df;
  background: transparent;
  font-size: 11px;
  cursor: pointer;
}
.history-retry:hover { color: var(--ui-deep-2); background: var(--ui-acid); }
.side-link { min-height: 42px; }
.new-analysis { min-height: 44px; }

/* Chat workspace */
.workspace-app .app-frame { grid-template-columns: 232px minmax(0, 1fr); }
.workspace-app .chat-workspace {
  height: 100%;
  min-height: 0;
  background: var(--ui-paper);
}
.workspace-header {
  min-width: 0;
  min-height: 70px;
  padding: 10px clamp(15px, 2.8vw, 34px);
  border-bottom: 1px solid var(--ui-line);
  background: var(--ui-paper);
  backdrop-filter: none;
}
.workspace-title { min-width: 0; }
.workspace-title h1 {
  max-width: min(42vw, 520px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.icon-button {
  width: 42px;
  height: 42px;
  border-color: var(--ui-line-strong);
  border-radius: 11px;
  background: var(--ui-paper);
}
.icon-button:hover { color: var(--ui-accent); background: var(--ui-panel); }
.model-picker { width: 210px; }
.model-picker summary { min-height: 48px; border-radius: 12px; background: var(--ui-paper); box-shadow: none; }
.model-menu {
  max-width: calc(100vw - 24px);
  max-height: min(570px, calc(var(--app-viewport-height) - var(--route-bar-height) - 88px));
  border: 1px solid var(--ui-line);
  box-shadow: 0 18px 48px rgba(11, 48, 38, .16);
}
.model-option { min-height: 58px; }

.conversation {
  min-width: 0;
  padding: clamp(20px, 4vh, 38px) clamp(18px, 5vw, 72px) 28px;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
  scroll-padding-block: 20px;
}
.welcome { margin-top: clamp(8px, 5vh, 58px); }
.welcome h2 { line-height: 1.24; }
.welcome > p:not(.eyebrow) { color: var(--ui-muted); font-size: 14px; }
.prompt-examples button { min-height: 108px; }
.prompt-examples strong { font-size: 13px; }

.message { max-width: 850px; margin-bottom: 30px; }
.user-copy { color: #2f4038; font-size: 15px; line-height: 1.82; }
.message-meta { color: var(--ui-faint); font-size: 11px; }
.answer-card { padding-block: 26px 30px; }
.answer-title { font-size: 18px; }
.answer-card p,
.analysis-sections dt,
.analysis-sections dd,
.reference-list,
.case-card p,
.case-document pre {
  font-size: 14px;
  line-height: 1.82;
}
.answer-card > small { display: inline-block; margin-top: 12px; color: var(--ui-muted); font-size: 11px; }
.issue strong { font-size: 14px; }
.issue p { font-size: 13px; }
.case-card { padding: 17px 18px; }
.case-card small { font-size: 11px; line-height: 1.5; }
.case-document summary { min-height: 42px; padding: 12px 0 2px; cursor: pointer; }
.case-document pre { max-height: min(52vh, 560px); padding: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }

.clarification-card {
  border: 1px solid #c6d7cd;
  background: #f4f8f4;
  box-shadow: 0 10px 28px rgba(25, 68, 53, .06);
}
.clarification-card > strong { font-size: 16px; }
.clarification-list { font-size: 14px; }
.clarification-help { font-size: 12px; }
.clarification-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.clarification-actions button { min-height: 42px; }

.loading-card { position: relative; overflow: hidden; }
.loading-card::before {
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--ui-accent), transparent);
  animation: ui-progress 1.6s ease-in-out infinite;
  content: "";
}
.analysis-progress { margin: 0 0 12px; color: var(--ui-accent); font-size: 13px; font-weight: 600; }
.stream-section h3, .stream-title { font-size: 14px; }
.stream-section p, .stream-copy, .stream-list { font-size: 13px; }
.error-card { padding: 20px; border: 1px solid #e1c2bd; background: #fbefec; }
.error-card strong { font-size: 15px; }
.error-card p { margin: 8px 0 0; font-size: 13px; line-height: 1.65; }
.retry-button { min-height: 42px; margin-top: 14px; padding-inline: 14px; }
.route-error { background: var(--ui-paper); }
.route-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: min(46vh, 380px);
  color: var(--ui-muted);
  font-size: 14px;
}
.route-loading .loader {
  width: 18px;
  height: 18px;
  border: 2px solid var(--ui-line-strong);
  border-top-color: var(--ui-accent);
  border-radius: 50%;
  animation: ui-spin .8s linear infinite;
}

.composer-wrap {
  position: relative;
  padding: 9px clamp(18px, 5vw, 72px) max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(220, 227, 222, .72);
  background: var(--ui-paper);
}
.composer {
  max-width: 850px;
  padding: 13px 14px 10px;
  border: 1px solid var(--ui-line-strong);
  border-radius: 16px;
  box-shadow: 0 9px 28px rgba(18, 61, 49, .09);
}
.composer textarea {
  min-height: 54px;
  max-height: min(28vh, 210px);
  resize: none;
  font-size: 15px;
  line-height: 1.6;
  overflow-y: auto;
}
.composer-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 5px 0;
  color: var(--ui-faint);
  font-size: 10px;
}
.tool-button, .analysis-modes button, .submit-analysis { min-height: 40px; }
.tool-button[disabled] { color: #87918c; cursor: not-allowed; opacity: .72; }
.tool-button small { margin-left: 3px; padding: 2px 5px; border-radius: 999px; background: #e8ece9; font-size: 8px; }
.demo-disclosure, .legal-disclaimer { max-width: 850px; }
.jump-to-latest {
  right: clamp(20px, 5vw, 72px);
  bottom: calc(var(--composer-height) + 12px);
  min-height: 42px;
  background: var(--ui-paper);
}
.screen-reader-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.workspace-app .inspector {
  top: var(--route-bar-height);
  bottom: 0;
  height: auto;
  max-height: none;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  background: var(--ui-panel);
}
.inspector[aria-hidden="true"] { visibility: hidden; }
.inspector.open { visibility: visible; }
.pipeline-card { background: var(--ui-deep); }
.pipeline-card[data-state="waiting"] { background: #5a4b2b; }
.pipeline-card[data-state="error"] { background: #713f3f; }
.pipeline-card[data-state="success"] { background: var(--ui-deep); }
.pipeline-card[data-state="idle"] .pipeline-line span { width: 0; }
.pipeline-card[data-state="waiting"] .pipeline-line span,
.pipeline-card[data-state="progress"] .pipeline-line span {
  width: 45%;
  animation: pipeline-progress 1.7s ease-in-out infinite alternate;
}
.pipeline-card[data-state="success"] .pipeline-line span { width: 100%; }
.workspace-app .backdrop,
.page-app .backdrop { background: rgba(8, 28, 21, .42); backdrop-filter: none; }
.workspace-app .backdrop { top: var(--route-bar-height); height: auto; }

/* Settings, admin and daily-trial pages */
.page-app .page-shell { grid-template-columns: 232px minmax(0, 1fr); }
.page-app .page-main {
  height: 100%;
  padding: 36px clamp(20px, 5vw, 68px) max(92px, calc(42px + env(safe-area-inset-bottom)));
  background: var(--ui-canvas);
  scrollbar-gutter: stable;
}
.page-header { align-items: flex-start; margin-bottom: 24px; }
.page-header h1 { font-size: clamp(29px, 3.5vw, 38px); line-height: 1.18; }
.page-description { max-width: 720px; color: var(--ui-muted); font-size: 14px; }
.settings-card, .admin-card, .metric-card, .trial-card {
  border: 1px solid rgba(209, 219, 212, .74);
  background: var(--ui-paper);
  box-shadow: 0 8px 24px rgba(20, 57, 44, .045);
}
.card-heading h2 { font-size: 18px; }
.card-heading p, .form-status, .field-label small { font-size: 11px; line-height: 1.55; }
.field-label { cursor: default; }
.field-control input, .field-control select { font-size: 13px; }
.primary-button, .secondary-button, .danger-button { min-height: 42px; }
.metrics-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.empty-state { min-height: 86px; padding: 22px; line-height: 1.65; }

.daily-trial-main { background: var(--ui-canvas); }
.daily-content { max-width: 1120px; margin-inline: auto; }
.trial-status-strip { border: 1px solid rgba(255, 255, 255, .06); box-shadow: none; }
.trial-status-strip span { font-size: 10px; }
.trial-status-strip strong { font-size: 12px; }
.trial-hero > div > p, .numbered-facts, .trial-list, .issue-list { font-size: 14px; line-height: 1.78; }
.trial-card h3 { font-size: 18px; }
.evidence-grid li { min-height: 44px; font-size: 12px; }
.daily-tabs button { min-height: 44px; font-size: 13px; }
.decision-options label > span { min-height: 76px; }
.judgment-field textarea { font-size: 14px; line-height: 1.65; }
.judgment-dialog::backdrop { background: rgba(8, 28, 21, .52); backdrop-filter: none; }
.daily-fallback { border: 1px solid var(--ui-line); background: var(--ui-paper); }
.daily-retry { min-height: 44px; margin-top: 18px; }

/* Data workspace */
.data-page { min-width: 0; color: var(--ui-ink); background: var(--ui-canvas); }
.data-page .global-route-bar {
  position: sticky;
  top: 0;
  min-height: var(--route-bar-height);
  padding: 0 clamp(12px, 2.4vw, 28px);
  background: var(--ui-deep-2);
  backdrop-filter: none;
}
.data-page .data-brand { min-width: 184px; color: #fff; }
.data-page .data-brand > span { color: var(--ui-deep-2); background: var(--ui-acid); }
.data-page .data-brand strong { display: inline; }
.data-page .data-brand small { display: inline; }
.data-page .route-links a { color: #adc0b8; }
.data-page .route-links a:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.data-page .route-links a[aria-current="page"] { color: var(--ui-deep-2); background: var(--ui-acid); }
.data-page main { width: min(100%, 1220px); padding: 38px clamp(13px, 3vw, 28px) max(96px, calc(48px + env(safe-area-inset-bottom))); }
.data-heading h1 { line-height: 1.2; }
.data-page section { padding: clamp(16px, 2.4vw, 24px); border: 1px solid rgba(209, 219, 212, .74); box-shadow: 0 7px 22px rgba(20, 57, 44, .045); }
.data-page section + section { margin-top: 18px; }
.data-page h2 { font-size: 19px; }
.data-page button, .data-page .button {
  min-height: 42px;
  padding: 10px 13px;
  border-color: var(--ui-line-strong);
  font-size: 12px;
}
.data-page input { min-height: 42px; font-size: 13px; }
.data-page .drop-zone { min-height: 112px; display: grid; place-items: center; font-size: 14px; text-align: center; }
.data-page progress { height: 10px; border: 0; border-radius: 999px; }
.data-page .progress-label { color: var(--ui-muted); font-size: 12px; }
.data-page .status-grid > div, .data-page .stats > div { min-width: 0; padding: 13px; border-radius: 10px; background: #f2f5f1; }
.data-page .option-grid label { min-height: 40px; }
.data-page .table-wrap { border: 1px solid var(--ui-line); border-radius: 11px; background: #fff; }
.data-page th { position: sticky; top: 0; z-index: 1; }
.data-page th, .data-page td { padding: 9px 8px; font-size: 12px; line-height: 1.45; }
.data-page .error {
  position: fixed;
  right: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 80;
  width: min(480px, calc(100vw - 32px));
  max-height: min(42vh, 300px);
  overflow: auto;
  border: 1px solid #dcaaa5;
  border-radius: 13px;
  box-shadow: 0 16px 44px rgba(80, 28, 28, .16);
}
.data-error-close { float: right; min-width: 40px; margin: -4px -4px 4px 12px; }

@keyframes ui-progress { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@keyframes ui-spin { to { transform: rotate(360deg); } }
@keyframes pipeline-progress { from { transform: translateX(-25%); } to { transform: translateX(135%); } }

@media (max-width: 1100px) {
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trial-status-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .trial-reading-grid { grid-template-columns: 1fr; }
}

@media (max-width: 920px) {
  .workspace-app .app-frame,
  .page-app .page-shell { display: block; }
  .workspace-app .mobile-only,
  .page-app .mobile-only { display: grid; }
  .workspace-app .sidebar,
  .page-app .page-shell > .sidebar {
    position: fixed;
    inset: var(--route-bar-height) auto 0 0;
    z-index: 60;
    display: flex;
    width: min(292px, 88vw);
    height: auto;
    max-height: none;
    transform: translateX(-104%);
    transition: transform .2s ease;
    box-shadow: 18px 0 48px rgba(8, 33, 25, .22);
  }
  .workspace-app .sidebar.open,
  .page-app .page-shell > .sidebar.open { transform: translateX(0); }
  .workspace-app .backdrop,
  .page-app .backdrop { position: fixed; inset: var(--route-bar-height) 0 0; z-index: 55; width: 100%; height: auto; }
  .workspace-app .chat-workspace,
  .page-app .page-main { width: 100%; height: 100%; }
  .workspace-header { grid-template-columns: auto minmax(0, 1fr) auto auto; }
  .workspace-title h1 { max-width: none; }
  .page-app .page-main { padding-top: 28px; }
}

@media (max-width: 680px) {
  :root { --route-bar-height: 52px; }
  .global-route-bar { padding-inline: 9px; }
  .route-bar-brand { min-width: 39px; width: 39px; }
  .route-bar-brand strong, .route-bar-brand small { display: none; }
  .route-links { justify-content: flex-start; padding-left: 3px; }
  .route-links a { min-height: 38px; padding-inline: 10px; }

  .workspace-header { min-height: 64px; padding: 8px 10px; gap: 7px; }
  .workspace-header h1 { font-size: 16px; }
  .model-picker { width: 132px; }
  .model-picker summary { min-height: 44px; padding: 7px 9px; }
  .model-picker summary small { display: none; }
  .model-menu { position: fixed; top: calc(var(--route-bar-height) + 58px); right: 8px; left: 8px; width: auto; }
  .model-option { grid-template-columns: 1fr; }
  .model-metrics { white-space: normal; }
  .icon-button { width: 44px; height: 44px; }

  .conversation { padding: 18px 14px 22px; scrollbar-gutter: auto; }
  .welcome { margin-top: 8px; }
  .welcome h2 { font-size: 28px; }
  .welcome > p:not(.eyebrow) { font-size: 13px; }
  .prompt-examples { margin-top: 26px; }
  .prompt-examples button, .prompt-examples button + button { min-height: 72px; }
  .message { margin-bottom: 26px; }
  .user-message, .ai-message { grid-template-columns: 28px minmax(0, 1fr); gap: 10px; }
  .avatar { width: 28px; height: 28px; }
  .answer-title { font-size: 17px; }
  .answer-card p, .analysis-sections dt, .analysis-sections dd, .reference-list, .case-card p { font-size: 13px; }
  .issue-grid { grid-template-columns: 1fr; }
  .analysis-sections { grid-template-columns: 1fr; }
  .analysis-sections dt { padding-bottom: 3px; border-bottom: 0; }
  .analysis-sections dd { padding-top: 0; }

  .composer-wrap { padding: 7px 8px max(8px, env(safe-area-inset-bottom)); }
  .composer { padding: 10px; border-radius: 14px; }
  .composer textarea { min-height: 46px; max-height: min(24vh, 150px); }
  .composer-meta { font-size: 9px; }
  .composer-toolbar { align-items: stretch; flex-direction: column; gap: 7px; }
  .tool-buttons { justify-content: space-between; min-width: 0; }
  .tool-button { display: none; }
  .analysis-modes { width: 100%; padding: 0; border-left: 0; }
  .analysis-modes { display: flex !important; }
  .analysis-modes button { flex: 1 1 0; min-width: 0; padding-inline: 5px; }
  .submit-analysis { width: 100%; min-height: 44px; justify-content: center; }
  .demo-disclosure { display: none; }
  .legal-disclaimer { margin-top: 5px; padding-inline: 8px; font-size: 8px; line-height: 1.4; }
  .jump-to-latest { right: 10px; min-height: 44px; }

  .page-app .page-main { padding: 22px 12px max(76px, calc(30px + env(safe-area-inset-bottom))); }
  .page-header { gap: 10px; margin-bottom: 20px; }
  .page-header h1 { font-size: 29px; }
  .page-description { font-size: 13px; }
  .metrics-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .metric-card { min-height: 120px; padding: 17px; }
  .form-row { grid-template-columns: 1fr; gap: 9px; }
  .card-heading, .card-body { padding-inline: 17px; }
  .card-heading { flex-direction: column; }
  .field-control input[type="text"], .field-control input[type="password"], .field-control input[type="number"], .field-control select { min-height: 44px; }
  .primary-button, .secondary-button, .danger-button { min-height: 44px; }

  .daily-trial-main { padding-inline: 12px; }
  .trial-status-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trial-status-strip > div { min-height: 68px; }
  .trial-hero { padding: 24px 18px; }
  .trial-card { padding: 20px 17px; }
  .decision-options { grid-template-columns: 1fr 1fr; }
  .judgment-actions, .dialog-actions { flex-direction: column-reverse; }
  .judgment-actions button, .dialog-actions button { width: 100%; min-height: 46px; }

  .data-page .global-route-bar { min-height: var(--route-bar-height); flex-direction: row; align-items: center; gap: 0; }
  .data-page .data-brand { min-width: 39px; width: 39px; }
  .data-page .data-brand > span { width: 27px; height: 27px; }
  .data-page .data-brand strong, .data-page .data-brand small { display: none; }
  .data-page .route-links { width: auto; }
  .data-page main { padding: 24px 10px max(78px, calc(32px + env(safe-area-inset-bottom))); }
  .data-heading { gap: 12px; }
  .data-heading h1 { font-size: 29px; }
  .data-page section { padding: 16px 13px; border-radius: 13px; }
  .data-page button, .data-page .button { min-height: 44px; }
  .data-page .buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
  .data-page .buttons > * { display: flex; width: 100%; margin: 0; align-items: center; justify-content: center; text-align: center; }
  .data-page .status-grid, .data-page .stats { grid-template-columns: 1fr 1fr; }
  .data-page .option-grid { grid-template-columns: 1fr; }
  .data-page #key-form button { width: 100%; margin-right: 0; }
  .data-page .section-title-row { flex-direction: column; }
  .data-page .error { right: 10px; bottom: max(10px, env(safe-area-inset-bottom)); width: calc(100vw - 20px); }
}

@media (max-width: 420px) {
  .route-links a { padding-inline: 9px; font-size: 10px; }
  .workspace-header .eyebrow { display: none; }
  .workspace-header h1 { margin-top: 0; font-size: 14px; }
  .model-picker { width: 118px; }
  .model-picker summary strong { font-size: 10px; }
  .welcome h2 { font-size: 25px; }
  .composer-meta span:first-child { display: none; }
  .composer-meta { justify-content: flex-end; }
  .metrics-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 104px; }
  .decision-options { grid-template-columns: 1fr; }
  .data-page .buttons, .data-page .status-grid, .data-page .stats { grid-template-columns: 1fr; }
}

@media (max-height: 680px) and (min-width: 681px) {
  .workspace-header { min-height: 58px; padding-block: 6px; }
  .model-picker summary { min-height: 43px; }
  .conversation { padding-top: 12px; padding-bottom: 12px; }
  .welcome { margin-top: 0; }
  .welcome-mark { width: 34px; height: 34px; margin-bottom: 8px; }
  .welcome h2 { margin-block: 7px; font-size: 28px; }
  .prompt-examples { margin-top: 16px; }
  .prompt-examples button { min-height: 70px; }
  .composer-wrap { padding-top: 6px; }
  .composer textarea { min-height: 38px; max-height: 88px; }
  .legal-disclaimer { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation: none !important; }
}
