/* ===== Instant Text API — minimalist theme ===== */
:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #f2f2ef;
  --text: #17181c;
  --muted: #7c7f88;
  --border: #e8e8e4;
  --accent: #2f6bff;
  --accent-hover: #1f57e6;
  --accent-soft: #eaf0ff;
  --ok: #1a9d5a;
  --danger: #e0483d;
  --code-bg: #f4f4f1;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.04);
  --maxw: 920px;
}
[data-theme="dark"] {
  --bg: #0f1013;
  --surface: #17181d;
  --surface-2: #1d1f26;
  --text: #eceef2;
  --muted: #8b8f9c;
  --border: #26282f;
  --accent: #5b8bff;
  --accent-hover: #7aa0ff;
  --accent-soft: #1a2236;
  --ok: #34d399;
  --danger: #f27a6f;
  --code-bg: #14161b;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 30px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  letter-spacing: -0.01em;
  transition: background .2s ease, color .2s ease;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Topbar ===== */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  max-width: var(--maxw); margin: 0 auto;
  padding: 18px 20px;
}
.brand { font-weight: 650; font-size: 1.05rem; color: var(--text); letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.topbar nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.topbar nav a {
  color: var(--muted); padding: 7px 12px; border-radius: 9px; font-size: .92rem; font-weight: 500;
}
.topbar nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.theme-toggle {
  border: 1px solid var(--border); background: var(--surface);
  border-radius: 9px; width: 36px; height: 36px; cursor: pointer; font-size: .95rem;
  display: inline-flex; align-items: center; justify-content: center;
}
.theme-toggle:hover { background: var(--surface-2); }

/* ===== Layout ===== */
.container { max-width: var(--maxw); margin: 0 auto; padding: 12px 20px 72px; }
h1 { font-size: 1.55rem; font-weight: 650; margin: 0 0 6px; letter-spacing: -0.02em; }
h2 { font-size: 1.05rem; font-weight: 600; margin: 0 0 14px; letter-spacing: -0.01em; }
h3 { font-size: .95rem; font-weight: 600; margin: 0 0 8px; }
.muted { color: var(--muted); font-size: .9rem; }
.center { text-align: center; }

/* ===== Cards & grid ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.auth-card { max-width: 400px; margin: 48px auto; }

/* ===== Hero ===== */
.hero { text-align: center; padding: 56px 0 28px; }
.hero .eyebrow {
  display: inline-block; font-size: .78rem; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--accent);
  background: var(--accent-soft); padding: 5px 12px; border-radius: 999px; margin-bottom: 18px;
}
.hero h1 { font-size: 2.4rem; line-height: 1.15; margin-bottom: 14px; }
.hero .lead { font-size: 1.12rem; color: var(--muted); max-width: 520px; margin: 0 auto; }
.hero-actions { display: flex; gap: 10px; justify-content: center; margin-top: 26px; flex-wrap: wrap; }

/* ===== Forms ===== */
label { display: block; margin-bottom: 15px; font-size: .85rem; font-weight: 500; color: var(--muted); }
input, textarea, select {
  width: 100%; margin-top: 6px; padding: 11px 13px;
  border: 1px solid var(--border); border-radius: 11px;
  background: var(--surface); color: var(--text); font-size: .98rem; font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 11px 18px; border-radius: 11px; cursor: pointer;
  font-size: .93rem; font-weight: 550; font-family: inherit;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { background: transparent; }
.btn.small { padding: 7px 13px; font-size: .84rem; }
.btn.tiny { padding: 5px 11px; font-size: .8rem; }
.btn.danger { color: #fff; background: var(--danger); border-color: var(--danger); }
.btn.warn { background: transparent; color: var(--danger); border-color: var(--border); }

/* ===== Code ===== */
.mono { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.mono.block, pre.mono, pre.code {
  display: block; background: var(--code-bg); border: 1px solid var(--border);
  padding: 13px 15px; border-radius: 12px; overflow-x: auto;
  font-size: .82rem; line-height: 1.6;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre; word-break: normal;
}
.mono.block { white-space: pre-wrap; word-break: break-all; }
.mono.small { font-size: .76rem; }
.stored {
  background: var(--code-bg); border: 1px solid var(--border);
  padding: 14px; border-radius: 12px; min-height: 46px;
  white-space: pre-wrap; word-break: break-word; margin: 0 0 10px; font-size: .9rem;
}
.copy-row { display: flex; gap: 8px; align-items: stretch; }
.copy-row code { flex: 1; display: flex; align-items: center; }

/* ===== Alerts & badges ===== */
.alert { padding: 11px 14px; border-radius: 11px; margin-bottom: 14px; font-size: .88rem; }
.alert.error { background: rgba(224,72,61,.1); color: var(--danger); }
.alert.ok { background: rgba(26,157,90,.1); color: var(--ok); }
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .72rem; font-weight: 500;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.badge-on { color: var(--ok); border-color: rgba(26,157,90,.3); }
.badge-off { color: var(--danger); border-color: rgba(224,72,61,.3); }

/* ===== Table ===== */
.table-card { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.table th, .table td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; white-space: nowrap; }
.table tr:last-child td { border-bottom: none; }
.table .truncate { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.actions { white-space: nowrap; }
.inline { display: inline; }

/* ===== Docs ===== */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tab {
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--muted); cursor: pointer; font-size: .85rem; font-weight: 500;
}
.tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.endpoint { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.method { font-weight: 700; font-size: .78rem; color: var(--ok); font-family: var(--mono); }
.toc a { display: block; padding: 4px 0; color: var(--muted); font-size: .9rem; }

/* ===== Footer ===== */
.site-footer { max-width: var(--maxw); margin: 0 auto; text-align: center; padding: 28px 20px; border-top: 1px solid var(--border); }

@media (max-width: 560px) {
  .hero { padding: 36px 0 20px; }
  .hero h1 { font-size: 1.9rem; }
  .card { padding: 18px; }
}

/* ============================================================
   Dashboard shell (sidebar layout) — reference-image style
   ============================================================ */
.app { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: 240px; flex-shrink: 0;
  background: #101114; color: #cfd2da;
  border-right: 1px solid #1e2027;
  display: flex; flex-direction: column;
  padding: 22px 16px;
  position: sticky; top: 0; height: 100vh;
}
[data-theme="light"] .sidebar { background: #101114; }
.side-brand {
  display: flex; align-items: center; gap: 9px;
  font-weight: 650; font-size: 1.1rem; color: #fff;
  padding: 4px 8px 22px; letter-spacing: -0.02em;
}
.side-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.side-nav a, .side-nav span {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 10px 12px; border-radius: 10px;
  color: #9a9ea9; font-size: .92rem; font-weight: 500; text-decoration: none;
}
.side-nav a:hover { background: #1a1c22; color: #fff; text-decoration: none; }
.side-nav a.active { background: #1e2028; color: #fff; }
.side-nav .soon { color: #5a5e69; cursor: default; }
.side-nav .soon em {
  font-style: normal; font-size: .68rem; background: #22242c; color: #7a7e89;
  padding: 2px 7px; border-radius: 999px;
}
.side-foot { border-top: 1px solid #1e2027; padding-top: 14px; margin-top: 8px; }

/* Main area */
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg); }
.app-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 30px; border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.app-top h2 { margin: 0; font-size: 1.15rem; }
.top-right { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .82rem; font-weight: 600;
}
.app-content { padding: 30px; max-width: 1100px; width: 100%; }

/* Welcome row */
.welcome-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; flex-wrap: wrap; margin-bottom: 26px;
}
.welcome-row h1 { font-size: 2rem; margin: 0 0 4px; }
.welcome-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Stat cards */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 22px;
}
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}
.stat .stat-head {
  display: flex; align-items: center; justify-content: space-between;
  color: var(--muted); font-size: .88rem; font-weight: 500; margin-bottom: 14px;
}
.stat .stat-value { font-size: 1.9rem; font-weight: 650; letter-spacing: -0.02em; line-height: 1; }
.stat .stat-sub { color: var(--muted); font-size: .82rem; margin-top: 8px; }

/* Two-column lower section */
.dash-cols {
  display: grid; grid-template-columns: 2fr 1fr; gap: 16px;
}
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow);
}
.panel h2 { margin-bottom: 4px; }
.panel .panel-sub { color: var(--muted); font-size: .88rem; margin: 0 0 18px; }

/* Progress metric rows */
.metric { margin-bottom: 18px; }
.metric-top { display: flex; justify-content: space-between; font-size: .9rem; margin-bottom: 7px; }
.metric-top .val { color: var(--muted); }
.bar { height: 7px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.metric-note { color: var(--muted); font-size: .78rem; margin-top: 6px; }

@media (max-width: 860px) {
  .app { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: static;
    flex-direction: row; align-items: center; gap: 6px;
    padding: 12px 16px; overflow-x: auto;
  }
  .side-brand { padding: 4px 8px; }
  .side-nav { flex-direction: row; flex: 1; gap: 4px; }
  .side-nav .soon, .side-foot { display: none; }
  .dash-cols { grid-template-columns: 1fr; }
  .app-content { padding: 20px; }
  .welcome-row h1 { font-size: 1.6rem; }
}
