/* ==========================================================================
   Components — every reusable UI element. Pages compose these; they do not
   restyle them.
   ========================================================================== */

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--surface); --btn-fg: var(--ink); --btn-border: var(--border-strong); --btn-bg-hover: var(--surface-sunken);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--control-height); padding: 0 var(--space-5);
  border: var(--border-width) solid var(--btn-border); border-radius: var(--radius-md);
  background: var(--btn-bg); color: var(--btn-fg);
  font-size: var(--text-sm); font-weight: var(--weight-semibold); line-height: 1; text-decoration: none; white-space: nowrap;
  transition: background var(--duration-fast) var(--ease), border-color var(--duration-fast) var(--ease), color var(--duration-fast) var(--ease), box-shadow var(--duration-fast) var(--ease);
  user-select: none;
}
.btn:hover { background: var(--btn-bg-hover); color: var(--btn-fg); }
.btn:active { transform: translateY(1px); }
.btn .icon { width: 18px; height: 18px; }
.btn--primary { --btn-bg: var(--primary); --btn-fg: var(--on-primary); --btn-border: var(--primary); --btn-bg-hover: var(--primary-hover); box-shadow: var(--shadow-xs); }
.btn--dark { --btn-bg: var(--navy-900); --btn-fg: #fff; --btn-border: var(--navy-900); --btn-bg-hover: var(--navy-800); }
.btn--sun { --btn-bg: var(--sun-400); --btn-fg: var(--navy-950); --btn-border: var(--sun-400); --btn-bg-hover: #ffca2e; }
.btn--ghost { --btn-bg: transparent; --btn-border: transparent; --btn-bg-hover: var(--surface-sunken); }
.btn--on-dark { --btn-bg: rgba(255,255,255,0.08); --btn-fg: #fff; --btn-border: rgba(255,255,255,0.28); --btn-bg-hover: rgba(255,255,255,0.16); }
.btn--danger { --btn-bg: var(--danger); --btn-fg: #fff; --btn-border: var(--danger); --btn-bg-hover: var(--danger-hover); }
.btn--danger-soft { --btn-bg: var(--surface); --btn-fg: var(--danger); --btn-border: #f3c4bf; --btn-bg-hover: var(--danger-soft); }
.btn--sm { min-height: var(--control-height-sm); padding: 0 var(--space-3); font-size: var(--text-sm); border-radius: var(--radius-sm); }
.btn--block { width: 100%; }
.btn--icon { padding: 0; width: var(--control-height); }
.btn--icon.btn--sm { width: var(--control-height-sm); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--btn-fg); border-right-color: transparent; animation: spin 0.7s linear infinite;
}
.btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.btn-row--end { justify-content: flex-end; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Form fields ---------- */
.field { align-content: start; display: grid; gap: var(--space-2); min-width: 0; }
.field__label { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--ink); }
.field__optional { font-weight: var(--weight-regular); color: var(--text-muted); }
.field__hint { font-size: var(--text-xs); color: var(--text-muted); line-height: var(--leading-snug); }
.input, .select, .textarea {
  width: 100%; min-height: var(--control-height); padding: 0 var(--space-3);
  border: var(--border-width) solid var(--border-strong); border-radius: var(--radius-md);
  background: var(--surface); color: var(--ink); font-size: var(--text-base);
  transition: border-color var(--duration-fast) var(--ease), box-shadow var(--duration-fast) var(--ease);
}
.textarea { padding: var(--space-3); min-height: 96px; resize: vertical; line-height: var(--leading-snug); }
.select {
  appearance: none; padding-right: var(--space-10);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234f5d73' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 18px;
}
.input::placeholder, .textarea::placeholder { color: var(--text-subtle); }
.input:hover, .select:hover, .textarea:hover { border-color: #94a3b8; }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29, 95, 209, 0.28); border-radius: var(--radius-md); }
.input[readonly] { background: var(--surface-sunken); }
.input--mono { font-family: var(--font-mono); font-size: var(--text-sm); }
.input-group { position: relative; display: flex; }
.input-group .input { padding-right: calc(var(--control-height) + var(--space-1)); }
.input-group__action { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.input-group__action:active { transform: translateY(calc(-50% + 1px)); }
.input-icon { position: relative; }
.input-icon > .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.input-icon > .input { padding-left: 40px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4) var(--space-5); }
.form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .span-full { grid-column: 1 / -1; }
.form-stack { display: grid; gap: var(--space-5); }
.form-section { display: grid; gap: var(--space-4); padding-block: var(--space-6); border-top: var(--border-width) solid var(--border); }
.form-section:first-of-type { border-top: 0; padding-top: 0; }
.form-section__title { display: flex; align-items: center; gap: var(--space-3); font-size: var(--text-base); font-weight: var(--weight-bold); color: var(--ink); }
.form-section__desc { font-size: var(--text-sm); color: var(--text-muted); margin-top: calc(var(--space-2) * -1); }

/* Checkbox + switch */
.check { display: flex; align-items: flex-start; gap: var(--space-3); cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--primary); flex: none; cursor: pointer; }
.check__text { display: grid; gap: 2px; }
.check__title { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--ink); }
.check__desc { font-size: var(--text-xs); color: var(--text-muted); line-height: var(--leading-snug); }
.check--disabled { cursor: default; }
.switch { position: relative; display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); padding: var(--space-4); border: var(--border-width) solid var(--border); border-radius: var(--radius-md); background: var(--surface); cursor: pointer; }
.switch:hover { border-color: var(--border-strong); }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__track { position: relative; flex: none; width: 44px; height: 26px; border-radius: var(--radius-pill); background: var(--border-strong); transition: background var(--duration) var(--ease); margin-top: 1px; }
.switch__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform var(--duration) var(--ease); }
.switch input:checked ~ .switch__track { background: var(--primary); }
.switch input:checked ~ .switch__track::after { transform: translateX(18px); }
.switch input:focus-visible ~ .switch__track { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.switch__state { font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--text-muted); }
.switch input:checked ~ .switch__body .switch__state--off, .switch input:not(:checked) ~ .switch__body .switch__state--on { display: none; }
.switch-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }

/* Password visibility */
.reveal-btn { color: var(--text-muted); }
.field__error { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--danger); font-weight: var(--weight-medium); }
.field__error .icon { width: 16px; height: 16px; }

/* ---------- Cards & surfaces ---------- */
.card { background: var(--surface); border: var(--border-width) solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); }
.card__body { padding: var(--space-6); }
.card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); padding: var(--space-5) var(--space-6); border-bottom: var(--border-width) solid var(--border); }
.card__title { font-size: var(--text-lg); }
.card__desc { margin-top: var(--space-1); font-size: var(--text-sm); color: var(--text-muted); }
.card__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; padding: var(--space-4) var(--space-6); border-top: var(--border-width) solid var(--border); background: var(--canvas); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.card--flush .card__body { padding: 0; }
.surface-muted { background: var(--canvas); border: var(--border-width) solid var(--border); border-radius: var(--radius-md); padding: var(--space-4); }

/* ---------- Badges & chips ---------- */
.badge {
  --badge-bg: var(--surface-sunken); --badge-fg: var(--text);
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--radius-pill);
  background: var(--badge-bg); color: var(--badge-fg); font-size: var(--text-xs); font-weight: var(--weight-semibold); line-height: 1.4; white-space: nowrap;
}
.badge .icon { width: 14px; height: 14px; }
.badge--success { --badge-bg: var(--success-soft); --badge-fg: var(--success); }
.badge--danger { --badge-bg: var(--danger-soft); --badge-fg: var(--danger); }
.badge--warning { --badge-bg: var(--warning-soft); --badge-fg: var(--warning); }
.badge--info { --badge-bg: var(--info-soft); --badge-fg: var(--blue-700); }
.badge--neutral { --badge-bg: var(--surface-sunken); --badge-fg: var(--text-muted); }
.chip-list { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: var(--border-width) solid var(--border); border-radius: var(--radius-pill); background: var(--surface); font-size: var(--text-xs); color: var(--text); }
.chip .icon { width: 14px; height: 14px; color: var(--text-muted); }

/* ---------- Alerts (inline, persistent messages) ---------- */
.alert { --alert-bg: var(--info-soft); --alert-fg: var(--blue-700); --alert-border: var(--blue-100);
  display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-4); border-radius: var(--radius-md);
  background: var(--alert-bg); border: var(--border-width) solid var(--alert-border); color: var(--text); font-size: var(--text-sm); }
.alert > .icon { color: var(--alert-fg); margin-top: 1px; }
.alert__title { display: block; font-weight: var(--weight-semibold); color: var(--ink); }
.alert__body { display: grid; gap: var(--space-2); min-width: 0; }
.alert--success { --alert-bg: var(--success-soft); --alert-fg: var(--success); --alert-border: #bfe6d4; }
.alert--danger { --alert-bg: var(--danger-soft); --alert-fg: var(--danger); --alert-border: #f5c6c0; }
.alert--warning { --alert-bg: var(--warning-soft); --alert-fg: var(--warning); --alert-border: #f6dc9b; }

/* ---------- Tabs (segmented style) ---------- */
.tabs { display: inline-flex; gap: var(--space-1); padding: var(--space-1); background: var(--surface-sunken); border-radius: var(--radius-md); max-width: 100%; overflow-x: auto; }
.tab { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 38px; padding: 0 var(--space-4); border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-muted); font-size: var(--text-sm); font-weight: var(--weight-semibold); white-space: nowrap; }
.tab .icon { width: 18px; height: 18px; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.tabs--full { display: flex; width: 100%; }
.tabs--full .tab { flex: 1; justify-content: center; }

/* ---------- Tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; }
.table { font-size: var(--text-sm); }
.table th { text-align: left; padding: var(--space-3) var(--space-4); font-size: var(--text-xs); font-weight: var(--weight-semibold); text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); background: var(--canvas); border-bottom: var(--border-width) solid var(--border); white-space: nowrap; }
.table td { padding: var(--space-4); border-bottom: var(--border-width) solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafbfd; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; }
.table__primary { font-weight: var(--weight-semibold); color: var(--ink); overflow-wrap: anywhere; }
.table__secondary { color: var(--text-muted); font-size: var(--text-xs); }

/* Responsive table → stacked cards */
@media (max-width: 900px) {
  .table--stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table--stack, .table--stack tbody, .table--stack tr, .table--stack td { display: block; width: 100%; }
  .table--stack tr { padding: var(--space-4); border-bottom: var(--border-width) solid var(--border); }
  .table--stack tbody tr:last-child { border-bottom: 0; }
  .table--stack td { padding: var(--space-2) 0; border: 0; text-align: left !important; }
  .table--stack td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 4px; font-size: var(--text-xs); font-weight: var(--weight-semibold); text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
  .table--stack tbody tr:hover td { background: transparent; }
  .table--stack .actions .btn-row { justify-content: flex-start; }
}

/* ---------- Stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--space-4); }
.stat { display: grid; gap: var(--space-1); padding: var(--space-5); background: var(--surface); border: var(--border-width) solid var(--border); border-radius: var(--radius-lg); }
.stat__label { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--text-muted); font-weight: var(--weight-medium); }
.stat__label .icon { width: 18px; height: 18px; color: var(--primary); }
.stat__value { font-size: var(--text-2xl); font-weight: var(--weight-bold); color: var(--ink); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat__meta { font-size: var(--text-xs); color: var(--text-muted); }

/* ---------- Key/value list ---------- */
.kv { display: grid; gap: 0; }
.kv__row { display: flex; justify-content: space-between; gap: var(--space-4); padding: var(--space-3) 0; border-bottom: var(--border-width) solid var(--border); font-size: var(--text-sm); }
.kv__row:last-child { border-bottom: 0; }
.kv__row dt { color: var(--text-muted); }
.kv__row dd { font-weight: var(--weight-semibold); color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* ---------- Meter bars (always paired with a text value) ---------- */
.meter-list { display: grid; gap: var(--space-4); margin: 0; padding: 0; list-style: none; }
.meter { display: grid; gap: var(--space-2); }
.meter__head { display: flex; justify-content: space-between; gap: var(--space-3); font-size: var(--text-sm); }
.meter__label { color: var(--ink); font-weight: var(--weight-medium); overflow-wrap: anywhere; }
.meter__value { color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.meter__track { height: 8px; border-radius: var(--radius-pill); background: var(--surface-sunken); overflow: hidden; }
.meter__fill { height: 100%; border-radius: inherit; background: var(--primary); }

/* ---------- Status list (health checks) ---------- */
.status-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-3); margin: 0; padding: 0; list-style: none; }
.status-item { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-4); border: var(--border-width) solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.status-item > .icon { margin-top: 1px; }
.status-item--ok > .icon { color: var(--success); }
.status-item--fail { border-color: #f5c6c0; background: var(--danger-soft); }
.status-item--fail > .icon { color: var(--danger); }
.status-item--warn { border-color: #f6dc9b; background: var(--warning-soft); }
.status-item--warn > .icon { color: var(--warning); }
.status-item__name { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--ink); }
.status-item__detail { font-size: var(--text-xs); color: var(--text-muted); overflow-wrap: anywhere; }

/* ---------- Empty, loading & skeleton states ---------- */
.empty-state { display: grid; justify-items: center; gap: var(--space-2); padding: var(--space-10) var(--space-6); text-align: center; color: var(--text-muted); }
.empty-state__icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: var(--radius-lg); background: var(--primary-soft); color: var(--primary); margin-bottom: var(--space-2); }
.empty-state__icon .icon { width: 26px; height: 26px; }
.empty-state__title { font-size: var(--text-base); font-weight: var(--weight-semibold); color: var(--ink); }
.empty-state__text { font-size: var(--text-sm); max-width: 42ch; }
.empty-state--compact { padding: var(--space-6) var(--space-4); }
.skeleton { position: relative; overflow: hidden; background: var(--surface-sunken); border-radius: var(--radius-sm); }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,0.7), transparent); animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }

/* ---------- Progress ---------- */
.progress { display: grid; gap: var(--space-2); }
.progress__head { display: flex; justify-content: space-between; gap: var(--space-3); font-size: var(--text-sm); color: var(--text-muted); }
.progress__value { font-weight: var(--weight-semibold); color: var(--ink); font-variant-numeric: tabular-nums; }
.progress__track { height: 8px; border-radius: var(--radius-pill); background: var(--surface-sunken); overflow: hidden; }
.progress__bar { height: 100%; width: 0; background: var(--primary); border-radius: inherit; transition: width var(--duration) var(--ease); }
.progress[data-state="error"] .progress__bar { background: var(--danger); }
.progress[data-state="done"] .progress__bar { background: var(--success); }

/* ---------- Copy field ---------- */
.copy-field { display: grid; gap: 6px; min-width: 0; }
.copy-field__label { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.copy-field__row { display: flex; align-items: flex-start; gap: var(--space-2); min-width: 0; }
.copy-field__value { flex: 1; min-width: 0; min-height: var(--control-height-sm); padding: 0 var(--space-3); border: var(--border-width) solid var(--border); border-radius: var(--radius-sm); background: var(--canvas); font-family: var(--font-mono); font-size: 0.8125rem; color: var(--ink); }
textarea.copy-field__value { padding: var(--space-2) var(--space-3); min-height: 76px; resize: vertical; line-height: 1.45; }

/* ---------- Disclosure ---------- */
.disclosure { border: var(--border-width) solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.disclosure > summary { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: var(--control-height); padding: var(--space-3) var(--space-4); cursor: pointer; list-style: none; font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--ink); border-radius: var(--radius-md); }
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary .icon--chevron { transition: transform var(--duration) var(--ease); color: var(--text-muted); }
.disclosure[open] > summary .icon--chevron { transform: rotate(180deg); }
.disclosure > summary:hover { background: var(--canvas); }
.disclosure__hint { font-weight: var(--weight-regular); color: var(--text-muted); font-size: var(--text-xs); }
.disclosure__body { padding: var(--space-2) var(--space-4) var(--space-5); display: grid; gap: var(--space-5); }

/* ---------- Toasts (one global system) ---------- */
.toast-region { position: fixed; z-index: var(--z-toast); top: var(--space-5); right: var(--space-5); display: grid; gap: var(--space-3); width: min(380px, calc(100vw - 2 * var(--space-4))); pointer-events: none; }
.toast {
  --toast-accent: var(--info);
  display: grid; grid-template-columns: auto 1fr auto; align-items: start; gap: var(--space-3);
  padding: var(--space-4); padding-left: calc(var(--space-4) + 4px);
  background: var(--surface); color: var(--ink); border: var(--border-width) solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg); font-size: var(--text-sm); line-height: var(--leading-snug); pointer-events: auto; position: relative; overflow: hidden;
  animation: toast-in var(--duration) var(--ease);
}
.toast::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--toast-accent); }
.toast > .icon { color: var(--toast-accent); margin-top: 1px; }
.toast__title { display: block; font-weight: var(--weight-semibold); }
.toast__msg { color: var(--text); overflow-wrap: anywhere; }
.toast__close { display: grid; place-items: center; width: 28px; height: 28px; margin: -4px -6px 0 0; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-muted); }
.toast__close:hover { background: var(--surface-sunken); color: var(--ink); }
.toast__close .icon { width: 16px; height: 16px; }
.toast--success { --toast-accent: var(--success); }
.toast--error { --toast-accent: var(--danger); }
.toast--warning { --toast-accent: #c27c00; }
.toast--info { --toast-accent: var(--info); }
.toast.is-leaving { animation: toast-out var(--duration) var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px) scale(0.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-6px); } }
@media (max-width: 600px) {
  .toast-region { top: auto; bottom: max(var(--space-4), env(safe-area-inset-bottom)); right: 50%; transform: translateX(50%); }
  @keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
}

/* ---------- Dialog (confirmations & forms) ---------- */
.dialog { width: min(460px, calc(100vw - 2 * var(--space-4))); max-height: calc(100vh - 2 * var(--space-4)); padding: 0; border: 0; border-radius: var(--radius-lg); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
.dialog::backdrop { background: rgba(7, 21, 40, 0.55); }
.dialog[open] { animation: dialog-in var(--duration) var(--ease); }
.dialog__body { display: grid; gap: var(--space-3); padding: var(--space-6); }
.dialog__icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--radius-md); background: var(--primary-soft); color: var(--primary); }
.dialog--danger .dialog__icon { background: var(--danger-soft); color: var(--danger); }
.dialog__title { font-size: var(--text-lg); }
.dialog__text { color: var(--text-muted); font-size: var(--text-sm); }
.dialog__foot { display: flex; justify-content: flex-end; gap: var(--space-3); padding: var(--space-4) var(--space-6); background: var(--canvas); border-top: var(--border-width) solid var(--border); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
@media (max-width: 600px) { .dialog__foot { flex-direction: column-reverse; } .dialog__foot .btn { width: 100%; } }

/* ---------- Secret reveal box ---------- */
.secret { display: grid; gap: var(--space-3); padding: var(--space-4); border: 1px dashed #e0b44c; border-radius: var(--radius-md); background: var(--sun-50); }
.secret__title { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--ink); }
.secret__title .icon { color: var(--warning); }

/* ---------- Code block ---------- */
.code-block { display: block; padding: var(--space-4); border-radius: var(--radius-md); background: var(--navy-950); color: #e2e8f0; font-family: var(--font-mono); font-size: 0.8125rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- Dropzone ---------- */
.dropzone { position: relative; display: grid; justify-items: center; gap: var(--space-3); padding: var(--space-8) var(--space-5); border: 2px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--canvas); text-align: center; transition: border-color var(--duration-fast) var(--ease), background var(--duration-fast) var(--ease); }
.dropzone.is-dragging { border-color: var(--primary); background: var(--primary-soft); }
.dropzone:focus-within { border-color: var(--primary); }
.dropzone__icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: var(--radius-lg); background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }
.dropzone__icon .icon { width: 26px; height: 26px; }
.dropzone__title { font-size: var(--text-base); font-weight: var(--weight-semibold); color: var(--ink); }
.dropzone__hint { font-size: var(--text-sm); color: var(--text-muted); }
.dropzone__input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.dropzone__input:focus-visible + .dropzone__pick { outline: 3px solid var(--focus-ring); outline-offset: 2px; }

/* ---------- File list (selected files) ---------- */
.file-list { display: grid; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.file-item { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: var(--space-3); padding: var(--space-2); padding-right: var(--space-3); border: var(--border-width) solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.file-item__thumb { width: 44px; height: 44px; border-radius: var(--radius-sm); object-fit: cover; background: var(--surface-sunken); }
.file-item__name { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item__meta { font-size: var(--text-xs); color: var(--text-muted); }
.file-item--warn { border-color: #f6dc9b; background: var(--warning-soft); }
.file-summary { display: flex; justify-content: space-between; gap: var(--space-3); font-size: var(--text-sm); color: var(--text-muted); }

/* ---------- Thumbnails ---------- */
.thumb { width: 56px; height: 56px; border-radius: var(--radius-md); object-fit: cover; background: var(--surface-sunken); border: var(--border-width) solid var(--border); }
.thumb--locked { display: grid; place-items: center; color: var(--text-muted); }

/* ---------- Pagination-free list toolbar ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); }
.toolbar__search { flex: 1 1 260px; max-width: 360px; }
.result-count { font-size: var(--text-sm); color: var(--text-muted); }
