/* SwissPay — design tokens */
@import url("https://fonts.googleapis.com/css2?family=Inter+Tight:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap");

:root {
  /* Type */
  --font-sans:
    "Inter Tight", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;

  /* Surfaces — warm off-white & true black */
  --bg: #fafaf7;
  --bg-elev: #ffffff;
  --bg-sunken: #f4f3ee;
  --ink: #0a0a0a;
  --ink-2: #2a2a28;
  --ink-3: #5c5c58;
  --ink-4: #8e8e88;
  --ink-5: #b8b8b2;
  --hairline: #e6e5df;
  --hairline-strong: #d4d2ca;

  /* Accent — Swiss red */
  --accent-h: 27;
  --accent-c: 0.21;
  --accent-l: 0.58;
  --accent: oklch(var(--accent-l) var(--accent-c) var(--accent-h));
  --accent-ink: oklch(0.42 0.2 var(--accent-h));
  --accent-soft: oklch(0.96 0.04 var(--accent-h));
  --accent-fg: #ffffff;

  /* Semantic */
  --ok: oklch(0.58 0.14 150);
  --ok-soft: oklch(0.96 0.04 150);
  --warn: oklch(0.72 0.16 75);
  --warn-soft: oklch(0.96 0.05 75);
  --err: oklch(0.58 0.21 27);
  --err-soft: oklch(0.96 0.04 27);
  --info: oklch(0.58 0.14 240);
  --info-soft: oklch(0.96 0.04 240);

  /* Density (overridden by Tweaks) */
  --row-h: 44px;
  --pad-x: 16px;
  --pad-y: 12px;
  --gap: 16px;

  /* Radii — sharp swiss */
  --r-0: 0px;
  --r-1: 2px;
  --r-2: 4px;

  /* Sidebar */
  --side-w: 232px;
}

[data-density="compact"] {
  --row-h: 36px;
  --pad-x: 12px;
  --pad-y: 8px;
  --gap: 12px;
}

* {
  box-sizing: border-box;
}
html,
body,
#root,
#react-root {
  height: 100%;
  margin: 0;
  padding: 0;
}
body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
a {
  color: inherit;
}

/* Mono numerals */
.mono,
.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: var(--hairline-strong);
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-track {
  background: transparent;
}

/* ----- Layout ----- */
.app {
  display: grid;
  grid-template-columns: var(--side-w) 1fr;
  height: 100vh;
  overflow: hidden;
}
.app[data-sidebar="icon"] {
  --side-w: 56px;
}
.app[data-sidebar="top"] {
  grid-template-columns: 1fr;
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}
.content {
  flex: 1;
  overflow: auto;
  padding: 32px 40px 64px;
}
[data-density="compact"] .content {
  padding: 24px 32px 48px;
}

/* ----- Sidebar ----- */
.sidebar {
  background: var(--bg-elev);
  border-right: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sidebar-brand {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border-bottom: 1px solid var(--hairline);
  font-weight: 600;
  letter-spacing: -0.02em;
  font-size: 15px;
}
.brand-mark {
  width: 22px;
  height: 22px;
  background: var(--ink);
  color: var(--bg-elev);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 12px;
  flex-shrink: 0;
  position: relative;
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(var(--accent), var(--accent)) center/8px 2px no-repeat,
    linear-gradient(var(--accent), var(--accent)) center/2px 8px no-repeat;
}
.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow: auto;
}
.nav-section {
  margin-bottom: 14px;
}
.nav-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-4);
  padding: 8px 12px 6px;
  font-weight: 500;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--r-1);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  user-select: none;
  position: relative;
}
.nav-item:hover {
  background: var(--bg-sunken);
}
.nav-item[aria-current="page"] {
  color: var(--ink);
  background: var(--bg-sunken);
}
.nav-item[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--accent);
}
.nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--ink-3);
}
.nav-item[aria-current="page"] .nav-icon {
  color: var(--ink);
}
.nav-badge {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-4);
}

.app[data-sidebar="icon"] .sidebar-brand span,
.app[data-sidebar="icon"] .nav-label,
.app[data-sidebar="icon"] .nav-item span:not(.nav-badge),
.app[data-sidebar="icon"] .nav-badge,
.app[data-sidebar="icon"] .sidebar-foot {
  display: none;
}
.app[data-sidebar="icon"] .sidebar-brand {
  justify-content: center;
  padding: 0;
}
.app[data-sidebar="icon"] .nav-item {
  justify-content: center;
  padding: 10px;
}

.sidebar-foot {
  border-top: 1px solid var(--hairline);
  padding: 12px;
  font-size: 12px;
  color: var(--ink-3);
}
.env-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border: 1px solid var(--hairline-strong);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.env-pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
}
.env-pill[data-env="live"] .dot {
  background: var(--accent);
}
.env-pill[data-env="test"] {
  color: oklch(0.42 0.12 75);
}
.env-pill[data-env="test"] .dot {
  background: oklch(0.62 0.18 75);
}

/* ----- Top sidebar variant ----- */
.app[data-sidebar="top"] .sidebar {
  border-right: none;
  border-bottom: 1px solid var(--hairline);
  flex-direction: row;
  height: 56px;
  align-items: center;
}
.app[data-sidebar="top"] .sidebar-brand {
  border-bottom: none;
  border-right: 1px solid var(--hairline);
}
.app[data-sidebar="top"] .sidebar-nav {
  display: flex;
  padding: 0 8px;
  gap: 2px;
  flex: 1;
}
.app[data-sidebar="top"] .nav-section {
  display: contents;
}
.app[data-sidebar="top"] .nav-label {
  display: none;
}
.app[data-sidebar="top"] .nav-item {
  width: auto;
  padding: 8px 12px;
}
.app[data-sidebar="top"] .nav-item[aria-current="page"]::before {
  left: 8px;
  right: 8px;
  top: auto;
  bottom: -1px;
  width: auto;
  height: 2px;
}
.app[data-sidebar="top"] .nav-badge {
  display: none;
}
.app[data-sidebar="top"] .sidebar-foot {
  border-top: none;
  border-left: 1px solid var(--hairline);
  padding: 0 16px;
  height: 100%;
  display: flex;
  align-items: center;
}
.app[data-sidebar="top"] {
  grid-template-rows: 56px 1fr;
}
.app[data-sidebar="top"] .sidebar {
  grid-column: 1 / -1;
}

/* ----- Topbar ----- */
.topbar {
  height: 56px;
  border-bottom: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 32px;
  background: var(--bg-elev);
  flex-shrink: 0;
}
.crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-3);
}
.crumbs strong {
  color: var(--ink);
  font-weight: 600;
}
.crumbs .sep {
  color: var(--ink-5);
}
.topbar-spacer {
  flex: 1;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ----- Page header ----- */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 24px;
}
.page-title {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.025em;
  margin: 0 0 4px;
  line-height: 1.1;
}
.page-sub {
  color: var(--ink-3);
  font-size: 13px;
  margin: 0;
}
.page-actions {
  display: flex;
  gap: 8px;
}

/* ----- Buttons ----- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--hairline-strong);
  background: var(--bg-elev);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--r-1);
  white-space: nowrap;
  transition:
    border-color 0.12s,
    background 0.12s;
}
.btn:hover {
  border-color: var(--ink);
}
.btn-primary {
  background: var(--ink);
  color: var(--bg-elev);
  border-color: var(--ink);
}
.btn-primary:hover {
  background: var(--ink-2);
  border-color: var(--ink-2);
}
.btn-accent {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}
.btn-accent:hover {
  filter: brightness(0.92);
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--bg-sunken);
  border-color: transparent;
}
.btn-sm {
  height: 26px;
  padding: 0 8px;
  font-size: 12px;
}
.btn-icon {
  width: 32px;
  padding: 0;
  justify-content: center;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ----- Inputs ----- */
.input,
.select {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--hairline-strong);
  background: var(--bg-elev);
  border-radius: var(--r-1);
  font-size: 13px;
  outline: none;
  transition:
    border-color 0.12s,
    box-shadow 0.12s;
  width: 100%;
}
.input:focus,
.select:focus,
textarea.input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px var(--bg-sunken);
}
.input.error {
  border-color: var(--err);
}
textarea.input {
  height: auto;
  padding: 8px 10px;
  resize: vertical;
  min-height: 72px;
  line-height: 1.5;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field label {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
}
.field .hint {
  font-size: 11px;
  color: var(--ink-4);
}
.field .err {
  font-size: 11px;
  color: var(--err);
}
.input-group {
  display: flex;
  align-items: center;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-1);
  background: var(--bg-elev);
}
.input-group:focus-within {
  border-color: var(--ink);
}
.input-group .prefix,
.input-group .suffix {
  padding: 0 10px;
  color: var(--ink-4);
  font-size: 13px;
  border-right: 1px solid var(--hairline);
}
.input-group .suffix {
  border-right: none;
  border-left: 1px solid var(--hairline);
}
.input-group input {
  border: none;
  flex: 1;
  height: 32px;
  padding: 0 10px;
  outline: none;
  background: transparent;
}

.search {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--hairline-strong);
  background: var(--bg-elev);
  border-radius: var(--r-1);
  width: 280px;
}
.search input {
  border: none;
  outline: none;
  flex: 1;
  background: transparent;
  font-size: 13px;
}
.search:focus-within {
  border-color: var(--ink);
}
.kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-4);
  border: 1px solid var(--hairline);
  padding: 1px 5px;
  border-radius: 2px;
  background: var(--bg-sunken);
}

/* ----- Cards ----- */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--hairline);
  border-radius: var(--r-1);
}
.card-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}
.card-sub {
  font-size: 12px;
  color: var(--ink-3);
  margin: 2px 0 0;
}
.card-body {
  padding: 18px;
}
.card-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--hairline);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--ink-3);
}

/* ----- KPI tiles ----- */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  border: 1px solid var(--hairline);
  background: var(--bg-elev);
  border-radius: var(--r-1);
  margin-bottom: 24px;
}
@media (max-width: 1100px) {
  .kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .kpi:nth-child(2) {
    border-right: none;
  }
  .kpi:nth-child(-n + 2) {
    border-bottom: 1px solid var(--hairline);
  }
}
.kpi {
  padding: 18px 20px;
  border-right: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  min-width: 0;
}
.kpi:last-child {
  border-right: none;
}
.kpi-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kpi-value {
  font-family: var(--font-mono);
  font-size: clamp(18px, 1.5vw, 24px);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.kpi-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-3);
}
.delta {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
}
.delta.up {
  color: var(--ok);
}
.delta.down {
  color: var(--err);
}
.spark {
  height: 28px;
  margin-top: 4px;
}

/* ----- Table ----- */
.table-wrap {
  background: var(--bg-elev);
  border: 1px solid var(--hairline);
  border-radius: var(--r-1);
  overflow: hidden;
}
.table-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--hairline);
  background: var(--bg-elev);
  flex-wrap: wrap;
}
.table-toolbar .spacer {
  flex: 1;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table thead th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  font-weight: 500;
  padding: 10px 14px;
  border-bottom: 1px solid var(--hairline);
  background: var(--bg-sunken);
  white-space: nowrap;
  user-select: none;
}
.table thead th.sortable {
  cursor: pointer;
}
.table thead th.sortable:hover {
  color: var(--ink);
}
.table tbody td {
  padding: 0 14px;
  height: var(--row-h);
  border-bottom: 1px solid var(--hairline);
  vertical-align: middle;
  white-space: nowrap;
}
.table tbody tr {
  cursor: pointer;
}
.table tbody tr:hover {
  background: var(--bg-sunken);
}
.table tbody tr:last-child td {
  border-bottom: none;
}
.table .num {
  text-align: right;
}
.table .ellipsis {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.table-empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--ink-3);
  font-size: 13px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-top: 1px solid var(--hairline);
  font-size: 12px;
  color: var(--ink-3);
}
.pagination .pages {
  display: flex;
  gap: 4px;
}
.page-btn {
  width: 26px;
  height: 26px;
  border: 1px solid var(--hairline);
  background: var(--bg-elev);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-family: var(--font-mono);
  border-radius: var(--r-1);
}
.page-btn[aria-current="page"] {
  background: var(--ink);
  color: var(--bg-elev);
  border-color: var(--ink);
}
.page-btn:disabled {
  opacity: 0.4;
}

/* ----- Status badges ----- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: var(--r-1);
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge .ind {
  width: 5px;
  height: 5px;
  border-radius: 50%;
}
.badge.success {
  background: var(--ok-soft);
  color: oklch(0.36 0.1 150);
}
.badge.success .ind {
  background: var(--ok);
}
.badge.warn {
  background: var(--warn-soft);
  color: oklch(0.42 0.13 75);
}
.badge.warn .ind {
  background: var(--warn);
}
.badge.err {
  background: var(--err-soft);
  color: var(--accent-ink);
}
.badge.err .ind {
  background: var(--err);
}
.badge.info {
  background: var(--info-soft);
  color: oklch(0.36 0.12 240);
}
.badge.info .ind {
  background: var(--info);
}
.badge.neutral {
  background: var(--bg-sunken);
  color: var(--ink-3);
  border-color: var(--hairline);
}
.badge.neutral .ind {
  background: var(--ink-4);
}

/* ----- Filters ----- */
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border: 1px dashed var(--hairline-strong);
  border-radius: var(--r-1);
  font-size: 12px;
  background: var(--bg-elev);
  color: var(--ink-3);
}
.filter-chip.active {
  border-style: solid;
  border-color: var(--ink);
  color: var(--ink);
}
.filter-chip .x {
  color: var(--ink-4);
  margin-left: 4px;
}
.filter-chip .x:hover {
  color: var(--ink);
}

/* ----- Drawer / Modal ----- */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.4);
  z-index: 90;
  animation: fadein 0.15s ease;
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 540px;
  max-width: 96vw;
  background: var(--bg);
  border-left: 1px solid var(--hairline);
  z-index: 100;
  display: flex;
  flex-direction: column;
  animation: slidein 0.2s ease;
}
.drawer-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--hairline);
  background: var(--bg-elev);
  flex-shrink: 0;
}
.drawer-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}
.drawer-body {
  flex: 1;
  overflow: auto;
  padding: 20px;
}
.drawer-foot {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 20px;
  border-top: 1px solid var(--hairline);
  background: var(--bg-elev);
  flex-shrink: 0;
}
.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 480px;
  max-width: 96vw;
  background: var(--bg-elev);
  border: 1px solid var(--hairline);
  border-radius: var(--r-1);
  z-index: 100;
  animation: pop 0.15s ease;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.18);
}
@keyframes fadein {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes slidein {
  from {
    transform: translateX(20px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}
@keyframes pop {
  from {
    transform: translate(-50%, -48%);
    opacity: 0;
  }
  to {
    transform: translate(-50%, -50%);
    opacity: 1;
  }
}

/* ----- Toast ----- */
.toast-stack {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
}
.toast {
  background: var(--ink);
  color: var(--bg-elev);
  padding: 10px 14px;
  border-radius: var(--r-1);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 240px;
  animation: slidein 0.2s ease;
}
.toast.success {
  border-left: 3px solid var(--ok);
}
.toast.err {
  border-left: 3px solid var(--accent);
}

/* ----- Empty state ----- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 64px 24px;
  color: var(--ink-3);
}
.empty-mark {
  width: 40px;
  height: 40px;
  border: 1px dashed var(--hairline-strong);
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  color: var(--ink-4);
}
.empty h4 {
  color: var(--ink);
  margin: 0 0 6px;
  font-size: 14px;
}
.empty p {
  margin: 0;
  font-size: 13px;
  max-width: 340px;
}

/* ----- Tabs ----- */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 24px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar {
  display: none;
}
.tab {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
  border: none;
  background: transparent;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  line-height: 1.2;
}
.tab[aria-selected="true"] {
  color: var(--ink);
  border-bottom-color: var(--ink);
}
.tab:hover {
  color: var(--ink);
}

/* ----- Misc ----- */
.divider {
  height: 1px;
  background: var(--hairline);
  margin: 24px 0;
}
.row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.grid-2-1 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}
.muted {
  color: var(--ink-3);
}
.dim {
  color: var(--ink-4);
}
.tag-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-sunken);
  border: 1px solid var(--hairline);
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-2);
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.method-icon {
  width: 28px;
  height: 18px;
  border: 1px solid var(--hairline);
  border-radius: 2px;
  display: inline-grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink-2);
  background: var(--bg-elev);
  flex-shrink: 0;
}
.method-icon.visa {
  color: #1a1f71;
}
.method-icon.mc {
  color: #eb001b;
}
.method-icon.amex {
  color: #006fcf;
}
.method-icon.twint {
  color: #000;
}
.method-icon.paypal {
  color: #003087;
}
.method-icon.sepa {
  color: #10298e;
}

/* hosted checkout */
.checkout-stage {
  background: var(--bg-sunken);
  min-height: 100%;
  padding: 48px 16px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.checkout {
  width: 100%;
  max-width: 920px;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 0;
  background: var(--bg-elev);
  border: 1px solid var(--hairline);
  border-radius: var(--r-1);
  overflow: hidden;
}

/* keyboard focus rings */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* checkbox */
.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}
.check input {
  width: 14px;
  height: 14px;
  accent-color: var(--ink);
}

/* code block */
.code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--ink);
  color: #e6e5df;
  padding: 14px 16px;
  border-radius: var(--r-1);
  overflow-x: auto;
  line-height: 1.6;
  white-space: pre;
}
.code .k {
  color: oklch(0.78 0.16 27);
}
.code .s {
  color: oklch(0.82 0.14 150);
}
.code .c {
  color: var(--ink-4);
}

/* segmented */
.seg {
  display: inline-flex;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-1);
  overflow: hidden;
  height: 28px;
}
.seg button {
  border: none;
  background: var(--bg-elev);
  padding: 0 12px;
  font-size: 12px;
  color: var(--ink-3);
  border-right: 1px solid var(--hairline-strong);
}
.seg button:last-child {
  border-right: none;
}
.seg button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg-elev);
}

/* progress */
.progress {
  height: 4px;
  background: var(--bg-sunken);
  overflow: hidden;
  border-radius: 2px;
}
.progress > span {
  display: block;
  height: 100%;
  background: var(--ink);
}

/* stepper */
.stepper {
  display: flex;
  gap: 0;
}
.step {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}
.step-num {
  width: 22px;
  height: 22px;
  border: 1px solid var(--hairline-strong);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-elev);
  flex-shrink: 0;
}
.step.done .step-num {
  background: var(--ink);
  color: var(--bg-elev);
  border-color: var(--ink);
}
.step.current .step-num {
  border-color: var(--ink);
  color: var(--ink);
}
.step-label {
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 500;
}
.step.done .step-label,
.step.current .step-label {
  color: var(--ink);
}
.step-line {
  flex: 1;
  height: 1px;
  background: var(--hairline-strong);
  margin: 0 12px;
}
.step.done + .step .step-line {
  background: var(--ink);
}
