/* SliceOfLife — a thin layer over Pico CSS. Pico handles typography, forms and
   light/dark; this file only adds the platform's shape and a few components. */

:root {
  --pico-font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans JP", sans-serif;
  --pico-border-radius: 0.6rem;
  --pico-spacing: 1rem;
  --space: #7c6cf0;
  --ok: #2f9e6e;
  --warn: #d08a1d;
  --bad: #d4495b;
  --muted: var(--pico-muted-color);
  --line: var(--pico-muted-border-color);
  /* Pico redefines --pico-color inside buttons; this keeps the page's ink. */
  --ink: var(--pico-color);
}
:root:not([data-theme="dark"]) { --pico-background-color: #fbfaf7; --card: #ffffff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --card: #1b1f27; } }

body { min-height: 100vh; }
main.container { padding-top: 1.25rem; padding-bottom: 4rem; }

/* top bar */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10; backdrop-filter: blur(10px);
  background: color-mix(in srgb, var(--pico-background-color) 82%, transparent); border-bottom: 1px solid var(--line); }
.topbar nav { padding-block: 0.15rem; }
.topbar nav ul { gap: 0.25rem; flex-wrap: wrap; }
.topbar nav a, .topbar nav li { padding-block: 0.5rem; }
.wordmark { font-weight: 750; letter-spacing: -0.02em; font-size: 1.15rem; color: var(--pico-color); text-decoration: none; }
.wordmark span { color: var(--space); }
.topbar a.active { color: var(--pico-primary); font-weight: 600; }
.space-title { font-weight: 600; }

/* page header */
.hello { margin: 0.5rem 0 1.5rem; }
.hello h1 { margin: 0; font-size: 1.9rem; letter-spacing: -0.02em; }
.hello p { margin: 0.2rem 0 0; color: var(--muted); }
h2.section { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 2rem 0 0.75rem; font-weight: 650; }

/* space cards */
.spaces { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); gap: 0.9rem; }
.space-card { display: block; text-decoration: none; color: inherit; background: var(--card); border: 1px solid var(--line);
  border-radius: 1rem; padding: 1.1rem 1.15rem 1rem; position: relative; overflow: hidden; transition: transform .15s ease, box-shadow .15s ease; }
.space-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--c, var(--space)); }
.space-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px -12px rgb(0 0 0 / .25); }
.space-card .icon { font-size: 1.8rem; line-height: 1; }
.space-card h3 { margin: 0.6rem 0 0.15rem; font-size: 1.1rem; }
.space-card p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.space-card .summary { margin-top: 0.7rem; font-size: 0.92rem; color: var(--pico-color); font-weight: 550; }
.space-card.error::before { background: var(--bad); }

/* two-column layout on wide screens */
.cols { display: grid; gap: 1.5rem; grid-template-columns: 1fr; }
@media (min-width: 960px) { .cols { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); } }

/* feeds and lists */
.feed { list-style: none; padding: 0; margin: 0; }
.feed li { list-style: none; display: flex; gap: 0.75rem; padding: 0.55rem 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.feed li:last-child { border-bottom: 0; }
.feed time { color: var(--muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; min-width: 3.2rem; }
.feed .text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.feed .src { color: var(--muted); font-size: 0.78rem; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 1rem; padding: 0.4rem 1rem; }
.empty { color: var(--muted); padding: 0.8rem 0; font-size: 0.92rem; }

/* status pills */
.pill { display: inline-block; font-size: 0.72rem; font-weight: 650; padding: 0.1rem 0.5rem; border-radius: 99px;
  background: color-mix(in srgb, var(--muted) 15%, transparent); color: var(--muted); white-space: nowrap; }
.pill.done, .pill.ok, .pill.on { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.pill.running, .pill.queued { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.pill.error { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }

/* tables scroll on phones */
.table-wrap { overflow-x: auto; }
table td, table th { vertical-align: middle; }
td.actions { white-space: nowrap; text-align: right; }
td small, .muted { color: var(--muted); }

/* rows of cards */
.cards { display: grid; gap: 0.9rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 1rem; padding: 1rem 1.1rem; }
.card h3 { margin: 0 0 0.25rem; font-size: 1.05rem; }
.card .meta { color: var(--muted); font-size: 0.82rem; margin-bottom: 0.5rem; }

/* agent transcript */
.thread { display: flex; flex-direction: column; gap: 0.6rem; }
.turn-task { background: color-mix(in srgb, var(--space) 10%, var(--card)); border: 1px solid var(--line); border-radius: 1rem; padding: 0.8rem 1rem; white-space: pre-wrap; }
.entry-text { background: var(--card); border: 1px solid var(--line); border-radius: 1rem; padding: 0.4rem 1rem; }
details.tool { margin: 0; border: 1px dashed var(--line); border-radius: 0.6rem; padding: 0.35rem 0.75rem; font-size: 0.86rem; }
details.tool summary { color: var(--muted); }
details.tool pre { margin: 0.4rem 0 0; max-height: 18rem; overflow: auto; font-size: 0.78rem; }
.result-box { border-left: 3px solid var(--ok); padding-left: 0.9rem; }
.error-card { border-left: 3px solid var(--bad); }
.error-card pre { white-space: pre-wrap; font-size: 0.78rem; max-height: 20rem; overflow: auto; }

.md > :first-child { margin-top: 0.4rem; }
.md > :last-child { margin-bottom: 0.4rem; }
.md pre { font-size: 0.8rem; }

.row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.row > * { margin-bottom: 0; }
.grow { flex: 1; }
button.small, a.small[role="button"] { padding: 0.3rem 0.7rem; font-size: 0.85rem; margin: 0; }
input.small, select.small { padding: 0.3rem 0.6rem; font-size: 0.85rem; height: auto; margin: 0; }
pre.plain { white-space: pre-wrap; font-size: 0.8rem; }

/* new space */
.space-card.new-space { border-style: dashed; background: transparent; }
.space-card.new-space::before { display: none; }
.space-card.new-space .icon { color: var(--muted); }
.new-space-form { max-width: 40rem; }
.icons { gap: 0.4rem; }
button.icon-pick { margin: 0; padding: 0.3rem 0.45rem; font-size: 1.4rem; line-height: 1; background: var(--card); border: 2px solid var(--line); border-radius: 0.6rem; }
button.icon-pick.on { border-color: var(--pico-primary); }
.swatches { gap: 0.5rem; }
button.swatch { margin: 0; padding: 0; width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--c); border: 3px solid var(--card); box-shadow: 0 0 0 1px var(--line); }
button.swatch.on { box-shadow: 0 0 0 2px var(--ink); }

/* settings: enrolling a device */
.enroll { display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; margin-top: 1rem; padding: 1rem; }
.enroll .qr { width: 11rem; height: 11rem; background: #fff; padding: 0.4rem; border-radius: 0.6rem; flex: none; }
.enroll .qr svg { width: 100%; height: 100%; display: block; }
.enroll > div:last-child { flex: 1; min-width: 14rem; }
