/* ClaimsCheck — examiner-friendly UI */
:root,
[data-theme="light"] {
  --bg: #f4f6f9;
  --bg-elev: #ffffff;
  --bg-muted: #eef1f6;
  --border: #d8dee8;
  --border-strong: #b8c2d1;
  --text: #1a2332;
  --text-secondary: #5a6577;
  --text-muted: #7a8699;
  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --primary-soft: #dbeafe;
  --success: #047857;
  --success-soft: #d1fae5;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --info: #0369a1;
  --info-soft: #e0f2fe;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 8px 24px rgba(16, 24, 40, 0.06);
  --radius: 12px;
  --radius-sm: 8px;
  --font: "IBM Plex Sans KR", "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "Consolas", monospace;
  --header-h: 64px;
  --claim-app: #1d4ed8;
  --claim-prior: #7c3aed;
  --kind-claim: #0f766e;
  --kind-element: #1d4ed8;
  --kind-limitation: #b45309;
  --edge: #94a3b8;
  --map-edge: #db2777;
}

[data-theme="dark"] {
  --bg: #0f141c;
  --bg-elev: #171e29;
  --bg-muted: #1e2736;
  --border: #2a3548;
  --border-strong: #3d4d66;
  --text: #e8edf5;
  --text-secondary: #a8b3c5;
  --text-muted: #7d8aa0;
  --primary: #60a5fa;
  --primary-hover: #93c5fd;
  --primary-soft: #1e3a5f;
  --success: #34d399;
  --success-soft: #064e3b;
  --warn: #fbbf24;
  --warn-soft: #78350f;
  --danger: #f87171;
  --danger-soft: #7f1d1d;
  --info: #38bdf8;
  --info-soft: #0c4a6e;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 12px 32px rgba(0, 0, 0, 0.35);
  --claim-app: #60a5fa;
  --claim-prior: #c4b5fd;
  --kind-claim: #2dd4bf;
  --kind-element: #60a5fa;
  --kind-limitation: #fbbf24;
  --edge: #475569;
  --map-edge: #f472b6;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Critical: flex containers must not override [hidden] */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

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

/* ---- Header ---- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
  background: color-mix(in srgb, var(--bg-elev) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

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

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff;
  font-size: 16px;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-text strong {
  font-size: 15px;
  letter-spacing: -0.02em;
}

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

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

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.status-pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
}

.status-pill[data-state="ok"] {
  background: var(--success-soft);
  border-color: color-mix(in srgb, var(--success) 35%, var(--border));
  color: var(--success);
}
.status-pill[data-state="ok"] .dot {
  background: var(--success);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 25%, transparent);
}

.status-pill[data-state="warn"] {
  background: var(--warn-soft);
  border-color: color-mix(in srgb, var(--warn) 35%, var(--border));
  color: var(--warn);
}
.status-pill[data-state="warn"] .dot {
  background: var(--warn);
}

.status-pill[data-state="err"] {
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 35%, var(--border));
  color: var(--danger);
}
.status-pill[data-state="err"] .dot {
  background: var(--danger);
}

.account-bar {
  display: flex;
  align-items: center;
}

.account-guest,
.account-user {
  display: flex;
  align-items: center;
  gap: 6px;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  cursor: pointer;
  display: grid;
  place-items: center;
  position: relative;
}

.theme-toggle:hover {
  border-color: var(--border-strong);
}

[data-theme="light"] .theme-icon-dark {
  display: none;
}
[data-theme="dark"] .theme-icon-light {
  display: none;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-secondary);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg-muted);
  color: var(--text);
}

.btn-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---- Main layout ---- */
.app-main {
  flex: 1;
  width: min(1400px, 100%);
  margin: 0 auto;
  padding: 20px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.panel-head h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.panel-head .sub {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}

@media (max-width: 980px) {
  .top-grid {
    grid-template-columns: 1fr;
  }
}

.claims-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 720px) {
  .claims-inputs {
    grid-template-columns: 1fr;
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.field-label em {
  font-style: normal;
  color: var(--danger);
  margin-left: 4px;
  font-size: 11px;
}

.field-label em.opt {
  color: var(--text-muted);
}

textarea,
input[type="text"],
input[type="password"] {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  padding: 10px 12px;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

textarea:focus,
input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}

textarea {
  min-height: 180px;
  font-size: 13px;
  line-height: 1.55;
}

/* ---- Log ---- */
.log-stream {
  height: min(420px, 55vh);
  overflow: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.55;
}

.log-line {
  display: grid;
  grid-template-columns: 64px 72px 1fr;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 4px;
}

.log-line:hover {
  background: var(--bg-muted);
}

.log-time {
  color: var(--text-muted);
}

.log-stage {
  color: var(--info);
  font-weight: 500;
}

.log-msg {
  color: var(--text);
  word-break: break-word;
}

.log-line.level-success .log-msg {
  color: var(--success);
}
.log-line.level-warn .log-msg {
  color: var(--warn);
}
.log-line.level-error .log-msg {
  color: var(--danger);
}

.log-empty {
  color: var(--text-muted);
  padding: 20px 8px;
  text-align: center;
  font-family: var(--font);
  font-size: 13px;
}

/* ---- Stages ---- */
.stage-cards {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}

@media (max-width: 1100px) {
  .stage-cards {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 560px) {
  .stage-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

.stage-card {
  text-align: left;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.15s, transform 0.1s, box-shadow 0.15s;
}

.stage-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.stage-card:active {
  transform: scale(0.98);
}

.stage-idx {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

.stage-title {
  font-size: 13px;
  font-weight: 600;
}

.stage-status {
  font-size: 11px;
  color: var(--text-muted);
}

.stage-card[data-status="running"] {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.stage-card[data-status="running"] .stage-status {
  color: var(--primary);
}

.stage-card[data-status="done"] {
  border-color: color-mix(in srgb, var(--success) 45%, var(--border));
}
.stage-card[data-status="done"] .stage-status {
  color: var(--success);
}

.stage-card[data-status="skipped"] {
  opacity: 0.7;
}
.stage-card[data-status="error"] {
  border-color: var(--danger);
  background: var(--danger-soft);
}
.stage-card[data-status="error"] .stage-status {
  color: var(--danger);
}

.stage-card.active {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.stage-detail {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  overflow: hidden;
}

.stage-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-muted);
}

.stage-detail-head h3 {
  margin: 0;
  font-size: 13px;
}

.stage-detail-body {
  margin: 0;
  padding: 14px 16px 18px;
  max-height: min(520px, 60vh);
  overflow: auto;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
}

.sd-summary {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  border: 1px solid color-mix(in srgb, var(--primary) 25%, var(--border));
  color: var(--text);
  font-weight: 500;
}

.sd-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.sd-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  padding: 10px 12px;
}

.sd-card h4 {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: -0.01em;
}

.sd-card ul {
  margin: 0;
  padding-left: 18px;
}

.sd-card li {
  margin-bottom: 4px;
  font-size: 12.5px;
}

.sd-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.sd-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-secondary);
}

.sd-chip strong {
  color: var(--text);
  font-weight: 700;
}

.sd-empty {
  color: var(--text-muted);
  padding: 12px 4px;
  margin: 0;
}

.sd-graph-box {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--border) 70%, transparent) 1px, transparent 0)
      0 0 / 16px 16px,
    var(--bg);
  min-height: 280px;
  margin-top: 8px;
  overflow: hidden;
  position: relative;
}

.sd-graph-box svg {
  width: 100%;
  height: 280px;
  display: block;
}

.sd-section-title {
  margin: 14px 0 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

.sd-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.sd-flow-step {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
}

.sd-flow-step .n {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 11px;
}

.sd-flow-arrow {
  color: var(--text-muted);
  font-size: 14px;
}

.btn-danger {
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 40%, var(--border));
  color: var(--danger);
}

.btn-danger:hover:not(:disabled) {
  background: color-mix(in srgb, var(--danger) 18%, var(--bg-elev));
}

.btn-warn {
  background: var(--warn-soft);
  border-color: color-mix(in srgb, var(--warn) 40%, var(--border));
  color: var(--warn);
}

.btn-warn:hover:not(:disabled) {
  background: color-mix(in srgb, var(--warn) 18%, var(--bg-elev));
}

.btn-ok {
  background: var(--success-soft);
  border-color: color-mix(in srgb, var(--success) 40%, var(--border));
  color: var(--success);
}

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.status-badge.pending { background: var(--warn-soft); color: var(--warn); }
.status-badge.active { background: var(--success-soft); color: var(--success); }
.status-badge.disabled { background: var(--danger-soft); color: var(--danger); }

.graph-svg {
  background: transparent;
}

/* ---- Graph ---- */
.graph-shell {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-elev);
}

.graph-shell[hidden],
.graph-wrap-placeholder[hidden] {
  display: none !important;
}

.graph-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-muted);
}

.graph-toolbar-left,
.graph-toolbar-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.zoom-readout {
  min-width: 52px;
  text-align: center;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  padding: 4px 6px;
  border-radius: 6px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  user-select: none;
}

.graph-hint {
  font-size: 11px;
  color: var(--text-muted);
  max-width: 360px;
}

.graph-wrap {
  position: relative;
  min-height: 440px;
  background:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--border) 80%, transparent) 1px, transparent 0) 0 0 / 18px 18px,
    var(--bg);
  overflow: hidden;
}

.graph-wrap-placeholder {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 280px;
}

.graph-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-muted);
  padding: 24px;
  gap: 8px;
}

.graph-empty p {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
}

.empty-icon {
  font-size: 36px;
  opacity: 0.5;
}

.graph-svg {
  width: 100%;
  height: 520px;
  display: block;
  cursor: grab;
  touch-action: none;
}

.graph-svg:active {
  cursor: grabbing;
}

.graph-svg-fs {
  height: 100%;
  min-height: 60vh;
}

.graph-selection {
  position: absolute;
  left: 10px;
  bottom: 10px;
  max-width: min(420px, 90%);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--bg-elev) 92%, transparent);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 12px;
  line-height: 1.45;
  pointer-events: none;
}

.graph-selection strong {
  color: var(--primary);
}

.graph-selection .gs-meta {
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 2px;
}

.graph-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-elev);
  font-size: 11px;
  color: var(--text-secondary);
}

.graph-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-tip {
  margin-left: auto;
  color: var(--text-muted);
  font-style: italic;
}

/* Fullscreen graph overlay */
.graph-fs {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(8, 12, 20, 0.55);
  display: flex;
  padding: 16px;
  box-sizing: border-box;
}

.graph-fs-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.graph-fs-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-muted);
}

.graph-fs-head h3 {
  margin: 0;
  font-size: 16px;
}

.graph-fs-head .sub {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.graph-toolbar-fs {
  border: none;
  background: transparent;
  padding: 0;
}

.graph-fs-body {
  position: relative;
  flex: 1;
  min-height: 0;
  background:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--border) 80%, transparent) 1px, transparent 0) 0 0 / 18px 18px,
    var(--bg);
  overflow: hidden;
}

.graph-selection-fs {
  bottom: 16px;
  left: 16px;
}

.lg {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}
.lg.claim {
  background: var(--kind-claim);
}
.lg.element {
  background: var(--kind-element);
}
.lg.limitation {
  background: var(--kind-limitation);
}
.lg.app {
  background: var(--claim-app);
  border-radius: 50%;
}
.lg.prior {
  background: var(--claim-prior);
  border-radius: 50%;
}
.lg.map {
  background: var(--map-edge);
  height: 3px;
  width: 16px;
  border-radius: 2px;
}

.graph-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.tab {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}

.tab.active {
  background: var(--primary-soft);
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
  color: var(--primary);
}

/* SVG node styles applied via attributes/classes in JS */
.g-node rect,
.g-node circle {
  stroke-width: 1.5;
}
.g-node text {
  font-family: var(--font);
  font-size: 11px;
  fill: var(--text);
  pointer-events: none;
}
.g-edge {
  fill: none;
  stroke: var(--edge);
  stroke-width: 1.4;
}
.g-edge.map {
  stroke: var(--map-edge);
  stroke-dasharray: 5 3;
  stroke-width: 1.8;
}
.g-edge.depends_on {
  stroke: var(--kind-claim);
}
.g-edge-label {
  font-size: 9px;
  fill: var(--text-muted);
  font-family: var(--font);
}

/* ---- Results ---- */
.result-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 14px;
}

@media (max-width: 800px) {
  .result-grid {
    grid-template-columns: 1fr;
  }
}

.result-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  padding: 12px 14px;
  min-height: 120px;
}

.result-card h3 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.result-body {
  font-size: 13px;
  line-height: 1.55;
}

.result-body.muted {
  color: var(--text-muted);
}

.result-body ul {
  margin: 0;
  padding-left: 18px;
}

.result-body li {
  margin-bottom: 4px;
}

.claim-block {
  border-left: 3px solid var(--primary);
  padding: 8px 10px;
  margin-bottom: 10px;
  background: var(--bg-elev);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.claim-block .cn {
  font-weight: 700;
  font-size: 12px;
  color: var(--primary);
}

.claim-block .ctype {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 6px;
}

.claim-block .ctext {
  margin-top: 4px;
  font-size: 12px;
  white-space: pre-wrap;
}

.elem-list {
  margin: 6px 0 0;
  padding-left: 16px;
  font-size: 12px;
  color: var(--text-secondary);
}

.tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--bg-muted);
  color: var(--text-muted);
  margin-right: 4px;
}

.tag.same { background: var(--success-soft); color: var(--success); }
.tag.similar { background: var(--info-soft); color: var(--info); }
.tag.different { background: var(--warn-soft); color: var(--warn); }
.tag.missing_in_prior,
.tag.missing_in_application { background: var(--danger-soft); color: var(--danger); }

/* ---- Footer ---- */
.app-footer {
  text-align: center;
  padding: 16px;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

.app-footer .sep {
  margin: 0 6px;
}

/* ---- Modals ---- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(10, 15, 25, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal {
  width: min(420px, 100%);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-wide {
  width: min(720px, 100%);
}

.modal h3 {
  margin: 0;
  font-size: 16px;
}

.modal-hint {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.form-error {
  margin: 0;
  font-size: 12px;
  color: var(--danger);
  background: var(--danger-soft);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
}

.admin-table-wrap {
  overflow: auto;
  max-height: 50vh;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

.admin-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--bg-muted);
  position: sticky;
  top: 0;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  background: var(--text);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow);
  max-width: min(90vw, 480px);
  text-align: center;
}
