/* Gather — minimalist, professional design system.
   Palette: warm stone background, teal accent, mono numerals for data. */

:root {
  --bg: #FAFAF9;
  --surface: #FFFFFF;
  --ink: #1C1917;
  --muted: #57534E;
  --faint: #A8A29E;
  --line: #E7E5E4;
  --line-strong: #D6D3D1;
  --accent: #0F766E;
  --accent-hover: #0B5D56;
  --accent-soft: #F0FDFA;
  --success: #15803D;
  --danger: #B91C1C;
  --danger-soft: #FEF2F2;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(28, 25, 23, 0.04), 0 1px 3px rgba(28, 25, 23, 0.06);
  --container: 1080px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

h1, h2, h3 { line-height: 1.2; margin: 0; font-weight: 650; letter-spacing: -0.01em; }
p { margin: 0 0 1rem; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 24px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.hidden { display: none !important; }

/* Eyebrow label — used to encode section meaning, not decorate. */
.eyebrow {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
  color: var(--accent);
}

/* ---- Top bar ---- */
.topbar {
  border-bottom: 1px solid var(--line);
  background: rgba(250, 250, 249, 0.85);
  backdrop-filter: saturate(140%) blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.topbar .inner {
  display: flex; align-items: center; gap: 24px;
  height: 60px;
}
.brand {
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 680; font-size: 1.05rem; color: var(--ink); letter-spacing: -0.02em;
}
.brand:hover { color: var(--ink); }
.brand .mark {
  width: 22px; height: 22px; border-radius: 6px;
  background: var(--accent);
  position: relative; flex: none;
}
.brand .mark::after {
  content: ""; position: absolute; inset: 6px 6px auto 6px; height: 2px;
  background: var(--accent-soft); border-radius: 2px;
  box-shadow: 0 4px 0 var(--accent-soft), 0 8px 0 var(--accent-soft);
}
.topbar nav { margin-left: auto; display: flex; align-items: center; gap: 20px; }
.topbar nav a { color: var(--muted); font-size: 0.92rem; }
.topbar nav a:hover { color: var(--ink); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-size: 0.92rem; font-weight: 550;
  padding: 9px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  cursor: pointer; transition: background 0.12s, border-color 0.12s, color 0.12s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--faint); background: #FCFCFB; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-danger { color: var(--danger); border-color: #F1D4D4; background: var(--danger-soft); }
.btn-danger:hover { background: #FCE8E8; border-color: #E7B9B9; color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); padding-left: 8px; padding-right: 8px; }
.btn-ghost:hover { background: #F4F2F0; color: var(--ink); }
.btn-sm { padding: 6px 11px; font-size: 0.85rem; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn-block { width: 100%; }

/* ---- Cards & surfaces ---- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-pad { padding: 22px 24px; }

/* ---- Forms ---- */
label.field { display: block; margin-bottom: 16px; }
label.field > span {
  display: block; font-size: 0.82rem; font-weight: 580; color: var(--ink);
  margin-bottom: 6px;
}
label.field .hint { font-weight: 400; color: var(--faint); font-size: 0.78rem; }
input[type=text], input[type=email], input[type=url], select, textarea {
  width: 100%; font: inherit; font-size: 0.92rem; color: var(--ink);
  padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); transition: border-color 0.12s, box-shadow 0.12s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; min-height: 76px; font-family: var(--mono); font-size: 0.85rem; }

/* ---- Badges ---- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.02em;
  padding: 3px 9px; border-radius: 999px;
  background: #F4F2F0; color: var(--muted); border: 1px solid var(--line);
  text-transform: capitalize;
}
.badge-accent { background: var(--accent-soft); color: var(--accent); border-color: #CCEBE6; }
.badge-success { background: #F0FDF4; color: var(--success); border-color: #CDEBD6; }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: #F1D4D4; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }

/* ---- Stat figures ---- */
.stat { }
.stat .num {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: 1.75rem; font-weight: 600; letter-spacing: -0.02em; color: var(--ink);
  line-height: 1.1;
}
.stat .lbl {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--faint); font-weight: 600; margin-top: 4px;
}

/* ---- Tables ---- */
table.data { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.data th {
  text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--faint); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line);
}
table.data td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: #FCFCFB; }

/* ---- Endpoint chip (signature element) ---- */
.endpoint {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 0.82rem; color: var(--ink);
  background: #FBFAF9; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 8px 8px 8px 12px; overflow: hidden;
}
.endpoint .method { color: var(--accent); font-weight: 600; }
.endpoint .url { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.endpoint button { margin-left: auto; }

/* ---- Toast ---- */
#toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(8px);
  background: var(--ink); color: #fff; font-size: 0.88rem;
  padding: 10px 16px; border-radius: var(--radius-sm); box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity 0.18s, transform 0.18s; z-index: 60;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--danger); }

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(28, 25, 23, 0.4);
  display: flex; align-items: flex-start; justify-content: center; padding: 7vh 20px;
  z-index: 50; overflow-y: auto;
}
.modal {
  background: var(--surface); border-radius: var(--radius); width: 100%; max-width: 520px;
  box-shadow: 0 12px 40px rgba(28, 25, 23, 0.18); border: 1px solid var(--line);
}
.modal header { padding: 20px 24px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.modal header h3 { font-size: 1.05rem; }
.modal .body { padding: 22px 24px; }
.modal footer { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }

/* ---- Layout helpers ---- */
.row { display: flex; gap: 12px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.grid { display: grid; gap: 18px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.section { padding: 56px 0; }
.divider { height: 1px; background: var(--line); border: 0; margin: 0; }

/* ---- App shell ---- */
.app-main { padding: 32px 0 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-head h1 { font-size: 1.5rem; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 28px; }
.tab {
  padding: 10px 14px; font-size: 0.9rem; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; border-top: none; border-left: none; border-right: none; font-family: inherit;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 550; }

.empty {
  text-align: center; padding: 56px 24px; color: var(--muted);
  border: 1px dashed var(--line-strong); border-radius: var(--radius); background: #FCFCFB;
}
.empty h3 { margin-bottom: 6px; color: var(--ink); }

.spinner {
  width: 18px; height: 18px; border: 2px solid var(--line-strong); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 720px) {
  .page-head { flex-direction: column; align-items: stretch; }
  .topbar nav { gap: 14px; }
  .section { padding: 40px 0; }
}

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