/* Hermes shared components. Flat: solid fills, 1px borders, one small shadow on cards.
   No gradients, no blur, no glass. Load after tokens.css. */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; background: var(--page); color: var(--ink); }
body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; }
h1, h2, h3 { text-wrap: balance; margin: 0; font-weight: 500; }
p { margin: 0; }
code, pre { font-family: var(--font-mono); font-size: 12.5px; }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.nowrap { white-space: nowrap; }

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, [tabindex]:focus-visible, summary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(17, 18, 19, 0.35);
  border-radius: var(--radius-control);
}

.kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

/* ---- card ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
  padding: var(--space-5);
  min-width: 0;
}
.card--flush { padding: 0; }
.card--raised { background: var(--surface-raised); box-shadow: none; }
.card-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3);
  margin-bottom: var(--space-4); flex-wrap: wrap;
}
.card--flush .card-head { padding: var(--space-5) var(--space-5) 0; }
.card-title { font-family: var(--font-serif); font-size: 19px; font-weight: 500; line-height: 1.25; }
.card-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 14px/1 var(--font-sans);
  padding: 10px 16px;
  border-radius: var(--radius-control);
  border: 1px solid transparent;
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur-fast) var(--ease);
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn--sm { padding: 7px 12px; font-size: 13px; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-raised); border-color: var(--divider); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-raised); color: var(--ink); }
.btn-danger { background: var(--surface); color: var(--negative-ink); border-color: var(--border); }
.btn-danger:hover:not(:disabled) { background: var(--negative-soft); border-color: var(--negative); }

/* ---- badge, dot, pill ---- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font: 600 11.5px/1 var(--font-sans);
  padding: 4px 9px;
  border-radius: var(--radius-pill);
  background: var(--surface-raised);
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.badge svg { width: 11px; height: 11px; }
.badge--positive { background: var(--positive-soft); color: var(--positive-ink); }
.badge--warning { background: var(--warning-soft); color: var(--warning-ink); }
.badge--negative { background: var(--negative-soft); color: var(--negative-ink); }
.badge--ink { background: var(--accent); color: var(--on-accent); }
.badge--outline { background: transparent; border: 1px solid var(--border); color: var(--muted); }

.dot { width: 8px; height: 8px; border-radius: var(--radius-pill); display: inline-block; flex-shrink: 0; background: var(--faint); }
.dot--positive { background: var(--positive); }
.dot--warning { background: var(--warning); }
.dot--negative { background: var(--negative); }
.dot--ink { background: var(--ink); }

.pill {
  display: inline-flex; align-items: center; gap: 8px;
  font: 500 13.5px/1 var(--font-sans);
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--border);
  cursor: pointer; text-decoration: none;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur-fast) var(--ease);
}
.pill:hover { background: var(--surface-raised); border-color: var(--divider); }
.pill:active { transform: scale(0.96); }
.pill.is-active { background: var(--accent-soft); border-color: var(--accent); font-weight: 600; }
.pill .count { color: var(--muted); font-variant-numeric: tabular-nums; }
.pill-row { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }

/* ---- table ---- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.table thead th {
  font: 500 11px/1.2 var(--font-mono);
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--divider);
  white-space: nowrap;
  background: var(--surface);
}
.table tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--dur) var(--ease); }
.table tbody tr:hover { background: var(--surface-raised); }
.table .num { text-align: right; }
.table tr.is-link { cursor: pointer; }

/* ---- forms ---- */
.input, .select, .textarea {
  width: 100%;
  font: 14px var(--font-sans); color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  padding: 9px 12px; outline: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.textarea { min-height: 80px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(17, 18, 19, 0.18); }
.select {
  appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236E6E6B' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 14px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font: 500 11px/1.2 var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.vh { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---- modal, toast ---- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(17, 18, 19, 0.38);
  display: none; align-items: center; justify-content: center; padding: 24px;
}
.modal-backdrop.is-open { display: flex; }
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card);
  box-shadow: 0 8px 28px rgba(17, 18, 19, 0.16);
  width: 100%; max-width: 520px; max-height: calc(100dvh - 48px);
  display: flex; flex-direction: column; overflow: hidden;
}
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-title { font-family: var(--font-serif); font-size: 19px; font-weight: 500; }
.modal-body { padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--border); }
.toast-host { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--muted);
  border-radius: var(--radius-control); box-shadow: var(--shadow-hover);
  padding: 12px 16px; font-size: 14px; max-width: 380px;
}
.toast--positive { border-left-color: var(--positive); }
.toast--negative { border-left-color: var(--negative); }

/* ---- skeleton ---- */
.skeleton { display: block; background: var(--surface-raised); border-radius: var(--radius-control); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ---- details / json ---- */
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
.json {
  margin: 0; padding: 12px 14px;
  background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius-control);
  overflow-x: auto; white-space: pre; line-height: 1.55; color: var(--ink); max-height: 360px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
