/* Enzz Agent — one look for every screen, light and dark.
   Colours are named for what they are for, never for what they look like,
   so a theme only has to change this first block. */

:root {
  --bg: #F6F8F6;
  --surface: #FFFFFF;
  --ink: #14201B;
  --muted: #45534C;
  --line: #DCE3DE;
  --line-strong: #C5D0C9;
  --accent: #0F6B4F;
  --accent-hover: #0A533D;
  --on-accent: #FFFFFF;
  --tint: #E4EDE7;
  --warn-ink: #7A4B00;
  --warn-bg: #FFF3DC;
  --danger: #A32222;
  --danger-bg: #FCE9E9;
  --shadow: 0 1px 2px rgba(20, 32, 27, .06);
  --radius: 14px;
  --font: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1512;
    --surface: #151E1A;
    --ink: #E7EEEA;
    --muted: #A3B2AA;
    --line: #24312B;
    --line-strong: #33443C;
    --accent: #4CC79B;
    --accent-hover: #6AD7AF;
    --on-accent: #06241A;
    --tint: #1B2A24;
    --warn-ink: #F2C879;
    --warn-bg: #2D2412;
    --danger: #F08A8A;
    --danger-bg: #331818;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1512;
  --surface: #151E1A;
  --ink: #E7EEEA;
  --muted: #A3B2AA;
  --line: #24312B;
  --line-strong: #33443C;
  --accent: #4CC79B;
  --accent-hover: #6AD7AF;
  --on-accent: #06241A;
  --tint: #1B2A24;
  --warn-ink: #F2C879;
  --warn-bg: #2D2412;
  --danger: #F08A8A;
  --danger-bg: #331818;
  --shadow: none;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 30px; line-height: 1.15; letter-spacing: -.5px; font-weight: 700; }
h2 { font-size: 20px; line-height: 1.25; font-weight: 700; }
h3 { font-size: 16px; font-weight: 600; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- buttons and fields --------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-weight: 600; font-size: 15px; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn.quiet { border-color: transparent; background: transparent; color: var(--muted); padding: 0 12px; }
.btn.quiet:hover { background: var(--tint); color: var(--ink); }
.btn.danger { color: var(--danger); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn svg { flex: none; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 14px; font-weight: 600; color: var(--muted); }
.field .hint { font-size: 13px; color: var(--muted); }
.input, textarea.input, select.input {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
}
textarea.input { resize: vertical; line-height: 1.5; }
.input::placeholder { color: var(--muted); opacity: .8; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 15px; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--accent); }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack.tight { gap: 8px; }
.stack.loose { gap: 28px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.grow { flex: 1 1 auto; min-width: 0; }

/* --- surfaces ------------------------------------------------------------- */

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.card.tinted { background: var(--tint); border-color: transparent; }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list > * { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.list > *:last-child { border-bottom: none; }
.list > a, .list > button { width: 100%; background: transparent; border-left: none; border-right: none; border-top: none; text-align: left; color: var(--ink); text-decoration: none; cursor: pointer; }
.list > a:hover, .list > button:hover { background: var(--tint); }
.empty { padding: 28px 20px; text-align: center; color: var(--muted); }
.tag { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--tint); color: var(--ink); white-space: nowrap; }
.tag.accent { background: var(--accent); color: var(--on-accent); }
.tag.warn { background: var(--warn-bg); color: var(--warn-ink); }
.tag.danger { background: var(--danger-bg); color: var(--danger); }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--accent); }
.notice { padding: 12px 14px; border-radius: 10px; background: var(--warn-bg); color: var(--warn-ink); font-size: 15px; }
.notice.bad { background: var(--danger-bg); color: var(--danger); }
.notice.good { background: var(--tint); color: var(--ink); }
.notice a { color: inherit; font-weight: 600; }

/* --- the frame around every signed-in screen ------------------------------ */

.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 32px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.brand { font-size: 22px; font-weight: 700; letter-spacing: -.5px; color: var(--accent); text-decoration: none; }
.nav { display: flex; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 8px; color: var(--muted); font-weight: 500; font-size: 15px; text-decoration: none; }
.nav a:hover { background: var(--tint); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--tint); color: var(--ink); font-weight: 600; }
.nav .count { font-size: 12px; font-weight: 700; background: var(--accent); color: var(--on-accent); border-radius: 999px; padding: 1px 7px; }
.topbar .right { display: flex; align-items: center; gap: 8px; }
.pill { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--ink); font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.pill:hover { border-color: var(--muted); color: var(--ink); }
.avatar { width: 40px; height: 40px; border-radius: 999px; border: none; background: var(--accent); color: var(--on-accent); font-weight: 700; cursor: pointer; }
.page { flex: 1 1 auto; width: 100%; max-width: 1040px; margin: 0 auto; padding: 32px 32px 64px; }
.page.wide { max-width: 1200px; }
.page.narrow { max-width: 760px; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.pagehead p { color: var(--muted); margin-top: 6px; }
.tabbar { display: none; }

/* --- first screen --------------------------------------------------------- */

.home { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 32px; align-items: start; }
.explain { background: var(--tint); border-radius: 20px; padding: 36px; display: flex; flex-direction: column; gap: 28px; }
.explain h1 { font-size: 44px; letter-spacing: -1.2px; line-height: 1.02; }
.explain p { font-size: 18px; color: var(--muted); }
.steps { display: flex; flex-direction: column; gap: 14px; margin: 0; padding: 0; list-style: none; }
.steps li { display: flex; align-items: center; gap: 14px; font-weight: 600; }
.steps .n { flex: none; width: 34px; height: 34px; border-radius: 999px; background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center; font-weight: 700; }
.ask { background: var(--surface); border: 1px solid var(--line-strong); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); }
.ask:focus-within { border-color: var(--accent); }
.ask textarea { border: none; outline: none; resize: none; background: transparent; font-size: 17px; line-height: 1.5; min-height: 84px; padding: 4px; }
.ask .bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 10px; border-radius: 999px; background: var(--tint); font-size: 14px; }
.chip button { border: none; background: transparent; color: var(--muted); cursor: pointer; min-width: 24px; min-height: 24px; }
.level { min-height: 44px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); padding: 0 10px; font-size: 14px; font-weight: 500; }

/* --- a conversation ------------------------------------------------------- */

.chat { display: flex; flex-direction: column; min-height: calc(100vh - 69px); }
.chathead { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 32px; border-bottom: 1px solid var(--line); background: var(--surface); }
.chathead h1 { font-size: 18px; letter-spacing: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread { flex: 1 1 auto; width: 100%; max-width: 760px; margin: 0 auto; padding: 28px 24px 12px; display: flex; flex-direction: column; gap: 20px; }
.said { align-self: flex-end; max-width: 85%; background: var(--tint); border-radius: 14px 14px 4px 14px; padding: 12px 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.turn { display: flex; flex-direction: column; gap: 14px; }
.doing { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.doing > button { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 46px; padding: 0 14px; border: none; background: transparent; color: var(--muted); font-size: 15px; text-align: left; cursor: pointer; }
.doing > button .what { display: flex; align-items: center; gap: 10px; min-width: 0; }
.doing > button .what span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doing .dot { flex: none; width: 9px; height: 9px; border-radius: 999px; background: var(--accent); }
.doing.working .dot { animation: pulse 1.2s ease-in-out infinite; }
.doing.failed .dot { background: var(--danger); }
.doing ol { margin: 0; padding: 4px 14px 14px 14px; list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: 14px; color: var(--muted); border-top: 1px solid var(--line); }
.doing li { display: flex; gap: 10px; align-items: flex-start; padding-top: 8px; }
.doing li.bad { color: var(--danger); }
.doing li .more { font-family: var(--mono); font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 4px; opacity: .85; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .doing.working .dot { animation: none; } }

.answer { font-size: 17px; line-height: 1.6; overflow-wrap: anywhere; display: flex; flex-direction: column; gap: 12px; }
.answer h3 { font-size: 18px; margin-top: 6px; }
.answer ul, .answer ol { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 4px; }
.answer pre { margin: 0; padding: 14px; border-radius: 10px; background: var(--tint); overflow-x: auto; font-family: var(--mono); font-size: 14px; line-height: 1.5; }
.answer code { font-family: var(--mono); font-size: .92em; background: var(--tint); padding: 1px 5px; border-radius: 5px; }
.answer pre code { background: transparent; padding: 0; }

.review { border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.changes { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.change { border-bottom: 1px solid var(--line); }
.change:last-child { border-bottom: none; }
.change > button { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 0 12px; border: none; background: transparent; text-align: left; cursor: pointer; }
.change > button:hover { background: var(--tint); }
.change .path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.diff { margin: 0; padding: 12px; background: var(--bg); font-family: var(--mono); font-size: 13px; line-height: 1.5; overflow-x: auto; white-space: pre; border-top: 1px solid var(--line); }
.diff .add { color: var(--accent); }
.diff .del { color: var(--danger); }
.composer { position: sticky; bottom: 0; background: linear-gradient(to top, var(--bg) 70%, transparent); padding: 12px 24px 24px; }
.composer .inner { max-width: 760px; margin: 0 auto; display: flex; align-items: flex-end; gap: 10px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 14px; padding: 8px 8px 8px 16px; }
.composer .inner:focus-within { border-color: var(--accent); }
.composer textarea { flex: 1 1 auto; border: none; outline: none; resize: none; background: transparent; min-height: 44px; max-height: 180px; padding: 10px 0; line-height: 1.5; }

/* --- to-dos --------------------------------------------------------------- */

.todo { align-items: flex-start !important; }
.todo .main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.todo .title { font-weight: 600; overflow-wrap: anywhere; }
.todo.done .title { text-decoration: line-through; color: var(--muted); font-weight: 500; }
.todo .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.group { display: flex; flex-direction: column; gap: 10px; }
.group > h3 { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; text-transform: uppercase; letter-spacing: .5px; }

/* --- plans ---------------------------------------------------------------- */

.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.plan { display: flex; flex-direction: column; gap: 12px; }
.plan.current { border-color: var(--accent); }
.plan .price { font-size: 26px; font-weight: 700; letter-spacing: -.5px; }
.plan ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
.plan .btn { margin-top: auto; }
.bignum { font-size: 34px; font-weight: 700; letter-spacing: -.8px; }

/* --- signing in ----------------------------------------------------------- */

.gate { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.gate .explain { border-radius: 0; padding: 56px; justify-content: center; }
.gate .form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.gate .form > div { width: 100%; max-width: 380px; }
.switch { display: flex; gap: 4px; background: var(--tint); border-radius: 10px; padding: 4px; }
.switch button { flex: 1; min-height: 40px; border: none; border-radius: 8px; background: transparent; font-weight: 600; cursor: pointer; color: var(--muted); }
.switch button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* --- little things -------------------------------------------------------- */

#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 60; width: min(92vw, 460px); pointer-events: none; }
.toast { background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 12px; font-size: 15px; box-shadow: 0 6px 24px rgba(0, 0, 0, .18); }
.toast.bad { background: var(--danger); color: #FFFFFF; }
.menu { position: relative; }
.menu .sheet { position: absolute; right: 0; top: 48px; min-width: 220px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; padding: 6px; box-shadow: 0 8px 28px rgba(0, 0, 0, .12); z-index: 20; display: flex; flex-direction: column; }
.menu .sheet a, .menu .sheet button { display: flex; align-items: center; min-height: 44px; padding: 0 12px; border: none; border-radius: 8px; background: transparent; color: var(--ink); text-decoration: none; text-align: left; cursor: pointer; font-size: 15px; }
.menu .sheet a:hover, .menu .sheet button:hover { background: var(--tint); }
.menu .who { padding: 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.spin { width: 18px; height: 18px; border-radius: 999px; border: 2px solid var(--line-strong); border-top-color: var(--accent); animation: turn .8s linear infinite; }
@keyframes turn { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 48px; color: var(--muted); }

/* --- small screens -------------------------------------------------------- */

@media (max-width: 860px) {
  .topbar { padding: 10px 16px; }
  .topbar .nav { display: none; }
  .page { padding: 20px 16px 96px; }
  .home { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .explain { padding: 24px; gap: 20px; }
  .explain h1 { font-size: 32px; letter-spacing: -.8px; }
  .explain p { font-size: 16px; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .gate { grid-template-columns: minmax(0, 1fr); }
  .gate .explain { padding: 28px 24px; }
  .chathead { padding: 10px 16px; }
  .thread { padding: 20px 16px 8px; }
  .composer { padding: 8px 12px 84px; }
  .chat { min-height: calc(100vh - 61px); }
  .home.seen .explain { display: none; }
  .todo { flex-direction: column; align-items: stretch !important; }
  .todo .acts { justify-content: flex-start; }
  .ask .bar, .ask .bar .row { flex-direction: column; align-items: stretch; }
  .ask .level, .ask .btn { width: 100%; }
  .tabbar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); z-index: 15; }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px; color: var(--muted); font-size: 12px; font-weight: 600; text-decoration: none; border-radius: 10px; }
  .tabbar a[aria-current="page"] { color: var(--accent); }
  #toasts { bottom: 84px; }
}
