/* --- Buttons --------------------------------------------------------- */
.btn {
  padding: 0.55rem 1rem; border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 0.88rem; font-weight: 500; cursor: pointer;
  font-family: var(--font); line-height: 1.2;
  transition: background .12s, border-color .12s, color .12s, transform .06s, box-shadow .12s;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.4rem; user-select: none; white-space: nowrap;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary {
  background: var(--primary); color: #fff;
  border-color: var(--primary);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset, 0 1px 2px rgba(0, 0, 0, 0.15);
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-secondary {
  background: rgba(255, 255, 255, 0.05); color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.09); border-color: var(--border-strong); }
.btn-danger {
  background: #f87171; color: #fff;
  border-color: #f87171;
}
.btn-danger:hover { background: #ef4444; border-color: #ef4444; }
.btn-success {
  background: var(--success); color: #fff; border-color: var(--success);
}
.btn-success:hover { filter: brightness(1.08); }
.btn-ok {
  background: var(--success-dim); color: #4ade80;
  border-color: rgba(34, 197, 94, 0.22);
}
.btn-ok:hover { background: rgba(34, 197, 94, 0.2); border-color: rgba(34, 197, 94, 0.35); }
.btn-send {
  background: var(--primary-dim); color: var(--primary);
  border-color: rgba(91, 141, 239, 0.22);
}
.btn-send:hover { background: rgba(91, 141, 239, 0.18); border-color: rgba(91, 141, 239, 0.4); }
/* Inside the detail-view Send-to-Page grid, buttons fill the whole grid cell
   and left-align their label so numbers stack up neatly.  When the same
   .btn-send class is used INLINE (as the Send button in a submissions row),
   the button stays its natural width so it doesn't push the other action
   buttons out of the table. */
.send-grid .btn-send {
  width: 100%; text-align: left; justify-content: flex-start;
  padding: 0.55rem 0.8rem; font-size: 0.85rem;
}
.btn-1tap {
  background: var(--warning-dim); color: var(--warning);
  border-color: rgba(245, 158, 11, 0.22);
}
.btn-1tap:hover { background: rgba(245, 158, 11, 0.2); }
.btn-info {
  background: rgba(59, 130, 246, 0.12); color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.22);
}
.btn-info:hover { background: rgba(59, 130, 246, 0.2); }
.btn-purple {
  background: rgba(167, 139, 250, 0.12); color: #a78bfa;
  border-color: rgba(167, 139, 250, 0.22);
}
.btn-purple:hover { background: rgba(167, 139, 250, 0.2); }
.btn-sm { font-size: 0.8rem; padding: 0.38rem 0.75rem; border-radius: 6px; }

/* --- Sites grid + card ---------------------------------------------- */
.card-grid {
  display: grid; gap: 0.9rem;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.site-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.1rem; cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .12s, background .15s;
  position: relative; overflow: hidden;
}
.site-card::after {
  content: ''; position: absolute; inset: 0;
  border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0) inset;
  transition: box-shadow .18s;
}
.site-card:hover {
  border-color: var(--border-strong); background: var(--surface-2);
  box-shadow: var(--shadow-md); transform: translateY(-1px);
}
.site-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.6rem; gap: 0.5rem;
}
.site-card-header h3 { font-size: 1.02rem; font-weight: 600; color: var(--text); }
.site-card-meta {
  display: flex; align-items: center; gap: 0.6rem;
  margin-bottom: 0.6rem; flex-wrap: wrap;
}
.site-card-meta .domain { font-size: 0.85rem; color: var(--text-secondary); }
.site-card-meta .domain-status { font-size: 0.78rem; display: inline-flex; align-items: center; }
.site-card-meta .pages { font-size: 0.8rem; color: var(--muted); }
.site-card-badges { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.mini-badge {
  font-size: 0.72rem; background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary); padding: 3px 8px; border-radius: 4px;
  font-weight: 500; letter-spacing: 0.02em;
}

/* --- Switch --------------------------------------------------------- */
.switch { position: relative; width: 34px; height: 20px; display: inline-block; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute; inset: 0;
  background: #3a3f4b; border-radius: 10px;
  cursor: pointer; transition: background .2s;
}
.switch-slider:before {
  content: ''; position: absolute; left: 2px; top: 2px;
  width: 16px; height: 16px; background: #fff;
  border-radius: 50%; transition: transform .2s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.switch input:checked + .switch-slider { background: var(--primary); }
.switch input:checked + .switch-slider:before { transform: translateX(14px); }

/* --- Badges (text-only status labels, no bubble) ------------------- */
.badge {
  font-size: 0.82rem; font-weight: 600;
  padding: 0; background: transparent; border: none;
  text-transform: capitalize; letter-spacing: 0.01em;
  display: inline-flex; align-items: center; gap: 4px;
}
.badge-ok       { color: var(--success); }
.badge-off      { color: var(--muted); }
.badge-pending  { color: var(--warning); }
.badge-accepted { color: var(--success); }
.badge-rejected { color: #f87171; }

/* --- Site detail: info bar, tabs, media ----------------------------- */
.site-info {
  display: flex; align-items: center; gap: 0.75rem;
  margin-bottom: 1rem; flex-wrap: wrap;
}
.site-domain { font-size: 0.92rem; color: var(--text-secondary); }
.site-domain a { color: var(--primary); text-decoration: none; font-weight: 500; }
.site-domain a:hover { text-decoration: underline; }
.site-media {
  display: flex; gap: 1.5rem; margin-bottom: 1.25rem;
  flex-wrap: wrap; padding: 1rem 1.15rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.site-tabs {
  display: flex; gap: 0; border-bottom: 1px solid var(--border);
  margin-bottom: 1.25rem;
}
.site-tab {
  background: none; border: none; padding: 0.7rem 1.15rem;
  font-size: 0.92rem; color: var(--text-secondary);
  cursor: pointer; border-bottom: 2px solid transparent;
  font-family: var(--font); font-weight: 500;
  transition: color .12s, border-color .12s;
  margin-bottom: -1px;
}
.site-tab:hover { color: var(--text); }
.site-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.site-tab-content { display: none; animation: fadeIn .18s ease-out; }
.site-tab-content.active { display: block; }

/* --- Pages ---------------------------------------------------------- */
.pages-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.75rem;
}
.pages-header h2 {
  font-size: 0.88rem; font-weight: 600; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.pages-list { display: flex; flex-direction: column; gap: 0.4rem; }
.page-item {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.7rem 0.9rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color .12s, background .12s;
}
.page-item:hover { border-color: var(--border-strong); background: var(--surface-2); }
.page-item.dragging { opacity: 0.4; }
.page-drag-handle { color: #4a4f5c; cursor: grab; flex-shrink: 0; }
.page-drag-handle:active { cursor: grabbing; }
.page-item-center { display: flex; align-items: center; gap: 0.5rem; flex: 1; min-width: 0; }
.page-order {
  font-size: 0.78rem; color: var(--text-secondary);
  font-weight: 700; min-width: 24px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 4px; padding: 3px 7px;
  text-align: center;
}
.page-name {
  font-size: 0.92rem; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.page-arrow { color: #4a4f5c; flex-shrink: 0; }
.page-item-actions { display: flex; gap: 0.3rem; flex-shrink: 0; flex-wrap: wrap; }
.pages-drop-zone {
  border: 2px dashed var(--border-strong); border-radius: 10px;
  padding: 1.5rem; text-align: center; margin-bottom: 0.75rem;
  background: rgba(91, 141, 239, 0.03); transition: background .15s, border-color .15s;
}
.pages-drop-zone.dragover {
  background: rgba(91, 141, 239, 0.08);
  border-color: rgba(91, 141, 239, 0.5);
}
.drop-zone-inner { font-size: 0.9rem; color: var(--muted); }

/* --- Submissions ---------------------------------------------------- */
.table-wrap { overflow-x: auto; flex: 1; min-height: 0; }
.table-wrap .tbl { min-width: 900px; }
.pending-bar { margin-bottom: 1rem; }

.tbl {
  width: 100%; border-collapse: separate;
  border-spacing: 0; font-size: 0.9rem;
}
.tbl thead th {
  text-align: left; padding: 0.65rem 0.95rem;
  font-size: 0.74rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.025);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
/* Utility classes need to override the default left-alignment above. */
.tbl thead th.text-center,
.tbl tbody td.text-center { text-align: center; }
.tbl thead th.text-right,
.tbl tbody td.text-right { text-align: right; }
.tbl tbody td {
  padding: 0.75rem 0.95rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl-subs {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.tbl-subs thead th:first-child { border-top-left-radius: var(--radius); }
.tbl-subs thead th:last-child  { border-top-right-radius: var(--radius); }
.tbl-subs tbody tr { transition: background .12s; }
.tbl-subs tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
.tbl-subs .sub-rejected { opacity: 0.55; }
.tbl-subs .sub-extrow td {
  padding-top: 4px; padding-bottom: 8px;
  border-top: none; background: rgba(167, 139, 250, 0.05);
}

.cell-val {
  cursor: pointer; font-size: 0.9rem; max-width: 200px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: color .12s;
}
.cell-val:hover { color: var(--primary); }
.cell-val.dim { color: var(--muted); cursor: default; }
.cell-val.dim:hover { color: var(--muted); }
.cell-val.copied { color: var(--success) !important; }
.cell-meta { font-size: 0.86rem; color: var(--text-secondary); }
.cell-device { max-width: 240px; }
.action-cell { min-width: 320px; max-width: 460px; }

.row-actions {
  display: flex; flex-wrap: wrap; gap: 0.35rem;
  align-items: center; justify-content: flex-end;
  max-width: 100%;
}
.row-actions .btn { flex: 0 0 auto; }
.row-actions-sep {
  width: 1px; height: 20px; background: var(--border);
  margin: 0 0.2rem; flex-shrink: 0;
}

.section-block { margin-bottom: 1.25rem; }
.section-title {
  font-size: 0.82rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 0.8rem; display: inline-flex; align-items: center; gap: 0.5rem;
}
.section-title.muted   { color: #8a919e; }
.section-title.ledger  { color: #BBB0FF; }
.section-title.trezor  { color: #82d8b9; }
.section-title.warning { color: #fbbf24; }
.section-divider {
  margin-top: 1.5rem; padding-top: 1.1rem;
  border-top: 1px solid var(--border);
}

.status-dot {
  display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; flex-shrink: 0;
}
.status-clean   { background: var(--success); box-shadow: 0 0 6px rgba(34, 197, 94, 0.5); }
.status-flagged { background: var(--danger);  box-shadow: 0 0 6px rgba(239, 68, 68, 0.45); }
.status-unknown { background: var(--muted); }

.online-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.online-dot.on {
  background: #4ade80;
  animation: livePulse 1.5s infinite;
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.55);
}
.online-dot.off { background: #ef4444; }

/* --- Detail panels (session views) --------------------------------- */
.detail-view { max-width: 720px; }
.panel {
  background: var(--surface); border: 1px solid var(--glass-border);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}
.panel-header {
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--glass-border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.5rem;
}
.panel-header span, .panel-title {
  font-size: 0.78rem; font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.07em;
}
.panel-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.72rem 1rem;
  border-bottom: 1px solid var(--glass-border); gap: 1rem;
}
.panel-row:last-child { border-bottom: none; }
.panel-row-label {
  font-size: 0.85rem; color: var(--text-secondary);
  font-weight: 500; flex-shrink: 0;
}
.panel-row-value {
  font-size: 0.88rem; color: var(--text);
  font-weight: 500; text-align: right;
}
.panel-body { padding: 0.85rem 1rem; }
.panel-grid {
  padding: 0.85rem 1rem; display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.55rem;
}

.stage-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 12px;
  background: rgba(187, 176, 255, 0.12);
  border: 1px solid rgba(187, 176, 255, 0.25);
  border-radius: 999px; font-size: 0.82rem; font-weight: 600;
  color: #BBB0FF; margin-bottom: 1rem;
}
.stage-pill-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #BBB0FF;
  animation: livePulse 1.5s infinite; display: inline-block;
}

/* "Loading..." indicator used in the session info panel while a
   submission is still pending (visitor typed data but admin hasn't
   accepted yet). Pulsing amber dot mirrors the warning colour used
   for the awaiting-approval bar. */
.status-loading {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 3px 10px; border-radius: 999px;
  background: var(--warning-dim);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: var(--warning);
  font-size: 0.82rem; font-weight: 600;
}
.status-loading-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--warning);
  animation: livePulse 1.2s infinite; display: inline-block;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.55);
}

/* --- Media upload blocks -------------------------------------------- */
.media-row { display: flex; align-items: center; gap: 1rem; }
.media-preview {
  max-width: 84px; max-height: 84px; border-radius: var(--radius-sm);
  object-fit: contain; background: var(--sidebar); padding: 6px;
  border: 1px solid var(--border);
}
.media-preview.sm { width: 40px; height: 40px; max-width: 40px; max-height: 40px; border-radius: 6px; padding: 4px; }
.media-placeholder {
  width: 64px; height: 64px; background: var(--surface);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 0.78rem;
  border: 1px dashed var(--border-strong); flex-shrink: 0;
}
.media-placeholder.sm { width: 40px; height: 40px; font-size: 0.6rem; border-radius: 6px; }
.media-label { font-size: 0.86rem; color: var(--text-secondary); margin-bottom: 0.5rem; }
