/* Agent of One — shared visual layer.
   One small token set, dark-first, no framework. Tuned for long reading:
   generous line-height, restrained colour, one accent. */

:root {
  color-scheme: dark;
  --bg:        #0c0e13;
  --bg-soft:   #11141b;
  --panel:     #141821;
  --panel-2:   #1a1f2a;
  --line:      #232937;
  --line-soft: #1b202b;

  --fg:        #e8eaf0;
  --fg-dim:    #98a1b3;
  --fg-faint:  #616b7d;

  --accent:    #7aa2f7;
  --accent-bg: #1b2740;
  --ok:        #7bd88f;
  --warn:      #e0af68;
  --err:       #f38b8b;

  --r-sm: 8px;
  --r:    12px;
  --r-lg: 16px;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.5);
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg:        #fbfbfd;
    --bg-soft:   #f4f5f8;
    --panel:     #ffffff;
    --panel-2:   #f4f5f8;
    --line:      #e3e6ec;
    --line-soft: #eceff4;
    --fg:        #14161c;
    --fg-dim:    #5c6575;
    --fg-faint:  #8b94a3;
    --accent:    #3b6fd4;
    --accent-bg: #eaf0fc;
    --ok:        #2e9e5b;
    --warn:      #a9761a;
    --err:       #c9433f;
    --shadow: 0 1px 2px rgba(16,24,40,.04), 0 8px 24px -12px rgba(16,24,40,.14);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

/* ---------- header ---------- */
header {
  flex: none;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  height: 54px;
  background: color-mix(in srgb, var(--panel) 85%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line-soft);
  position: sticky;
  top: 0;
  z-index: 20;
}
header h1 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
header .sp { flex: 1; }

nav { display: flex; gap: 2px; }
nav a {
  color: var(--fg-dim);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--r-sm);
  transition: background .15s, color .15s;
}
nav a:hover { color: var(--fg); background: var(--panel-2); }
nav a.active { color: var(--accent); background: var(--accent-bg); }

.status { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--fg-dim); }
.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--err);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--err) 18%, transparent);
  transition: background .3s, box-shadow .3s;
}
.dot.on {
  background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 18%, transparent);
}

/* ---------- layout ---------- */
main { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.wrap { max-width: 780px; margin: 0 auto; padding: 24px 18px 40px; }
.wrap.wide { max-width: 1100px; }

/* ---------- cards / controls ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card.flush { padding: 0; overflow: hidden; }

input, textarea, select {
  background: var(--bg-soft);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font: inherit;
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--fg-faint); }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

button {
  font: inherit;
  cursor: pointer;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--fg);
  padding: 8px 14px;
  font-size: 13.5px;
  font-weight: 500;
  transition: background .15s, border-color .15s, transform .08s, opacity .15s;
}
button:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: default; }
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #08101f;
  font-weight: 600;
}
button.primary:hover { filter: brightness(1.08); }
button.ghost { background: transparent; }

.muted { color: var(--fg-dim); font-size: 13px; }
.faint { color: var(--fg-faint); font-size: 12px; }
.row { display: flex; gap: 10px; align-items: center; }

.tag {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--panel-2);
  color: var(--fg-dim);
  border: 1px solid var(--line);
  white-space: nowrap;
}

/* ---------- scrollbars ---------- */
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 10px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--fg-faint); background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- rendered markdown ---------- */
.md > *:first-child { margin-top: 0; }
.md > *:last-child { margin-bottom: 0; }
.md p { margin: 0 0 10px; }
.md strong { font-weight: 650; color: var(--fg); }
.md em { font-style: italic; }
.md ul, .md ol { margin: 8px 0 10px; padding-left: 22px; }
.md li { margin: 3px 0; }
.md li::marker { color: var(--fg-faint); }
.md h1, .md h2, .md h3 {
  margin: 16px 0 8px;
  font-weight: 620;
  letter-spacing: -0.01em;
  line-height: 1.35;
}
.md h1 { font-size: 1.25em; }
.md h2 { font-size: 1.15em; }
.md h3 { font-size: 1.05em; }
.md a { color: var(--accent); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.md a:hover { border-bottom-color: var(--accent); }
.md code {
  font-family: var(--mono);
  font-size: .88em;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  padding: 1px 5px;
  border-radius: 5px;
}
.md pre {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  overflow-x: auto;
  margin: 10px 0;
}
.md pre code { background: none; border: none; padding: 0; font-size: .86em; }
.md blockquote {
  margin: 10px 0;
  padding: 2px 0 2px 14px;
  border-left: 2px solid var(--line);
  color: var(--fg-dim);
}
.md hr { border: none; border-top: 1px solid var(--line); margin: 16px 0; }
.md table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: .95em; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.md th { background: var(--panel-2); font-weight: 600; }

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