/* Symphora components. Vanilla CSS, BEM-ish names, no JS required to render.
   Pair with tokens.css. Class set is intentionally small. */

/* ====== Typography ======================================================= */
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.015em; line-height: 1.2; }
h1 { font-size: var(--t-2xl); letter-spacing: -0.02em; }
h2 { font-size: var(--t-xl); }
h3 { font-size: var(--t-lg); }
h4 { font-size: var(--t-md); }
p  { margin: 0; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.1em;
  color: var(--ink-3);
  text-transform: uppercase;
}

.display {
  font-size: var(--t-3xl);
  letter-spacing: -0.025em;
  line-height: 1.05;
  font-weight: 600;
}

/* ====== Buttons ========================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px;
  background: var(--paper); color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-size: var(--t-base); font-weight: 500;
  white-space: nowrap;
  transition: background .15s var(--ease), border-color .15s var(--ease), transform .12s var(--ease);
}
.btn:hover { background: var(--paper-2); border-color: var(--ink-4); }
.btn:active { transform: translateY(0.5px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn--primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn--primary:hover { background: var(--ink-2); border-color: var(--ink-2); }

.btn--accent { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn--accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn--ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn--ghost:hover { background: var(--paper-2); color: var(--ink); }

.btn--danger { background: var(--bad); color: white; border-color: var(--bad); }

.btn--lg { height: 40px; padding: 0 18px; font-size: var(--t-md); border-radius: var(--r-md); }
.btn--sm { height: 26px; padding: 0 10px; font-size: var(--t-sm); border-radius: var(--r-sm); }
.btn--icon { width: 32px; padding: 0; }

/* ====== Inputs =========================================================== */
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: var(--t-sm); font-weight: 500; color: var(--ink-2); }
.field__hint  { font-size: var(--t-xs); color: var(--ink-3); }
.field__error { font-size: var(--t-xs); color: var(--bad-ink); }

.input, .select, .textarea {
  width: 100%;
  height: 36px; padding: 0 12px;
  background: var(--paper); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-md);
  font-size: var(--t-base); line-height: 1.4;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.input:hover, .select:hover { border-color: var(--ink-4); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-4); }
.textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 80px; }

.select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%237a7e88' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 12px;
  padding-right: 30px;
}

.input--lg { height: 44px; font-size: var(--t-md); padding: 0 14px; }

/* Search input */
.search {
  position: relative; display: flex; align-items: center;
  height: 32px;
  background: var(--paper-2); border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 0 10px; gap: 8px;
  color: var(--ink-3);
}
.search input {
  flex: 1; background: transparent; border: 0; outline: none;
  font-size: var(--t-base); color: var(--ink);
  height: 100%;
}
.search input::placeholder { color: var(--ink-4); }
.search__kbd {
  font-family: var(--font-mono); font-size: var(--t-xs);
  padding: 2px 6px; background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r-sm); color: var(--ink-3);
}

/* ====== Card ============================================================= */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  overflow: hidden;
}
.card__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--line-2);
  gap: var(--s-3);
}
.card__title { font-size: var(--t-md); font-weight: 600; }
.card__body { padding: var(--s-4); }
.card__foot {
  padding: var(--s-3) var(--s-4);
  border-top: 1px solid var(--line-2);
  font-size: var(--t-sm); color: var(--ink-2);
}

/* ====== Status: dots, tags, meters ======================================= */
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 99px; background: var(--ink-3); flex-shrink: 0; }
.dot--good { background: var(--good); }
.dot--warn { background: var(--warn); }
.dot--bad  { background: var(--bad); }
.dot--accent { background: var(--accent); }
.dot--lg { width: 8px; height: 8px; }

.tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: var(--t-xs); font-weight: 500;
  padding: 2px 8px;
  background: var(--paper-3); color: var(--ink-2);
  border-radius: var(--r-full);
  line-height: 1.4;
  white-space: nowrap;
}
.tag--good { background: var(--good-soft); color: var(--good-ink); }
.tag--warn { background: var(--warn-soft); color: var(--warn-ink); }
.tag--bad  { background: var(--bad-soft); color: var(--bad-ink); }
.tag--accent { background: var(--accent-soft); color: var(--accent-ink); }
.tag--outline { background: transparent; border: 1px solid var(--line); color: var(--ink-2); }

.status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--t-sm); color: var(--ink-2);
}

.meter {
  display: inline-flex; align-items: center; gap: 8px;
}
.meter__track {
  height: 4px; width: 80px;
  background: var(--paper-3); border-radius: 99px; overflow: hidden;
}
.meter__fill {
  height: 100%; background: var(--ink-2);
  transition: width .25s var(--ease);
}
.meter__fill--good { background: var(--good); }
.meter__fill--warn { background: var(--warn); }
.meter__value { font-family: var(--font-mono); font-size: var(--t-xs); color: var(--ink-2); }

/* ====== Avatar =========================================================== */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border-radius: 99px;
  background: var(--paper-3); color: var(--ink-2);
  font-size: var(--t-xs); font-weight: 600;
  flex-shrink: 0;
}
.avatar--sm { width: 22px; height: 22px; font-size: 10px; }
.avatar--lg { width: 36px; height: 36px; font-size: var(--t-sm); }
.avatar--xl { width: 56px; height: 56px; font-size: var(--t-lg); }
.avatar--ring { box-shadow: 0 0 0 2px var(--paper); }
.avatar-stack { display: inline-flex; }
.avatar-stack > .avatar { box-shadow: 0 0 0 2px var(--paper); }
.avatar-stack > .avatar + .avatar { margin-left: -8px; }

/* Avatar tones — categorical, low-saturation */
.avatar[data-tone="1"] { background: oklch(0.85 0.05 230); color: oklch(0.32 0.1 230); }
.avatar[data-tone="2"] { background: oklch(0.85 0.05 155); color: oklch(0.32 0.1 155); }
.avatar[data-tone="3"] { background: oklch(0.87 0.06 75);  color: oklch(0.35 0.1 75);  }
.avatar[data-tone="4"] { background: oklch(0.85 0.06 25);  color: oklch(0.35 0.1 25);  }
.avatar[data-tone="5"] { background: oklch(0.85 0.05 295); color: oklch(0.32 0.1 295); }
.avatar[data-tone="6"] { background: oklch(0.85 0.05 195); color: oklch(0.32 0.1 195); }
.avatar[data-tone="7"] { background: oklch(0.85 0.05 350); color: oklch(0.32 0.1 350); }

/* ====== Tables =========================================================== */
.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--paper);
  overflow: hidden;
}
.table {
  width: 100%; border-collapse: collapse;
  font-size: var(--t-base);
}
.table thead th {
  text-align: left;
  padding: var(--s-3) var(--s-4);
  font-size: var(--t-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table tbody td {
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--line-2);
  color: var(--ink);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--paper-2); }
.table--compact thead th, .table--compact tbody td { padding: 6px var(--s-3); }

.col-id { font-family: var(--font-mono); font-size: var(--t-xs); color: var(--ink-3); }
.col-num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; }
.col-actions { width: 1%; white-space: nowrap; text-align: right; }

/* Identity cell: avatar + name + secondary id/email */
.identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.identity__main { display: flex; flex-direction: column; min-width: 0; }
.identity__name { font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.identity__meta { font-family: var(--font-mono); font-size: 10px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Tabs (saved views) */
.tabs {
  display: flex; align-items: flex-end; gap: 2px;
  border-bottom: 1px solid var(--line);
}
.tabs__item {
  padding: 8px 14px;
  font-size: var(--t-base); font-weight: 500;
  color: var(--ink-2);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  display: inline-flex; align-items: center; gap: 8px;
  white-space: nowrap;
}
.tabs__item:hover { color: var(--ink); }
.tabs__item[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }
.tabs__count { font-family: var(--font-mono); font-size: 10px; color: var(--ink-3); }

/* ====== Toolbar ========================================================== */
.toolbar {
  display: flex; align-items: center; gap: var(--s-2);
  flex-wrap: wrap;
}
.toolbar > .spacer { flex: 1; }

/* Segmented control */
.seg {
  display: inline-flex; gap: 0; padding: 2px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.seg__item {
  padding: 5px 10px;
  border-radius: var(--r-sm);
  font-size: var(--t-sm); font-weight: 500;
  color: var(--ink-2);
}
.seg__item[aria-pressed="true"] {
  background: var(--paper); color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* ====== Lists & rows ===================================================== */
.row {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--line-2);
}
.row:last-child { border-bottom: 0; }
.row--clickable { cursor: pointer; transition: background .15s var(--ease); }
.row--clickable:hover { background: var(--paper-2); }

/* Stat strip — one bar with deltas */
.stat-strip {
  display: flex; align-items: stretch;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r-xl); overflow: hidden;
}
.stat-strip > .stat { flex: 1; padding: var(--s-3) var(--s-4); border-right: 1px solid var(--line-2); }
.stat-strip > .stat:last-child { border-right: 0; }
.stat__label { font-size: var(--t-xs); font-weight: 500; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; }
.stat__value {
  display: flex; align-items: baseline; gap: 8px; margin-top: 4px;
  font-size: var(--t-xl); font-weight: 600; letter-spacing: -0.01em;
}
.stat__delta { font-family: var(--font-mono); font-size: var(--t-xs); color: var(--ink-3); font-weight: 400; }
.stat__delta--good { color: var(--good-ink); }
.stat__delta--bad  { color: var(--bad-ink); }

/* ====== Empty & loading ================================================== */
.empty {
  padding: var(--s-7) var(--s-5); text-align: center;
  color: var(--ink-3); font-size: var(--t-sm);
}
.empty__title { color: var(--ink); font-size: var(--t-md); font-weight: 600; margin-bottom: 4px; }
.skeleton {
  background: linear-gradient(90deg, var(--paper-2) 0%, var(--paper-3) 50%, var(--paper-2) 100%);
  background-size: 200% 100%;
  animation: skeleton 1.4s var(--ease) infinite;
  border-radius: var(--r-sm);
}
@keyframes skeleton { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ====== Toasts =========================================================== */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--ink); color: var(--paper);
  padding: 10px 14px; border-radius: var(--r-md);
  font-size: var(--t-sm);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  display: flex; align-items: center; gap: 8px;
  animation: toast-in .2s var(--ease);
}
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ====== Wordmark ========================================================= */
.wordmark {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.025em;
  color: var(--ink);
  display: inline-flex; align-items: baseline; gap: 0;
}
.wordmark::after {
  content: '.';
  color: var(--accent);
  font-weight: 600;
}
.wordmark--lg { font-size: var(--t-xl); }
.wordmark--xl { font-size: var(--t-2xl); }

/* ====== Charts (lightweight CSS sparkline) =============================== */
.spark {
  display: flex; align-items: flex-end; gap: 3px;
  height: 36px;
}
.spark__bar {
  flex: 1; min-width: 2px;
  background: var(--ink-2);
  border-radius: 1px 1px 0 0;
}
.spark__bar--accent { background: var(--accent); }
.spark__bar--warn { background: var(--warn); }
.spark__bar--bad { background: var(--bad); }

/* Bar comparison (stacked horizontal) */
.stack-bar {
  display: flex; height: 8px; border-radius: 99px;
  overflow: hidden; background: var(--paper-3);
}
.stack-bar > span { display: block; }

/* ====== Responsive helpers =============================================== */
.grid { display: grid; gap: var(--s-4); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) {
  .grid--4, .grid--3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .grid--4, .grid--3, .grid--2 { grid-template-columns: 1fr; }
}

.stack { display: flex; flex-direction: column; gap: var(--s-3); }
.row-flex { display: flex; align-items: center; gap: var(--s-3); }

/* ====== Containers ======================================================= */
.page {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--s-5) var(--s-6);
}
@media (max-width: 720px) { .page { padding: var(--s-4); } }

.page__head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: var(--s-5); gap: var(--s-4); flex-wrap: wrap;
}
.page__title { font-size: var(--t-2xl); font-weight: 600; letter-spacing: -0.02em; margin: 4px 0 0; }
.page__sub { font-size: var(--t-base); color: var(--ink-2); margin-top: 2px; }
