/* ============================================================
   DEADFRAME v5 — Shared Component Library
   All values use CSS variables — works across all 6 themes.
   Section map:
     page · type · tabs · cards · status · buttons · tables
     forms · drawers · modals · toasts · htmx · bento · split
     empty · timeline · log · service-grid · gallery · avatar · utils
   ============================================================ */

/* ── Page layout ────────────────────────────────────────────── */
.df-page {
  padding: 24px;
  max-width: 1640px;
}

.df-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.df-page-title {
  font-family: var(--heading-font);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 10px;
}

.df-page-title .accent-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.df-page-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}

.df-page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ── Typography helpers ─────────────────────────────────────── */
.text-xs   { font-size: 11px; line-height: 1.4; }
.text-sm   { font-size: 13px; line-height: 1.4; }
.text-base { font-size: 15px; line-height: 1.5; }
.text-lg   { font-size: 18px; line-height: 1.4; }
.text-xl   { font-size: 22px; line-height: 1.3; }
.text-2xl  { font-size: 28px; line-height: 1.2; }

.text-accent  { color: var(--accent); }
.text-muted   { color: var(--muted); }
.text-dim     { color: var(--dim, var(--muted)); }
.text-up      { color: var(--up); }
.text-down    { color: var(--down); }
.text-warn    { color: var(--warn); }
.text-info    { color: var(--info); }
.text-link    { color: var(--link); }

.font-mono    { font-family: var(--mono-font); }
.font-heading { font-family: var(--heading-font); }

.label {
  font-family: var(--heading-font);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.label-mono {
  font-family: var(--mono-font);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.stat-label {
  font-family: var(--mono-font);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.stat-val {
  font-family: var(--mono-font);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}
.meta-text {
  font-family: var(--mono-font);
  font-size: 11px;
  color: var(--muted);
}

/* ── Tabs ───────────────────────────────────────────────────── */
.df-tabs {
  display: flex;
  align-items: flex-end;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
  scrollbar-width: none;
}
.df-tabs::-webkit-scrollbar { display: none; }

.df-tab {
  font-family: var(--mono-font);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 9px 18px 11px;
  cursor: pointer;
  border: none;
  background: transparent;
  position: relative;
  transition: color var(--t-fast);
  white-space: nowrap;
  flex-shrink: 0;
}
.df-tab:hover { color: var(--text-dim); }
.df-tab.active { color: var(--accent); }
.df-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 0; right: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 1px 1px 0 0;
}
.df-tab-content { display: none; }
.df-tab-content.active { display: block; }

/* ── Cards ──────────────────────────────────────────────────── */
.df-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  position: relative;
  overflow: hidden;
}
.df-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--border-bright) 50%, transparent 100%);
  opacity: 0.3;
  pointer-events: none;
}

.df-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-dim);
  gap: 8px;
}
.df-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--heading-font);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.df-card-title svg, .df-card-title i { width: 14px; height: 14px; stroke: currentColor; }
.df-card-body { padding: 16px; }
.df-card-body.p-0 { padding: 0; }
.df-card-footer {
  padding: 11px 16px;
  border-top: 1px solid var(--border-dim);
  display: flex;
  align-items: center;
  gap: 8px;
}

.df-card.interactive {
  cursor: pointer;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.df-card.interactive:hover {
  border-color: var(--border-bright);
  box-shadow: -3px 0 0 0 var(--accent);
}

.df-card.featured { border-color: var(--accent-dim); }
.df-card.featured::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 0; height: 0;
  border-style: solid;
  border-width: 0 14px 14px 0;
  border-color: transparent var(--accent) transparent transparent;
  pointer-events: none;
}

/* ── Status indicators ──────────────────────────────────────── */
.df-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.df-dot.up      { background: var(--up); }
.df-dot.down    { background: var(--down); animation: df-pulse 2s ease-in-out infinite; }
.df-dot.warn    { background: var(--warn); }
.df-dot.unknown { background: var(--dim, var(--muted)); }
.df-dot.info    { background: var(--info); }

@keyframes df-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

.df-status { display: inline-flex; align-items: center; gap: 6px; }

/* Badges */
.df-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 3px;
  font-family: var(--mono-font);
  font-size: 11px;
  letter-spacing: 0.05em;
  font-weight: 600;
  text-transform: uppercase;
  border: 1px solid transparent;
  white-space: nowrap;
}
.df-badge.up          { background: rgba(0,0,0,0.0); color: var(--up);   border-color: var(--up);   opacity: 0.85; }
.df-badge.down        { background: rgba(0,0,0,0.0); color: var(--down); border-color: var(--down); opacity: 0.85; }
.df-badge.warn        { background: rgba(0,0,0,0.0); color: var(--warn); border-color: var(--warn); opacity: 0.85; }
.df-badge.info        { background: rgba(0,0,0,0.0); color: var(--info); border-color: var(--info); opacity: 0.85; }
.df-badge.neutral     { background: rgba(0,0,0,0.0); color: var(--muted); border-color: var(--border-bright); }
.df-badge.accent      { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); opacity: 0.85; }
/* Incident severity */
.df-badge.p1          { color: var(--down); border-color: var(--down); }
.df-badge.p2          { color: var(--accent); border-color: var(--accent); }
.df-badge.p3          { color: var(--warn); border-color: var(--warn); }
.df-badge.p4          { color: var(--info); border-color: var(--info); }
/* Incident state */
.df-badge.open        { color: var(--down); border-color: var(--down); }
.df-badge.investigating { color: var(--warn); border-color: var(--warn); }
.df-badge.resolved    { color: var(--up); border-color: var(--up); }
.df-badge.closed      { color: var(--muted); border-color: var(--border-bright); }

/* ── Buttons ────────────────────────────────────────────────── */
.df-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--r-sm);
  font-family: var(--mono-font);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--t-fast);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}
.df-btn:hover { text-decoration: none; }
.df-btn svg, .df-btn i { width: 14px; height: 14px; stroke: currentColor; flex-shrink: 0; }
.df-btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

.df-btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.df-btn-primary:hover { filter: brightness(1.12); box-shadow: 0 0 12px var(--accent-glow); color: #fff; }

.df-btn-secondary {
  background: transparent;
  color: var(--text-dim);
  border-color: var(--border-bright);
}
.df-btn-secondary:hover { color: var(--text); border-color: var(--muted); background: var(--hover-bg); }

.df-btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
  padding: 7px;
}
.df-btn-ghost:hover { color: var(--text); background: var(--hover-bg); border-color: var(--border); }

.df-btn-warn {
  background: transparent;
  color: var(--warn);
  border-color: var(--warn);
  opacity: 0.85;
}
.df-btn-warn:hover { opacity: 1; background: rgba(230, 165, 32, 0.08); }

.df-btn-danger {
  background: transparent;
  color: var(--down);
  border-color: var(--down);
  opacity: 0.8;
}
.df-btn-danger:hover { opacity: 1; background: var(--hover-bg-danger); }

.df-btn-sm { padding: 4px 10px; font-size: 11px; }
.df-btn-lg { padding: 10px 20px; font-size: 13px; }
.df-btn-icon { padding: 6px; }

/* ── Tables ─────────────────────────────────────────────────── */
.df-table-wrap {
  overflow-x: auto;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
}

.df-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.df-table thead th {
  position: sticky;
  top: 0;
  background: var(--surface-2, var(--surface));
  font-family: var(--mono-font);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  z-index: 1;
}
.df-table tbody tr { transition: background var(--t-fast); }
.df-table tbody tr:hover { background: var(--hover-bg); }
.df-table tbody tr + tr { border-top: 1px solid var(--border-dim); }
.df-table tbody td {
  padding: 10px 14px;
  color: var(--text-dim);
  vertical-align: middle;
}
.df-table tbody td.primary { color: var(--text); font-weight: 500; }
.df-table tfoot td {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}

/* ── Forms ──────────────────────────────────────────────────── */
.df-field { display: flex; flex-direction: column; gap: 6px; }
.df-label {
  font-family: var(--mono-font);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.df-input,
.df-select,
.df-textarea {
  background: var(--surface-2, var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font-family: var(--body-font);
  font-size: 13px;
  padding: 8px 12px;
  width: 100%;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  outline: none;
}
.df-input::placeholder, .df-textarea::placeholder { color: var(--muted); }
.df-input:focus, .df-select:focus, .df-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}
.df-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}
.df-textarea { resize: vertical; min-height: 80px; }

.df-checkbox { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.df-checkbox input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.df-form-group { display: grid; gap: 16px; }
.df-form-group.cols-2 { grid-template-columns: 1fr 1fr; }
.df-form-group.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

.df-form-error { font-size: 12px; color: var(--down); margin-top: 3px; }
.df-form-help  { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* ── Drawers ─────────────────────────────────────────────────── */
.df-drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 300;
  backdrop-filter: blur(2px);
}
.df-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(580px, 96vw);
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 310;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform var(--t-med);
}
.df-drawer.open { transform: translateX(0); }

.df-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.df-drawer-title {
  font-family: var(--heading-font);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
}
.df-drawer-close {
  background: none; border: none; cursor: pointer;
  color: var(--muted); padding: 4px;
  border-radius: var(--r-sm);
  transition: color var(--t-fast), background var(--t-fast);
  display: flex; align-items: center; justify-content: center;
}
.df-drawer-close:hover { color: var(--text); background: var(--hover-bg); }
.df-drawer-close svg, .df-drawer-close i { width: 18px; height: 18px; stroke: currentColor; }
.df-drawer-body { flex: 1; overflow-y: auto; padding: 20px; }
.df-drawer-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  flex-shrink: 0;
}

/* ── Modals ──────────────────────────────────────────────────── */
.df-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(3px);
}
.df-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.df-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.df-modal-title {
  font-family: var(--heading-font);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
}
.df-modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.df-modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  flex-shrink: 0;
}
.df-modal-sm { max-width: 380px; }
.df-modal-lg { max-width: 760px; }

/* Native <dialog> reset — the global margin:0 breaks showModal() centering */
dialog { margin: auto; }

/* ── Toasts ──────────────────────────────────────────────────── */
.df-toast-container {
  position: fixed;
  bottom: 20px; right: 20px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.df-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  font-size: 13px;
  color: var(--text);
  pointer-events: auto;
  min-width: 260px;
  max-width: 380px;
  animation: df-toast-in 0.2s ease;
}
@keyframes df-toast-in {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}
.df-toast.success { border-left: 3px solid var(--up); }
.df-toast.error   { border-left: 3px solid var(--down); }
.df-toast.warn    { border-left: 3px solid var(--warn); }
.df-toast.info    { border-left: 3px solid var(--info); }
.df-toast-icon { flex-shrink: 0; }
.df-toast-icon svg, .df-toast-icon i { width: 16px; height: 16px; stroke: currentColor; }
.df-toast.success .df-toast-icon { color: var(--up); }
.df-toast.error   .df-toast-icon { color: var(--down); }
.df-toast.warn    .df-toast-icon { color: var(--warn); }
.df-toast.info    .df-toast-icon { color: var(--info); }

/* ── HTMX Progress bar ──────────────────────────────────────── */
#htmx-indicator, .htmx-indicator {
  opacity: 0;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-glow, var(--accent)) 100%);
  z-index: 9999;
  transition: opacity 0.15s;
}
.htmx-request #htmx-indicator,
.htmx-request.htmx-indicator { opacity: 1; }

/* ── Bento grid ─────────────────────────────────────────────── */
.df-bento {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}
.df-col-3  { grid-column: span 3; }
.df-col-4  { grid-column: span 4; }
.df-col-6  { grid-column: span 6; }
.df-col-8  { grid-column: span 8; }
.df-col-9  { grid-column: span 9; }
.df-col-12 { grid-column: span 12; }

@media (max-width: 1280px) {
  .df-col-3  { grid-column: span 6; }
  .df-col-4  { grid-column: span 6; }
  .df-col-8  { grid-column: span 12; }
  .df-col-9  { grid-column: span 12; }
}
@media (max-width: 768px) {
  .df-bento { grid-template-columns: 1fr; gap: 12px; }
  .df-col-3, .df-col-4, .df-col-6, .df-col-8, .df-col-9, .df-col-12 { grid-column: span 1; }
  .df-page { padding: 16px; }
}

/* ── Split panel ─────────────────────────────────────────────── */
.df-split {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: 0;
  overflow: hidden;
}
.df-split-list {
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
.df-split-detail { overflow-y: auto; }

@media (max-width: 900px) {
  .df-split { grid-template-columns: 1fr; }
  .df-split-list { border-right: none; border-bottom: 1px solid var(--border); max-height: 40vh; }
}

/* ── Empty state ─────────────────────────────────────────────── */
.df-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
  gap: 12px;
}
.df-empty-icon {
  width: 48px; height: 48px;
  color: var(--dim, var(--muted));
  opacity: 0.6;
}
.df-empty-icon svg, .df-empty-icon i { width: 100%; height: 100%; stroke: currentColor; }
.df-empty-title { font-size: 15px; font-weight: 600; color: var(--text-dim); }
.df-empty-desc  { font-size: 13px; color: var(--muted); max-width: 360px; }

/* ── Timeline ────────────────────────────────────────────────── */
.df-timeline { display: flex; flex-direction: column; gap: 0; }
.df-tl-item {
  display: flex;
  gap: 14px;
  position: relative;
  padding-bottom: 20px;
}
.df-tl-item:last-child { padding-bottom: 0; }
.df-tl-line {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}
.df-tl-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 2px solid var(--border-bright);
  background: var(--surface);
  flex-shrink: 0;
  margin-top: 4px;
}
.df-tl-dot.up      { background: var(--up);   border-color: var(--up); }
.df-tl-dot.down    { background: var(--down); border-color: var(--down); }
.df-tl-dot.warn    { background: var(--warn); border-color: var(--warn); }
.df-tl-dot.info    { background: var(--info); border-color: var(--info); }
.df-tl-dot.accent  { background: var(--accent); border-color: var(--accent); }
.df-tl-connector {
  width: 1px;
  flex: 1;
  background: var(--border);
  margin-top: 4px;
}
.df-tl-item:last-child .df-tl-connector { display: none; }
.df-tl-body { flex: 1; padding-top: 2px; }
.df-tl-time { font-family: var(--mono-font); font-size: 11px; color: var(--muted); }
.df-tl-text { font-size: 13px; color: var(--text-dim); margin-top: 2px; }

/* ── Log output ──────────────────────────────────────────────── */
.df-log {
  background: var(--surface-2, var(--bg));
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-family: var(--mono-font);
  font-size: 12px;
  line-height: 1.6;
  padding: 12px 16px;
  overflow-x: auto;
  max-height: 520px;
  overflow-y: auto;
}
.df-log-line { display: block; padding: 1px 0; color: var(--text-dim); }
.df-log-line.ERROR, .df-log-line.error { color: var(--down); }
.df-log-line.WARN,  .df-log-line.warn  { color: var(--warn); }
.df-log-line.INFO,  .df-log-line.info  { color: var(--info); }
.df-log-line.success                   { color: var(--up); }
.df-log-ts { color: var(--muted); margin-right: 8px; }

/* ── Service grid ────────────────────────────────────────────── */
.df-service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

/* ── Gallery / lightbox ──────────────────────────────────────── */
.df-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}

.df-gallery-thumb {
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--r-sm);
  cursor: pointer;
  position: relative;
  background: var(--surface);
}
.df-gallery-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform var(--t-med), filter var(--t-med);
}
.df-gallery-thumb:hover img { transform: scale(1.04); filter: brightness(1.1); }
.df-gallery-thumb-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0);
  transition: background var(--t-fast);
  display: flex; align-items: flex-end;
  padding: 8px;
}
.df-gallery-thumb:hover .df-gallery-thumb-overlay { background: rgba(0,0,0,0.3); }

.df-lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.df-lightbox-img {
  max-width: 94vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-lg);
}
.df-lightbox-close {
  position: absolute;
  top: 16px; right: 20px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--r-sm);
  color: #fff;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--t-fast);
}
.df-lightbox-close:hover { background: rgba(255,255,255,0.2); }
.df-lightbox-close svg, .df-lightbox-close i { width: 20px; height: 20px; stroke: currentColor; }
.df-lightbox-nav {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--r-sm);
  color: #fff;
  cursor: pointer;
  padding: 10px 8px;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--t-fast);
}
.df-lightbox-nav:hover { background: rgba(255,255,255,0.18); }
.df-lightbox-nav svg, .df-lightbox-nav i { width: 22px; height: 22px; stroke: currentColor; }
.df-lightbox-prev { left: 16px; }
.df-lightbox-next { right: 16px; }
.df-lightbox-caption {
  position: absolute;
  bottom: 16px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,0.6);
  color: rgba(255,255,255,0.85);
  font-size: 12px;
  padding: 6px 14px;
  border-radius: var(--r-sm);
  white-space: nowrap;
  max-width: 80vw;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Avatar ──────────────────────────────────────────────────── */
.df-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  color: #fff;
  background: var(--accent);
  overflow: hidden;
}
.df-avatar img { width: 100%; height: 100%; object-fit: cover; }
.df-avatar.sm  { width: 22px; height: 22px; font-size: 9px; }
.df-avatar.lg  { width: 40px; height: 40px; font-size: 15px; }
.df-avatar.xl  { width: 64px; height: 64px; font-size: 22px; }

/* ── Utilities ──────────────────────────────────────────────── */
.df-divider { height: 1px; background: var(--border); margin: 16px 0; opacity: 0.5; }

.df-code {
  font-family: var(--mono-font);
  font-size: 12px;
  background: var(--surface-2, var(--bg));
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  padding: 1px 6px;
  color: var(--accent);
}

.df-pre {
  font-family: var(--mono-font);
  font-size: 12px;
  background: var(--surface-2, var(--bg));
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  overflow-x: auto;
  line-height: 1.6;
  color: var(--text-dim);
  white-space: pre-wrap;
  word-break: break-all;
}

.df-spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: df-spin 0.6s linear infinite;
  flex-shrink: 0;
}
.df-spinner.sm { width: 14px; height: 14px; }
.df-spinner.lg { width: 28px; height: 28px; border-width: 3px; }
@keyframes df-spin { to { transform: rotate(360deg); } }

.df-kbd {
  font-family: var(--mono-font);
  font-size: 11px;
  background: var(--surface);
  border: 1px solid var(--border-bright);
  border-radius: var(--r-xs);
  padding: 1px 5px;
  color: var(--text-dim);
  box-shadow: 0 2px 0 var(--border);
}

/* Flexbox helpers */
.df-flex   { display: flex; }
.df-flex-center  { display: flex; align-items: center; }
.df-flex-between { display: flex; align-items: center; justify-content: space-between; }
.df-flex-col { display: flex; flex-direction: column; }
.gap-2  { gap: 2px; }
.gap-4  { gap: 4px; }
.gap-6  { gap: 6px; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

/* Spacing */
.mt-0 { margin-top: 0; }    .mb-0 { margin-bottom: 0; }
.mt-8 { margin-top: 8px; }  .mb-8 { margin-bottom: 8px; }
.mt-16 { margin-top: 16px; } .mb-16 { margin-bottom: 16px; }
.mt-24 { margin-top: 24px; } .mb-24 { margin-bottom: 24px; }
.p-0 { padding: 0; } .p-8 { padding: 8px; } .p-16 { padding: 16px; }

/* Visibility */
.hidden  { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── df-modal-overlay — used by dfModal() JS helper ────────────────────────── */
/* Set display:none by default; dfModal() switches to display:flex */
.df-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 400;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(3px);
}

/* ── Stat chip — compact KPI display ───────────────────────────────────────── */
.df-stat-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  min-width: 80px;
}
.df-stat-chip-val {
  font-family: var(--mono-font);
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
}
.df-stat-chip-label {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 3px;
}
