/* Chief of staff (chief.js, 27 Oct 2026). Same cards, type and tokens as Keystone; phone first. No :has() and no
   runtime custom properties (see the 22 Oct perf rules in app.css). */
.cos { display: flex; flex-direction: column; gap: 12px; }
.cos h3 small { font-weight: 400; color: var(--muted); }
.cos-i { width: 15px; height: 15px; flex: none; vertical-align: -2px; color: var(--accent); }
.cos-mut { font-size: 12.5px; color: var(--muted); }
.cos-fine { font-size: 11.5px; margin: 6px 0 0; }
.cos-warn { font-size: 13px; color: #c2410c; margin: 6px 0 0; }
.cos-sub { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 14px 0 6px; }
.cos-link { color: var(--accent); font-size: 13px; padding: 8px 0 0; }
.cos-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cos-row .cos-mut { margin: 0; }
.cos-row .btn { flex: none; white-space: nowrap; }
.cos .btn, .cos-rec .btn { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 0 14px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: 14px; }
.cos .btn.ghost, .cos-rec .btn.ghost { background: var(--surface); color: var(--accent); border: 1px solid var(--rule); }
.cos .btn[disabled], .cos-rec .btn[disabled] { opacity: .45; cursor: default; }

/* the header: who it is, and today's spend against the limit */
.cos-top h3 { margin: 0; font-family: "Instrument Serif", Georgia, serif; font-weight: 400; font-size: 24px; line-height: 1.1; }
.cos-title { display: flex; gap: 10px; align-items: flex-start; }
.cos-title .cos-i { width: 22px; height: 22px; margin-top: 3px; }
.cos-title p { margin: 3px 0 0; }
.cos-meter { margin-top: 12px; }
.cos-meter-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; flex-wrap: wrap; }
.cos-bar { height: 8px; border-radius: 99px; background: var(--notice); overflow: hidden; margin-top: 6px; }
.cos-bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s ease; }
.cos-bar.high i { background: #e8a33d; } .cos-bar.full i { background: #c2410c; }

/* pills and chips */
.cos-pill { display: inline-flex; align-items: center; flex: none; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.cos-pill.ok { background: #dcf3e8; color: #13744a; } .cos-pill.warn { background: #fdecd6; color: #a14b00; } .cos-pill.bad { background: #fde3dc; color: #b42318; } .cos-pill.mute { background: var(--notice); color: var(--muted); }
.cos-chip { display: inline-block; font-size: 12px; line-height: 1.3; padding: 4px 9px; border-radius: 10px; background: var(--notice); color: var(--muted); }
.cos-chip.ok { background: #dcf3e8; color: #13744a; } .cos-chip.warn { background: #fdecd6; color: #a14b00; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .cos-pill.ok, :root:not([data-theme="light"]) .cos-chip.ok { background: #12352a; color: #6fd3a5; }
  :root:not([data-theme="light"]) .cos-pill.warn, :root:not([data-theme="light"]) .cos-chip.warn { background: #3a2a14; color: #f2b366; }
  :root:not([data-theme="light"]) .cos-pill.bad { background: #3d1a16; color: #ff9b8a; }
  :root:not([data-theme="light"]) .cos-warn { color: #ff9b6a; }
}
.cos-ref { color: var(--accent); font: inherit; font-weight: 600; padding: 0; text-align: left; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.cos-noteref { font-weight: 600; }

/* approvals */
.cos-ap { border-top: 1px solid var(--rule); padding: 12px 0 4px; }
.cos-ap:first-of-type, .cos-sub + .cos-ap, h3 + .cos-ap { border-top: 0; padding-top: 4px; }
.cos-ap-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 15px; }
.cos-sum { margin: 6px 0 0; font-size: 14px; overflow-wrap: anywhere; }
.cos-why { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.cos-ap-btns { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.cos-msg { margin-top: 8px; }
.cos textarea, .cos input:not([type=checkbox]):not([type=radio]), .cos select, .cos-rec textarea { width: 100%; border: 1px solid var(--rule); border-radius: 10px; background: var(--surface); color: var(--ink); padding: 9px 10px; font: inherit; font-size: 16px; }
.cos textarea, .cos-rec textarea { resize: vertical; }
.cos-reason { margin-top: 8px; }
.cos textarea:focus, .cos input:focus, .cos select:focus, .cos-rec textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }

/* chat */
.cos-thread { display: flex; flex-direction: column; gap: 8px; max-height: min(56vh, 520px); overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 2px 0 8px; }
.cos-empty p { margin: 0; font-size: 14.5px; color: var(--muted); }
.cos-b { max-width: 88%; padding: 9px 12px; border-radius: 16px; font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }
.cos-b.me { align-self: flex-end; background: var(--mine); color: var(--mine-ink); border-bottom-right-radius: 6px; }
.cos-b.them { align-self: flex-start; background: var(--bg); border: 1px solid var(--rule); border-bottom-left-radius: 6px; }
.cos-b p { margin: 0 0 6px; } .cos-b p:last-child { margin-bottom: 0; }
.cos-b ul { margin: 2px 0 6px; padding-left: 18px; } .cos-b li { margin: 2px 0; }
.cos-b .cos-h { font-weight: 600; }
.cos-did { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.cos-meta { font-size: 11px; color: var(--muted); margin-top: 6px; }
.cos-typing { display: flex; gap: 4px; padding: 13px 14px; }
.cos-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); opacity: .4; animation: cosdot 1.2s infinite; }
.cos-typing i:nth-child(2) { animation-delay: .2s; } .cos-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes cosdot { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: .9; transform: translateY(-3px); } }
.cos-sugg { display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding: 4px 0 8px; }
.cos-sugg::-webkit-scrollbar { display: none; }
.cos-sugg button { flex: none; font-size: 13px; padding: 7px 11px; border-radius: 999px; border: 1px solid var(--rule); background: var(--surface); color: var(--accent); white-space: nowrap; }
.cos-input { display: flex; gap: 8px; align-items: flex-end; }
.cos-input textarea { min-height: 42px; max-height: 160px; resize: none; }
.cos-input .btn { flex: none; min-height: 42px; }

/* jobs, drafts, usage, settings */
.cos-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-bottom: 10px; }
.cos-tabs::-webkit-scrollbar { display: none; }
.cos-tabs button { flex: none; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--rule); background: var(--surface); font-size: 13.5px; color: var(--muted); white-space: nowrap; }
.cos-tabs button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.cos-list { list-style: none; margin: 8px 0 0; padding: 0; }
.cos-job, .cos-draft { border-top: 1px solid var(--rule); padding: 10px 0; }
.cos-job:first-child, .cos-draft:first-child { border-top: 0; }
.cos-job-head { display: flex; width: 100%; align-items: center; gap: 8px; justify-content: space-between; text-align: left; padding: 0; }
.cos-job-t { font-size: 15px; font-weight: 500; min-width: 0; }
.cos-job-prev { margin: 4px 0 0; font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cos-job-body { margin-top: 8px; padding: 10px 12px; background: var(--bg); border: 1px solid var(--rule); border-radius: 12px; font-size: 14px; overflow-wrap: anywhere; }
.cos-job-body p { margin: 0 0 6px; } .cos-job-body ul { margin: 2px 0 6px; padding-left: 18px; }
.cos-jobform { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; padding: 12px; border: 1px solid var(--rule); border-radius: 12px; background: var(--bg); }
.cos-seg { display: flex; gap: 16px; font-size: 14px; } .cos-seg label { display: flex; gap: 6px; align-items: center; }
.cos-pre { white-space: pre-wrap; font: inherit; font-size: 14px; margin: 8px 0 0; padding: 10px 12px; background: var(--bg); border: 1px solid var(--rule); border-radius: 12px; overflow-wrap: anywhere; }
.cos-days { display: flex; align-items: flex-end; gap: 3px; height: 96px; padding-top: 4px; }
.cos-day { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 3px; }
.cos-day i { display: block; width: 100%; max-width: 22px; background: var(--accent); border-radius: 4px 4px 1px 1px; }
.cos-day span { font-size: 10px; color: var(--muted); }
.cos-t { width: 100%; border-collapse: collapse; font-size: 13px; }
.cos-t th { text-align: left; font-weight: 500; color: var(--muted); font-size: 11.5px; padding: 0 6px 4px 0; }
.cos-t td { border-top: 1px solid var(--rule); padding: 6px 6px 6px 0; overflow-wrap: anywhere; }
.cos-t td:last-child, .cos-t th:last-child { text-align: right; padding-right: 0; }
@media (max-width: 520px) { .cos-t th:nth-child(4), .cos-t td:nth-child(4), .cos-t th:nth-child(5), .cos-t td:nth-child(5) { display: none; } }
.cos-kinds { display: flex; flex-wrap: wrap; gap: 6px; }
.cos-calls, .cos-acts { list-style: none; margin: 0; padding: 0; }
.cos-calls li, .cos-acts li { display: flex; gap: 8px; justify-content: space-between; align-items: baseline; border-top: 1px solid var(--rule); padding: 7px 0; font-size: 13px; flex-wrap: wrap; }
.cos-calls li:first-child, .cos-acts li:first-child { border-top: 0; }
.cos-calls li span:first-child, .cos-acts li span:first-child { flex: 1 1 60%; min-width: 0; }
.cos-form { display: flex; flex-direction: column; gap: 10px; }
.cos-fld { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.cos-chk { display: flex; gap: 8px; align-items: center; font-size: 14px; } .cos-chk input { width: 20px; height: 20px; flex: none; }

/* the record panel */
.cos-rec h3 { display: flex; align-items: center; gap: 6px; }
.cos-rec .cos-sugg { padding-top: 8px; }
.cos-rans { display: flex; flex-direction: column; gap: 8px; }
.cos-rans .cos-b { max-width: 100%; }

/* AI cost alert (a model's cost per call jumped against its 7-day average) */
.cos-notice { border-color: #e8a33d; background: #fdf3e2; }
.cos-notice b { color: #a14b00; } .cos-notice p { margin: 4px 0 0; font-size: 14px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cos-notice { background: #2a2012; border-color: #6b4a1a; } :root:not([data-theme="light"]) .cos-notice b { color: #f2b366; } }
/* 28 Oct 2026 UX pass: tap targets on phones */
.cos-sugg button { min-height: 40px; }
.cos-tabs button { min-height: 40px; }
.cos-link { min-height: 40px; }
.cos .cos-ap-btns .btn { min-height: 44px; }

/* How we work (28 Oct 2026): the agency's playbook, things to remember (Approve / Edit / Decline), ideas for Backbone */
.cos-memcard h3 { margin: 0; min-width: 0; }
.cos-memintro { margin: 6px 0 2px; }
.cos-memcard > .cos-warn { margin-top: 8px; }
.cos-memq { margin: 6px 0 2px; font-size: 15.5px; font-weight: 500; line-height: 1.4; overflow-wrap: anywhere; }
.cos-memtext { margin-top: 8px; }
.cos-memfor { display: flex; flex-wrap: wrap; gap: 0 16px; margin-top: 6px; font-size: 14px; }
.cos-memfor label { display: flex; gap: 8px; align-items: center; min-height: 44px; }
.cos-memfor input { width: 20px; height: 20px; flex: none; }
.cos-flag { margin-top: 10px; padding: 10px 12px; border: 1px solid #e8a33d; background: #fdf3e2; border-radius: 12px; font-size: 13.5px; }
.cos-flag b { color: #a14b00; } .cos-flag p { margin: 4px 0 0; }
.cos-flag ul { margin: 6px 0 0; padding-left: 18px; } .cos-flag li { margin: 3px 0; overflow-wrap: anywhere; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cos-flag { background: #2a2012; border-color: #6b4a1a; } :root:not([data-theme="light"]) .cos-flag b { color: #f2b366; } }
.cos-memfoot { display: flex; justify-content: space-between; align-items: center; gap: 4px 12px; flex-wrap: wrap; border-top: 1px solid var(--rule); margin-top: 12px; padding-top: 4px; }
.cos-memfoot .cos-link { padding: 0; }
.cos-ideas-box .cos-sub { margin-top: 10px; }
.cos-ideas-box > .cos-mut { margin: 0; }
.cos-ideas { list-style: none; margin: 8px 0 0; padding: 0; }
.cos-ideas li { border-top: 1px solid var(--rule); padding: 10px 0; }
.cos-ideas li:first-child { border-top: 0; }
.cos-idea-t { font-size: 14.5px; min-width: 0; overflow-wrap: anywhere; flex: 1 1 60%; }
.cos-ideas .btn { min-height: 40px; font-size: 13px; padding: 0 10px; }

/* ───── Desktop (28 Oct 2026): side-by-side panels on a laptop. Everything below 1024px is untouched. ───── */
@media (min-width: 1024px) {
  .cos-memfor label { min-height: 32px; }
  .cos-memcard .cos-row .btn, .cos-ideas .btn { min-height: 34px; }
  .cos-memfoot .cos-link:hover { text-decoration: underline; }
  .cos { gap: 16px; }
  .cos-top { display: flex; align-items: center; gap: 28px; }
  .cos-top .cos-title { flex: 1; min-width: 0; }
  .cos-top .cos-meter { flex: 0 0 min(380px, 40%); margin-top: 0; }
  .cos-sugg { flex-wrap: wrap; overflow: visible; }
  .cos-input textarea { min-height: 44px; }
  /* no oversized touch padding on a mouse */
  .cos-sugg button, .cos-tabs button, .cos-link { min-height: 34px; }
  .cos .cos-ap-btns .btn { min-height: 38px; }
  .cos-t { font-size: 13.5px; }
  .cos-t td { padding: 7px 10px 7px 0; }
  /* hover + keyboard focus */
  .cos .btn:hover:not([disabled]), .cos-rec .btn:hover:not([disabled]) { filter: brightness(1.08); }
  .cos .btn.ghost:hover:not([disabled]), .cos-rec .btn.ghost:hover:not([disabled]) { filter: none; border-color: var(--accent); }
  .cos-sugg button:hover { border-color: var(--accent); background: var(--accent-soft); }
  .cos-tabs button:not(.on):hover { color: var(--ink); border-color: var(--muted); }
  .cos-job-head { cursor: pointer; border-radius: 8px; }
  .cos-job-head:hover .cos-job-t, .cos-link:hover, .cos-ref:hover { color: var(--accent); }
  .cos-job:hover { background: color-mix(in srgb, var(--bg) 60%, transparent); }
  .cos button:focus-visible, .cos-rec button:focus-visible, .cos a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
}
@media (min-width: 1280px) {
  /* header across the top; the conversation on the left (it stays in view while you scroll); approvals and the
     jobs / drafts / usage / settings card on the right (a 1024px laptop keeps one column: two would be too narrow) */
  body:not(.chat-docked) .cos { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); grid-auto-flow: row dense; align-items: start; }
  body:not(.chat-docked) .cos > .cos-top, body:not(.chat-docked) .cos > .cos-notice { grid-column: 1 / -1; }
  body:not(.chat-docked) .cos > .cos-chat { grid-column: 1; grid-row: span 3; position: sticky; top: 12px; display: flex; flex-direction: column; }
  body:not(.chat-docked) .cos > .card:not(.cos-top):not(.cos-notice):not(.cos-chat) { grid-column: 2; }
  body:not(.chat-docked) .cos-thread { max-height: none; height: clamp(240px, calc(100dvh - 540px), 680px); }
}
@media (min-width: 1440px) {
  body:not(.chat-docked) .cos { grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 20px; }
}

/* files dropped into the chat (13 Nov 2026) */
.cos-chat { position: relative; }
.cos-dropzone { position: absolute; inset: 6px; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  border: 2px dashed var(--accent, #2f6fed); border-radius: 14px; background: rgba(255, 255, 255, .94); padding: 18px; pointer-events: none; }
.cos-dropzone[hidden] { display: none; }
.cos-dropzone b { font-size: 17px; }
.cos-dropzone span { font-size: 13px; opacity: .75; max-width: 360px; }
.cos-attach { flex: none; min-height: 42px; min-width: 42px; padding: 0 10px; cursor: pointer; font-size: 18px; display: inline-flex; align-items: center; justify-content: center; }
.cos-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.cos-b.me .cos-files:first-child { margin-top: 0; }
.cos-file { display: inline-block; font-size: 12.5px; padding: 3px 9px; border-radius: 999px; background: rgba(0, 0, 0, .07); color: inherit; text-decoration: none; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cos-file.busy { opacity: .7; }
