/* ==========================================================================
   301cell — Components
   ========================================================================== */

/* ---------- Card ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xs);
}
.card-head {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border-subtle);
}
.card-head h3 { font-size: var(--fs-md); font-weight: var(--fw-semibold); }
.card-head .sub { font-size: var(--fs-xs); color: var(--text-muted); }
.card-body { padding: var(--sp-5); }
.card-body.is-tight { padding: var(--sp-3) var(--sp-4); }
.card-body.is-flush { padding: 0; }
.card-foot {
  padding: var(--sp-3) var(--sp-5); border-top: 1px solid var(--border-subtle);
  background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg);
  font-size: var(--fs-xs); color: var(--text-muted);
}
.card.is-clickable { cursor: pointer; transition: box-shadow var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); }
.card.is-clickable:hover { box-shadow: var(--sh-md); border-color: var(--border-strong); }
.card.is-clickable:active { transform: translateY(1px); }

.section-title {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-xs); font-weight: var(--fw-semibold); letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--text-muted); margin-bottom: var(--sp-3);
}
.section-title::after { content: ""; flex: 1 1 auto; height: 1px; background: var(--border-subtle); }

/* ---------- MetricCard ---------- */
.metric {
  display: flex; flex-direction: column; gap: var(--sp-2);
  padding: var(--sp-4);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--sh-xs);
  position: relative; overflow: hidden;
}
.metric.is-clickable { cursor: pointer; }
.metric.is-clickable:hover { border-color: var(--border-strong); box-shadow: var(--sh-sm); }
.metric .m-label { font-size: var(--fs-xs); color: var(--text-muted); display: flex; align-items: center; gap: var(--sp-1); }
.metric .m-value { font-size: var(--fs-3xl); font-weight: var(--fw-semibold); line-height: 1.05; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.metric .m-unit  { font-size: var(--fs-md); font-weight: var(--fw-normal); color: var(--text-muted); margin-left: 2px; }
.metric .m-foot  { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-xs); color: var(--text-muted); }
.metric .m-delta { display: inline-flex; align-items: center; gap: 2px; font-weight: var(--fw-medium); }
.metric .m-delta.up   { color: var(--sig-ok); }
.metric .m-delta.down { color: var(--sig-danger); }
.metric .m-delta.flat { color: var(--text-faint); }
.metric .m-spark { height: 30px; margin: 0 calc(var(--sp-4) * -1) calc(var(--sp-4) * -1); }

.metric[data-alert]::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
}
.metric[data-alert="warning"]::before  { background: var(--sig-warn); }
.metric[data-alert="danger"]::before   { background: var(--sig-danger); }
.metric[data-alert="critical"]::before { background: var(--sig-critical); }
.metric[data-alert="ok"]::before       { background: var(--sig-ok); }
.metric[data-alert="danger"] .m-value,
.metric[data-alert="critical"] .m-value { color: var(--sig-danger); }

/* ---------- StatusBadge ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 21px; padding: 0 var(--sp-2);
  border: 1px solid var(--tone-neutral-bd);
  background: var(--tone-neutral-bg); color: var(--tone-neutral-fg);
  border-radius: var(--r-full);
  font-size: var(--fs-xs); font-weight: var(--fw-medium); white-space: nowrap;
  line-height: 1;
}
.badge .icon { flex: none; }
.badge[data-tone="info"]       { background: var(--tone-info-bg);       color: var(--tone-info-fg);       border-color: var(--tone-info-bd); }
.badge[data-tone="progress"]   { background: var(--tone-progress-bg);   color: var(--tone-progress-fg);   border-color: var(--tone-progress-bd); }
.badge[data-tone="attention"]  { background: var(--tone-attention-bg);  color: var(--tone-attention-fg);  border-color: var(--tone-attention-bd); }
.badge[data-tone="success"]    { background: var(--tone-success-bg);    color: var(--tone-success-fg);    border-color: var(--tone-success-bd); }
.badge[data-tone="warning"]    { background: var(--tone-warning-bg);    color: var(--tone-warning-fg);    border-color: var(--tone-warning-bd); }
.badge[data-tone="danger"]     { background: var(--tone-danger-bg);     color: var(--tone-danger-fg);     border-color: var(--tone-danger-bd); }
.badge[data-tone="disposed"]   { background: var(--tone-disposed-bg);   color: var(--tone-disposed-fg);   border-color: var(--tone-disposed-bd); }
/* 격리는 색상 외에 사선 패턴으로도 구분 (색각 이상 대응) */
.badge[data-tone="quarantine"] {
  color: var(--tone-quarantine-fg); border-color: var(--tone-quarantine-bd);
  background-color: var(--tone-quarantine-bg);
  background-image: repeating-linear-gradient(45deg,
    transparent 0 5px, color-mix(in srgb, var(--tone-quarantine-fg) 16%, transparent) 5px 7px);
}
.badge.is-lg { height: 26px; padding: 0 var(--sp-3); font-size: var(--fs-sm); }
.badge.is-square { border-radius: var(--r-sm); }

/* 카운트 pill */
.pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-full);
  background: var(--surface-3); color: var(--text-secondary);
  font-size: var(--fs-2xs); font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums;
}
.pill[data-tone="danger"] { background: var(--tone-danger-bg); color: var(--tone-danger-fg); }
.pill[data-tone="warning"]{ background: var(--tone-warning-bg); color: var(--tone-warning-fg); }
.pill[data-tone="primary"]{ background: var(--primary-soft); color: var(--primary-soft-fg); }

/* 신호 점 */
.dot-sig { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--sig-idle); }
.dot-sig[data-sig="ok"] { background: var(--sig-ok); }
.dot-sig[data-sig="warn"] { background: var(--sig-warn); }
.dot-sig[data-sig="danger"] { background: var(--sig-danger); }
.dot-sig[data-sig="live"] { background: var(--sig-ok); box-shadow: 0 0 0 0 color-mix(in srgb, var(--sig-ok) 60%, transparent); animation: pulse 2s infinite; }
@keyframes pulse {
  70%  { box-shadow: 0 0 0 6px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex; align-items: center; gap: var(--sp-1);
  border-bottom: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-3); margin-bottom: -1px;
  border: 0; border-bottom: 2px solid transparent; background: transparent;
  color: var(--text-muted); font-size: var(--fs-md); font-weight: var(--fw-medium);
  white-space: nowrap; cursor: pointer;
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); }
.tab .pill { font-size: 10px; min-width: 18px; height: 18px; }
.tabpanel { padding-top: var(--sp-5); }
.tabpanel[hidden] { display: none; }

/* 서브 탭 (pill 형태) */
.tabs-pill { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-3); border-radius: var(--r-md); border: 0; }
.tabs-pill .tab {
  padding: var(--sp-1) var(--sp-3); margin: 0; border: 0; border-radius: var(--r-sm);
  font-size: var(--fs-sm); height: 28px;
}
.tabs-pill .tab[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--sh-xs); }

/* ---------- DataTable ---------- */
.table-wrap {
  border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--surface); overflow: hidden;
}
.table-toolbar {
  display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap;
  padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border-subtle);
  background: var(--surface);
}
.table-toolbar .search-wrap { flex: 1 1 240px; max-width: 340px; }
.table-scroll { overflow-x: auto; }

table.dt { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-sm); }
table.dt th, table.dt td {
  padding: var(--sp-3) var(--sp-3); text-align: left; vertical-align: middle;
  border-bottom: 1px solid var(--border-subtle); white-space: nowrap;
}
table.dt thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-2); color: var(--text-muted);
  font-size: var(--fs-xs); font-weight: var(--fw-semibold);
  border-bottom: 1px solid var(--border);
  user-select: none;
}
table.dt thead th.is-sortable { cursor: pointer; }
table.dt thead th.is-sortable:hover { color: var(--text); background: var(--surface-3); }
table.dt thead th .sort { display: inline-flex; align-items: center; gap: 4px; }
table.dt thead th .sort .icon { opacity: 0.3; }
table.dt thead th[aria-sort]:not([aria-sort="none"]) { color: var(--text); }
table.dt thead th[aria-sort]:not([aria-sort="none"]) .sort .icon { opacity: 1; color: var(--primary); }

table.dt tbody tr { transition: background var(--dur-fast) var(--ease); }
table.dt tbody tr:hover { background: var(--surface-hover); }
table.dt tbody tr.is-selected { background: var(--primary-soft); }
table.dt tbody tr.is-clickable { cursor: pointer; }
table.dt tbody tr:last-child td { border-bottom: 0; }
table.dt td.num, table.dt th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.dt td.wrap { white-space: normal; min-width: 200px; }
table.dt .col-check { width: 40px; padding-right: 0; }
table.dt .col-actions { width: 1%; text-align: right; }
table.dt .cell-id { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-secondary); }
table.dt .cell-strong { font-weight: var(--fw-medium); color: var(--text); }

/* 밀도 */
table.dt.is-compact th, table.dt.is-compact td { padding: var(--sp-2) var(--sp-3); }
table.dt.is-comfortable th, table.dt.is-comfortable td { padding: var(--sp-4) var(--sp-3); }

.table-foot {
  display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
  padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--border-subtle);
  background: var(--surface-2); font-size: var(--fs-xs); color: var(--text-muted);
}
.pager { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.pager button {
  min-width: 28px; height: 28px; padding: 0 var(--sp-2);
  border: 1px solid transparent; background: transparent; border-radius: var(--r-sm);
  color: var(--text-secondary); font-size: var(--fs-xs); cursor: pointer;
}
.pager button:hover:not(:disabled) { background: var(--surface-hover); }
.pager button[aria-current="page"] { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); font-weight: var(--fw-semibold); }
.pager button:disabled { opacity: 0.35; cursor: not-allowed; }

/* 일괄 선택 바 */
.bulkbar {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-4);
  background: var(--primary-soft); color: var(--primary-soft-fg);
  border-bottom: 1px solid var(--tone-info-bd); font-size: var(--fs-sm);
}

/* ---------- Filter chips ---------- */
.filterbar { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  height: 28px; padding: 0 var(--sp-2) 0 var(--sp-3);
  border: 1px solid var(--border-strong); border-radius: var(--r-full);
  background: var(--surface); color: var(--text-secondary);
  font-size: var(--fs-xs); cursor: pointer; white-space: nowrap;
}
.chip:hover { border-color: var(--text-faint); background: var(--surface-hover); }
.chip.is-on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-soft-fg); font-weight: var(--fw-medium); }
.chip .k { color: var(--text-faint); }
.chip .x { display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; }
.chip .x:hover { background: color-mix(in srgb, currentColor 16%, transparent); }

/* ---------- 상태 / 빈 화면 ---------- */
.state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--sp-3); padding: var(--sp-12) var(--sp-5); text-align: center;
  color: var(--text-muted);
}
.state .state-icon {
  width: 48px; height: 48px; border-radius: var(--r-lg);
  display: grid; place-items: center;
  background: var(--surface-3); color: var(--text-faint);
}
.state .state-title { font-size: var(--fs-md); font-weight: var(--fw-semibold); color: var(--text); }
.state .state-desc { font-size: var(--fs-sm); max-width: 42ch; }
.state.is-error .state-icon { background: var(--tone-danger-bg); color: var(--tone-danger-fg); }
.state.is-compact { padding: var(--sp-8) var(--sp-4); }

/* Skeleton */
.sk {
  position: relative; overflow: hidden;
  background: var(--skeleton-base); border-radius: var(--r-sm);
}
.sk::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, var(--skeleton-shine), transparent);
  transform: translateX(-100%);
  animation: sk-shine 1.4s infinite;
}
@keyframes sk-shine { 100% { transform: translateX(100%); } }
.sk-line { height: 12px; margin-bottom: var(--sp-2); }
.sk-line:last-child { margin-bottom: 0; width: 60%; }
.sk-title { height: 20px; width: 40%; margin-bottom: var(--sp-3); }
.sk-block { height: 88px; }
.sk-circle { border-radius: 50%; }

/* ---------- Progress / Gauge ---------- */
.progress {
  height: 6px; border-radius: var(--r-full);
  background: var(--surface-3); overflow: hidden;
}
.progress > i {
  display: block; height: 100%; border-radius: inherit;
  background: var(--primary); transition: width var(--dur-slow) var(--ease);
}
.progress[data-tone="success"] > i { background: var(--sig-ok); }
.progress[data-tone="warning"] > i { background: var(--sig-warn); }
.progress[data-tone="danger"]  > i { background: var(--sig-danger); }
.progress.is-lg { height: 10px; }

.meter { display: flex; align-items: center; gap: var(--sp-2); }
.meter .progress { flex: 1 1 auto; }
.meter .val { font-size: var(--fs-xs); font-variant-numeric: tabular-nums; color: var(--text-secondary); min-width: 38px; text-align: right; }

/* ---------- Timeline ---------- */
.timeline { position: relative; padding-left: var(--sp-6); }
.timeline::before {
  content: ""; position: absolute; left: 7px; top: 4px; bottom: 4px;
  width: 2px; background: var(--border);
}
.tl-item { position: relative; padding-bottom: var(--sp-5); }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: calc(var(--sp-6) * -1 + 2px); top: 4px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--border-strong);
}
.tl-item[data-tone="success"]::before { border-color: var(--sig-ok); background: var(--sig-ok); }
.tl-item[data-tone="danger"]::before  { border-color: var(--sig-danger); background: var(--sig-danger); }
.tl-item[data-tone="warning"]::before { border-color: var(--sig-warn); background: var(--sig-warn); }
.tl-item[data-tone="primary"]::before { border-color: var(--primary); background: var(--primary); }
.tl-time { font-size: var(--fs-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.tl-title { font-size: var(--fs-md); font-weight: var(--fw-medium); margin-top: 2px; }
.tl-desc { font-size: var(--fs-sm); color: var(--text-secondary); margin-top: var(--sp-1); }
.tl-meta { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; margin-top: var(--sp-2); font-size: var(--fs-xs); color: var(--text-muted); }

/* ---------- LineageTree ---------- */
.lineage { font-size: var(--fs-sm); }
.lineage ul { list-style: none; margin: 0; padding-left: var(--sp-5); position: relative; }
.lineage > ul { padding-left: 0; }
.lineage ul ul::before {
  content: ""; position: absolute; left: 9px; top: 0; bottom: 12px; width: 1px; background: var(--border);
}
.lineage li { position: relative; padding: 2px 0; }
.lineage ul ul > li::before {
  content: ""; position: absolute; left: -11px; top: 15px; width: 10px; height: 1px; background: var(--border);
}
.ln-node {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-2); border-radius: var(--r-sm);
  border: 1px solid transparent; cursor: pointer;
}
.ln-node:hover { background: var(--surface-hover); border-color: var(--border); }
.ln-node.is-current { background: var(--primary-soft); border-color: var(--primary); font-weight: var(--fw-medium); }
.ln-kind {
  font-size: 10px; padding: 1px 5px; border-radius: var(--r-xs);
  background: var(--surface-3); color: var(--text-muted); flex: none; letter-spacing: 0.02em;
}
.ln-id { font-family: var(--font-mono); font-size: var(--fs-xs); }

/* ---------- WorkflowStepper ---------- */
.stepper { display: flex; align-items: stretch; gap: 0; overflow-x: auto; scrollbar-width: none; }
.stepper::-webkit-scrollbar { display: none; }
.step {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4) var(--sp-3) var(--sp-5);
  background: var(--surface); border: 1px solid var(--border); border-left: 0;
  color: var(--text-muted); font-size: var(--fs-sm); white-space: nowrap;
  position: relative; flex: none;
}
.step:first-child { border-left: 1px solid var(--border); border-radius: var(--r-md) 0 0 var(--r-md); padding-left: var(--sp-4); }
.step:last-child { border-radius: 0 var(--r-md) var(--r-md) 0; }
.step::after {
  content: ""; position: absolute; right: -9px; top: 50%; z-index: 1;
  width: 16px; height: 16px; margin-top: -8px;
  background: inherit; border-right: 1px solid var(--border); border-top: 1px solid var(--border);
  transform: rotate(45deg);
}
.step:last-child::after { display: none; }
.step .n {
  display: grid; place-items: center; flex: none;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--surface-3); color: var(--text-muted);
  font-size: var(--fs-2xs); font-weight: var(--fw-semibold);
}
.step.is-done { color: var(--text-secondary); }
.step.is-done .n { background: var(--tone-success-bg); color: var(--tone-success-fg); }
.step.is-current { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-soft-fg); font-weight: var(--fw-medium); }
.step.is-current::after { background: var(--primary-soft); border-color: var(--primary); }
.step.is-current .n { background: var(--primary); color: var(--primary-fg); }
.step.is-error .n { background: var(--tone-danger-bg); color: var(--tone-danger-fg); }
.step.is-clickable { cursor: pointer; }

/* 세로형 (모바일) */
@media (max-width: 860px) {
  .stepper.is-responsive { flex-direction: column; }
  .stepper.is-responsive .step { border-left: 1px solid var(--border); border-radius: 0; border-top: 0; }
  .stepper.is-responsive .step:first-child { border-top: 1px solid var(--border); border-radius: var(--r-md) var(--r-md) 0 0; }
  .stepper.is-responsive .step:last-child { border-radius: 0 0 var(--r-md) var(--r-md); }
  .stepper.is-responsive .step::after { display: none; }
}

/* ---------- Kanban (배양 작업보드) ---------- */
.board { display: flex; gap: var(--sp-3); align-items: flex-start; overflow-x: auto; padding-bottom: var(--sp-3); }
.board-col {
  flex: 0 0 288px; display: flex; flex-direction: column; min-height: 120px;
  background: var(--bg-sunken); border: 1px solid var(--border-subtle); border-radius: var(--r-lg);
}
.board-col-head {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3); border-bottom: 1px solid var(--border-subtle);
  font-size: var(--fs-sm); font-weight: var(--fw-semibold);
  position: sticky; top: 0; background: var(--bg-sunken); border-radius: var(--r-lg) var(--r-lg) 0 0; z-index: 1;
}
.board-col-head .bar { width: 3px; height: 14px; border-radius: var(--r-full); background: var(--text-faint); flex: none; }
.board-col-body { padding: var(--sp-2); display: flex; flex-direction: column; gap: var(--sp-2); overflow-y: auto; max-height: calc(100vh - 260px); }

/* ---------- Storage position map ---------- */
.posmap { display: grid; gap: 3px; }
.pos {
  aspect-ratio: 1; display: grid; place-items: center;
  border-radius: var(--r-xs); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-faint);
  font-size: 9px; font-family: var(--font-mono); cursor: pointer;
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.pos:hover { transform: scale(1.12); box-shadow: var(--sh-sm); z-index: 1; }
.pos[data-state="empty"]      { background: var(--surface-2); }
.pos[data-state="occupied"]   { background: var(--tone-progress-bg); border-color: var(--tone-progress-bd); color: var(--tone-progress-fg); }
.pos[data-state="reserved"]   { background: var(--tone-info-bg); border-color: var(--tone-info-bd); color: var(--tone-info-fg); }
.pos[data-state="quarantined"]{
  border-color: var(--tone-quarantine-bd); color: var(--tone-quarantine-fg);
  background-color: var(--tone-quarantine-bg);
  background-image: repeating-linear-gradient(45deg, transparent 0 3px,
    color-mix(in srgb, var(--tone-quarantine-fg) 26%, transparent) 3px 5px);
}
.pos[data-state="disabled"]   { background: var(--tone-disposed-bg); color: var(--tone-disposed-fg); cursor: not-allowed; opacity: 0.6; }
.pos.is-selected { outline: 2px solid var(--primary); outline-offset: 1px; }
.posmap-legend { display: flex; gap: var(--sp-3); flex-wrap: wrap; font-size: var(--fs-xs); color: var(--text-muted); }
.posmap-legend span { display: inline-flex; align-items: center; gap: var(--sp-1); }
.posmap-legend i { width: 12px; height: 12px; border-radius: var(--r-xs); border: 1px solid var(--border); }

/* ---------- Charts ---------- */
.chart { position: relative; width: 100%; }
.chart canvas { display: block; width: 100%; }
.chart-legend { display: flex; gap: var(--sp-3); flex-wrap: wrap; font-size: var(--fs-xs); color: var(--text-muted); margin-top: var(--sp-2); }
.chart-legend span { display: inline-flex; align-items: center; gap: var(--sp-1); cursor: pointer; }
.chart-legend i { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.chart-legend .is-off { opacity: 0.4; text-decoration: line-through; }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 5;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  box-shadow: var(--sh-md); padding: var(--sp-2) var(--sp-3); font-size: var(--fs-xs);
  white-space: nowrap; transform: translate(-50%, calc(-100% - 8px)); opacity: 0;
  transition: opacity var(--dur-fast) var(--ease);
}
.chart-tip.is-on { opacity: 1; }

/* ---------- 전자서명 / 승인 ---------- */
.sig-box {
  border: 1px dashed var(--border-strong); border-radius: var(--r-md);
  padding: var(--sp-4); background: var(--surface-2);
}
.sig-meaning { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.sig-meaning label {
  flex: 1 1 130px; display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3); border: 1px solid var(--border); border-radius: var(--r-md);
  cursor: pointer; background: var(--surface); font-size: var(--fs-sm);
}
.sig-meaning label:has(:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-soft-fg); }
.sig-stamp {
  display: inline-flex; flex-direction: column; gap: 2px;
  padding: var(--sp-2) var(--sp-3); border: 1.5px solid var(--primary);
  border-radius: var(--r-sm); color: var(--primary); background: var(--surface);
  font-size: var(--fs-xs); line-height: 1.3;
}
.sig-stamp .who { font-weight: var(--fw-semibold); font-size: var(--fs-sm); }

.approval-flow { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.approval-node {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3); border: 1px solid var(--border);
  border-radius: var(--r-md); background: var(--surface); font-size: var(--fs-sm);
}
.approval-node[data-state="done"]    { border-color: var(--tone-success-bd); background: var(--tone-success-bg); color: var(--tone-success-fg); }
.approval-node[data-state="current"] { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-soft-fg); }
.approval-node[data-state="reject"]  { border-color: var(--tone-danger-bd); background: var(--tone-danger-bg); color: var(--tone-danger-fg); }

/* ---------- 감사추적 ---------- */
.audit-row {
  display: grid; grid-template-columns: 128px 1fr; gap: var(--sp-3);
  padding: var(--sp-3) 0; border-bottom: 1px solid var(--border-subtle); font-size: var(--fs-sm);
}
.audit-row:last-child { border-bottom: 0; }
.audit-row .at { font-size: var(--fs-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.audit-diff { display: grid; grid-template-columns: 1fr auto 1fr; gap: var(--sp-2); align-items: center;
  margin-top: var(--sp-2); font-size: var(--fs-xs); }
.audit-diff .before { background: var(--tone-danger-bg); color: var(--tone-danger-fg); padding: 2px 6px; border-radius: var(--r-xs); }
.audit-diff .after  { background: var(--tone-success-bg); color: var(--tone-success-fg); padding: 2px 6px; border-radius: var(--r-xs); }
@media (max-width: 640px) { .audit-row { grid-template-columns: 1fr; } }

/* ---------- 파일 / 이미지 ---------- */
.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: var(--r-lg);
  padding: var(--sp-8) var(--sp-5); text-align: center; color: var(--text-muted);
  background: var(--surface-2); cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.dropzone:hover, .dropzone.is-over { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-soft-fg); }
.filelist { display: flex; flex-direction: column; gap: var(--sp-2); }
.fileitem {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3); border: 1px solid var(--border);
  border-radius: var(--r-md); background: var(--surface); font-size: var(--fs-sm);
}
.fileitem .thumb { width: 36px; height: 36px; border-radius: var(--r-sm); object-fit: cover; background: var(--surface-3); flex: none; }

.imggrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--sp-3); }
.imgcard { border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; background: var(--surface); cursor: pointer; }
.imgcard:hover { border-color: var(--primary); }
.imgcard .ph { aspect-ratio: 4/3; background: var(--surface-3); display: grid; place-items: center; color: var(--text-faint); }
.imgcard .cap { padding: var(--sp-2); font-size: var(--fs-xs); }

/* ---------- 알림 ---------- */
.notice {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md);
  border: 1px solid var(--tone-info-bd); background: var(--tone-info-bg); color: var(--tone-info-fg);
  font-size: var(--fs-sm);
}
.notice[data-tone="warning"] { border-color: var(--tone-warning-bd); background: var(--tone-warning-bg); color: var(--tone-warning-fg); }
.notice[data-tone="danger"]  { border-color: var(--tone-danger-bd);  background: var(--tone-danger-bg);  color: var(--tone-danger-fg); }
.notice[data-tone="success"] { border-color: var(--tone-success-bd); background: var(--tone-success-bg); color: var(--tone-success-fg); }
.notice .icon { flex: none; margin-top: 1px; }

.popover {
  position: absolute; z-index: var(--z-tooltip);
  min-width: 220px; max-width: 360px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--sh-lg); padding: var(--sp-2);
}
.menu-item {
  display: flex; align-items: center; gap: var(--sp-2); width: 100%;
  padding: var(--sp-2) var(--sp-3); border: 0; background: transparent;
  border-radius: var(--r-sm); color: var(--text); font-size: var(--fs-sm);
  text-align: left; cursor: pointer;
}
.menu-item:hover { background: var(--surface-hover); text-decoration: none; }
.menu-item[data-tone="danger"] { color: var(--sig-danger); }
.menu-sep { height: 1px; background: var(--border-subtle); margin: var(--sp-1) 0; }

/* ---------- 바코드 / 라벨 ---------- */
.barcode-box {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3); background: #fff; border: 1px solid var(--border); border-radius: var(--r-sm);
}
.barcode-box canvas, .barcode-box svg { background: #fff; }
.barcode-box .code { font-family: var(--font-mono); font-size: var(--fs-xs); color: #000; letter-spacing: 0.08em; }

.label-preview {
  width: 240px; padding: var(--sp-3); background: #fff; color: #000;
  border: 1px solid #999; border-radius: 2px; font-size: 11px; line-height: 1.35;
}
.label-preview .l-title { font-weight: 700; font-size: 12px; }
.label-preview .l-row { display: flex; gap: 6px; }
.label-preview .l-k { color: #555; min-width: 42px; }

/* ---------- 캘린더 ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--border-subtle);
  border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.cal-h { background: var(--surface-2); padding: var(--sp-2); text-align: center; font-size: var(--fs-xs); color: var(--text-muted); font-weight: var(--fw-semibold); }
.cal-d { background: var(--surface); min-height: 92px; padding: var(--sp-2); font-size: var(--fs-xs); }
.cal-d.is-out { background: var(--surface-2); color: var(--text-faint); }
.cal-d.is-today .d-n { background: var(--primary); color: var(--primary-fg); border-radius: var(--r-full); padding: 0 5px; }
.cal-d .d-n { font-weight: var(--fw-semibold); display: inline-block; margin-bottom: var(--sp-1); }
.cal-ev {
  display: block; padding: 1px 4px; border-radius: var(--r-xs); margin-bottom: 2px;
  background: var(--primary-soft); color: var(--primary-soft-fg);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; font-size: 10px;
}
.cal-ev[data-tone="warning"] { background: var(--tone-warning-bg); color: var(--tone-warning-fg); }
.cal-ev[data-tone="danger"]  { background: var(--tone-danger-bg); color: var(--tone-danger-fg); }
.cal-ev[data-tone="success"] { background: var(--tone-success-bg); color: var(--tone-success-fg); }

/* ---------- 기타 ---------- */
.kv-strip { display: flex; gap: var(--sp-5); flex-wrap: wrap; }
.kv-strip > div { min-width: 0; }
.kv-strip .k { font-size: var(--fs-xs); color: var(--text-muted); }
.kv-strip .v { font-size: var(--fs-md); font-weight: var(--fw-medium); }

.divider-v { width: 1px; align-self: stretch; background: var(--border); margin-inline: var(--sp-1); }

.avatar-stack { display: flex; }
.avatar-stack .avatar { margin-left: -8px; border: 2px solid var(--surface); }
.avatar-stack .avatar:first-child { margin-left: 0; }

.tag {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 var(--sp-2);
  border-radius: var(--r-xs); background: var(--surface-3); color: var(--text-secondary); font-size: var(--fs-2xs);
}

/* 준비중 화면 안내 */
.stub {
  display: grid; place-items: center; min-height: 50vh; text-align: center; gap: var(--sp-4);
}
.stub .mark-img { width: 64px; opacity: 0.35; }
