:root {
  /* 밝은 테마, 서늘한 중성 회색 기반. */
  --paper: #eef1f5;
  --surface: #f7f9fb;
  --card: #ffffff;

  --ink: #15181d;
  --ink-soft: #414b57;
  --muted: #697382;
  --faint: #99a2b0;

  --line: #dde2e9;
  --line-soft: #eceff4;

  /* UI 강조색. 3D 뷰의 좌/우 데이터 색과 겹치지 않는 계열을 쓴다. */
  --accent: #0f766e;
  --accent-soft: #d8efec;

  /* 경고색도 데이터 색과 겹치지 않게 한다. */
  --alert: #c0392b;
  --ok: #2f7d5f;
  --warning: #b07d1f;

  --recording: #d7443a;
  --ready: #2f7d5f;
  --running: #0f766e;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(21, 24, 29, 0.05), 0 1px 3px rgba(21, 24, 29, 0.04);
  --shadow-md: 0 4px 12px rgba(21, 24, 29, 0.07), 0 1px 3px rgba(21, 24, 29, 0.05);
  --shadow-lg: 0 16px 40px rgba(21, 24, 29, 0.14);

  --bar-h: 56px;
  --tabs-h: 42px;

  --track: 0.01em;
  --track-eyebrow: 0.06em;

  /* 본문과 UI 는 시스템 산세리프. 웹폰트를 받지 않으므로 오프라인에서도 안전하다. */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  /* 고정폭은 자릿수가 흔들리면 안 되는 수치 데이터에만 쓴다. */
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, "DejaVu Sans Mono",
    Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------- app bar ---------- */

.app-bar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 40;
  height: var(--bar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}

.app-bar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand-mark {
  width: 22px;
  height: 22px;
  display: block;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.brand {
  color: var(--ink);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand-rule {
  width: 1px;
  height: 16px;
  background: var(--line);
}

.brand-context {
  overflow: hidden;
  color: var(--muted);
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-bar-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 27px;
  padding: 0 11px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 12px;
  white-space: nowrap;
}

.meta-chip::before {
  content: "";
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--faint);
}

.meta-chip.is-live::before {
  background: var(--ok);
}

.meta-chip.plain::before {
  display: none;
}

/* ---------- tabs ---------- */

.app-tabs {
  position: fixed;
  inset: var(--bar-h) 0 auto 0;
  z-index: 39;
  height: var(--tabs-h);
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
  scrollbar-width: none;
}

.app-tabs::-webkit-scrollbar {
  display: none;
}

.app-tabs a {
  display: flex;
  align-items: center;
  height: 28px;
  padding: 0 13px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.app-tabs a:hover {
  background: var(--surface);
  color: var(--ink);
}

.app-tabs a.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

/* ---------- shell ---------- */

.app-shell {
  min-width: 0;
  overflow-x: hidden;
  padding: calc(var(--bar-h) + var(--tabs-h) + 22px) 24px 36px;
}

h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.015em;
}

/* 섹션 머리말만 작은 대문자 아이브로우, 나머지는 문장 표기. */
h2 {
  margin: 0;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: var(--track);
}

.capture-stack {
  min-width: 0;
  display: grid;
  gap: 16px;
}

/* ---------- panels ---------- */

.work-surface {
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  margin: -18px -18px 18px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
}

.section-title.with-meta {
  justify-content: space-between;
}

.section-title.with-meta div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title.with-meta strong {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.section-title > span {
  color: var(--faint);
  font-size: 12px;
  font-weight: 400;
}

/* ---------- form controls ---------- */

label {
  display: grid;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 500;
}

input,
select,
textarea {
  min-width: 0;
  width: 100%;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 11px;
  background: #fff;
  color: var(--ink);
  font-family: var(--font);
  font-size: 13px;
}

textarea {
  height: auto;
  padding: 10px;
  line-height: 1.5;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

input[readonly] {
  background: var(--surface);
  color: var(--ink-soft);
}

select {
  appearance: none;
  padding-right: 28px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
}

input[type="checkbox"],
input[type="radio"] {
  width: auto;
  height: auto;
  accent-color: var(--accent);
}

input[type="range"] {
  height: 20px;
  padding: 0;
  border: 0;
  background: transparent;
  accent-color: var(--accent);
}

.list-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
}

.list-pager .button[disabled] {
  opacity: 0.4;
  cursor: default;
}

.list-pager-status {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  min-width: 56px;
  text-align: center;
}

.intrinsic-upload-field {
  align-self: stretch;
}

/* A label above a .calibration-picker: the picker holds its own <label>, so the two
   can't nest the way other fields do. */
.calibration-picker-field {
  display: grid;
  gap: 6px;
}

.calibration-picker-field > label {
  display: block;
}

/* Project calibration dropdown and Upload share one bordered field. */
.calibration-picker {
  display: flex;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  overflow: hidden;
}

.calibration-picker:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.calibration-picker select {
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
  border: 0;
  border-radius: 0;
}

.calibration-picker select:focus {
  box-shadow: none;
}

.calibration-picker-upload {
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-left: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 550;
  cursor: pointer;
}

.calibration-picker-upload:hover {
  background: var(--line-soft);
}

/* The global `input` rule would otherwise stretch this hidden input to full width
   and push the page into horizontal overflow. */
.calibration-picker-upload input.visually-hidden-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
}

/* ---------- buttons ---------- */

.button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  background: #fff;
  color: var(--ink);
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 550;
  text-decoration: none;
  cursor: pointer;
}

.button:hover:not(:disabled) {
  border-color: var(--faint);
  background: var(--surface);
}

.button:disabled {
  cursor: not-allowed;
  color: var(--faint);
  opacity: 0.6;
}

.button.secondary {
  background: #fff;
  color: var(--ink);
}

/* 주요 동작은 강조색. */
.button.solid {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}

.button.solid:hover:not(:disabled) {
  border-color: #0b5d57;
  background: #0b5d57;
}

.compact-button {
  min-height: 28px;
  padding: 0 11px;
  font-size: 12px;
}

/* ---------- status ---------- */

.status-dot {
  width: 7px;
  height: 7px;
  display: inline-block;
  border-radius: 50%;
  background: var(--faint);
}

.status-dot.ready {
  background: var(--ok);
}

.status-dot.recording {
  background: var(--recording);
}

.status-dot.warning {
  background: var(--warning);
}

.empty {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
}

::selection {
  background: rgba(15, 118, 110, 0.16);
}

@media (max-width: 980px) {
  .app-bar {
    padding: 0 16px;
  }

  .app-bar-meta {
    display: none;
  }

  .app-tabs {
    padding: 0 12px;
  }

  /* 탭 여섯 개가 폰 너비 한 줄을 나눠 쓰므로 더 촘촘하게. */
  .app-tabs a {
    padding: 0 10px;
    font-size: 12px;
  }

  .app-shell {
    padding: calc(var(--bar-h) + var(--tabs-h) + 16px) 16px 24px;
  }
}
