/*
 * theme.css — Payment Failure Dashboard.
 * Dense, calm operations screen in the spirit of Stripe's dashboard and Linear:
 * cool slate neutrals, one indigo accent for actions, red reserved for failures.
 * IBM Plex Sans for UI, IBM Plex Mono for ids and amounts.
 */

:root {
  --canvas: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #eceff4;
  --border: #dde2ea;
  --border-strong: #b4bccb;
  --ink: #131923;
  --muted: #566173;
  --accent: #2f4bd8;
  --accent-hover: #2539b0;
  --accent-ink: #ffffff;
  --accent-text: #2a43c4;
  --accent-strong: #1f33a0;
  --accent-soft: #e7ebfc;
  --accent-border: #b9c4f4;
  --success: #12704f;
  --success-ink: #ffffff;
  --success-soft: #def2ea;
  --success-strong: #0d5e42;
  --warning: #a84d06;
  --warning-ink: #ffffff;
  --warning-soft: #fbeedd;
  --warning-strong: #8a3f05;
  --danger: #c02626;
  --danger-ink: #ffffff;
  --danger-soft: #fce7e5;
  --danger-strong: #9f1d1d;
  --chart-1: #c02626;
  --chart-2: #2f4bd8;
  --chart-3: #a84d06;
  --chart-4: #12704f;
  --chart-5: #7c3aed;
  --chart-6: #0e7490;

  --font-display: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  --font-body: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  --font-sans: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --display-weight: 600;
  --display-tracking: -0.015em;
  --eyebrow-tracking: 0.08em;

  --radius-btn: 8px;
  --radius-card: 12px;
  --radius-input: 8px;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 1px rgba(0, 0, 0, 0.03);
}

html[data-theme="dark"] {
  --canvas: #0d1016;
  --surface: #151a23;
  --surface-2: #1c222e;
  --border: #283040;
  --border-strong: #444f63;
  --ink: #e7ebf2;
  --muted: #9aa4b5;
  --accent: #8095ff;
  --accent-hover: #98a9ff;
  --accent-ink: #0d1016;
  --accent-text: #9caeff;
  --accent-strong: #c0caff;
  --accent-soft: #1d2547;
  --accent-border: #36427c;
  --success: #3fb68b;
  --success-ink: #0d1016;
  --success-soft: #11291f;
  --success-strong: #74d6ae;
  --warning: #e3a443;
  --warning-ink: #0d1016;
  --warning-soft: #2d2210;
  --warning-strong: #f2c27a;
  --danger: #f07070;
  --danger-ink: #0d1016;
  --danger-soft: #341617;
  --danger-strong: #ffa3a3;
  --chart-1: #f07070;
  --chart-2: #8095ff;
  --chart-3: #e3a443;
  --chart-4: #3fb68b;
  --chart-5: #b48cff;
  --chart-6: #38bdd8;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* app.css — what no primitive covers on the failures dashboard. Tokens only. */

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  background: var(--danger-soft);
  color: var(--danger-strong);
  flex-shrink: 0;
}

.live-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 25%, transparent);
}

/* Period switch: a segmented control. */
.period {
  display: inline-flex;
  padding: 0.25rem;
  gap: 0.25rem;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  width: fit-content;
}
.period-opt {
  padding: 0.375rem 0.75rem;
  border-radius: 7px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}
.period-opt:hover { color: var(--ink); text-decoration: none; }
.period-opt.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* Stat tiles. */
.stat { --card-pad: 1rem; }
.stat > * + * { margin-top: 0.25rem; }
.stat-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
}
.stat-value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.stat-value.font-mono { font-family: var(--font-mono); font-size: 1.375rem; letter-spacing: -0.01em; }
.stat-note { font-size: 0.75rem; color: var(--muted); }
.stat-danger { border-top: 3px solid var(--danger); }
.stat-danger .stat-label { color: var(--danger-strong); }
.stat-success { border-top: 3px solid var(--success); }
.stat-success .stat-label { color: var(--success-strong); }

/* Table details. */
.reason-cell { min-width: 15rem; max-width: 22rem; }
tr.is-recovered td { color: var(--muted); }
tr.is-recovered td .font-medium { color: var(--ink); }
.payment-id {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.25rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--muted);
  text-decoration: none;
}
.payment-id:hover { color: var(--accent-text); text-decoration: underline; }
.icon-xs { width: 0.75rem; height: 0.75rem; }
.empty-ok { background: var(--success-soft); color: var(--success-strong); }

/* Failure reasons: a native <progress> per reason. */
.reasons { display: flex; flex-direction: column; gap: 0.875rem; }
.reason-bar {
  display: block;
  width: 100%;
  height: 0.375rem;
  margin-top: 0.375rem;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  appearance: none;
  background: var(--surface-2);
}
.reason-bar::-webkit-progress-bar { background: var(--surface-2); border-radius: 999px; }
.reason-bar::-webkit-progress-value { background: var(--danger); border-radius: 999px; }
.reason-bar::-moz-progress-bar { background: var(--danger); border-radius: 999px; }

/* Refresh: fade the panel while it reloads. */
#failures.htmx-request { opacity: 0.55; transition: opacity 200ms; }
