/* ODGA capture: dark UI, mobile first (phone -> tablet -> desktop). No build step. */

:root {
  color-scheme: dark;
  --bg: #0b0b12;
  --bg-2: #0f0f18;
  --surface: #13131d;
  --surface-2: #1a1a26;
  --surface-3: #232332;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f3f3f7;
  --muted: #9b9bb0;
  --faint: #6c6c82;
  --accent: #9b6dff;
  --accent-strong: #7c4dff;
  --accent-soft: rgba(155, 109, 255, 0.14);
  --pink: #f43f7a;
  --orange: #ff8a3d;
  --green: #4ade80;
  --green-soft: rgba(74, 222, 128, 0.12);
  --red: #ff5d6c;
  --red-soft: rgba(255, 93, 108, 0.14);
  --amber: #fbbf24;
  --grad: linear-gradient(90deg, #7c4dff 0%, #b13fd6 55%, #f43f7a 100%);
  --grad-ring: conic-gradient(from 200deg, #ff8a3d, #f43f7a, #b13fd6, #ff8a3d);
  --radius: 16px;
  --radius-sm: 10px;
  --gap: 16px;
  --pad: 16px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Roboto Mono", Menlo, monospace;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: radial-gradient(1200px 600px at 80% -10%, rgba(124, 77, 255, 0.10), transparent 60%), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 400 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.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; }
.muted { color: var(--muted); }
.small { font-size: 0.8em; font-weight: 400; text-transform: none; letter-spacing: 0; }
.center { text-align: center; }
.sprite { position: absolute; }
.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.i.accent { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- layout ---------- */
.shell { min-height: 100dvh; display: flex; }
.rail { display: none; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.grid {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 4px var(--pad) 24px;
  display: grid;
  gap: var(--gap);
  grid-template-columns: minmax(0, 1fr);
}

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: calc(10px + var(--safe-t)) var(--pad) 10px;
  background: rgba(11, 11, 18, 0.82);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-bottom: 1px solid transparent;
}
.topbar-logo { height: 22px; width: auto; }
.topbar-title { flex: 1; margin: 0; font-size: 16px; font-weight: 600; text-align: center; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.banner {
  max-width: 640px; width: calc(100% - 2 * var(--pad)); margin: 8px auto 4px;
  display: flex; gap: 10px; align-items: center;
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--accent-soft); border: 1px solid rgba(155, 109, 255, 0.35);
  font-size: 14px;
}
.banner span { flex: 1; }

/* ---------- cards ---------- */
.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0.01)), var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px var(--pad);
  min-width: 0;
}
.card-title {
  margin: 0 0 14px; font-size: 15px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.card-title .num { color: var(--accent); margin-right: 2px; }
.card-title label { cursor: default; }

/* session (colorist + location) */
.session { padding: 12px var(--pad); }
.session-summary { display: flex; align-items: center; gap: 10px; }
.session-summary p { flex: 1; margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.session-fields { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; margin-top: 12px; }
.session.editing .session-summary { display: none; }
.session-done { grid-column: 1 / -1; justify-self: end; min-width: 88px; }
.session.editing .session-fields { margin-top: 0; }

/* ---------- fields ---------- */
.field { margin-bottom: 14px; min-width: 0; }
.field:last-child { margin-bottom: 0; }
.field label, .photo-label { display: block; font-size: 14px; color: var(--muted); margin: 0 0 6px; }
.req { color: var(--pink); }
input:not([type=checkbox]):not([type=file]), textarea {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  font-size: 16px; /* >= 16px: iOS doesn't zoom on focus */
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none; appearance: none;
}
textarea { resize: vertical; min-height: 92px; line-height: 1.45; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(155, 109, 255, 0.22); }
input.invalid { border-color: var(--red); }
input.invalid:focus { box-shadow: 0 0 0 3px rgba(255, 93, 108, 0.2); }
.combo > input.has-icon { padding-left: 44px; }
.combo { position: relative; }
.field-icon { position: absolute; left: 14px; top: 15px; color: var(--faint); pointer-events: none; }
.combo:focus-within .field-icon { color: var(--accent); }
.hint { margin: 6px 2px 0; font-size: 13px; color: var(--muted); min-height: 0; }
.hint:empty { display: none; }
.hint.error { color: var(--red); }
#rec-hint.error { color: #ffb3ba; }
.hint.known { color: var(--green); display: flex; gap: 6px; align-items: center; }
.hint .link-btn { font-size: 13px; padding: 0; min-height: 0; }

/* suggestions dropdown */
.suggest {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px);
  margin: 0; padding: 6px; list-style: none;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 12px;
  box-shadow: var(--shadow); max-height: 280px; overflow: auto; overscroll-behavior: contain;
}
.suggest li {
  display: flex; flex-direction: column; gap: 1px;
  padding: 10px 12px; border-radius: 8px; cursor: pointer; min-height: 44px; justify-content: center;
}
.suggest li[aria-selected=true], .suggest li:hover { background: var(--accent-soft); }
.suggest .s-main { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest .s-main mark { background: none; color: var(--accent); font-weight: 600; }
.suggest .s-sub { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.suggest .s-head { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: 6px 12px 2px; min-height: 0; cursor: default; }
.suggest .s-head:hover { background: none; }

/* consent switch */
.switch-row {
  display: flex; align-items: center; gap: 14px; margin-top: 4px;
  padding: 12px 14px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--border-strong);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.switch-row:has(.switch:checked) { border-color: rgba(74, 222, 128, 0.45); background: var(--green-soft); }
.switch-row.invalid { border-color: var(--red); }
.switch-txt { flex: 1; display: flex; flex-direction: column; gap: 2px; font-size: 15px; }
.switch-txt .muted { font-size: 13px; }
.switch {
  -webkit-appearance: none; appearance: none; flex: none;
  width: 52px; height: 32px; border-radius: 16px; margin: 0;
  background: var(--surface-3); border: 1px solid var(--border-strong);
  position: relative; cursor: pointer; transition: background .2s;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.4); transition: transform .2s;
}
.switch:checked { background: var(--green); border-color: var(--green); }
.switch:checked::after { transform: translateX(20px); }

/* ---------- buttons ---------- */
.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px; border-radius: 12px;
  border: 1px solid transparent; background: var(--surface-3); font-weight: 500; font-size: 16px;
  transition: transform .08s, filter .15s, opacity .15s, background .15s;
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.btn:active { transform: scale(0.98); }
.btn.sm { min-height: 40px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn.primary { background: var(--grad) border-box; color: #fff; font-weight: 600; box-shadow: 0 8px 24px rgba(177, 63, 214, 0.28); }
.btn.secondary { background: var(--surface-3); border-color: var(--border-strong); }
.btn.ghost { background: transparent; border-color: var(--border-strong); color: var(--accent); }
.btn.danger { background: var(--red-soft); border-color: rgba(255, 93, 108, 0.5); color: #ffb3ba; }
.btn[aria-disabled=true] { opacity: 0.45; box-shadow: none; filter: saturate(0.4); }
.btn > * { position: relative; }
.btn-progress { position: absolute !important; left: 0; top: 0; bottom: 0; width: 0; background: rgba(255,255,255,0.18); transition: width .2s; }
.link-btn { background: none; border: 0; padding: 6px 4px; color: var(--accent); font-size: 15px; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; }
.link-btn.danger-txt { color: #ff9aa4; }
.icon-btn { background: none; border: 0; padding: 4px; border-radius: 50%; display: inline-grid; place-items: center; min-width: 44px; min-height: 44px; color: var(--muted); }
.icon-btn.sm { min-width: 40px; min-height: 40px; border: 1px solid var(--border-strong); border-radius: 10px; }

.avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--grad); color: #fff; font-weight: 600; font-size: 16px; text-transform: uppercase;
}
.avatar.sm { width: 34px; height: 34px; font-size: 14px; }

/* ---------- recorder ---------- */
.rec-live, .rec-done { display: none; }
.rec[data-state=recording] .rec-idle, .rec[data-state=paused] .rec-idle,
.rec[data-state=done] .rec-idle { display: none; }
.rec[data-state=recording] .rec-live, .rec[data-state=paused] .rec-live { display: block; }
.rec[data-state=done] .rec-done { display: block; }

.rec-idle { display: flex; flex-direction: column; align-items: center; padding: 6px 0 2px; }
.ring-btn { background: none; border: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 4px; border-radius: 20px; touch-action: manipulation; }
.ring {
  width: 104px; height: 104px; border-radius: 50%; display: grid; place-items: center; position: relative;
  background: var(--grad-ring); box-shadow: 0 0 0 8px rgba(244, 63, 122, 0.08), 0 12px 40px rgba(244, 63, 122, 0.25);
  transition: transform .15s, box-shadow .2s;
}
.ring::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--surface); }
.ring .i { position: relative; width: 36px; height: 36px; color: #fff; stroke-width: 1.6; }
.ring-btn:active .ring { transform: scale(0.96); }
.ring-label { font-weight: 600; font-size: 17px; }
.ring-btn[aria-disabled=true] .ring { filter: grayscale(0.9) brightness(0.7); box-shadow: none; }
.ring-btn[aria-disabled=true] .ring-label { color: var(--muted); }
.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.rec-status { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); flex: none; box-shadow: 0 0 0 0 rgba(255, 93, 108, 0.6); animation: pulse 1.6s infinite; }
.rec[data-state=paused] .dot, .actionbar[data-mode=paused] .dot { background: var(--amber); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 93, 108, 0.6); } 70% { box-shadow: 0 0 0 10px rgba(255, 93, 108, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 93, 108, 0); } }
.timer { text-align: center; font: 300 52px/1.1 var(--font); font-variant-numeric: tabular-nums; letter-spacing: 0.02em; margin: 6px 0 4px; }
.wave { display: block; width: 100%; height: 64px; margin: 4px 0 14px; }
.rec-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.warn { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; background: rgba(251, 191, 36, 0.12); border: 1px solid rgba(251, 191, 36, 0.4); color: #fde68a; font-size: 14px; }

.import-audio { margin-top: 4px; font-size: 14px; cursor: pointer; }
.import-audio .i { width: 17px; height: 17px; }
.import-audio[aria-disabled=true] { color: var(--muted); }
.rec-done-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.rec-done-head p { margin: 2px 0 0; font-size: 14px; }
.ok-badge { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--green-soft); color: var(--green); flex: none; }
.ok-badge.lg { width: 64px; height: 64px; margin: 4px auto 8px; }
.ok-badge.lg .i { width: 32px; height: 32px; stroke-width: 2.4; }
audio { width: 100%; height: 44px; margin-bottom: 6px; color-scheme: dark; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.rec-done-actions { display: inline-flex; gap: 4px; margin-left: auto; }
.upload-state { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.upload-state.ok { color: var(--green); }
.upload-state.err { color: var(--red); }

/* ---------- photos ---------- */
.photos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.photo { min-width: 0; }
.photo-label { display: flex; align-items: center; gap: 6px; }
.dot-ok { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.drop {
  position: relative; display: grid; place-items: center; overflow: hidden;
  aspect-ratio: 4 / 5; border-radius: 12px; cursor: pointer;
  border: 1.5px dashed rgba(155, 109, 255, 0.45); background: rgba(155, 109, 255, 0.04);
  transition: border-color .15s, background .15s;
}
.drop:hover, .drop.dragover { border-color: var(--accent); background: var(--accent-soft); }
.drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.drop.filled { border-style: solid; border-color: var(--border); }
.drop-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 10px; }
.drop-icon { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; border: 1px solid rgba(155, 109, 255, 0.35); color: var(--accent); }
.drop-icon .i { width: 26px; height: 26px; }
.drop-cta { color: var(--accent); font-weight: 500; font-size: 15px; }
.drop-sub { font-size: 12.5px; }
.drop-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.drop-fallback { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px; font-size: 13px; color: var(--muted); text-align: center; word-break: break-all; }
.drop-progress { position: absolute; left: 10px; right: 10px; bottom: 10px; height: 4px; border-radius: 2px; background: rgba(0,0,0,0.5); overflow: hidden; }
.drop-progress span { display: block; height: 100%; width: 0; background: var(--grad); transition: width .2s; }
.photo-actions { display: flex; gap: 8px; margin-top: 8px; }
.photo-actions .btn { flex: 1; }

/* ---------- action bar ---------- */
.actionbar {
  position: sticky; bottom: 0; z-index: 25; margin-top: auto;
  padding: 10px var(--pad) calc(10px + var(--safe-b));
  background: rgba(11, 11, 18, 0.88);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
}
.actionbar > div { max-width: 640px; margin: 0 auto; }
.bar-rec { display: none; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border-strong); box-shadow: var(--shadow); }
.actionbar[data-mode=recording] .bar-rec, .actionbar[data-mode=paused] .bar-rec { display: flex; }
.actionbar[data-mode=recording] .bar-save, .actionbar[data-mode=paused] .bar-save { display: none; }
.bar-timer { font-variant-numeric: tabular-nums; font-weight: 600; }
.bar-rec-txt { flex: 1; font-size: 14px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
@media (max-width: 400px) { .bar-rec-txt { visibility: hidden; } }
.bar-hint { margin: 0 0 8px; line-height: 1.3; text-align: center; font-size: 13.5px; color: var(--muted); }
.bar-hint:empty { display: none; }
.bar-hint.error { color: #ffb3ba; }
#save-btn { min-height: 56px; font-size: 17px; }
body.typing .actionbar { display: none; } /* phone keyboard open: give the space to the form */

/* ---------- sheets, modals, toast ---------- */
dialog { color: var(--text); padding: 0; border: 0; background: transparent; max-width: none; max-height: none; }
dialog::backdrop { background: rgba(0, 0, 0, 0.6); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.sheet { margin: auto auto 0; width: 100%; max-width: 520px; }
.sheet-body { background: var(--surface); border: 1px solid var(--border-strong); border-bottom: 0; border-radius: 22px 22px 0 0; padding: 10px var(--pad) calc(16px + var(--safe-b)); max-height: 85dvh; overflow: auto; }
.sheet[open] .sheet-body { animation: up .22s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--border-strong); margin: 0 auto 14px; }
.sheet-actions { display: grid; gap: 10px; margin-top: 16px; }
.modal { width: calc(100% - 32px); max-width: 420px; margin: auto; }
.modal-body { background: var(--surface); border: 1px solid var(--border-strong); border-radius: 20px; padding: 22px; box-shadow: var(--shadow); }
.modal[open] .modal-body { animation: pop .18s ease-out; }
@keyframes pop { from { transform: scale(0.96); opacity: 0; } }
.modal h2 { margin: 0 0 8px; font-size: 19px; font-weight: 600; }
.modal p { margin: 0 0 18px; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.profile { display: flex; align-items: center; gap: 12px; padding: 4px 0 12px; }
.profile-txt { display: flex; flex-direction: column; min-width: 0; }
.profile-txt > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-txt .muted { font-size: 14px; }
.rail-title { font-size: 12.5px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 14px 0 8px; display: flex; align-items: center; gap: 8px; }
.count { background: var(--surface-3); color: var(--text); border-radius: 10px; padding: 1px 8px; font-size: 12px; }
.today { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.today li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--border); font-size: 14px; }
.today li .t-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.today li .t-time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.today li .i { width: 16px; height: 16px; color: var(--green); }
.today .empty { color: var(--faint); background: none; border: 1px dashed var(--border); justify-content: center; }

.toast {
  position: fixed; z-index: 60; left: 50%; transform: translateX(-50%);
  bottom: calc(110px + var(--safe-b)); width: max-content; max-width: calc(100% - 32px);
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: 12px; background: #2a2a3b; border: 1px solid var(--border-strong);
  box-shadow: var(--shadow); font-size: 14.5px; animation: pop .18s ease-out;
}
.toast.error { background: #3a1a22; border-color: rgba(255, 93, 108, 0.5); }

/* ---------- login ---------- */
.login { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: calc(24px + var(--safe-t)) var(--pad) calc(24px + var(--safe-b)); }
.login-logo { width: 170px; height: auto; }
.login-sub { margin: 8px 0 28px; }
.login-card { width: 100%; max-width: 400px; padding: 24px; }
.login-card .card-title { font-size: 17px; }
.login-card .btn { margin-top: 8px; }
.login-card #login-info:not(:empty) { margin: -4px 0 14px; color: var(--accent); }
.combo > input.has-action { padding-right: 52px; }
.field-action { position: absolute; right: 3px; top: 3px; }

/* ---------- lab: navigation ---------- */
.view { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.tabs {

  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
  max-width: 640px; width: calc(100% - 2 * var(--pad)); margin: 2px auto 10px; padding: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
}
.tabs a, .rail-nav a {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 8px;
  border-radius: 10px; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500;
}
.tabs a .i { width: 17px; height: 17px; }
.tabs a.active, .rail-nav a.active { background: var(--accent-soft); color: var(--text); }
.tabs a.active .i, .rail-nav a.active .i { color: var(--accent); }
.rail-nav { display: grid; gap: 4px; margin: 0 0 8px; }
.rail-nav a { justify-content: flex-start; padding: 0 12px; font-size: 15px; }
.env-badge { display: inline-block; margin-left: 6px; padding: 0 8px; border-radius: 8px; background: var(--surface-3); color: var(--amber); font-size: 12px; }
.env-badge:empty { display: none; }
.stack { display: grid; gap: 10px; }
.clickable { cursor: pointer; }
.today li.clickable:hover { border-color: var(--border-strong); }

/* ---------- lab: lists ---------- */
.lab-wrap { width: 100%; max-width: 640px; margin: 0 auto; padding: 4px var(--pad) 32px; min-width: 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 8px; }
.toolbar .grow { flex: 1 1 240px; }
.list-note { margin: 4px 2px 10px; font-size: 13px; }
.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-width: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
}
.row.clickable:hover { border-color: var(--border-strong); background: var(--surface-2); }
.row-main { flex: 1; min-width: 0; display: grid; gap: 4px; }
.row-main p { margin: 0; }
.row-title { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.row-sub { font-size: 13.5px; overflow-wrap: anywhere; }
.row-link { font-size: 13.5px; color: var(--accent); text-decoration: none; }
.row .chev { transform: rotate(180deg); color: var(--faint); }
.rows .empty { padding: 18px; text-align: center; color: var(--faint); border: 1px dashed var(--border); border-radius: 14px; }
.rows .empty.error { color: var(--red); }
.badge { display: inline-block; padding: 1px 8px; border-radius: 8px; background: var(--surface-3); color: var(--muted); font-size: 12px; font-weight: 500; text-transform: none; letter-spacing: 0; vertical-align: middle; }
.badge.warn { background: rgba(251, 191, 36, 0.14); color: var(--amber); }
.badge.new { background: var(--accent-soft); color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; background: var(--bg-2); border: 1px solid var(--border); color: var(--muted); }
.chip.toggle { min-height: 36px; padding: 0 14px; font-size: 14px; }
.chip.toggle.on { background: var(--accent-soft); border-color: rgba(155, 109, 255, 0.45); color: var(--text); }
.st-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.st-completed .st-dot { background: var(--green); }
.st-running .st-dot, .st-pending .st-dot { background: var(--accent); animation: blink 1s infinite alternate; }
.st-failed .st-dot { background: var(--red); }
.st-unavailable .st-dot { background: var(--faint); }
.st-none { opacity: 0.5; }
@keyframes blink { to { opacity: 0.3; } }
.spinner { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--accent-soft); border-top-color: var(--accent); animation: spin .8s linear infinite; vertical-align: -2px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- lab: one diagnostic ---------- */
.back { margin: 0 0 6px -4px; text-decoration: none; }
.dcols, .dcol { display: grid; gap: var(--gap); min-width: 0; align-content: start; }
.card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head .card-title { margin: 0; flex: 1; }
.card-title .badge { margin-left: 6px; }
select {
  min-height: 40px; padding: 0 12px; border-radius: 10px; background: var(--bg-2); color: var(--text);
  border: 1px solid var(--border-strong); font: inherit; font-size: 14px;
}
.head-top { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.head-txt { min-width: 0; }
.head-txt h2 { margin: 0; font-size: 20px; font-weight: 600; }
.head-txt p { margin: 2px 0 0; font-size: 14px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.step { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 4px 10px; padding: 10px 12px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--border); }
.step-name { display: flex; flex-direction: column; font-weight: 500; }
.step-name .small { font-size: 12px; }
.step-note { font-size: 13.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.step-error { grid-column: 2 / -1; margin: 0; color: #ffb3ba; font-size: 13px; overflow-wrap: anywhere; }
.st-icon { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--faint); }
.step.st-completed .st-icon { border-color: var(--green); background: var(--green); box-shadow: inset 0 0 0 3px var(--bg-2); }
.step.st-running .st-icon, .step.st-pending .st-icon { border-color: var(--accent-soft); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.step.st-failed .st-icon { border-color: var(--red); background: var(--red); box-shadow: inset 0 0 0 3px var(--bg-2); }
.step.st-failed { border-color: rgba(255, 93, 108, 0.4); }
.step.st-unavailable .st-icon { border-style: dashed; }
.step.st-unavailable .step-error { color: var(--muted); }
.head-foot { margin-top: 10px; }
.head-foot .link-btn { font-size: 14px; }
code { font-family: var(--mono); font-size: 0.92em; color: var(--muted); }
.events { margin: 8px 0 0; padding: 10px 12px 10px 28px; border-radius: 10px; background: var(--bg-2); font-size: 12.5px; display: grid; gap: 3px; max-height: 240px; overflow: auto; overflow-wrap: anywhere; }

.placeholder { margin: 0; padding: 20px 4px; color: var(--muted); text-align: center; }
.sec { padding: 12px 0; border-top: 1px solid var(--border); }
.sec h3 { margin: 0 0 6px; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent); }
.sec p { margin: 0; line-height: 1.55; }
.evidence { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.ev { min-width: 30px; min-height: 26px; padding: 0 6px; border-radius: 7px; border: 1px solid var(--border-strong); background: var(--bg-2); color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.ev:hover { color: var(--text); border-color: var(--accent); }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
.facts dt { color: var(--muted); font-size: 14px; }
.facts dd { margin: 0; }
.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.conclusion ol { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.conclusion li p { margin: 2px 0 0; color: var(--muted); }
.model { margin: 8px 0 0; text-align: right; }
.instruction { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 10px; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); font-size: 14px; }
.instruction .i { width: 16px; height: 16px; margin-top: 2px; color: var(--accent); }

.chat { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.chat:empty { display: none; }
.chat li { max-width: 88%; padding: 9px 12px; border-radius: 14px; font-size: 14.5px; display: grid; gap: 2px; }
.chat .me { justify-self: end; background: var(--accent-soft); border-bottom-right-radius: 4px; }
.chat .me.pending { opacity: 0.8; }
.chat .bot { justify-self: start; background: var(--surface-3); border-bottom-left-radius: 4px; }
.chat .bot.error { background: var(--red-soft); color: #ffb3ba; }
.edit-form textarea { min-height: 72px; }
.edit-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
#d-mic[aria-pressed=true] { background: var(--red-soft); border-color: rgba(255, 93, 108, 0.5); color: #ffb3ba; }

.thumbs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.thumb { position: relative; display: block; aspect-ratio: 4 / 5; border-radius: 12px; overflow: hidden; background: var(--bg-2); border: 1px solid var(--border); text-decoration: none; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb span { position: absolute; left: 8px; bottom: 8px; padding: 2px 8px; border-radius: 8px; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 12.5px; }
.thumb.empty { display: grid; place-items: center; }
.thumb.empty span { position: static; background: none; color: var(--faint); }
#d-media audio { margin-bottom: 12px; }
#d-media .instruction { margin: 12px 0 0; }

h3.sub { margin: 4px 0 8px; font-size: 13px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.bars { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.bars li { display: grid; grid-template-columns: minmax(90px, 30%) 1fr 48px; align-items: center; gap: 10px; font-size: 14px; }
.bar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 8px; border-radius: 4px; background: var(--bg-2); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--grad); border-radius: 4px; }
.bar-val { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }

.legend { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: -4px 0 10px; }
.spk { display: inline-block; padding: 1px 8px; border-radius: 8px; font-size: 12px; font-weight: 600; }
.spk.colorist { background: var(--accent-soft); color: var(--accent); }
.spk.client { background: rgba(244, 63, 122, 0.14); color: #ff8fb1; }
.spk.other { background: var(--surface-3); color: var(--muted); }
.turns { display: grid; gap: 10px; }
.turn { padding-left: 10px; border-left: 2px solid var(--border-strong); }
.turn.colorist { border-left-color: rgba(155, 109, 255, 0.5); }
.turn.client { border-left-color: rgba(244, 63, 122, 0.5); }
.turn-head { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.ts { background: none; border: 0; padding: 0; color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.ts:hover { color: var(--accent); }
.turn p { margin: 0; font-size: 14.5px; line-height: 1.55; }
.seg { border-radius: 4px; cursor: pointer; }
.seg:hover { background: rgba(255, 255, 255, 0.05); }
.seg.hl { background: rgba(251, 191, 36, 0.25); box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.25); }

body:not([data-view=capture]) .actionbar { display: none; }

/* ---------- tablet & desktop ---------- */
@media (min-width: 720px) {
  :root { --pad: 24px; --gap: 20px; }
  .grid, .banner, .actionbar > div, .lab-wrap, .tabs { max-width: 720px; }
  .topbar-title { font-size: 17px; }
}

@media (min-width: 960px) {
  .grid {
    max-width: 1120px;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "session session" "client photos" "rec photos" "rec comment";
    grid-template-rows: auto auto auto 1fr;
    align-items: start;
  }
  .banner, .actionbar > div, .lab-wrap { max-width: 1120px; }
  .tabs { max-width: 1120px; }
  .dcols { grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); align-items: start; }
  .turns { max-height: 70vh; overflow: auto; padding-right: 6px; }
  #session-card { grid-area: session; }
  #client-card { grid-area: client; }
  #rec-card { grid-area: rec; }
  #photos-card { grid-area: photos; }
  #comment-card { grid-area: comment; }
  .session.editing .session-fields, .session-fields { grid-template-columns: 1fr 1fr; }
  .bar-save { display: flex; align-items: center; gap: 16px; }
  .bar-hint { flex: 1; margin: 0; text-align: right; }
  #save-btn { width: auto; min-width: 360px; }
  .bar-rec { max-width: 560px; margin-left: auto !important; }
  body.typing .actionbar { display: block; }
}

@media (min-width: 1280px) {
  .rail {
    display: flex; flex-direction: column; flex: none;
    position: sticky; top: 0; height: 100dvh; width: 280px;
    padding: 28px 20px 20px; background: var(--bg-2); border-right: 1px solid var(--border);
  }
  .rail-logo { width: 130px; height: auto; }
  .rail-sub { margin: 6px 0 24px; color: var(--muted); font-size: 14px; }
  .rail .profile { padding: 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
  .rail .today { overflow: auto; flex: 1; align-content: start; }
  .rail-logout { margin-top: 12px; align-self: flex-start; color: var(--muted); }
  .topbar-logo, #menu-btn { visibility: hidden; }
  .tabs { display: none; }
  .topbar { justify-content: center; }
}

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

@media (max-width: 400px) {
  .tabs a { font-size: 12.5px; gap: 4px; padding: 0 2px; }
  .tabs a .i { display: none; }
}

/* ---------- import ---------- */
.import-drop { aspect-ratio: auto; min-height: 180px; margin-bottom: 14px; }
.import-drop code { font-size: 12px; }
.import-bar { align-items: center; }
.import-bar p { margin: 0; }
#imp-list .row { align-items: center; }
#imp-list .imp-check { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
#imp-list .row-title .small { margin-left: 8px; overflow-wrap: anywhere; }
#imp-list .bar { display: block; margin-top: 6px; }
#imp-list .ok { color: var(--green); }
#imp-list .error { color: var(--red); }
