/* TDoctor — Apple-style minimal dark UI. ES/EN shared layout. */
:root {
  color-scheme: dark;
  --bg: #000000;
  --bg-elevated: #1c1c1e;
  --bg-card: #2c2c2e;
  --bg-hover: #3a3a3c;
  --text: #f5f5f7;
  --text-secondary: #8e8e93;
  --accent: #0a84ff;
  --accent-press: #0071e3;
  --danger: #ff453a;
  --ok: #30d158;
  --warn: #ffd60a;
  --separator: #38383a;
  --badge: #3a3a3c;
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --pad: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  min-height: 100%;
  min-height: 100dvh;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img, video, canvas { max-width: 100%; display: block; }

.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: calc(var(--safe-top) + 12px) var(--pad) calc(var(--safe-bottom) + 12px);
  max-width: 1100px;
  margin: 0 auto;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.brand { font-size: 21px; font-weight: 600; letter-spacing: -0.02em; }
.header-actions { display: flex; gap: 8px; align-items: center; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--badge);
  color: var(--text);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
}
.badge.standin { background: #3a2a00; color: var(--warn); }
.badge.general { background: #2a2a00; color: #ffd60a; }
.badge.medical { background: #0c2a18; color: var(--ok); }

.btn {
  appearance: none;
  border: 0;
  background: var(--bg-card);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 600;
}
.btn:hover { background: var(--bg-hover); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary {
  background: var(--accent);
  color: #fff;
  width: 100%;
  padding: 16px 18px;
  font-size: 17px;
  border-radius: 14px;
}
.btn-primary:hover { background: var(--accent-press); }
.btn-secondary {
  background: var(--bg-card);
  width: 100%;
}
.btn-ghost { background: transparent; color: var(--accent); padding: 8px 10px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1; min-width: 120px; }

.drop-zone {
  border: 1.5px dashed var(--separator);
  border-radius: var(--radius);
  padding: 22px 16px;
  text-align: center;
  color: var(--text-secondary);
  margin: 12px 0;
  background: var(--bg-elevated);
}
.drop-zone.active { border-color: var(--accent); color: var(--text); background: #0a84ff14; }
@media (hover: none) and (pointer: coarse) {
  .drop-zone { display: none; }
}

.workspace {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}
.workspace.layout-cover-stack {
  display: flex;
  flex-direction: column;
}
.workspace.layout-open-two-pane {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}
@media (horizontal-viewport-segments: 2) {
  .workspace.layout-open-two-pane {
    grid-template-columns: env(viewport-segment-width 0 0, 1fr) env(viewport-segment-width 1 0, 1fr);
    column-gap: env(viewport-segment-left 1 0, 20px);
  }
}

.pane {
  background: var(--bg-elevated);
  border-radius: var(--radius);
  padding: 14px;
  min-width: 0;
}
.pane h2 { margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; }

.preview-wrap { position: relative; border-radius: 12px; overflow: hidden; background: #000; }
.preview-wrap img, .preview-wrap video { width: 100%; height: auto; max-height: 60vh; object-fit: contain; margin: 0 auto; }
.crop-rect {
  position: absolute; border: 2px solid var(--accent); box-shadow: 0 0 0 9999px #0008;
  pointer-events: none;
}

.hidden, [hidden] { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); border: 0;
}

textarea, input[type="text"], input[type="search"], select {
  width: 100%;
  background: var(--bg-card);
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
}
textarea { min-height: 88px; resize: vertical; }

.case-list { list-style: none; margin: 0; padding: 0; }
.case-list li { border-top: 1px solid var(--separator); }
.case-list button {
  width: 100%; text-align: left; background: transparent; border: 0;
  padding: 12px 4px; color: var(--text);
}
.case-list .meta { color: var(--text-secondary); font-size: 13px; }

.thread { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.bubble { background: var(--bg-card); border-radius: 12px; padding: 10px 12px; }
.bubble.doctor { background: #0a84ff22; }
.bubble .who { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }

.conf {
  display: flex; align-items: center; gap: 10px; margin: 8px 0;
  color: var(--text-secondary); font-size: 14px;
}
.conf-bar { flex: 1; height: 6px; background: var(--bg-card); border-radius: 99px; overflow: hidden; }
.conf-bar > span { display: block; height: 100%; background: var(--accent); }
.conf.low .conf-bar > span { background: var(--warn); }

.footer {
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid var(--separator);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
}
.footer .ver { margin-top: 6px; color: var(--text); font-weight: 600; }

.modal-backdrop {
  position: fixed; inset: 0; background: #000c;
  display: flex; align-items: flex-end; justify-content: center;
  padding: 16px; z-index: 40;
}
.modal {
  background: var(--bg-elevated);
  border-radius: 20px 20px 16px 16px;
  padding: 20px;
  width: min(520px, 100%);
  max-height: 90dvh;
  overflow: auto;
}
.modal h2 { margin: 0 0 10px; font-size: 20px; }
.progress { height: 8px; background: var(--bg-card); border-radius: 99px; overflow: hidden; margin: 10px 0; }
.progress > span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }

.settings-panel label { display: block; margin: 10px 0 6px; color: var(--text-secondary); font-size: 13px; }
.caps-pre {
  background: #000; color: #8e8e93; font-size: 11px; padding: 10px;
  border-radius: 10px; overflow: auto; max-height: 220px; white-space: pre-wrap;
}

.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.queue-hint { color: var(--text-secondary); font-size: 13px; margin: 8px 0; }
.secondary-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
@media (max-width: 360px) { .secondary-actions { grid-template-columns: 1fr; } }

.slider { width: 100%; accent-color: var(--accent); }


/* v0.1.1 — large touch targets (44pt minimum, 48dp on coarse / Android). */
.btn, .btn-primary, .btn-secondary, .btn-ghost, .chip, .case-list button, #btn-lang, #btn-settings {
  min-height: 44px;
  min-width: 44px;
}
@media (pointer: coarse) {
  .btn, .btn-primary, .btn-secondary, .btn-ghost, .chip, .case-list button, #btn-lang, #btn-settings {
    min-height: 48px;
    min-width: 48px;
  }
}

.offline-pill {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 600;
  background: var(--bg-card); color: var(--text-secondary);
}
.offline-pill.ready { background: #0c2a18; color: var(--ok); }
.offline-pill.downloading { background: #3a2a00; color: var(--warn); }

.dl-bar {
  margin: 0 0 12px;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.dl-bar .progress { margin: 6px 0; }
.dl-bar p { margin: 6px 0 0; font-size: 13px; color: var(--text-secondary); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chip {
  appearance: none; border: 0; border-radius: 999px;
  background: var(--bg-card); color: var(--text);
  padding: 10px 16px; font-weight: 600; font-size: 15px;
}
.chip:hover, .chip[aria-pressed="true"] { background: var(--accent); color: #fff; }

.summary { font-size: 17px; line-height: 1.45; margin: 8px 0 10px; }
.details-wrap { margin: 8px 0 12px; }
.details-wrap > summary {
  cursor: pointer; color: var(--accent); font-weight: 600;
  min-height: 44px; display: flex; align-items: center;
}
.conf-hint { font-size: 13px; color: var(--text-secondary); margin: 0 0 8px; }

.install-banner {
  background: var(--bg-elevated); border-radius: var(--radius);
  padding: 14px; margin: 0 0 12px;
}
.install-banner ol { margin: 8px 0 0; padding-left: 1.2em; color: var(--text-secondary); }
.install-banner li { margin: 4px 0; }

/* Notice is a short sheet, not a wizard. */
#modal-notice .modal { padding-bottom: 20px; }
#modal-notice .modal h2 { font-size: 18px; }
#modal-notice .modal p { color: var(--text-secondary); }

.header { flex-wrap: wrap; }
.header-status { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
