/* Approval uses the whole ticket surface, with words as well as colour. */
.cb-card[data-approval-state="approved"],.cb2-list tr[data-approval-state="approved"] { background:#e8f5ef; border-color:#9acbb4; box-shadow:inset 4px 0 0 #27845d; }
.cb2-list tr[data-approval-state="approved"] td { background:transparent; }
.cb-card[data-approval-state="changed"],.cb2-list tr[data-approval-state="changed"] { background:#fff2df; border-color:#dfb269; box-shadow:inset 4px 0 0 #af6e0d; }
.cb2-list tr[data-approval-state="changed"] td { background:transparent; }
.cb-card[data-approval-state="approved"] .cb2-approval,.cb2-list tr[data-approval-state="approved"] .cb2-approval { color:#176342; font-size:12px; }
.cb-card[data-approval-state="changed"] .cb2-approval,.cb2-list tr[data-approval-state="changed"] .cb2-approval { color:#88520b; font-size:12px; }

body:has(.cb3-workspace) { overflow:hidden; }
.modal-backdrop.cb3-backdrop { padding:16px; align-items:center; }
.modal-wide.cb-panel.cb3-workspace { display:grid; grid-template-columns:minmax(0,1fr); grid-template-rows:auto auto minmax(0,1fr) auto; gap:0; width:calc(100vw - 32px); max-width:1800px; height:calc(100dvh - 32px); max-height:none; padding:0; overflow:hidden; border-radius:14px; background:#fff; }
.cb3-workspace [hidden] { display:none!important; }
.cb3-workspace .cb3-header { display:block; position:static; padding:14px 24px 0; background:#fff; border:0; }
.cb3-heading-top { display:flex; align-items:center; justify-content:space-between; gap:14px; }
.cb3-workspace .cb-panel-head { gap:9px; }
.cb3-workspace .cb-title-row { margin:10px 0 8px; align-items:center; gap:14px; }
.cb3-workspace .cb-title-row h2 { flex:1; margin:0; font-size:24px; line-height:1.3; letter-spacing:-.4px; overflow-wrap:anywhere; }
.cb3-workspace .cb-title-row button { flex-shrink:0; }
.cb3-workspace .cb3-tabs { display:flex; gap:4px; margin:12px 0 0; padding:0; overflow-x:auto; scrollbar-width:thin; }
.cb3-workspace .cb3-tabs button { flex:0 0 auto; padding:12px 15px; min-height:44px; font-size:13px; line-height:1.3; font-weight:650; border:0; border-bottom:3px solid transparent; border-radius:6px 6px 0 0; background:transparent; color:var(--muted); }
.cb3-tabs button[aria-selected="true"] { color:var(--deep); border-bottom-color:var(--brand); background:var(--soft); }
.cb3-tabs button span { display:inline-block; font-size:11px; background:#edf2f2; color:var(--body); border-radius:5px; padding:1px 5px; margin-left:3px; }
.cb3-workspace .cb3-approval { display:flex; align-items:center; gap:12px; padding:12px 24px; background:#f0f5f7; border-block:1px solid #dbe5e9; min-width:0; }
.cb3-approval-icon { display:grid; place-items:center; flex:0 0 34px; height:34px; border-radius:50%; background:#dfeaed; color:#436577; font-size:23px; font-weight:600; }
.cb3-approval > div { flex:1; min-width:0; }
.cb3-approval h3 { font-size:14px; line-height:1.4; margin:0 0 2px; }
.cb3-approval p { font-size:12px; line-height:1.5; color:var(--body); margin:0; }
.cb3-approval > button { flex-shrink:0; }
.cb3-approval[data-state="approved"] { background:#e8f5ef; border-color:#bddcca; }
.cb3-approval[data-state="approved"] .cb3-approval-icon { color:#176342; background:#cde8da; }
.cb3-approval[data-state="changed"] { background:#fff2df; border-color:#ecd1a6; }
.cb3-approval[data-state="changed"] .cb3-approval-icon { color:#88520b; background:#f6dfb9; }
.cb3-sr-only { position:absolute!important; width:1px!important; height:1px!important; padding:0!important; margin:-1px!important; overflow:hidden!important; clip:rect(0,0,0,0); white-space:nowrap; border:0!important; }
.cb3-body { overflow:auto; min-height:0; min-width:0; overscroll-behavior:contain; background:#fafcfc; scrollbar-gutter:stable; }
.cb3-workspace .modal-form-pane { display:block; width:100%; min-width:0; max-width:none; overflow:visible; border:0; }
.cb3-workspace .form-scroll { overflow:visible; max-width:1450px; margin:auto; padding:24px 28px 32px; }
.cb3-workspace .modal-feed-pane { display:block; width:100%; max-width:1000px; min-width:0; margin:auto; padding:24px 28px 32px; background:transparent; border:0; }
.cb3-workspace .feed-list { overflow:visible; max-height:none; }
.cb3-workspace textarea { overflow:hidden!important; overflow-y:hidden!important; max-height:none!important; resize:none; box-sizing:border-box; }
.cb3-workspace .cb3-page > .cb-section:first-child,.cb3-workspace .cb3-overview-main > .cb-section:first-of-type { border-top:0; padding-top:0; margin-top:0; }
.cb3-workspace .cb3-page[data-ticket-page="details"] { display:grid; grid-template-columns:minmax(0,1.7fr) minmax(280px,1fr); gap:28px; align-items:start; }
.cb3-overview-main,.cb3-overview-aside { min-width:0; }
.cb3-overview-main:has(.cb-details:not([hidden])) .cb3-description { display:none; }
.cb3-workspace .cb3-description { border:0; margin-top:0; padding-top:0; }
.cb3-workspace .cb3-overview-build { border:0; margin-top:0; padding-top:0; }
.cb3-open-plan { margin-top:12px; }
.cb3-heading-buttons { display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end; }
.cb3-workspace .cb3-overview-main > .cb3-description + .cb3-overview-build { border-top:1px solid var(--line); margin-top:24px; padding-top:20px; }
.cb3-workspace .cb-meta { grid-template-columns:repeat(2,minmax(0,1fr)); margin:0 0 16px; background:#fff; }
.cb3-workspace .cb-manage { grid-template-columns:minmax(0,1fr); margin:0; background:#fff; }
.cb3-workspace .cb-section h3 { font-size:17px; margin-bottom:12px; }
.cb3-workspace .cb-text { font-size:14px; line-height:1.75; }
.cb3-workspace .cb3-page[data-ticket-page="prompt"],.cb3-workspace .cb3-page[data-ticket-page="questions"],.cb3-workspace .cb3-page[data-ticket-page="history"] { max-width:1080px; margin:auto; }
.cb3-section-heading { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-bottom:16px; }
.cb3-workspace .cb3-section-heading h3 { margin:0; }
.cb3-reading-note { color:var(--muted); font-size:12px; margin-bottom:18px; }
.cb3-prompt-reader h4,.cb3-round-reader h4 { font-size:12px; color:var(--deep); text-transform:uppercase; letter-spacing:.06em; margin:22px 0 8px; }
.cb3-prompt-reader > h4:first-of-type { margin-top:0; }
.cb3-workspace .cb-prompt .cb-text { padding:0; background:transparent; }
.cb3-empty { padding:30px 0; color:var(--muted); }
.cb3-empty h3 { font-size:18px; margin-bottom:10px; }
.cb3-workspace .cb-photos { grid-template-columns:repeat(auto-fill,minmax(190px,1fr)); }
.cb3-workspace :focus-visible { outline:2px solid var(--brand); outline-offset:3px; }
.cb3-footer { display:flex; align-items:center; gap:14px; padding:12px 20px; border-top:1px solid var(--line2); background:#fff; box-shadow:0 -3px 12px #0b141706; position:relative; z-index:4; min-width:0; flex-wrap:wrap; }
.cb3-workspace .cb3-tools { flex:1; display:flex; align-items:center; gap:12px; justify-content:space-between; margin:0; padding:0; border:0; min-width:0; }
.cb3-save-area,.cb3-job-actions { display:flex; align-items:center; flex-wrap:wrap; gap:10px; }
.cb3-save-state { font-size:12px; color:var(--muted); }
.cb3-save-state[data-dirty="true"] { color:var(--amber); font-weight:600; }
.cb3-workspace .modal-actions { display:flex; margin:0; padding:0!important; position:static!important; box-shadow:none!important; background:transparent; }
.cb3-workspace .modal-actions [data-close] { display:inline-flex; }
.cb3-workspace .cb2-ticket-nav { display:flex; flex-wrap:nowrap; gap:8px; margin:0; font-size:12px; }
.cb3-workspace .cb2-ticket-nav button { padding:9px 10px; }
.cb3-footer > .cb-error { flex-basis:100%; margin:0; padding:8px 12px; background:#fff0ed; border-radius:6px; }
.cb3-more { position:relative; }
.cb3-more > summary { display:flex; align-items:center; gap:8px; list-style:none; cursor:pointer; white-space:nowrap; }
.cb3-more > summary::-webkit-details-marker { display:none; }
.cb3-more > summary::after { content:'▴'; font-size:10px; }
.cb3-more-menu { position:absolute; bottom:calc(100% + 10px); right:0; width:240px; max-width:calc(100vw - 32px); padding:8px; border:1px solid var(--line2); border-radius:10px; background:#fff; box-shadow:0 8px 32px #0b141724; }
.cb3-more-menu button,.cb3-more-menu a { display:block; width:100%; padding:11px 10px; text-align:left; font-size:13px; font-weight:600; color:var(--ink); background:transparent; border:0; text-decoration:none; border-radius:6px; }
.cb3-more-menu .cb-danger-link { color:var(--danger); border-top:1px solid var(--line); border-radius:0; margin-top:4px; }
.cb3-more-menu .cb3-review-menu { display:none; }
.cb3-workspace .cb3-audit { border:0; margin:0; padding:0; }
.cb3-audit > summary { font-size:18px; color:var(--ink); font-weight:650; list-style:none; cursor:default; margin-bottom:18px; pointer-events:none; }
.cb3-audit > summary::-webkit-details-marker { display:none; }
.cb3-timeline { list-style:none; margin:0; padding:0; }
.cb3-timeline > li { position:relative; padding:0 0 24px 28px; border-left:1px solid var(--line2); margin-left:5px; }
.cb3-timeline > li:last-child { border-left-color:transparent; }
.cb3-history-dot { position:absolute; width:9px; height:9px; border-radius:50%; background:var(--brand); border:2px solid #fafcfc; left:-5px; top:5px; box-sizing:content-box; }
.cb3-history-meta { display:flex; align-items:baseline; gap:12px; flex-wrap:wrap; font-size:12px; color:var(--muted); }
.cb3-history-meta strong { color:var(--body); font-weight:600; }
.cb3-timeline h4 { margin:4px 0 9px; font-size:14px; font-weight:650; color:var(--ink); }
.cb3-timeline dl { margin:0; background:#fff; border:1px solid var(--line); border-radius:8px; padding:12px 14px; }
.cb3-timeline dl > div + div { border-top:1px solid var(--line); padding-top:10px; margin-top:10px; }
.cb3-timeline dt { font-size:11px; color:var(--muted); margin-bottom:5px; }
.cb3-timeline dd { margin:0; font-size:13px; line-height:1.6; white-space:pre-wrap; overflow-wrap:anywhere; }
.cb3-timeline dd small { display:block; color:var(--muted); font-size:10px; font-weight:650; text-transform:uppercase; letter-spacing:.05em; }
.cb3-history-before { color:var(--muted); padding-bottom:8px; }
.cb3-history-after { color:var(--ink); }
.cb3-history-long summary { cursor:pointer; color:var(--deep); white-space:normal; }
.cb3-history-long > div { margin-top:8px; }
.cb3-past-plan { margin:16px 0; }
.cb3-past-plan > summary { font-size:13px; color:var(--deep); margin-bottom:12px; }
.cb3-round-reader > p { font-size:13px; color:var(--body); margin:12px 0; }
.cb3-round-editor { margin-top:16px; }
@media(hover:hover) {
  .cb3-tabs button:hover,.cb3-more-menu button:hover,.cb3-more-menu a:hover { background:var(--soft); color:var(--deep); }
}
@media(max-width:520px) {
  .cb3-workspace .cb3-tabs { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); overflow:visible; }
  .cb3-workspace .cb3-tabs button { padding:10px 4px; }
}
@media(max-width:1050px) {
  .cb3-workspace .cb3-page[data-ticket-page="details"] { grid-template-columns:minmax(0,1fr); }
  .cb3-overview-aside { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
  .cb3-workspace .cb-meta { margin:0; }
  .cb3-save-state { display:none; }
}
@media(max-width:720px) {
  .modal-backdrop.cb3-backdrop { padding:0; }
  .modal-wide.cb-panel.cb3-workspace { width:100%; height:100dvh; max-height:100dvh; border-radius:0; }
  .cb3-workspace .cb3-header { padding:8px 12px 0; }
  .cb3-workspace .cb-panel-head { gap:6px; }
  .cb3-workspace .cb-panel-install,.cb3-workspace .cb-panel-head .cb-kind,.cb3-workspace .cb-panel-head .cb-mark { display:none; }
  .cb3-workspace .cb-title-row { flex-wrap:nowrap; gap:8px; margin:8px 0 0; }
  .cb3-workspace .cb-title-row h2 { flex:1; font-size:17px; line-height:1.35; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
  .cb3-workspace .cb-title-row [data-edit-details] { font-size:12px; padding:6px 8px; }
  .cb3-workspace .cb3-tabs { flex-wrap:nowrap; gap:0; margin-top:8px; }
  .cb3-workspace .cb3-tabs button { font-size:12px; padding:11px 10px; min-height:44px; }
  .cb3-workspace .cb3-approval { display:grid; grid-template-columns:28px minmax(0,1fr); padding:10px 12px; gap:6px 8px; }
  .cb3-approval-icon { flex-basis:28px; height:28px; font-size:20px; }
  .cb3-approval h3 { font-size:13px; }
  .cb3-approval p { font-size:11px; }
  .cb3-approval > button { grid-column:2; justify-self:start; margin-left:0; padding:8px 12px; min-height:40px; }
  .cb3-workspace .form-scroll,.cb3-workspace .modal-feed-pane { padding:18px 16px 24px; }
  .cb3-overview-aside { grid-template-columns:minmax(0,1fr); }
  .cb3-workspace .cb-meta { margin:0; }
  .cb3-footer { padding:8px 12px max(8px,env(safe-area-inset-bottom)); gap:6px; }
  .cb3-workspace .cb3-tools { gap:6px; flex-wrap:wrap; }
  .cb3-save-area { flex:1; }
  .cb3-save-area:has(button[hidden]) { display:none; }
  .cb3-job-actions { flex:1; justify-content:flex-end; gap:6px; }
  .cb3-workspace .cb3-job-actions > button { font-size:12px; padding:8px; }
  .cb3-workspace .cb3-job-actions [data-job="review"] { display:none; }
  .cb3-more-menu .cb3-review-menu { display:block; }
  .cb3-workspace .cb3-footer .modal-actions { display:none; }
  .cb3-more > summary { font-size:12px; padding:10px; min-height:44px; }
  .cb3-footer:has(.cb2-ticket-nav) .cb2-ticket-nav { flex-basis:100%; justify-content:space-between; padding-bottom:4px; }
  .cb3-workspace .cb3-section-heading { align-items:flex-start; }
  .cb3-workspace .cb3-section-heading button { font-size:12px; padding:8px; }
  .cb3-timeline > li { padding-left:20px; }
  .cb3-history-meta { gap:3px 12px; }
  .cb3-history-meta time { font-size:11px; }
}
.cb3-workspace .cb3-proposed-model { grid-column:1/-1; padding-bottom:12px; border-bottom:1px solid var(--line); }
.cb3-workspace .cb3-meta-copy { grid-column:2; align-self:end; justify-self:start; }
.cb3-workspace .cb3-proposed-model dd { font-size:18px; overflow-wrap:anywhere; }
.cb3-client-brief { padding:20px; border:1px solid var(--line); border-left:4px solid var(--brand); border-radius:10px; background:var(--soft); }
.cb3-client-brief textarea { width:100%; min-height:160px; resize:vertical; }
.cb3-summary-tags { display:flex; flex-wrap:wrap; gap:6px; margin:6px 0; }
.cb3-summary-count { text-align:right; margin:4px 0 8px; }
.cb3-heading-top > [data-refresh-ticket] { flex-shrink:0; margin-left:auto; }
.cb3-heading-top > [data-close] { flex-shrink:0; }
@media(max-width:520px) {
  .cb3-heading-top { gap:8px; }
  .cb3-heading-top > [data-refresh-ticket] { padding:9px 10px; font-size:12px; }
}
