*{box-sizing:border-box}
html,body{overflow-x:clip}
body{margin:0;font-family:Inter,system-ui,-apple-system,sans-serif;background:#F5F6F8;color:#111827;font-size:15px}
[hidden]{display:none!important}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
.screen{min-height:100dvh;display:flex;flex-direction:column;padding-bottom:calc(var(--tabs-h,64px) + 8px);max-width:760px;margin:0 auto}
.top{display:flex;align-items:center;gap:12px;padding:16px 20px 12px;background:#fff;border-bottom:1px solid #E5E7EB;position:sticky;top:0;z-index:1}
.top h1{margin:0;font-size:22px}
.grow{flex:1}
.avatar{width:40px;height:40px;border-radius:50%;overflow:hidden;background:#1D4ED8;color:#fff;display:flex;align-items:center;justify-content:center;font-weight:700}
.title{font-weight:600;font-size:17px}
.sub{font-size:12px;color:#4B5563}
.pill{font-size:12px;background:#F3F4F6;border-radius:999px;padding:6px 10px;color:#374151}
.list{flex:1;display:flex;flex-direction:column;gap:12px;padding:16px}
.card{background:#fff;border:1px solid #E5E7EB;border-radius:14px;padding:14px;display:flex;flex-direction:column;gap:10px}
.card.warn{background:#FFFBEB;border-color:#F5C451}
.me{align-self:flex-end;max-width:85%;background:#1D4ED8;color:#fff;border-radius:18px 18px 4px 18px;padding:12px 14px;line-height:1.45;white-space:pre-wrap}
.meta{display:flex;justify-content:space-between;font-size:12px;color:#4B5563}
.row{display:flex;justify-content:space-between;gap:8px;font-size:14px}
.row span:last-child{color:#4B5563}
.money{display:flex;justify-content:space-between;background:#F3F4F6;border-radius:10px;padding:10px 12px;font-size:13px}
.result{white-space:pre-wrap;line-height:1.5;font-size:14px;max-height:360px;overflow:auto;background:#F9FAFB;border-radius:10px;padding:10px}
.buttons{display:flex;gap:8px}
button{font:inherit;cursor:pointer}
.buttons button,.login button{flex:1;min-height:44px;border-radius:10px;border:1px solid #D1D5DB;background:#fff;font-weight:500}
button.primary{background:#1D4ED8;border-color:#1D4ED8;color:#fff;font-weight:600}
textarea,input,select{font:inherit}
textarea{width:100%;min-height:80px;border:1px solid #D1D5DB;border-radius:10px;padding:10px}
.composer{position:fixed;bottom:var(--tabs-h,64px);left:0;right:0;max-width:760px;margin:0 auto;display:flex;flex-wrap:wrap;gap:8px;padding:10px 12px;background:#fff;border-top:1px solid #E5E7EB}
.composer input{flex:1;min-height:44px;border:1px solid #D1D5DB;border-radius:22px;padding:0 16px;background:#F9FAFB}
.composer select{max-width:110px;border:1px solid #D1D5DB;border-radius:10px;background:#fff}
.round{width:44px;height:44px;border-radius:22px;border:0;font-size:18px}
#chat .list{padding-bottom:calc(var(--composer-h,80px) + 8px)}
.tabs{position:fixed;bottom:0;left:0;right:0;display:grid;grid-template-columns:repeat(4,1fr);background:#fff;border-top:1px solid #E5E7EB;padding:6px 6px calc(6px + env(safe-area-inset-bottom))}
.tabs button{min-height:48px;border:0;background:none;color:#4B5563;font-size:13px}
.tabs button.on{color:#1D4ED8;font-weight:600}
.login{max-width:360px;margin:20vh auto 0;width:calc(100% - 32px)}
.login h1{margin:0 0 4px}
.login input{min-height:44px;border:1px solid #D1D5DB;border-radius:10px;padding:0 12px}
.stack{display:flex;flex-direction:column;gap:10px}
.stack p{margin:0;line-height:1.45}
.qr{width:200px;align-self:center}
.qr svg{width:100%;height:auto}
code{word-break:break-all;font-size:13px}
button.link{background:none;border:0;color:#1D4ED8;min-height:44px;font-size:14px}
.error{color:#B42318;font-size:13px;margin:0}
.bar{height:8px;border-radius:999px;background:#E5E7EB;overflow:hidden}
.bar div{height:8px;background:#1D4ED8}
.big{font-size:28px;font-weight:700}
details summary{cursor:pointer;list-style:none;min-height:32px;align-items:center}
details summary::-webkit-details-marker{display:none}
.nested{border-top:1px solid #F3F4F6;padding:6px 0 6px 12px;display:flex;flex-direction:column;gap:6px}
.nested[open]{gap:6px}
.user{padding-left:12px;font-size:13px}
.card a{color:#1D4ED8;font-size:13px}
.meta input[type=month]{font:inherit;font-size:13px;border:1px solid #D1D5DB;border-radius:8px;padding:4px 6px}
.empty{color:#4B5563;text-align:center;padding:40px 0}
.form{display:flex;flex-direction:column;gap:8px}
.form input{min-height:44px;border:1px solid #D1D5DB;border-radius:10px;padding:0 12px}
.form label{font-size:13px;color:#374151}
.status{font-size:12px;border-radius:999px;padding:2px 8px;background:#F3F4F6;color:#374151;white-space:nowrap}
.picked{display:flex;flex-wrap:wrap;gap:6px;align-items:center;font-size:13px;color:#374151}
.picked select{font:inherit;font-size:13px;border:1px solid #D1D5DB;border-radius:8px;padding:4px}

/* files */
.attached{flex-basis:100%;display:flex;flex-wrap:wrap;gap:6px}
.attached:empty{display:none}
.chip{display:flex;align-items:center;gap:6px;background:#EEF2FF;border-radius:999px;padding:4px 4px 4px 10px;font-size:12px;max-width:100%}
.chip span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:180px}
.chip button{border:0;background:none;min-width:28px;min-height:28px;font-size:16px;color:#374151}
.chip.err{background:#FEE4E2}
button.plain{background:#F3F4F6;color:#374151;border:0;display:flex;align-items:center;justify-content:center}
.drop-hint{position:fixed;inset:0;background:rgba(29,78,216,.12);border:3px dashed #1D4ED8;display:flex;align-items:center;justify-content:center;font-size:20px;font-weight:600;color:#1D4ED8;z-index:10;pointer-events:none}
.files{display:grid;grid-template-columns:repeat(auto-fill,minmax(140px,1fr));gap:10px}
.file{border:1px solid #E5E7EB;border-radius:10px;overflow:hidden;display:flex;flex-direction:column;background:#fff}
.file img,.file video{width:100%;height:110px;object-fit:cover;background:#F3F4F6;display:block}
.file .ph{height:110px;display:flex;align-items:center;justify-content:center;background:#F3F4F6;color:#4B5563;font-size:13px;text-transform:uppercase}
.file .meta2{padding:8px;font-size:12px;display:flex;flex-direction:column;gap:2px}
.file .meta2 span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* iPad and computer: sidebar, wider pages, chat and approvals side by side */
@media (min-width: 700px) {
  body{display:block}
  #app{display:grid;grid-template-columns:200px 1fr;min-height:100dvh}
  .tabs{position:sticky;top:0;height:100dvh;grid-row:1;grid-column:1;display:flex;flex-direction:column;justify-content:flex-start;gap:4px;padding:20px 12px;border-top:0;border-right:1px solid #E5E7EB}
  .tabs button{text-align:left;padding:0 14px;border-radius:10px;font-size:15px}
  .tabs button.on{background:#EEF2FF}
  .screen{grid-column:2;grid-row:1;max-width:none;padding-bottom:0;margin:0}
  #app.wide-chat{grid-template-columns:200px minmax(0,1fr) minmax(320px,420px)}
  #app.wide-chat #approvals{grid-column:3;border-left:1px solid #E5E7EB;display:flex!important;max-height:100dvh;overflow:auto;position:sticky;top:0}
  .composer{position:sticky;bottom:0;max-width:none;margin:0}
  #chat .list{padding-bottom:16px}
  #projects .list,#costs .list{max-width:980px}
  .login{margin-top:15vh}
}

/* dates and finished jobs */
.stamp{font-size:11px;color:#6B7280;margin-top:4px;text-align:right}
.me .stamp{color:#DBEAFE}
.day{align-self:center;font-size:12px;color:#4B5563;background:#E5E7EB;border-radius:999px;padding:3px 10px;margin:6px 0}
.bar.done div{background:#16A34A}

/* previews */
.thumb{position:relative;border:0;padding:0;background:none;display:block;width:100%;cursor:zoom-in}
.thumb .play{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;font-size:32px;color:#fff;text-shadow:0 1px 4px rgba(0,0,0,.6)}
.viewer{position:fixed;inset:0;background:rgba(0,0,0,.92);z-index:70;display:flex;flex-direction:column}
.viewer-bar{display:flex;align-items:center;gap:16px;padding:calc(10px + env(safe-area-inset-top)) 14px 10px;color:#fff;font-size:14px}
.viewer-bar span{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.viewer-bar a{color:#BFDBFE}
.viewer-bar button{background:none;border:0;color:#fff;font-size:22px;min-width:44px;min-height:44px}
.viewer img,.viewer video{flex:1;min-height:0;width:100%;object-fit:contain}
details.nested summary span:first-child{color:#111827}

.rule-group{display:flex;flex-direction:column;gap:6px}
.rule{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:8px 0;border-top:1px solid #F3F4F6;font-size:14px}
.form select{min-height:44px;border:1px solid #D1D5DB;border-radius:10px;padding:0 10px;background:#fff;font:inherit}
.job-files{display:flex;flex-direction:column;gap:6px;margin-top:6px}
.job-files h3{margin:0;font-size:13px;color:#374151}

.update{position:fixed;top:calc(10px + env(safe-area-inset-top));left:50%;transform:translateX(-50%);z-index:60;background:#111827;color:#fff;border:0;border-radius:999px;padding:12px 20px;font-size:14px;font-weight:600;box-shadow:0 4px 16px rgba(0,0,0,.25)}
.change-box{display:flex;flex-direction:column;gap:8px;margin-top:10px}.change-box textarea{width:100%;min-height:64px;box-sizing:border-box;font:inherit;padding:10px;border:1px solid #D1D5DB;border-radius:10px}
.avatar img{width:100%;height:100%;object-fit:cover;border-radius:inherit}
.mic.on{background:#DC2626;color:#fff;animation:pulse 1.2s ease-in-out infinite}.mic.busy{opacity:.55}
@keyframes pulse{0%,100%{box-shadow:0 0 0 0 rgba(220,38,38,.45)}50%{box-shadow:0 0 0 10px rgba(220,38,38,0)}}
@media (prefers-reduced-motion:reduce){.mic.on{animation:none}}
.composer input{min-width:0}@media (max-width:420px){.composer select{max-width:84px;font-size:13px}}

/* projects: one simple list, details on tap */
.new-project{align-self:flex-start;min-height:44px;padding:0 18px;border-radius:22px;border:0}
.list-card{padding:0;gap:0;overflow:hidden}
.proj-row{display:flex;align-items:center;gap:12px;width:100%;padding:14px 16px;background:none;border:0;border-bottom:1px solid #F1F5F9;text-align:left;font:inherit;color:inherit;cursor:pointer;min-height:60px}
.proj-row:last-child,.job-row:last-child{border-bottom:0}
.proj-row .grow,.job-row summary .grow{display:flex;flex-direction:column;gap:2px;min-width:0;flex:1}
.proj-row .amt{font-variant-numeric:tabular-nums;color:#374151}
.chev{color:#9CA3AF;font-size:20px}
.proj-head .big{font-size:20px}
.job-row{border-bottom:1px solid #F1F5F9}
.job-row summary{display:flex;align-items:center;gap:12px;padding:12px 16px;cursor:pointer;list-style:none;min-height:60px}
.job-row summary::-webkit-details-marker{display:none}
.job-row summary strong{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.job-thumb{width:48px;height:48px;border-radius:8px;object-fit:cover;flex:none;background:#F3F4F6;display:flex;align-items:center;justify-content:center;font-size:20px}
.job-body{display:flex;flex-direction:column;gap:10px;padding:0 16px 16px 76px}
.actions{display:flex;flex-wrap:wrap;align-items:center;gap:14px}
.actions select.move{min-height:36px;border:1px solid #D1D5DB;border-radius:8px;background:#fff;padding:0 8px}
.pill{font-size:12px;padding:3px 9px;border-radius:999px;background:#F3F4F6;color:#374151;white-space:nowrap;flex:none}
.pill.s-approved{background:#DCFCE7;color:#166534}.pill.s-awaiting_approval{background:#FEF3C7;color:#92400E}
.pill.s-running{background:#DBEAFE;color:#1E40AF}.pill.s-failed,.pill.s-stopped_budget{background:#FEE2E2;color:#991B1B}
@media (max-width:520px){.job-body{padding-left:16px}}
.viewer audio{width:min(92vw,560px);margin:auto}

.lock{position:fixed;inset:0;z-index:50;background:#fff;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:24px;text-align:center}
.lock-face{width:88px;height:88px;border-radius:50%;object-fit:cover}
.lock h1{font-size:22px;margin:4px 0 0}
.lock #unlock{min-height:52px;min-width:220px;border-radius:26px;border:0;font-size:17px}
.lock-settings .card{gap:12px}
@media (max-width:420px){.tabs button{font-size:12px;padding:0 2px}}
.ok{color:#166534}

/* costs chart: bars = spent per day/month (series 1), line = running total (series 2); one dollar axis */
.seg{display:inline-flex;border:1px solid #D1D5DB;border-radius:10px;overflow:hidden}
.seg button{border:0;background:#fff;padding:0 12px;min-height:36px;font:inherit;font-size:14px;color:#374151;cursor:pointer}
.seg button+button{border-left:1px solid #D1D5DB}
.seg button.on{background:#EEF2FF;color:#1D4ED8;font-weight:600}
.chart-wrap{position:relative}
.chart{width:100%;height:auto;display:block;overflow:visible}
.chart .grid{stroke:#EEF0F3;stroke-width:1}.chart .axis{stroke:#D1D5DB;stroke-width:1}
.chart .tick{font-size:12px;fill:#6B7280}
.chart .bar-mark{fill:#257de0}
.chart .run-line{fill:none;stroke:#f47230;stroke-width:2;stroke-linejoin:round;stroke-linecap:round}
.chart .run-dot{fill:#f47230;stroke:#fff;stroke-width:2}
.chart .run-label{font-size:13px;font-weight:600;fill:#111827}
.chart .hit{fill:transparent;cursor:pointer;outline:none}
.chart .guide{stroke:#9CA3AF;stroke-width:1;stroke-dasharray:3 3}
.chart-tip{position:absolute;top:0;transform:translateX(-50%);background:#111827;color:#fff;border-radius:8px;padding:6px 10px;font-size:13px;pointer-events:none;white-space:nowrap;box-shadow:0 4px 12px rgba(0,0,0,.15)}
.chart-tip .sub{color:#D1D5DB}
.legend{display:flex;gap:16px;font-size:13px;color:#374151;flex-wrap:wrap}
.legend span{display:inline-flex;align-items:center;gap:6px}
.key-bar{width:12px;height:12px;border-radius:3px;background:#257de0;display:inline-block}
.key-line{width:16px;height:2px;background:#f47230;display:inline-block;border-radius:2px}
.cost-table{width:100%;border-collapse:collapse;font-size:14px;margin-top:8px}
.cost-table th,.cost-table td{text-align:left;padding:6px 4px;border-bottom:1px solid #F1F5F9}
.cost-table td:not(:first-child),.cost-table th:not(:first-child){text-align:right;font-variant-numeric:tabular-nums}
#settings-view .form button:not(.link){min-height:44px;border-radius:10px;border:1px solid #D1D5DB;background:#fff;font:inherit;font-weight:500;color:#111827}
#settings-view .form button.primary{background:#1D4ED8;border-color:#1D4ED8;color:#fff}

/* threads */
#project{display:none}            /* the thread decides the project now */
.thread-btn{border:0;background:none;padding:0;font:inherit;font-weight:700;font-size:17px;color:#111827;cursor:pointer;text-align:left;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.chat-top .grow{min-width:0}
.thread-side{display:none}
.sheet{align-items:flex-end;justify-content:center}
.sheet-card{width:min(560px,100vw);max-height:80dvh;overflow:auto;border-radius:16px 16px 0 0;gap:12px}
.thread-list{display:flex;flex-direction:column;gap:14px}
.new-thread{min-height:44px;border-radius:22px;border:0;align-self:flex-start;padding:0 18px}
.thread-group-name{font-size:12px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;color:#6B7280;margin:0 4px 4px}
.thread-row{display:flex;align-items:center;border-radius:10px}
.thread-row.on{background:#EEF2FF}
.thread-open{flex:1;min-width:0;display:grid;grid-template-columns:1fr auto;gap:2px 8px;text-align:left;background:none;border:0;padding:10px;font:inherit;color:inherit;cursor:pointer;min-height:52px}
.thread-title{font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.thread-prev{grid-column:1/-1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.thread-when{grid-row:1;grid-column:2;font-size:11px}
.thread-edit{min-width:40px;min-height:40px}
/* iPad, unfolded phone, computer: the chat is a fixed frame. Header and message box stay put; only the
   conversation scrolls inside its own area (no 'sticky' tricks, which Safari handles badly while scrolling). */
@media (min-width: 700px) {
  #chat:not([hidden]){display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr) auto;height:100dvh;overflow:hidden}
  #chat .chat-top{grid-row:1;position:static}
  #chat #thread{grid-row:2;overflow-y:auto;min-height:0;overscroll-behavior:contain;padding-bottom:16px}
  #chat .composer{grid-row:3;position:static}
}
/* Computer, iPad landscape, unfolded phone: one sidebar on the left, like ChatGPT and Claude:
   new chat, the menu, projects (drop a chat on one to move it) and recent chats. */
.sidebar{display:none}
@media (min-width: 700px) {
  #app{grid-template-columns:272px minmax(0,1fr)}
  #app .tabs{display:none}
  .sidebar{display:flex;flex-direction:column;gap:4px;grid-column:1;grid-row:1;position:sticky;top:0;height:100dvh;overflow-y:auto;border-right:1px solid #E5E7EB;background:#F7F7F8;padding:14px 10px}
  .screen{grid-column:2}
}
.side-brand{display:flex;align-items:center;gap:10px;padding:4px 6px 10px;font-weight:700;font-size:16px}
.side-brand img{width:30px;height:30px;border-radius:999px;object-fit:cover}
.side-item{display:flex;align-items:center;gap:10px;width:100%;min-height:40px;padding:0 10px;border:0;border-radius:10px;background:none;font:inherit;font-size:15px;color:#111827;text-align:left;cursor:pointer}
.side-item:hover{background:#ECEDF0}.side-item.on{background:#E5E7EB;font-weight:600}
.side-new{font-weight:600}
.side-head{display:block;width:100%;text-align:left;border:0;background:none;cursor:pointer;font-size:12px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;color:#6B7280;margin:14px 0 4px;padding:4px 10px;border-radius:8px}
.side-head:hover{background:#ECEDF0}
.side-project.drop{outline:2px dashed #257de0;background:#EEF2FF}
.chat-row{display:flex;align-items:center;border-radius:10px}
.chat-row:hover{background:#ECEDF0}.chat-row.on{background:#E5E7EB}
.chat-row[draggable=true]{cursor:grab}
.chat-open{flex:1;min-width:0;display:flex;flex-direction:column;align-items:flex-start;gap:1px;text-align:left;background:none;border:0;padding:8px 10px;font:inherit;color:inherit;cursor:pointer}
.chat-title{font-size:14px;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.chat-meta{font-size:12px}
.chat-more{border:0;background:none;min-width:34px;min-height:34px;border-radius:8px;font-size:18px;color:#6B7280;cursor:pointer;opacity:.6}
.chat-row:hover .chat-more,.chat-more:focus{opacity:1}
.chat-list{display:flex;flex-direction:column;gap:2px}
.menu-list{display:flex;flex-direction:column;gap:8px}
.menu-list button{min-height:48px;text-align:left;padding:0 14px}
/* Notifications bell (top right) and its list */
.top{padding-right:72px}
.bell{position:fixed;top:calc(12px + env(safe-area-inset-top));right:14px;z-index:55;width:46px;height:46px;border-radius:999px;border:1px solid #E5E7EB;background:#fff;font-size:20px;cursor:pointer;box-shadow:0 2px 8px rgba(0,0,0,.08)}
.bell-count{position:absolute;top:-4px;right:-4px;min-width:20px;height:20px;padding:0 5px;border-radius:999px;background:#DC2626;color:#fff;font-size:12px;font-weight:700;line-height:20px;text-align:center}
.notes{position:fixed;top:calc(66px + env(safe-area-inset-top));right:14px;z-index:56;width:min(420px,calc(100vw - 28px));max-height:70vh;overflow-y:auto;background:#fff;border:1px solid #E5E7EB;border-radius:14px;box-shadow:0 12px 32px rgba(0,0,0,.18);padding:12px;display:flex;flex-direction:column;gap:6px}
.notes[hidden]{display:none}
.note{display:flex;gap:10px;align-items:flex-start;width:100%;text-align:left;font:inherit;color:inherit;background:none;border:0;border-radius:10px;padding:10px;cursor:pointer}
.note:hover{background:#F5F6F8}.note.new{background:#EEF2FF}
.note-icon{font-size:18px;line-height:1.3}.note-body{display:flex;flex-direction:column;gap:2px;min-width:0}
.note-asked{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.origin .link{padding:0;min-height:0}
.card.flash{outline:3px solid #257de0;outline-offset:2px}
#app[hidden] ~ .bell,#app[hidden] ~ .notes{display:none}
.notes > .row{align-items:center;margin:0 0 4px}
.notes > .link{text-align:left;padding:4px 10px}
.me .changes{margin-top:6px;padding-top:6px;border-top:1px solid rgba(255,255,255,.35);font-size:14px}
.viewer-bar .viewer-close{font-size:16px;font-weight:600;background:rgba(255,255,255,.15);border-radius:999px;padding:0 14px}
.menu-list button,.menu-list select{min-height:48px;width:100%;border:1px solid #D1D5DB;border-radius:12px;background:#fff;font:inherit;font-size:16px;color:#111827;text-align:left;padding:0 14px}
.pt-group{display:flex;flex-direction:column;gap:10px}
.pt-row{display:flex;gap:12px;align-items:flex-start;padding:10px 0;border-top:1px solid #F1F5F9}
.pt-row.off{opacity:.75}
.pt-dot{font-size:14px;line-height:1.6}
.pt-body{display:flex;flex-direction:column;gap:2px;min-width:0}
.pt-name{font-weight:600}
.pt-price{color:#374151}
.pt-why{font-size:13px;color:#B45309}
.section-title{font-size:18px;margin:8px 4px 0}
.section-note{margin:0 4px}
.wallet{display:flex;flex-direction:column;gap:6px}
.wallet.low{border-color:#F59E0B}
.wallet-topup{font-weight:600;white-space:nowrap}
.wallet-form{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.wallet-form input{width:110px}
.side-project{padding:0 4px 0 0;gap:0}
.side-fold{flex:1;min-width:0;display:flex;align-items:center;gap:4px;min-height:40px;padding:0 10px;border:0;background:none;font:inherit;font-size:15px;color:#111827;text-align:left;cursor:pointer;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.fold-arrow{display:inline-block;width:14px;color:#6B7280}
.side-open-project{border:0;background:none;min-width:32px;min-height:32px;border-radius:8px;color:#6B7280;cursor:pointer;opacity:.6}
.side-project:hover .side-open-project{opacity:1}
.side-project-chats{display:flex;flex-direction:column;gap:2px;margin:0 0 6px}
.chat-row.in-project,.side-item.in-project{margin-left:18px;width:calc(100% - 18px)}
.side-empty{padding:4px 10px}
.menu-list button.danger{color:#B91C1C;border-color:#FCA5A5}
.toast{position:fixed;left:50%;bottom:calc(90px + env(safe-area-inset-bottom));transform:translateX(-50%);z-index:80;background:#111827;color:#fff;border-radius:999px;padding:10px 18px;font-size:14px;box-shadow:0 6px 18px rgba(0,0,0,.2)}
.brief-head{display:flex;flex-direction:column;gap:8px}
.brief-read{display:flex;gap:8px;flex-wrap:wrap}
.brief-read button{min-height:40px;border:1px solid #D1D5DB;border-radius:999px;background:#fff;padding:0 14px;font:inherit;font-size:14px;cursor:pointer}
.brief-intro{font-size:17px;font-weight:600}
.brief-item{border-top:1px solid #F1F5F9;padding-top:10px;display:flex;flex-direction:column;gap:6px}
.brief-body{white-space:pre-wrap;line-height:1.55;font-size:15px}
.brief-actions{display:flex;gap:8px;align-items:center}
.brief-actions .vote{min-width:44px;min-height:36px;border:1px solid #E5E7EB;border-radius:999px;background:#fff;cursor:pointer;font-size:16px}
.brief-actions .vote.on{background:#EEF2FF;border-color:#257de0}
.brief-tune{display:flex;gap:8px;flex-wrap:wrap;align-items:center;border-top:1px solid #F1F5F9;padding-top:10px}
.brief-tune input{flex:1;min-width:160px}

/* Phone (and folded phone): the same sidebar slides in from the left when ☰ is tapped. */
.menu-btn{display:none}
.side-backdrop{display:none}
@media (max-width: 699px) {
  .menu-btn{display:inline-flex;align-items:center;justify-content:center;width:40px;height:40px;margin-right:2px;border:0;border-radius:10px;background:none;font-size:22px;color:#111827;cursor:pointer;flex:none}
  .menu-btn:active{background:#ECEDF0}
  .sidebar.open{display:flex;flex-direction:column;gap:4px;position:fixed;top:0;left:0;bottom:0;width:min(86vw,320px);z-index:66;overflow-y:auto;overscroll-behavior:contain;background:#F7F7F8;padding:calc(14px + env(safe-area-inset-top)) 10px calc(14px + env(safe-area-inset-bottom));box-shadow:4px 0 24px rgba(0,0,0,.18);animation:side-in .18s ease-out}
  .side-backdrop.open{display:block;position:fixed;inset:0;z-index:65;background:rgba(0,0,0,.35)}
  .sidebar .side-item{min-height:44px}
}
@keyframes side-in{from{transform:translateX(-100%)}to{transform:none}}
@media (prefers-reduced-motion:reduce){.sidebar.open{animation:none}}

.brief-item.reading,.brief-intro.reading{outline:2px solid #2563EB;outline-offset:4px;border-radius:10px;background:#EFF6FF}
.brief-read button{min-width:44px;min-height:40px}

.brief-audio{display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px;margin:8px 0}
.brief-audio audio{width:100%;max-width:520px}
.brief-making{padding:8px 0}
.brief-days{display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px;justify-content:center;padding:8px 0 4px}
.brief-days select{font:inherit;padding:4px 8px;border-radius:8px}
/* Unfolded phone / small tablet: the same sidebar, a little narrower so the chat keeps its room. */
@media (min-width: 700px) and (max-width: 999px) { #app{grid-template-columns:236px minmax(0,1fr)} }

.rate{display:flex;flex-wrap:wrap;align-items:center;gap:6px 8px;margin:8px 0 2px}
.rate input{flex:1;min-width:160px;font:inherit;padding:6px 10px;border:1px solid #D1D5DB;border-radius:10px}
.rate .vote{min-width:40px;min-height:36px}
.rate-trial{color:#1D4ED8;font-weight:600}
.compare{display:flex;flex-direction:column;gap:10px;width:100%}
.cmp{border:1px solid #E5E7EB;border-radius:12px;padding:10px}
.cmp-head{display:flex;align-items:center;gap:8px;margin-bottom:6px}
.cmp-pick{margin-left:auto}
.who{align-items:center}
.who-actions{display:flex;flex-direction:column;align-items:flex-end;gap:4px}
.who-actions select{font:inherit;max-width:180px}

.mic{touch-action:none;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
.mic.cancel{background:#FEE2E2!important;border-color:#DC2626!important}

.money-cat{padding:8px 0;border-top:1px solid #F1F2F4}
.money-bar{position:relative;height:8px;background:#F1F2F4;border-radius:6px;margin:6px 0 4px}
.money-bar span{position:absolute;left:0;top:0;bottom:0;background:#2563EB;border-radius:6px}
.money-bar i{position:absolute;top:-3px;width:2px;height:14px;background:#111827}
.money-flag{padding:8px 0;border-top:1px solid #F1F2F4}
.money-line{padding:8px 0;border-top:1px solid #F1F2F4;gap:12px}
.money-tx{padding:8px 0;border-top:1px solid #F1F2F4}
.money-tx select{font:inherit;font-size:13px;max-width:160px}
.money-desc{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:68%}
.money-in{color:#15803D}
.steps-list{margin:8px 0 0 18px;line-height:1.6}
/* My money: balance sheet and cash flow */
.money-top{margin:4px 2px 10px;align-items:center}
.money-networth{text-align:center;padding:6px 0 10px}
.money-head{font-weight:600;padding:10px 0 4px;border-top:1px solid #E5E7EB;margin-top:6px}
.money-net{font-size:1.05em}
.money-out{color:#B91C1C}
.money-group summary{cursor:pointer;list-style:none}
.money-group summary::-webkit-details-marker{display:none}
.money-group summary span::before{content:'▸ ';color:#9CA3AF}
.money-group[open] summary span::before{content:'▾ '}
.money-acct{padding:6px 0 6px 14px;border-top:1px dashed #F1F2F4}
.money-acct select{max-width:9.5em}
details.card > summary{cursor:pointer}
/* 🐶 Ask Corgi bubble: bottom right, above the tab bar (and above the message box on the chat screen) */
.ask-fab{position:fixed;right:16px;bottom:calc(var(--tabs-h,64px) + 16px + env(safe-area-inset-bottom));z-index:40;width:58px;height:58px;border-radius:999px;border:2px solid #fff;background:#1D4ED8;padding:0;overflow:hidden;box-shadow:0 6px 18px rgba(29,78,216,.35);cursor:pointer}
.ask-fab img{width:100%;height:100%;object-fit:cover;display:block}
body.on-chat .ask-fab{bottom:calc(var(--tabs-h,64px) + var(--composer-h,72px) + 14px)}
.ask-panel{position:fixed;right:12px;bottom:calc(var(--tabs-h,64px) + 12px + env(safe-area-inset-bottom));z-index:45;width:min(400px,calc(100vw - 24px));height:min(560px,calc(100dvh - var(--tabs-h,64px) - 90px));background:#fff;border:1px solid #E5E7EB;border-radius:16px;box-shadow:0 16px 40px rgba(0,0,0,.22);display:flex;flex-direction:column;overflow:hidden}
.ask-panel[hidden],.ask-fab[hidden]{display:none}
.ask-head{display:flex;align-items:center;gap:10px;padding:12px 14px;border-bottom:1px solid #E5E7EB}
.ask-head strong{flex:1}
.ask-x{border:0;background:none;font-size:18px;cursor:pointer;color:#6B7280;min-width:36px;min-height:36px}
.ask-log{flex:1;overflow-y:auto;padding:12px;display:flex;flex-direction:column;gap:10px;background:#F9FAFB}
.ask-log .me{align-self:flex-end;max-width:85%}
.ask-log .card{margin:0}
.ask-log .result-text{white-space:pre-wrap;line-height:1.5}
.ask-form{display:flex;gap:8px;padding:10px;border-top:1px solid #E5E7EB;background:#fff}
.ask-form textarea{flex:1;resize:none;font:inherit;font-size:16px;padding:10px 12px;border:1px solid #D1D5DB;border-radius:12px;max-height:120px}
.ask-form button{min-width:46px;border-radius:12px}
@media (min-width:700px){.ask-panel{height:min(620px,calc(100dvh - 120px))}}
.ask-form textarea{min-height:44px;height:44px}
.money-line.sub strong{font-weight:500;color:#374151}
#money-view,#cost-view,#settings-view,#project-view,#powertools-view,#approval-list,#rules-view{padding-bottom:96px}
.money-manual-form{display:flex;flex-direction:column;gap:8px;padding:10px 0 4px}
.money-manual-form input,.money-manual-form select{font:inherit;font-size:16px;padding:10px 12px;border:1px solid #D1D5DB;border-radius:10px;background:#fff}
.link.danger{color:#B91C1C}
.side-signout{margin-top:auto;color:#6B7280;border-top:1px solid #E5E7EB;border-radius:0;padding-top:10px;margin-bottom:10px}
/* period and range chips, the clear button, the trend line */
.chips{display:flex;gap:6px;flex-wrap:wrap;margin:8px 0 4px}
.chip-btn{border:1px solid #D1D5DB;background:#fff;color:#374151;border-radius:999px;padding:7px 14px;font:inherit;font-size:14px;cursor:pointer;min-height:36px}
.chip-btn.on{background:#1D4ED8;border-color:#1D4ED8;color:#fff}
.pill{border:1px solid #D1D5DB;background:#fff;color:#1D4ED8;border-radius:999px;padding:6px 12px;font:inherit;font-size:13px;cursor:pointer;min-height:32px;white-space:nowrap}
.money-flag{display:flex;align-items:center;justify-content:space-between;gap:12px}
.money-custom{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:6px 0}
.money-custom input{font:inherit;font-size:15px;padding:6px 8px;border:1px solid #D1D5DB;border-radius:8px}
.money-trend{margin:4px 0 10px}
.trend-svg{width:100%;height:120px;display:block}
.trend-svg path{fill:none;stroke:#1D4ED8;stroke-width:2;stroke-linejoin:round;stroke-linecap:round}
.money-flag .grow{flex:1}
.money-why{display:flex;gap:8px;margin-top:8px}
.money-why input{flex:1;font:inherit;font-size:15px;padding:8px 10px;border:1px solid #D1D5DB;border-radius:10px}
/* 🏠 Deal hunter */
.deal-field{display:flex;flex-direction:column;gap:4px;flex:1;min-width:140px}
.deal-field input{font:inherit;font-size:16px;padding:9px 11px;border:1px solid #D1D5DB;border-radius:10px}
.deal-grid{display:flex;flex-wrap:wrap;gap:10px;margin:8px 0}
.deal-form details summary{cursor:pointer;margin:6px 0}
.deal{display:flex;flex-direction:column;gap:6px}
.deal-tags{display:flex;gap:6px;flex-wrap:wrap}
.tag{background:#F3F4F6;border-radius:999px;padding:3px 10px;font-size:13px;color:#374151}
.tag.hot{background:#FEF2F2;color:#B91C1C}
.deal-math{border-top:1px solid #F1F2F4;padding-top:6px;display:flex;flex-direction:column;gap:4px}
.deal-field textarea{font:inherit;font-size:16px;padding:9px 11px;border:1px solid #D1D5DB;border-radius:10px;resize:vertical}
.deal-settings > summary{cursor:pointer;list-style:none}
.deal-settings > summary::-webkit-details-marker{display:none}
.deal-settings[open] > summary{margin-bottom:8px}
.deal-runbar{margin:4px 2px;align-items:center}
.danger-pill{color:#B91C1C;border-color:#FCA5A5;margin-top:8px}
.menu-row{display:flex;align-items:center;gap:8px;padding:6px 0;border-top:1px solid #F1F2F4}
.menu-row input{font:inherit;font-size:16px;padding:8px 10px;border:1px solid #D1D5DB;border-radius:10px;flex:1;min-width:0}
.menu-row input.menu-icon{flex:0 0 3.2em;text-align:center}
.menu-row.off input{opacity:.5}
.pill[disabled]{opacity:.35;cursor:default}

/* 📓 What Corgi knows */
.nb-group { margin: 6px 0; }
.nb-topic { font-size: 12px; text-transform: capitalize; color: var(--muted, #888); margin-bottom: 4px; }
.nb-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.nb-row input { flex: 1; min-width: 0; }
.noted { margin-top: 6px; }
.link-btn { background: none; border: 0; padding: 0 4px; color: var(--accent, #2f6fde); text-decoration: underline; cursor: pointer; font: inherit; }

/* 🐶 bubble: mic and files */
.ask-tool { background: none; border: 0; font-size: 20px; padding: 4px 6px; cursor: pointer; flex: none; touch-action: none; user-select: none; -webkit-user-select: none; }
.ask-mic.rec { background: #e5484d; border-radius: 50%; }
.ask-mic.cancel { background: #888; border-radius: 50%; }
.ask-mic.busy { opacity: .5; }
.ask-files { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 10px; }
.ask-files:empty { display: none; }
.ask-chip { font-size: 12px; background: var(--chip, #eef1f6); border-radius: 12px; padding: 2px 4px 2px 8px; display: inline-flex; align-items: center; gap: 2px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ask-chip.error { color: #b42318; }
.ask-hint { padding: 4px 12px; color: #e5484d; }
