/* Agentix Notes. References: Notion (sidebar, document page), Mercury (cards, pills, activity table),
   OpenAI Platform (keys table), Exa / OpenAI usage (charts), Linear / Family (passkey sign-in). */
:root {
  --bg: #ffffff;
  --sidebar: #f8f8f7;
  --card: #ffffff;
  --text: #1d1d1b;
  --muted: #7a7974;
  --faint: #a8a7a2;
  --border: #ebebe8;
  --hover: #f0f0ee;
  --chip: #f2f2f0;
  --code: #f6f6f4;
  --accent: #5b5bd6;
  --accent-ink: #ffffff;
  --accent-soft: #eeeefb;
  --ok: #1d7f47;
  --ok-soft: #e7f4ec;
  --err: #c93636;
  --err-soft: #fbeceb;
  --warn-soft: #fdf4e3;
  --shadow: 0 1px 2px rgba(20, 20, 18, .04), 0 1px 1px rgba(20, 20, 18, .02);
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #191919;
    --sidebar: #1f1f1e;
    --card: #202020;
    --text: #ececea;
    --muted: #9b9a95;
    --faint: #6d6c68;
    --border: #2e2e2c;
    --hover: #2a2a29;
    --chip: #2a2a29;
    --code: #252524;
    --accent: #8d8df5;
    --accent-ink: #141414;
    --accent-soft: #2b2b48;
    --ok: #5cc98b;
    --ok-soft: #1f3328;
    --err: #ef7c7c;
    --err-soft: #3a2323;
    --warn-soft: #3a3020;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }
h1 { font-size: 28px; font-weight: 650; line-height: 1.2; }
h2 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
code, pre { font-family: var(--mono); font-size: 12.5px; }
svg.icon { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.truncate { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.num { font-variant-numeric: tabular-nums; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }  /* minmax: long secrets scroll instead of widening the card */
.row { display: flex; align-items: center; gap: 8px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 16px; }

/* shell */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column;
  gap: 4px; padding: 12px 10px; background: var(--sidebar); border-right: 1px solid var(--border); }
.account { display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px; }
.account-name { font-weight: 600; line-height: 1.2; }
.nav { display: grid; gap: 1px; }
.nav a, .nav-foot a, .linklike { display: flex; align-items: center; gap: 9px; height: 30px; padding: 0 8px;
  border-radius: 8px; color: var(--muted); font-weight: 500; }
.nav a:hover, .nav-foot a:hover, .linklike:hover { background: var(--hover); color: var(--text); }
.nav a.active, .nav-foot a.active { background: var(--hover); color: var(--text); }
.nav a.active svg { color: var(--accent); }
.nav-label { margin: 18px 8px 4px; font-size: 12px; font-weight: 500; color: var(--faint); }
.nav-foot { margin-top: auto; display: grid; gap: 1px; padding-top: 12px; }
.linklike { width: 100%; border: 0; background: none; font: inherit; cursor: pointer; text-align: left; }
.main { min-width: 0; padding: 36px 56px 72px; }
.page { max-width: 1100px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.page-head p { margin-top: 6px; color: var(--muted); max-width: 620px; }
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.crumbs a:hover { color: var(--text); }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 15px;
  border-radius: 999px; border: 1px solid transparent; font: 500 14px var(--font); cursor: pointer; white-space: nowrap;
  background: var(--chip); color: var(--text); transition: background .12s, opacity .12s; }
.btn:hover { background: var(--hover); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent); opacity: .9; }
.btn-outline { background: var(--card); border-color: var(--border); }
.btn-danger { background: var(--err-soft); color: var(--err); }
.btn-danger:hover { background: var(--err-soft); opacity: .85; }
.btn-wide { width: 100%; height: 42px; font-size: 15px; }
.btn-sm { height: 28px; padding: 0 11px; font-size: 13px; }
input[type=text], input[type=search], input:not([type]) { height: 36px; width: 100%; padding: 0 12px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--card); color: var(--text); font: inherit; }
input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
label.field { display: grid; gap: 6px; font-size: 13px; font-weight: 500; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input { flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: 999px;
  background: var(--chip); color: var(--muted); font-weight: 500; font-size: 13px; }
.chip:hover { color: var(--text); }
.chip.active { background: var(--text); color: var(--bg); }
.search { position: relative; }
.search svg { position: absolute; left: 11px; top: 10px; color: var(--faint); }
.search input { padding-left: 34px; }

/* surfaces */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 22px 0; }
.card-head + .card-body { padding-top: 12px; }
.card-body { padding: 16px 22px 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.grid-2 > *, .grid-3 > *, .grid-4 > *, .split > * { min-width: 0; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.banner { padding: 12px 16px; border-radius: 12px; background: var(--warn-soft); margin: 0 auto 20px; max-width: 1100px; }
.banner-error { background: var(--err-soft); color: var(--err); }
.empty { padding: 48px 24px; text-align: center; color: var(--muted); display: grid; gap: 6px; justify-items: center; }
.empty svg { width: 28px; height: 28px; color: var(--faint); margin-bottom: 6px; }

/* numbers, Mercury-style */
.stat-label { color: var(--muted); font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.stat-value { font-size: 30px; font-weight: 600; letter-spacing: -0.03em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 15px; color: var(--muted); font-weight: 500; letter-spacing: 0; margin-left: 4px; }
.stat-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* first-run checklist */
.steps { list-style: none; margin: 0; display: grid; }
.steps li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.steps li:last-child { border-bottom: 0; padding-bottom: 0; }
.steps li > div { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.steps p { margin-top: 2px; }
.step-mark { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--chip);
  color: var(--muted); font-weight: 600; font-size: 13px; }
.steps li.done .step-mark { background: var(--ok-soft); color: var(--ok); }
.steps li.done b { color: var(--muted); }
.steps li.current .step-mark { background: var(--accent); color: var(--accent-ink); }

/* project cards */
.project-card { display: grid; gap: 18px; padding: 20px 22px; transition: border-color .12s; }
.project-card:hover { border-color: var(--faint); }
.project-card .icon-tile { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); }
.project-meta { display: flex; gap: 18px; color: var(--muted); font-size: 13px; }

/* pills, avatars */
.pill { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 6px;
  background: var(--chip); color: var(--muted); font-size: 12px; font-weight: 500; white-space: nowrap; }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-err { background: var(--err-soft); color: var(--err); }
.pill-accent { background: var(--accent-soft); color: var(--accent); }
.pill .perm { font-family: var(--mono); letter-spacing: .04em; }
.avatar { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; flex: none;
  font-size: 11px; font-weight: 600; background: hsl(var(--h) 70% 92%); color: hsl(var(--h) 45% 32%); }
@media (prefers-color-scheme: dark) { .avatar { background: hsl(var(--h) 35% 24%); color: hsl(var(--h) 70% 80%); } }

/* tables, Mercury / OpenAI-style */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 0 12px 10px 0;
  border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 11px 12px 11px 0; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.link-row { cursor: pointer; }
.table tbody tr.link-row:hover td { background: var(--hover); }
.table td:first-child, .table th:first-child { padding-left: 4px; }
.table .right { text-align: right; }
.perm-grid td { text-align: center; }
.perm-grid td:first-child, .perm-grid th:first-child { text-align: left; }
.perm-grid th { text-align: center; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }

/* notes list, Evernote / Notion-style */
.note-list { display: grid; }
.note-item { display: grid; gap: 4px; padding: 14px 6px; border-bottom: 1px solid var(--border); border-radius: 0; }
.note-item:hover { background: var(--hover); }
.note-item:last-child { border-bottom: 0; }
.note-title { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.note-summary { color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.note-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; color: var(--faint); font-size: 12.5px; margin-top: 4px; }
.note-meta time, .table td .row, .table td time, .table td code { white-space: nowrap; }

/* document page */
.doc { max-width: 760px; margin: 0 auto; }
.doc h1 { font-size: 38px; font-weight: 700; letter-spacing: -0.025em; margin: 8px 0 22px; }
.props { display: grid; grid-template-columns: 150px 1fr; row-gap: 6px; padding-bottom: 22px; margin-bottom: 26px;
  border-bottom: 1px solid var(--border); }
.props dt { display: flex; align-items: center; gap: 8px; color: var(--muted); height: 30px; }
.props dd { margin: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-height: 30px; }
.props dd a { color: var(--accent); }
.summary-box { background: var(--code); border-radius: 12px; padding: 14px 16px; margin-bottom: 26px; }
.prose { font-size: 16px; line-height: 1.7; }
.prose h1, .prose h2, .prose h3 { margin: 1.6em 0 .5em; font-weight: 650; }
.prose h1 { font-size: 26px; } .prose h2 { font-size: 21px; } .prose h3 { font-size: 17px; }
.prose p, .prose ul, .prose ol, .prose pre, .prose blockquote, .prose table { margin: 0 0 1em; }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.prose code { background: var(--code); padding: 2px 5px; border-radius: 5px; }
.prose pre { background: var(--code); padding: 14px 16px; border-radius: 12px; overflow-x: auto; }
.prose pre code { background: none; padding: 0; }
.prose blockquote { border-left: 3px solid var(--border); padding-left: 14px; color: var(--muted); }
.prose table { border-collapse: collapse; } .prose th, .prose td { border: 1px solid var(--border); padding: 6px 10px; }
.prose img { max-width: 100%; }

/* chart, Exa / OpenAI usage-style */
.bars { position: relative; display: grid; grid-template-columns: repeat(14, 1fr); align-items: end; gap: 8px;
  height: 150px; padding-top: 18px; border-top: 1px dashed var(--border); }
.bar { position: relative; background: var(--accent); border-radius: 5px 5px 2px 2px; min-height: 2px; opacity: .9; }
.bar.zero { background: var(--border); }
.bar:hover { opacity: 1; }
.bar:hover::after { content: attr(data-label); position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%); background: var(--text); color: var(--bg); font-size: 12px; padding: 3px 7px;
  border-radius: 6px; white-space: nowrap; }
.bars-axis { display: flex; justify-content: space-between; color: var(--faint); font-size: 12px; margin-top: 8px; }
.meter { height: 6px; border-radius: 99px; background: var(--chip); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

/* secrets */
.secret { display: flex; align-items: center; gap: 8px; background: var(--code); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 8px 8px 12px; }
.secret code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; }
.callout { border: 1px solid var(--accent); background: var(--accent-soft); border-radius: var(--radius); padding: 18px 20px;
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.callout pre { margin: 0; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
  white-space: pre-wrap; word-break: break-all; }

/* sign-in, Linear / Family-style */
body.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-box { width: 100%; max-width: 360px; display: grid; gap: 14px; justify-items: center; text-align: center; }
.auth-box h1 { font-size: 22px; font-weight: 650; margin-top: 10px; }
.auth-box form { width: 100%; display: grid; gap: 12px; text-align: left; margin-top: 6px; }
.auth-foot { margin-top: 18px; }
.error { color: var(--err); min-height: 1.5em; font-size: 13px; }

@media (max-width: 1200px) {
  .main { padding: 32px 36px 64px; }
  .split { grid-template-columns: minmax(0, 1fr); }
  .split > aside.stack { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}
@media (max-width: 960px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .shell { grid-template-columns: 1fr; }
  .shell { grid-template-rows: auto 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; align-content: flex-start; gap: 4px;
    border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar .nav { display: flex; flex-wrap: wrap; }
  .account { padding: 4px 8px; }
  .nav-label, .sidebar .projects-nav { display: none; }
  .nav-foot { margin: 0; padding: 0; display: flex; }
  .main { padding: 24px 16px 56px; }
  .split, .grid-2, .grid-3, .split > aside.stack { grid-template-columns: minmax(0, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nav-foot form { display: none; }  /* sign-out lives on the Settings page, away from the header links */
  .props { grid-template-columns: 110px 1fr; }
  .table-wrap { overflow-x: auto; }
}
