:root {
  color-scheme: light;
  --bg: #eef2f6;
  --sheet: #ffffff;
  --sheet-alt: #f8fafc;
  --line: #cfd8e3;
  --line-strong: #a8b6c7;
  --text: #1a2733;
  --muted: #5e6c7b;
  --accent: #1f5f8b;
  --accent-soft: #e7f0f8;
  --success: #1d6b3f;
  --danger: #9d2f2f;
  --radius: 6px;
  --font: "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
}

body.page-portable,
body.page-portable input,
body.page-portable textarea,
body.page-portable select,
body.page-portable button {
  color-scheme: light;
}

body.page-transfer {
  background: #ffffff;
  color: #111111;
}

code,
.mono-block,
.payload-output {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.layout {
  width: min(920px, calc(100vw - 12px));
  margin: 0 auto;
  padding: 10px 0 24px;
}

.transfer-shell {
  min-height: 100vh;
  padding: 12px;
}

.transfer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.transfer-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.transfer-stage {
  display: grid;
  gap: 12px;
}

.transfer-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.transfer-chip {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #c7d0da;
  background: #f5f8fb;
  color: #243342;
  display: inline-flex;
  align-items: center;
  font-weight: 700;
}

.transfer-qr-box {
  min-height: calc(100vh - 120px);
  border: 2px solid #d7dee8;
  background: #ffffff;
  display: grid;
  place-items: center;
  padding: 24px;
}

.transfer-qr-box.is-ready {
  padding: 32px;
}

.transfer-empty {
  color: var(--muted);
  font-size: 18px;
  font-weight: 700;
}

.transfer-qr-svg {
  width: min(92vmin, calc(100vw - 64px), calc(100vh - 180px));
  line-height: 0;
}

.transfer-qr-svg svg {
  width: 100%;
  height: auto;
  display: block;
}

.hero {
  margin-bottom: 10px;
}

.hero-bar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px 6px;
  border-bottom: 2px solid var(--line-strong);
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

h2 {
  margin-bottom: 2px;
  font-size: 16px;
  font-weight: 700;
}

h3 {
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
}

p,
.panel-head p,
.field small,
.panel-status,
td,
th {
  color: var(--muted);
}

.hero-actions,
.button-row,
.tab-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.hint-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: var(--sheet);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.tab-bar {
  margin-bottom: 10px;
  padding: 0 2px;
}

.tab-button {
  min-width: 92px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  background: #f4f7fa;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.tab-button.is-active {
  background: var(--sheet);
  color: var(--accent);
  border-color: var(--accent);
}

.panel {
  margin-top: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--sheet);
}

.panel-form {
  background: var(--sheet);
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.panel-head p {
  margin-bottom: 0;
  font-size: 12px;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  font-weight: 700;
}

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

input[type="text"],
input[type="password"],
input[type="file"],
textarea,
select,
input[type="number"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  background: var(--sheet);
  color: var(--text);
  border-radius: 0;
}

input[type="file"] {
  padding: 6px;
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid rgba(31, 95, 139, 0.14);
  border-color: var(--accent);
}

.button {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: #f4f7fa;
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
}

.button-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.button-secondary {
  background: var(--sheet-alt);
}

.button:disabled {
  opacity: 0.6;
  cursor: default;
}

.panel-status {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 10px 14px;
  font-weight: 600;
  background: var(--sheet-alt);
}

.panel-status.success {
  color: var(--success);
}

.panel-status.error {
  color: var(--danger);
}

.install-banner {
  margin-top: 0;
}

.office-note {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--sheet-alt);
  flex-wrap: wrap;
}

.office-note span {
  font-weight: 700;
}

.camera-panel {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--sheet-alt);
}

.camera-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.camera-preview {
  width: 100%;
  min-height: 220px;
  border: 1px solid var(--line);
  background: #0f1720;
  object-fit: cover;
}

.camera-help {
  margin-bottom: 0;
  font-size: 12px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(116px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.summary-grid-tight {
  margin-bottom: 8px;
}

.summary-item {
  min-height: 70px;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--sheet-alt);
}

.summary-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.summary-value {
  display: block;
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
}

.qr-layout {
  display: grid;
  grid-template-columns: minmax(360px, 640px) minmax(260px, 1fr);
  gap: 12px;
  align-items: start;
}

.qr-card,
.info-box {
  border: 1px solid var(--line);
  background: var(--sheet-alt);
}

.qr-card {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 18px;
  min-height: 420px;
}

.qr-card img {
  width: 100%;
  max-width: 560px;
  height: auto;
  image-rendering: pixelated;
}

.qr-empty {
  color: var(--muted);
  font-size: 18px;
  font-weight: 700;
}

.result-notes {
  display: grid;
  gap: 10px;
}

.info-box {
  padding: 12px;
}

.compact-box p:last-child {
  margin-bottom: 0;
}

.payload-output {
  margin: 0;
  min-height: 120px;
  white-space: pre-wrap;
}

.table-panel {
  margin-top: 14px;
}

.date-strip {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.date-chip {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  background: #f4f7fa;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.date-chip.is-active {
  border-color: var(--accent);
  background: var(--sheet);
  color: var(--accent);
}

.sync-panel {
  margin-bottom: 14px;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--sheet-alt);
}

.sync-summary-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.sync-meta {
  color: var(--muted);
  font-size: 12px;
}

.sync-detail-list {
  display: grid;
  gap: 6px;
}

.sync-detail-row {
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: #ffffff;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.sync-kind {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin-right: 8px;
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  font-size: 11px;
  font-weight: 700;
}

.sync-kind.added {
  color: var(--success);
}

.sync-kind.removed {
  color: var(--danger);
}

.sync-kind.updated {
  color: var(--accent);
}

.progress-strip {
  margin-bottom: 14px;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--sheet-alt);
}

.progress-list {
  display: grid;
  gap: 10px;
}

.progress-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.progress-label,
.progress-text {
  font-size: 12px;
  font-weight: 700;
}

.progress-track {
  height: 12px;
  border: 1px solid var(--line);
  background: #ffffff;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
}

.subtab-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.subtab-button {
  min-width: 108px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  background: #f4f7fa;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.subtab-button.is-active {
  background: var(--sheet);
  border-color: var(--accent);
  color: var(--accent);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  background: var(--sheet);
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

th,
td {
  padding: 8px 10px;
  border-right: 1px solid #e3e9ef;
  border-bottom: 1px solid #dbe3ec;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th:last-child,
td:last-child {
  border-right: 0;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #edf3f8;
  color: var(--text);
  font-weight: 700;
}

tr.row-done td {
  background: #edf7f0;
}

.row-link {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.row-link:hover {
  text-decoration: underline;
}

.worklist-list {
  display: grid;
  gap: 8px;
}

.notice-panel {
  margin-bottom: 14px;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--sheet-alt);
}

.notice-panel .panel-head {
  margin-bottom: 10px;
}

.notice-output {
  min-height: 240px;
  background: #ffffff;
}

.sync-transfer-panel {
  margin-top: 10px;
  padding: 0;
}

.sync-transfer-summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 700;
}

.sync-transfer-summary::-webkit-details-marker {
  display: none;
}

.sync-transfer-body {
  padding: 0 14px 14px;
}

.worklist-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--sheet);
}

.worklist-card.is-done {
  background: #edf7f0;
  border-left: 4px solid #2f7d4c;
}

.worklist-card.has-pca {
  border-left: 4px solid #c96a19;
}

.worklist-card.has-spinal {
  border-left: 8px solid #0047ff;
  background: linear-gradient(90deg, #cfe0ff 0, #eaf2ff 22%, #ffffff 100%);
  box-shadow: inset 0 0 0 2px #0047ff;
}

.worklist-card.has-general:not(.has-spinal) {
  box-shadow: inset 0 0 0 1px #7b8794;
}

.worklist-top {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
}

.worklist-loc {
  font-weight: 700;
}

.worklist-name {
  font-size: 15px;
  font-weight: 700;
}

.worklist-sub {
  color: var(--muted);
  font-size: 12px;
}

.worklist-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.worklist-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.work-meta-cell {
  display: grid;
  gap: 4px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: var(--sheet-alt);
}

.work-meta-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.work-meta-value {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  word-break: break-word;
}

.worklist-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.worklist-open {
  border: 1px solid var(--line-strong);
  background: #f4f7fa;
  color: var(--accent);
  padding: 6px 10px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.done-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.sheet-list {
  display: grid;
  gap: 12px;
}

.patient-sheet {
  border: 1px solid var(--line);
  background: var(--sheet);
}

.patient-sheet.is-draft-done {
  border-left: 4px solid #2f7d4c;
}

.patient-sheet.is-consent-done {
  background: #f6fbf7;
}

.patient-sheet.has-pca {
  border-top: 3px solid #c96a19;
}

.patient-sheet.has-spinal {
  border-top: 8px solid #0047ff;
  background: #f8fbff;
  box-shadow: inset 0 0 0 2px #c6d8ff;
}

.patient-sheet.has-spinal .patient-summary {
  background: #d7e7ff;
  border-bottom-color: #91b3ff;
}

.patient-sheet.has-spinal .patient-summary-name,
.worklist-card.has-spinal .worklist-name,
.worklist-card.has-spinal .worklist-loc {
  color: #0037c7;
}

.patient-sheet.has-general:not(.has-spinal) {
  border-top: 3px solid #7b8794;
}

.patient-sheet summary {
  list-style: none;
}

.patient-sheet summary::-webkit-details-marker {
  display: none;
}

.patient-summary {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #edf3f8;
  cursor: pointer;
  line-height: 1.2;
}

.patient-summary-main {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}

.patient-summary-side {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.patient-summary-name {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.15;
}

.patient-summary-meta {
  color: var(--muted);
  font-size: 12px;
  white-space: normal;
  word-break: keep-all;
  line-height: 1.2;
}

.patient-summary-loc {
  font-weight: 700;
}

.patient-summary-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-start;
  grid-column: 1 / 3;
}

.summary-toggle {
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  background: #ffffff;
  color: var(--muted);
  font: inherit;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.summary-toggle.is-active {
  color: #ffffff;
}

.summary-toggle-draft.is-active {
  border-color: #1d6b3f;
  background: #1d6b3f;
}

.summary-toggle-first.is-active {
  border-color: #5c43c8;
  background: #5c43c8;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  background: #ffffff;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
}

.tag-pca {
  border-color: #d8a36b;
  background: #fff4e8;
  color: #9a4f0f;
}

.tag-spinal {
  min-height: 22px;
  padding: 0 8px;
  border: 2px solid #0037c7;
  background: #0047ff;
  color: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.tag-general {
  border-color: #bac5d1;
  background: #f3f6f9;
  color: #526170;
}

.tag-draft {
  border-color: #95c9a9;
  background: #edf7f0;
  color: #1d6b3f;
}

.tag-consent {
  border-color: #89c1ba;
  background: #e9f8f5;
  color: #16685d;
}

.tag-met {
  border-color: #d79f67;
  background: #fff1e2;
  color: #a24f10;
}

.tag-cancel {
  border-color: #d88d8d;
  background: #fff0f0;
  color: #b12c2c;
}

.patient-sheet-body {
  padding: 12px;
}

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

.action-card {
  display: grid;
  gap: 4px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  background: var(--sheet-alt);
}

.action-card-draft {
  border-color: #95c9a9;
  background: #edf7f0;
}

.action-card-consent {
  border-color: #89c1ba;
  background: #e9f8f5;
}

.action-card-met {
  border-color: #d7c28a;
  background: #fff9e8;
}

.action-card span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.action-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
}

.compact-check-row,
.tooth-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.tooth-grid {
  display: grid;
  gap: 8px;
}

.compact-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line);
  background: #ffffff;
  font-size: 12px;
  font-weight: 700;
}

.compact-check input {
  margin: 0;
}

.optional-section {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.optional-summary {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.transfer-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 10px 0 6px;
}

.transfer-note {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.35;
}

.transfer-options .compact-check {
  min-height: 44px;
  justify-content: space-between;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  background: #f9fbfd;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.transfer-options .compact-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.transfer-options .compact-check:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: #10324a;
}

.patient-brief {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.brief-cell {
  display: grid;
  gap: 4px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: var(--sheet-alt);
}

.brief-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.brief-value {
  color: var(--text);
  font-size: 13px;
  word-break: break-word;
}

.check-section {
  margin-top: 10px;
}

.check-section:first-of-type {
  margin-top: 0;
}

.check-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.check-section-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.check-section-spinal {
  padding: 10px;
  border: 2px solid #0047ff;
  background: #e7f0ff;
  box-shadow: inset 0 0 0 1px #bdd2ff;
}

.check-section-spinal .check-section-title,
.check-section-spinal .check-field > span {
  color: #0037c7;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.check-field {
  display: grid;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  background: var(--sheet-alt);
}

.check-field-wide {
  grid-column: 1 / -1;
}

.check-field span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.inline-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.note-input {
  min-height: 88px;
  resize: vertical;
}

.section-flag {
  color: var(--muted);
  font-size: 11px;
}

.section-flag-spinal {
  color: #0057b8;
  font-weight: 700;
}

.receiver-tools-panel,
.sync-transfer-panel {
  padding: 0;
}

.receiver-tools-summary,
.sync-transfer-summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 700;
}

.receiver-tools-summary::-webkit-details-marker,
.sync-transfer-summary::-webkit-details-marker {
  display: none;
}

.receiver-tools-body {
  padding: 0 14px 14px;
}

.receiver-status-panel {
  margin-top: 12px;
}

.progress-strip {
  position: sticky;
  top: 0;
  z-index: 8;
  gap: 8px;
  padding: 8px;
  margin-bottom: 10px;
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(6px);
}

.progress-list {
  display: grid;
  gap: 6px;
}

.hud-primary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.hud-date {
  font-size: 13px;
  font-weight: 700;
}

.hud-progress {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-progress strong {
  font-size: 12px;
}

.hud-progress-bar {
  width: 120px;
  height: 10px;
  border: 1px solid var(--line);
  background: #ffffff;
}

.hud-progress-fill {
  height: 100%;
  background: #228b45;
}

.hud-chips,
.progress-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.hud-chip {
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid var(--line);
  background: var(--sheet-alt);
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
}

.hud-chip-strong {
  border-color: #228b45;
  color: #228b45;
}

.hud-chip-away {
  border-color: #d48c1f;
  color: #a06712;
}

.hud-chip-cancel {
  border-color: #cf3f3f;
  color: #b52a2a;
}

.worklist-card,
.patient-sheet-body,
.work-meta-cell,
.check-field {
  gap: 4px;
}

.worklist-card {
  padding: 8px;
}

.worklist-grid {
  gap: 6px;
}

.work-meta-cell {
  padding: 6px 8px;
}

.patient-sheet.is-manual {
  border-right: 4px solid #8a5cf6;
}

.patient-sheet.is-consent-done {
  background: #eef9f1;
  border-left: 6px solid #228b45;
}

.patient-sheet.is-away {
  background: #fff8e8;
  border-left: 6px solid #d48c1f;
}

.patient-sheet.is-cancelled {
  background: #fff0f0;
  border-left: 6px solid #cf3f3f;
  opacity: 0.92;
}

.patient-sheet-body {
  padding: 8px;
}

.patient-brief-compact {
  gap: 6px;
  margin-bottom: 8px;
}

.patient-compact-line {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-start;
  padding: 6px 8px;
  border: 1px solid var(--line);
  background: var(--sheet-alt);
  font-size: 12px;
  line-height: 1.25;
}

.patient-compact-dim {
  color: var(--muted);
}

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

.compact-stack,
.manual-grid,
.overview-list,
.overview-section,
.overview-section-list {
  display: grid;
  gap: 6px;
}

.mini-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.record-field {
  display: grid;
  gap: 4px;
}

.record-field-wide {
  grid-column: 1 / -1;
}

.record-field span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.manual-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding-top: 8px;
}

.check-note {
  min-height: 28px;
  padding: 6px 8px;
  border: 1px dashed #92a9d8;
  background: #f8fbff;
  color: #365a9e;
  font-size: 11px;
  font-weight: 700;
}

.patient-footer-actions {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding-top: 8px;
  margin-top: 8px;
  background: linear-gradient(180deg, rgba(255,255,255,0) 0, rgba(255,255,255,0.92) 18px, #ffffff 18px);
}

.state-button {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  background: #f4f7fa;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.state-button.is-active {
  color: #ffffff;
}

.state-button.tone-done.is-active {
  border-color: #228b45;
  background: #228b45;
}

.state-button.tone-away.is-active {
  border-color: #d48c1f;
  background: #d48c1f;
}

.state-button.tone-cancel.is-active {
  border-color: #cf3f3f;
  background: #cf3f3f;
}

.state-button.tone-delete {
  min-height: 28px;
  padding: 0 10px;
  border-color: #d3b2b2;
  background: #faf4f4;
  color: #a34747;
}

.overview-section-head {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.overview-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.overview-toggle {
  background: #ffffff;
}

.overview-card {
  display: grid;
  gap: 5px;
  padding: 8px;
  border: 1px solid var(--line);
  background: var(--sheet);
}

.overview-card-head,
.overview-card-main,
.overview-card-metrics {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.overview-mark {
  min-width: 40px;
  padding: 1px 6px;
  border: 1px solid var(--line-strong);
  background: var(--sheet-alt);
  font-size: 11px;
  font-weight: 700;
}

.overview-card-main {
  font-size: 12px;
}

.overview-card-metrics {
  font-size: 11px;
  color: var(--muted);
}

.overview-metric {
  display: inline-flex;
  gap: 4px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  background: var(--sheet-alt);
}

.is-hidden {
  display: none !important;
}

@media (max-width: 960px) {
  .layout {
    width: min(100vw - 12px, 100%);
    padding-top: 10px;
  }

  .transfer-shell {
    padding: 8px;
  }

  .transfer-toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .transfer-qr-box {
    min-height: calc(100vh - 132px);
    padding: 16px;
  }

  .transfer-qr-svg {
    width: min(94vmin, calc(100vw - 32px), calc(100vh - 170px));
  }

  .hero-bar,
  .panel-head,
  .patient-summary {
    grid-template-columns: 64px minmax(0, 1fr) auto;
    display: grid;
  }

  .hero-actions {
    justify-content: start;
  }

  .qr-layout,
  .check-grid,
  .manual-grid,
  .worklist-top,
  .worklist-actions,
  .worklist-grid {
    grid-template-columns: 1fr;
  }

  .patient-footer-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .subtab-bar {
    position: sticky;
    top: 72px;
    z-index: 7;
    background: var(--bg);
    padding-bottom: 6px;
  }

  .hud-primary {
    align-items: start;
    flex-direction: column;
  }

  .hud-progress,
  .progress-actions {
    width: 100%;
  }

  .hud-progress-bar {
    flex: 1 1 auto;
    width: auto;
  }

  .patient-summary-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    grid-column: 1 / -1;
  }

  table {
    min-width: 760px;
  }
}

@media (min-width: 961px) {
  .layout {
    width: min(1180px, calc(100vw - 24px));
    padding-top: 16px;
  }

  .patient-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .patient-brief {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .manual-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .worklist-top {
    grid-template-columns: 84px minmax(0, 1fr) auto;
    align-items: center;
  }

  .worklist-actions {
    justify-content: flex-end;
  }

  .worklist-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .patient-summary {
    grid-template-columns: 84px minmax(0, 1fr) minmax(220px, auto);
  }

  .patient-summary-tags {
    grid-column: auto;
    justify-content: flex-end;
  }
}
