/* LoanPilot Agents — the Ippo One / LoanPilot design language (packages/ui theme.css tokens):
   ink #111C24, lime #CAFC01, substrate #F9FAFC, DM Mono headings/labels, Inter text, tight 0.3rem radius,
   dark ink sidebar with a lime active state. */
:root {
  color-scheme: light;
  --ink: #111c24; --lime: #cafc01; --substrate: #f9fafc;
  --bg: #f9fafc; --fg: #111c24; --card: #fff; --muted: #f1f3f6; --muted-fg: #5d6a73;
  --secondary: #eef1f4; --border: #e4e8ec; --input: #d9dee4; --ring: #111c24;
  --primary: #111c24; --primary-fg: #fff;
  --success: #1f9d55; --success-ink: #13703b; --warning: #e8a317; --warning-ink: #8a5a00;
  --danger: #d64545; --danger-ink: #b02a2a;
  --sidebar: #111c24; --sidebar-fg: #f9fafc; --sidebar-active: #cafc01; --sidebar-active-fg: #111c24;
  --sidebar-accent: rgb(255 255 255 / .07); --sidebar-border: rgb(255 255 255 / .09);
  --radius: 0.3rem;
  --shadow: 0 1px 2px rgb(17 28 36 / .04), 0 6px 20px rgb(17 28 36 / .05);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --substrate: #0b1218; --bg: #0b1218; --fg: #f9fafc; --card: #111c24; --muted: #17232d;
    --muted-fg: #9aa7b1; --secondary: #17232d; --border: rgb(255 255 255 / .09); --input: rgb(255 255 255 / .14);
    --ring: #cafc01; --primary: #cafc01; --primary-fg: #111c24;
    --sidebar: #0e171e; --sidebar-accent: rgb(255 255 255 / .06); --sidebar-border: rgb(255 255 255 / .07);
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px rgb(0 0 0 / .45);
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', system-ui, sans-serif; font-size: 14px; line-height: 1.5; }
.mono, h1, h2, h3, .label, .brand, .nav a, .pill, .btn { font-family: 'DM Mono', ui-monospace, 'SF Mono', Menlo, monospace; }
h1, h2, h3 { font-weight: 500; letter-spacing: -.01em; }
a { color: inherit; }
button { font: inherit; cursor: pointer; }

/* ---- shell: dark sidebar + light content ---- */
.shell { display: flex; min-height: 100%; }
.sidebar { width: 236px; flex: none; background: var(--sidebar); color: var(--sidebar-fg); display: flex; flex-direction: column;
  padding: 18px 14px; padding-top: calc(18px + env(safe-area-inset-top,0px)); position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 500; letter-spacing: -.02em; padding: 4px 8px 20px; }
.brand .logo { width: 28px; height: 28px; border-radius: var(--radius); background: var(--lime); color: var(--ink); display: grid; place-items: center; font-weight: 500; }
.brand .sub { color: rgb(255 255 255 / .5); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: var(--radius); color: rgb(255 255 255 / .72);
  font-size: 12.5px; font-weight: 400; text-decoration: none; cursor: pointer; letter-spacing: .01em; }
.nav a:hover { background: var(--sidebar-accent); color: #fff; }
.nav a.on { background: var(--sidebar-active); color: var(--sidebar-active-fg); font-weight: 500; }
.side-foot { margin-top: auto; border-top: 1px solid var(--sidebar-border); padding-top: 14px; font-size: 12px; }
.side-foot .u { color: #fff; font-weight: 500; }
.side-foot .o { color: rgb(255 255 255 / .5); font-family: 'DM Mono', monospace; font-size: 11px; margin-top: 2px; }
.side-foot a { color: rgb(255 255 255 / .6); text-decoration: none; font-size: 11px; }
.side-foot a:hover { color: var(--lime); }

.main { flex: 1; min-width: 0; }
.wrap { max-width: 980px; margin: 0 auto; padding: 32px 28px 64px; }
.page-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-h h1 { font-size: 20px; margin: 0; }
.page-h .muted { color: var(--muted-fg); font-size: 13px; margin-top: 4px; font-family: inherit; }

/* ---- buttons ---- */
.btn { font-size: 12px; font-weight: 500; letter-spacing: .01em; padding: 8px 14px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--card); color: var(--fg); }
.btn:hover { border-color: var(--input); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); }
.btn.sm { padding: 5px 10px; font-size: 11px; }
.btn:disabled { opacity: .5; cursor: default; }

/* ---- cards ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card .r1 { display: flex; align-items: center; gap: 11px; margin-bottom: 10px; }
.ic { width: 36px; height: 36px; border-radius: var(--radius); display: grid; place-items: center; font-size: 16px; flex: none;
  background: var(--muted); color: var(--fg); }
.card h3 { margin: 0; font-size: 14px; }
.card .k { font-size: 11px; color: var(--muted-fg); font-family: 'DM Mono', monospace; margin-top: 2px; }
.card .goal { color: var(--muted-fg); font-size: 13px; margin: 10px 0 14px; min-height: 18px; font-family: -apple-system, Inter, sans-serif; }
.card .foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; border-top: 1px solid var(--border); padding-top: 11px; }
.pill { font-size: 10.5px; font-weight: 500; padding: 3px 9px; border-radius: 999px; letter-spacing: .03em; text-transform: uppercase; }
.pill.draft { background: var(--secondary); color: var(--muted-fg); }
.pill.active { background: color-mix(in srgb, var(--success) 15%, transparent); color: var(--success-ink); }
.pill.paused { background: color-mix(in srgb, var(--warning) 18%, transparent); color: var(--warning-ink); }

/* ---- empty ---- */
.empty { text-align: center; padding: 64px 24px; background: var(--card); border: 1px dashed var(--input); border-radius: var(--radius); }
.empty h2 { font-size: 16px; margin: 0 0 6px; }
.empty .muted { color: var(--muted-fg); font-size: 13px; font-family: -apple-system, Inter, sans-serif; }

/* ---- modal ---- */
.scrim { position: fixed; inset: 0; background: rgb(17 28 36 / .5); display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); width: 100%; max-width: 460px; padding: 22px; }
.modal h2 { margin: 0 0 16px; font-size: 16px; }
.field { margin-bottom: 14px; }
.field label, .label { display: block; font-size: 10.5px; font-weight: 500; color: var(--muted-fg); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: .06em; font-family: 'DM Mono', monospace; }
.field input, .field select, .field textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--input); border-radius: var(--radius);
  background: var(--bg); color: var(--fg); font: inherit; font-family: -apple-system, Inter, sans-serif; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--ring); outline-offset: -1px; border-color: var(--ring); }
.field textarea { min-height: 62px; resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.section-h { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted-fg); font-family: 'DM Mono', monospace;
  margin: 18px 0 10px; border-top: 1px solid var(--border); padding-top: 14px; }
.chk { display: flex; align-items: center; gap: 9px; font-size: 13px; padding: 5px 0; color: var(--fg); font-family: -apple-system, Inter, sans-serif; }
.chk input { width: 15px; height: 15px; accent-color: var(--ink); }
.req { font-size: 10px; color: var(--warning-ink); font-weight: 600; }

/* ---- readiness ---- */
.rdy { background: var(--muted); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px; font-size: 12.5px; font-family: -apple-system, Inter, sans-serif; }
.rdy-h { font-weight: 600; margin-bottom: 7px; }
.rq { padding: 2px 0; }
.rq.ok { color: var(--success-ink); }
.rq.no { color: var(--muted-fg); }

/* ---- sign in ---- */
.signin { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--bg); }
.signin .box { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 40px; max-width: 380px; text-align: center; }
.signin .logo { width: 46px; height: 46px; margin: 0 auto 18px; border-radius: var(--radius); background: var(--lime); color: var(--ink); display: grid; place-items: center; font-weight: 500; font-size: 22px; font-family: 'DM Mono', monospace; }
.signin h1 { font-size: 19px; margin: 0 0 8px; }
.signin p { color: var(--muted-fg); margin: 0 0 22px; font-family: -apple-system, Inter, sans-serif; font-size: 13px; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #f9fafc; padding: 10px 16px; border-radius: var(--radius); font-size: 12.5px; z-index: 60; box-shadow: var(--shadow); }
.toast.err { background: var(--danger); color: #fff; }
.spin { padding: 80px; text-align: center; color: var(--muted-fg); font-family: 'DM Mono', monospace; font-size: 13px; }

@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .sidebar { width: auto; height: auto; position: static; flex-direction: row; align-items: center; gap: 8px; padding: 10px 14px; }
  .brand { padding: 0; } .nav { flex-direction: row; } .side-foot { margin: 0 0 0 auto; border: none; padding: 0; }
  .side-foot .o { display: none; }
}
