:root {
  color-scheme: light;
  --forest-950: #0d1714;
  --forest-900: #14231f;
  --forest-800: #1c312b;
  --forest-700: #29433b;
  --ink: #17201d;
  --ink-soft: #53615c;
  --stone-50: #fbfaf6;
  --stone-100: #f4f1e9;
  --stone-200: #e7e2d7;
  --paper: #ffffff;
  --lime: #cbf36d;
  --lime-strong: #b8e755;
  --copper: #c97842;
  --gold: #c98a32;
  --red: #c9544d;
  --blue: #4c7c88;
  --line: rgba(23,32,29,.105);
  --line-dark: rgba(255,255,255,.11);
  --shadow-sm: 0 1px 2px rgba(25,33,30,.04), 0 8px 24px rgba(25,33,30,.055);
  --shadow-lg: 0 30px 80px rgba(5,14,11,.25);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--stone-100); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--stone-100); -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
textarea::placeholder, input::placeholder { color: #8c9893; }
.is-hidden { display: none !important; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 342px minmax(0, 1fr); }
.pet-rail { min-height: 100vh; height: 100vh; position: sticky; top: 0; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 32px 30px 25px; color: #f9fbf7; background: radial-gradient(circle at 50% 30%, #28433a 0, var(--forest-900) 35%, var(--forest-950) 100%); }
.pet-rail::before { content: ""; position: absolute; width: 360px; height: 360px; left: -95px; top: 135px; border: 1px solid rgba(203,243,109,.13); border-radius: 50%; box-shadow: 0 0 0 55px rgba(203,243,109,.025), 0 0 0 110px rgba(203,243,109,.018); pointer-events: none; }
.rail-main, .rail-footer { position: relative; z-index: 1; }
.brand { display: flex; align-items: center; gap: 11px; font-size: 13px; font-weight: 900; letter-spacing: .18em; }
.brand-mark { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; color: #1c2915; background: var(--lime); letter-spacing: 0; box-shadow: 0 8px 22px rgba(203,243,109,.2); }
.brand-mark img { width: 31px; height: 31px; object-fit: contain; }
.brand-suffix { margin-left: -5px; color: #89958f; font-size: 10px; letter-spacing: .12em; }
.sparky-frame { position: relative; z-index: 1; width: 100%; height: 292px; margin: 5px 0 -2px; overflow: hidden; display: grid; place-items: center; }
.sparky-frame.compact { width: 240px; height: 220px; margin: -20px auto -10px; transform: scale(.78); }
.sparky-sprite { width: 240px; height: 260px; background-image: url('/sparky.webp'); background-size: 1920px 2860px; background-repeat: no-repeat; background-position: 0 0; image-rendering: auto; filter: drop-shadow(0 25px 18px rgba(0,0,0,.3)); }
.status-pill { width: fit-content; display: flex; align-items: center; gap: 8px; margin: 0 0 24px; color: var(--lime); background: rgba(203,243,109,.075); border: 1px solid rgba(203,243,109,.18); border-radius: 999px; padding: 8px 12px; font-size: 11px; font-weight: 760; letter-spacing: .01em; }
.status-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 12px rgba(203,243,109,.8); }
.pet-rail h1 { margin: 0 0 15px; font-size: 42px; line-height: 1; letter-spacing: -.05em; }
.pet-rail h1 em { color: var(--lime); font-style: normal; }
.pet-copy { max-width: 260px; margin: 0; color: #a7b1ad; font-size: 14px; line-height: 1.55; }
.rail-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 18px; border-top: 1px solid var(--line-dark); }
.rail-footer p { margin: 0; color: #7f8d87; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.rail-actions { display: flex; gap: 7px; }

.workspace { width: min(1080px, 100%); margin-inline: auto; padding: 42px 48px 80px; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; margin-bottom: 28px; }
.eyebrow { margin: 0 0 8px; color: var(--lime); font-size: 10px; font-weight: 850; letter-spacing: .17em; }
.eyebrow.dark { color: var(--copper); }
.topbar h2 { margin: 0; font-size: clamp(29px, 4vw, 40px); line-height: 1.08; letter-spacing: -.045em; }
.header-copy { max-width: 520px; margin: 9px 0 0; color: var(--ink-soft); font-size: 14px; line-height: 1.5; }
.counts { display: flex; align-items: stretch; gap: 9px; }
.counts span { min-width: 84px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; padding: 12px 13px; color: var(--ink-soft); background: rgba(255,255,255,.56); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 1px 1px rgba(0,0,0,.02); }
.counts small { font-size: 9px; font-weight: 820; letter-spacing: .12em; }
.counts strong { color: var(--ink); font-size: 23px; letter-spacing: -.04em; }
.counts .urgent-count { background: #fff7f5; border-color: rgba(201,84,77,.16); }
.counts .urgent-count strong { color: var(--red); }

.capture-card { display: grid; grid-template-columns: minmax(240px,.8fr) minmax(360px,1.2fr); align-items: center; gap: 28px; padding: 24px 25px; color: #f8fbf6; background: linear-gradient(135deg, var(--forest-800), var(--forest-900)); border: 1px solid rgba(255,255,255,.08); border-radius: 22px; box-shadow: 0 18px 45px rgba(20,35,31,.16); }
.capture-copy { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: flex-start; }
.capture-icon { width: 42px; height: 42px; display: grid; place-items: center; flex: 0 0 auto; color: #1d2a16; background: var(--lime); border-radius: 13px; font-size: 26px; line-height: 1; }
.capture-card h3 { margin: 0 0 5px; font-size: 18px; letter-spacing: -.015em; }
.capture-card p:not(.eyebrow) { margin: 0; color: #aebbb6; font-size: 12px; line-height: 1.45; }
.capture-form textarea, .chat-form textarea { width: 100%; resize: none; outline: none; border-radius: 13px; transition: border-color .15s, box-shadow .15s; }
.capture-form textarea { min-height: 66px; padding: 13px 14px; color: #f8faf7; background: rgba(4,11,8,.35); border: 1px solid rgba(255,255,255,.11); }
.capture-form textarea:focus { border-color: rgba(203,243,109,.52); box-shadow: 0 0 0 3px rgba(203,243,109,.08); }
.capture-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 9px; }

.primary, .quiet, .voice-button { min-height: 39px; border-radius: 10px; padding: 9px 13px; font-weight: 760; border: 0; transition: transform .12s, background-color .12s, border-color .12s; }
.primary { display: inline-flex; align-items: center; justify-content: center; gap: 9px; color: #1b2913; background: var(--lime); }
.primary:hover { background: #ddff90; }
.primary:active, .quiet:active, .voice-button:active { transform: translateY(1px); }
.quiet, .voice-button { color: #edf2ee; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); }
.quiet:hover, .voice-button:hover { background: rgba(255,255,255,.1); }
.voice-button span { color: var(--red); font-size: 9px; }
.full { width: 100%; margin-top: 16px; }

.tabs { width: fit-content; display: flex; gap: 2px; margin: 30px 0 26px; padding: 4px; background: rgba(255,255,255,.48); border: 1px solid var(--line); border-radius: 13px; }
.tabs button { min-height: 38px; display: flex; align-items: center; gap: 7px; padding: 8px 13px; color: #68736f; background: transparent; border: 0; border-radius: 9px; font-weight: 720; }
.tabs button b { width: 17px; color: #8f9a95; font-size: 12px; font-weight: 800; }
.tabs button.active { color: var(--ink); background: var(--paper); box-shadow: 0 2px 9px rgba(20,31,27,.08); }
.tabs button.active b { color: var(--copper); }
.tabs span { min-width: 20px; height: 20px; display: inline-grid; place-items: center; padding: 0 6px; margin-left: 1px; color: #69736f; background: var(--stone-100); border-radius: 999px; font-size: 10px; }
.tabs button.active span { color: var(--forest-900); background: #edf2e4; }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: reveal .18s ease-out; }
@keyframes reveal { from { opacity: 0; transform: translateY(4px); } }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 13px; }
.section-heading .eyebrow { margin-bottom: 5px; }
.section-heading h3 { margin: 0; font-size: 21px; letter-spacing: -.025em; }
.section-heading > p { margin: 0 0 2px; color: #75807c; font-size: 12px; }
.action-list, .proposal-list { display: grid; gap: 9px; }
.action-card, .proposal-card { background: rgba(255,255,255,.86); border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--shadow-sm); }
.action-card { min-height: 78px; display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 14px; padding: 14px 14px 14px 16px; transition: transform .14s, border-color .14s, box-shadow .14s; }
.action-card:hover { transform: translateY(-1px); border-color: rgba(23,32,29,.17); box-shadow: 0 2px 3px rgba(25,33,30,.04), 0 14px 30px rgba(25,33,30,.07); }
.priority-bar { width: 4px; height: 48px; border-radius: 999px; background: #a9b1ae; }
.priority-bar.urgent { background: var(--red); }
.priority-bar.important { background: var(--gold); }
.action-main { min-width: 0; }
.action-main h4 { margin: 0 0 5px; color: var(--ink); font-size: 14px; font-weight: 760; letter-spacing: -.005em; }
.action-main p { margin: 0; color: #697570; font-size: 12px; line-height: 1.45; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 7px; }
.tag { padding: 3px 7px; color: #68736f; background: var(--stone-100); border: 1px solid rgba(23,32,29,.05); border-radius: 6px; font-size: 10px; font-weight: 650; text-transform: capitalize; }
.tag.priority-urgent { color: #a94741; background: #fff0ee; }
.tag.priority-important { color: #9c681e; background: #fff5e4; }
.tag.due { color: #8d5821; background: #fff4e4; border-color: rgba(201,138,50,.12); }
.tag.due.overdue { color: #a23f39; background: #ffebe8; border-color: rgba(201,84,77,.15); }
.complete-button { width: 36px; height: 36px; display: grid; place-items: center; color: #7b8782; background: #fafaf7; border: 1px solid var(--stone-200); border-radius: 50%; font-size: 15px; transition: color .12s, border-color .12s, background .12s; }
.complete-button:hover { color: var(--forest-900); background: #eff8dc; border-color: var(--lime-strong); }
.action-card.completed { opacity: .55; box-shadow: none; }
.action-card.completed h4 { text-decoration: line-through; }

.proposal-card { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 20px; padding: 19px; border-left: 4px solid var(--blue); }
.proposal-card h4 { margin: 0 0 6px; font-size: 16px; }
.proposal-card p:not(.eyebrow) { margin: 0; color: var(--ink-soft); font-size: 12px; line-height: 1.48; }
.proposal-actions { display: flex; gap: 7px; }
.proposal-actions button { min-height: 38px; padding: 8px 13px; border-radius: 9px; font-weight: 760; }
.approve { color: #1b2913; background: var(--lime); border: 1px solid var(--lime-strong); }
.reject { color: var(--ink-soft); background: var(--paper); border: 1px solid var(--stone-200); }
.empty { padding: 48px 22px; text-align: center; color: #7c8783; background: rgba(255,255,255,.38); border: 1px dashed rgba(23,32,29,.16); border-radius: 15px; }

.chat-panel { max-width: 820px; }
.chat-history { height: min(52vh,520px); overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 14px 5px 22px; }
.message { max-width: 82%; padding: 12px 14px; border-radius: 15px; font-size: 14px; line-height: 1.48; white-space: pre-wrap; box-shadow: 0 2px 10px rgba(25,33,30,.05); }
.message.user { align-self: flex-end; color: #1b2913; background: var(--lime); border-bottom-right-radius: 5px; }
.message.sparky { align-self: flex-start; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.chat-form { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 9px; padding: 13px; background: rgba(255,255,255,.66); border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--shadow-sm); }
.chat-form textarea { min-height: 48px; padding: 11px 12px; color: var(--ink); background: transparent; border: 0; }
.chat-form textarea:focus { box-shadow: none; }
.chat-form button { min-width: 72px; height: 42px; }
.chat-connection { margin: 8px 2px 0; color: #7b8581; font-size: 10px; }

.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 25%, #2c4a40 0, var(--forest-900) 40%, var(--forest-950) 100%); }
.login-screen::before { content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .32; background-image: radial-gradient(rgba(255,255,255,.1) .7px, transparent .7px); background-size: 22px 22px; }
.login-card { position: relative; width: min(430px,100%); padding: 30px 34px 28px; text-align: center; color: #f7faf6; background: rgba(13,23,20,.72); border: 1px solid rgba(255,255,255,.1); border-radius: 26px; box-shadow: var(--shadow-lg); backdrop-filter: blur(18px); }
.login-card > .eyebrow { display: none; }
.login-card h1 { margin: 0 0 8px; font-size: 32px; letter-spacing: -.04em; }
.login-card > p:not(.eyebrow):not(.error) { max-width: 340px; margin: 0 auto; color: #aeb9b5; font-size: 14px; line-height: 1.52; }
.login-card form { margin-top: 24px; text-align: left; }
.login-card label { display: block; margin: 0 0 7px; color: #aeb9b5; font-size: 11px; font-weight: 720; }
.login-card input { width: 100%; padding: 12px 13px; outline: none; color: #f8faf7; background: rgba(2,8,5,.42); border: 1px solid rgba(255,255,255,.11); border-radius: 11px; }
.login-card input:focus { border-color: rgba(203,243,109,.58); box-shadow: 0 0 0 3px rgba(203,243,109,.08); }
.error { min-height: 18px; margin-bottom: 0; color: #ff918a; font-size: 12px; }
.access-dialog { width: min(480px, calc(100% - 28px)); padding: 0; color: var(--ink); background: transparent; border: 0; }
.access-dialog::backdrop { background: rgba(7,16,13,.67); backdrop-filter: blur(8px); }
.access-card { position: relative; padding: 28px; background: var(--stone-50); border: 1px solid rgba(255,255,255,.65); border-radius: 22px; box-shadow: var(--shadow-lg); }
.access-card h2 { margin: 0 36px 9px 0; font-size: 25px; letter-spacing: -.035em; }
.dialog-copy { margin: 0 0 22px; color: var(--ink-soft); font-size: 13px; line-height: 1.5; }
.access-card label { display: block; margin: 13px 0 6px; color: var(--ink-soft); font-size: 11px; font-weight: 760; }
.access-card input:not(.credential-username) { width: 100%; padding: 12px 13px; outline: none; color: var(--ink); background: #fff; border: 1px solid var(--stone-200); border-radius: 11px; }
.access-card input:focus { border-color: var(--forest-700); box-shadow: 0 0 0 3px rgba(41,67,59,.09); }
.credential-username { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dialog-close { position: absolute; top: 18px; right: 18px; width: 34px; height: 34px; display: grid; place-items: center; padding: 0; color: #72807a; background: var(--stone-100); border: 1px solid var(--stone-200); border-radius: 50%; font-size: 21px; }
.access-error { min-height: 18px; margin: 10px 0 0; color: var(--red); font-size: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.dialog-actions button { min-height: 41px; padding: 9px 14px; border-radius: 10px; font-weight: 760; }
.dialog-cancel { color: var(--ink-soft); background: #fff; border: 1px solid var(--stone-200); }
.toast { position: fixed; z-index: 20; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translate(-50%,20px); opacity: 0; pointer-events: none; padding: 11px 15px; color: #17200e; background: #e8f8c4; border-radius: 11px; box-shadow: 0 16px 45px rgba(20,31,27,.2); font-size: 12px; font-weight: 760; transition: .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%,0); }

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .pet-rail { min-height: 68px; height: auto; position: relative; flex-direction: row; align-items: center; padding: 16px 22px; }
  .rail-main { display: contents; }
  .pet-rail::before, .pet-rail h1, .pet-copy, .pet-rail .status-pill, .pet-rail .sparky-frame { display: none; }
  .rail-footer { padding: 0; border: 0; }
  .rail-footer p { display: none; }
  .workspace { padding: 30px 24px 110px; }
  .capture-card { grid-template-columns: 1fr 1.15fr; }
}

@media (max-width: 650px) {
  .pet-rail { min-height: 62px; padding: 13px 15px; }
  .brand-mark { width: 31px; height: 31px; border-radius: 10px; }
  .logout { min-height: 34px; padding: 7px 11px; font-size: 12px; }
  .workspace { padding: 24px 14px 104px; }
  .topbar { align-items: flex-start; gap: 15px; margin-bottom: 21px; }
  .topbar h2 { font-size: 26px; }
  .header-copy { display: none; }
  .counts { gap: 5px; }
  .counts span { min-width: 56px; display: block; padding: 7px 8px; text-align: center; border-radius: 11px; }
  .counts small { display: block; margin-bottom: 1px; font-size: 7px; }
  .counts strong { font-size: 18px; }
  .capture-card { grid-template-columns: 1fr; gap: 15px; padding: 17px; border-radius: 18px; }
  .capture-icon { width: 38px; height: 38px; border-radius: 11px; }
  .capture-card h3 { font-size: 16px; }
  .capture-form textarea { min-height: 72px; }
  .capture-actions { justify-content: stretch; }
  .capture-actions button { flex: 1; padding-inline: 8px; }
  .tabs { position: fixed; z-index: 10; left: 9px; right: 9px; bottom: calc(8px + env(safe-area-inset-bottom)); width: auto; justify-content: stretch; margin: 0; padding: 5px; background: rgba(255,255,255,.94); box-shadow: 0 12px 45px rgba(20,31,27,.22); backdrop-filter: blur(18px); }
  .tabs button { flex: 1; justify-content: center; padding: 9px 5px; font-size: 12px; }
  .tabs button b { display: none; }
  .tabs span { min-width: 18px; height: 18px; font-size: 9px; }
  .section-heading { display: block; }
  .section-heading > p { margin-top: 6px; }
  .action-card { gap: 11px; padding: 13px 11px 13px 13px; }
  .action-main p { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .meta { gap: 4px; }
  .tag { padding: 3px 5px; }
  .proposal-card { grid-template-columns: 1fr; gap: 14px; padding: 16px; }
  .proposal-actions button { flex: 1; }
  .message { max-width: 91%; }
  .chat-history { height: 45vh; }
  .chat-form { padding: 9px; }
  .login-card { padding: 25px 22px 23px; border-radius: 22px; }
  .access-card { padding: 24px 19px 20px; }
  .dialog-actions { display: grid; grid-template-columns: 1fr 1.35fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
