/* Stacks AI dashboard — borrows the Smallstacks design tokens. */
:root {
  --bg: #ffffff;
  --bg-alt: #f5f5f7;
  --ink: #1d1d1f;
  --ink-soft: #6e6e73;
  --ink-faint: #86868b;
  --line: #e5e5e7;
  --line-strong: #d2d2d7;
  --accent: #0071e3;
  --radius: 18px;
  --radius-pill: 980px;
  --shadow: 0 8px 30px rgba(0, 0, 0, .07);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg-alt);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1 { font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.2rem); font-weight: 600; letter-spacing: -.03em; }
h2 { font-size: 1.05rem; font-weight: 600; letter-spacing: -.01em; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }
a { color: var(--accent); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 24px;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -.01em; }
.brand em { font-style: normal; font-weight: 400; color: var(--ink-faint); }
.mark { display: block; border-radius: 7px; flex: none; }

/* ---------- layout ---------- */
.page { max-width: 1000px; margin-inline: auto; padding: 32px 24px 140px; }
.head { margin-bottom: 22px; }
.lead { color: var(--ink-soft); font-size: .95rem; }
.hint { color: var(--ink-faint); font-size: .82rem; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.card {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
}
.card--wide { grid-column: 1 / -1; }
.card--narrow { max-width: 480px; margin: 8vh auto 0; }
.card > * + * { margin-top: 12px; }
@media (max-width: 760px) { .grid { grid-template-columns: 1fr; } .page { padding: 24px 16px 140px; } }

/* ---------- form controls ---------- */
label { display: block; font-size: .85rem; font-weight: 500; margin-top: 14px; }
label + input, label + select, label + textarea, label + .row { margin-top: 6px; }
input, select, textarea {
  width: 100%; font: inherit; font-size: .95rem; color: inherit;
  padding: 10px 13px; background: #fff;
  border: 1px solid var(--line-strong); border-radius: 11px;
}
textarea { resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0, 113, 227, .16);
}
input[type="color"] { width: 52px; height: 42px; padding: 4px; flex: none; cursor: pointer; }
.row { display: flex; gap: 10px; align-items: center; }
.row input[type="text"], .row input[type="url"] { flex: 1; min-width: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-size: .93rem; font-weight: 500; cursor: pointer;
  padding: 10px 20px; border-radius: var(--radius-pill); border: 1px solid transparent;
  transition: background .2s ease, border-color .2s ease, opacity .2s ease;
}
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: #0064c8; }
.btn--dark { background: var(--ink); color: #fff; }
.btn--dark:hover { background: #000; }
.btn--ghost { background: #fff; color: var(--ink); border-color: var(--line-strong); }
.btn--ghost:hover { border-color: var(--ink); }
.btn--block { width: 100%; margin-top: 18px; }
.btn:disabled { opacity: .5; cursor: default; }

/* ---------- pieces ---------- */
.code {
  background: #0e0e12; color: #e8e8ef; padding: 14px 16px; border-radius: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem;
  overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere;
}
.notice { border-radius: 12px; padding: 12px 14px; font-size: .88rem; }
.notice--error { background: #fff3f3; border: 1px solid #ffd4d4; color: #a11; }
.notice--ok { background: #f0f9f2; border: 1px solid #cfe9d6; color: #1a6b32; }
.notice--warn { background: #fff8ec; border: 1px solid #f6e0b8; color: #7a5410; margin-bottom: 18px; }
.notice--ok code { display: block; margin-top: 6px; overflow-wrap: anywhere; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat {
  background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 15px 16px;
}
.stat b { display: block; font-size: 1.5rem; font-weight: 600; letter-spacing: -.02em; }
.stat span { font-size: .78rem; color: var(--ink-faint); }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

table { width: 100%; border-collapse: collapse; font-size: .87rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--ink-faint); font-weight: 500; font-size: .78rem; }
td:last-child, th:last-child { text-align: right; }

.reveal { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 14px; }
.reveal summary { cursor: pointer; font-size: .87rem; color: var(--ink-soft); }
.reveal[open] summary { margin-bottom: 6px; }

.savebar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; align-items: center; justify-content: flex-end; gap: 14px;
  padding: 14px 24px;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line);
}

[hidden] { display: none !important; }
