:root {
  --bg: #111318; --panel: #171a22; --panel2: #202430; --line: #2d3343; --text: #edf0f7; --dim: #a8b0c2;
  --accent: #68a6ff; --accent-fill: #2563eb; --accent-hover: #3571f0;
  --ok: #38c97e; --warn: #ebb949; --bad: #ef5b53; --wip: #a87bf0;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body, #root { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.48 "Segoe UI", system-ui, -apple-system, sans-serif; -webkit-font-smoothing: antialiased; }
* { scrollbar-color: var(--line) var(--bg); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: var(--panel2); border: 1px solid var(--line); border-radius: 7px; padding: 5px 11px; cursor: pointer; transition: border-color .12s, background .12s; }
button:hover:not(:disabled) { border-color: var(--accent); background: #262b39; }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--accent-fill); border-color: var(--accent-fill); color: #ffffff; font-weight: 600; }
button.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
input, select, textarea { background: #0e1015; border: 1px solid var(--line); border-radius: 7px; padding: 6px 10px; color: var(--text); }
input::placeholder, textarea::placeholder { color: #7a8396; }
a { color: var(--accent); cursor: pointer; }

.login { display: grid; place-items: center; height: 100%; }
.login form { background: var(--panel); padding: 30px; border-radius: 12px; width: 340px; display: grid; gap: 12px; border: 1px solid var(--line); box-shadow: 0 16px 40px rgba(0,0,0,.45); }
.login h1 { margin: 0 0 2px; font-size: 24px; letter-spacing: -.02em; }
.login .hint { color: var(--dim); font-size: 12.5px; line-height: 1.45; }
.error { color: #ff8079; min-height: 1.2em; font-size: 13px; }

.shell { display: grid; grid-template-columns: 256px 1fr; height: 100%; }
.shell.drawer-open { grid-template-columns: 256px minmax(0, 1fr) 400px; }
@media (max-width: 1180px) {
  .shell.drawer-open { grid-template-columns: 256px minmax(0, 1fr); }
  .drawer { position: fixed; right: 0; top: 0; bottom: 0; width: min(400px, 92vw); z-index: 8; box-shadow: -10px 0 28px rgba(0,0,0,.5); }
}
@media (max-width: 760px) {
  .shell, .shell.drawer-open { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  /* Keep shell search visible above the main pane; collapse only navigation. */
  .side > #side { display: none; }
}
.side { background: var(--panel); border-right: 1px solid var(--line); overflow-y: auto; overflow-x: hidden; padding: 10px 0 22px; scrollbar-width: none; }
.side::-webkit-scrollbar { width: 0; height: 0; display: none; }
.side.has-active-project { border-right: 0; box-shadow: inset -2px 0 0 rgba(104, 166, 255, .78); }
.side .brand { padding: 4px 16px 12px; font-weight: 800; font-size: 19px; display: flex; justify-content: space-between; align-items: center; }
.side .brand small { font-weight: 400; color: var(--dim); font-size: 12px; }
.side .sec { color: var(--dim); text-transform: uppercase; font-size: 11px; font-weight: 700; letter-spacing: .07em; padding: 14px 16px 5px; display: flex; justify-content: space-between; align-items: center; }
.side .sec-right, .side .proj-acts { display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0; }
.side-proj-list { display: flex; flex-direction: column; gap: 4px; padding: 6px 0; }
.side-proj-group { padding: 4px 0 5px; margin: 0 6px; border-radius: 12px; border: 1.5px solid transparent; transition: opacity .16s ease, background .16s ease, border-color .16s ease; }
.side-proj-group .item { margin: 1px 4px; }
.side-proj-group .item.proj { padding: 6px 10px; font-size: 13.5px; }
.side-proj-group .item:not(.proj) { padding-left: 14px; font-size: 13px; }
.chan-grip { font-size: 11px; color: transparent; margin-right: 4px; cursor: grab; user-select: none; letter-spacing: -1px; transition: color .12s; }
.chan-row:hover .chan-grip { color: var(--dim); }
.chan-row.dragging { opacity: .45; }
.chan-row.drag-before { box-shadow: inset 0 2px 0 var(--accent); }
.chan-row.drag-after { box-shadow: inset 0 -2px 0 var(--accent); }
.side-proj-list.has-active .side-proj-group:not(.active) { opacity: .48; }
.side-proj-list.has-active .side-proj-group:not(.active):hover,
.side-proj-list.has-active .side-proj-group:not(.active):focus-within { opacity: .94; background: rgba(255, 255, 255, .03); border-color: rgba(255, 255, 255, .08); }
.side-proj-group.active {
  position: relative;
  z-index: 2;
  margin: 8px 0 8px 8px;
  padding: 6px 8px 7px 4px;
  border-radius: 14px 0 0 14px;
  border: 2px solid rgba(104, 166, 255, .78);
  border-right: 0;
  background: linear-gradient(90deg, rgba(104, 166, 255, .13) 0%, #131722 70%, var(--bg) 100%);
  box-shadow: -4px 0 18px rgba(104, 166, 255, .12);
}
/* Soft concave outer fillet curves where the active project bridges into the main pane */
.side-proj-group.active::before,
.side-proj-group.active::after {
  content: "";
  position: absolute;
  right: 0;
  width: 12px;
  height: 12px;
  pointer-events: none;
}
.side-proj-group.active::before {
  top: -12px;
  background: radial-gradient(circle 12px at 0 0, var(--panel) 9.6px, rgba(104, 166, 255, .78) 10.1px, rgba(104, 166, 255, .78) 11.7px, var(--bg) 12.2px);
}
.side-proj-group.active::after {
  bottom: -12px;
  background: radial-gradient(circle 12px at 0 100%, var(--panel) 9.6px, rgba(104, 166, 255, .78) 10.1px, rgba(104, 166, 255, .78) 11.7px, var(--bg) 12.2px);
}
.side-proj-group.active .item.proj { color: #ffffff; font-weight: 700; }
.side-proj-group.active .item.proj.active { box-shadow: none; background: rgba(104, 166, 255, .18); }
.side-proj-group.active .item:not(.proj) { color: #c7d0e2; }
.side-proj-group.active .item:not(.proj):hover,
.side-proj-group.active .item:not(.proj).active { color: #ffffff; }
.side .item { margin: 1px 8px; padding: 6px 10px 6px 14px; border-radius: 7px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 6px; color: var(--dim); font-size: 13.5px; transition: background .1s, color .1s; }
.side .item > span:first-child { display: inline-flex; align-items: center; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .item.proj { padding-left: 10px; color: var(--text); font-weight: 650; }
.side .item:hover { background: var(--panel2); color: var(--text); }
.side .item.active { background: rgba(91, 157, 255, .15); color: #ffffff; font-weight: 600; }
.badge { background: var(--accent-fill); color: #ffffff; border-radius: 10px; padding: 1px 7px; font-size: 11px; font-weight: 700; }
.tag { font-size: 10px; border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; color: var(--dim); margin-left: 6px; font-weight: 600; }
.tag.client { border-color: rgba(235, 185, 73, .55); color: #f6d57a; background: rgba(235, 185, 73, .1); }

.main { display: flex; flex-direction: column; min-width: 0; height: 100%; }
.top { display: flex; align-items: center; gap: 10px; padding: 9px 18px; min-height: 52px; border-bottom: 1px solid var(--line); background: var(--panel); }
.top h2 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 36%; }
.top .role { color: var(--dim); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tabs { display: flex; gap: 4px; margin-left: auto; flex-shrink: 0; }
.tabs button { padding: 5px 10px; font-size: 13px; background: transparent; border-color: transparent; color: var(--dim); font-weight: 500; }
.tabs button:hover { background: var(--panel2); color: var(--text); border-color: var(--line); }
.tabs button.on { background: var(--accent-fill); border-color: var(--accent-fill); color: #ffffff; font-weight: 600; }
.addbar .tabs { margin-left: 0; }
.body { flex: 1; overflow: auto; padding: 0; min-height: 0; }

.chat { display: flex; flex-direction: column; height: 100%; }
.msgs { flex: 1; overflow-y: auto; padding: 12px 16px; }
.msg { padding: 6px 8px; border-radius: 6px; position: relative; }
.msg:hover { background: var(--panel); }
.msg .who { font-weight: 600; }
.msg .when { color: var(--dim); font-size: 11px; margin-left: 6px; }
.msg .ref { color: var(--accent); cursor: pointer; }
.msg .acts { position: absolute; right: 8px; top: 4px; display: none; }
.msg:hover .acts { display: block; }
.msg .acts button { font-size: 11px; padding: 2px 6px; }
.cards { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.card { background: var(--panel2); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 6px; padding: 6px 10px; min-width: 220px; cursor: pointer; }
.card:hover { border-color: var(--accent); }
.card .c1 { display: flex; gap: 8px; align-items: center; }
.card .code { font-weight: 700; }
.card .meta { color: var(--dim); font-size: 12px; }
.card.locked { border-left-color: var(--dim); color: var(--dim); cursor: default; }
.composer { border-top: 1px solid var(--line); padding: 10px 16px; position: relative; }
.composer textarea { width: 100%; resize: none; height: 54px; }
.composer .help { color: var(--dim); font-size: 11px; margin-top: 4px; }
.suggest { position: absolute; bottom: 92px; left: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; min-width: 300px; max-height: 240px; overflow-y: auto; z-index: 5; }
.suggest div { padding: 5px 10px; cursor: pointer; }
.suggest div.on, .suggest div:hover { background: var(--panel2); }
.suggest .dim { color: var(--dim); margin-left: 6px; }

.pill { display: inline-block; border-radius: 10px; padding: 1px 9px; font-size: 11.5px; font-weight: 600; background: var(--line); color: var(--text); letter-spacing: .01em; }
.st-wip, .st-in_progress, .st-active, .st-building { background: var(--wip); color: #ffffff; }
.st-review, .st-fixed, .st-queued { background: var(--warn); color: #12100a; }
.st-approved, .st-done, .st-verified, .st-closed, .st-ok { background: var(--ok); color: #09150f; }
.st-hold, .st-failed, .st-open { background: var(--bad); color: #ffffff; }

table.tree { width: 100%; border-collapse: collapse; }
table.tree th { text-align: left; color: var(--dim); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; padding: 10px 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); }
table.tree td { padding: 9px 12px; border-bottom: 1px solid rgba(255,255,255,.05); }
table.tree tr:hover td { background: var(--panel); cursor: pointer; }
.indent0 { padding-left: 12px !important; } .indent1 { padding-left: 30px !important; } .indent2 { padding-left: 50px !important; } .indent3 { padding-left: 70px !important; }
.typecol { color: var(--dim); font-size: 12.5px; }
.addbar { display: flex; gap: 8px; padding: 10px 18px; border-bottom: 1px solid var(--line); align-items: center; flex-wrap: wrap; background: var(--bg); }

.board { display: flex; gap: 14px; padding: 14px 18px; align-items: flex-start; height: 100%; overflow-x: auto; }
.col { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; min-width: 248px; width: 248px; padding: 10px; }
.col h3 { margin: 0 0 10px; font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--dim); display: flex; justify-content: space-between; }
.col.dragover { border-color: var(--accent); }
.col .card { min-width: 0; margin-bottom: 8px; }
.boardsel { padding: 10px 18px 0; }

.drawer { background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; padding: 16px 18px; }
.drawer h3 { margin: 4px 0 8px; font-size: 17px; line-height: 1.3; }
.drawer .row { display: grid; grid-template-columns: 96px 1fr; gap: 10px; align-items: center; margin: 9px 0; }
.drawer .row label { color: var(--dim); font-size: 12.5px; font-weight: 500; }
.drawer .sec { color: var(--dim); text-transform: uppercase; font-size: 11px; font-weight: 700; letter-spacing: .06em; margin: 18px 0 8px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.06); }
.drawer .close { float: right; }
.drawer .mention { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 7px; }
.drawer .mention .meta { color: var(--dim); font-size: 11.5px; }
.lockline { color: #f6d57a; font-size: 12.5px; }
.list { padding: 14px 18px; }
.list .card { margin-bottom: 9px; }
.empty { color: var(--dim); padding: 28px 20px; font-size: 13.5px; }
.audit td { font-size: 12.5px; }
.toast { position: fixed; bottom: 18px; right: 18px; background: var(--panel2); border: 1px solid var(--accent); color: #ffffff; padding: 9px 14px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.5); z-index: 20; font-size: 13px; }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: grid; place-items: center; z-index: 10; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px; width: 360px; display: grid; gap: 10px; }
.modal.wide { width: 560px; }
.modal .meta { color: var(--dim); font-size: 12px; }
.pipeedit { width: 100%; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }

table.pipe th.stepcol { text-align: center; min-width: 78px; }
table.pipe td.cell { text-align: center; cursor: pointer; border-left: 1px solid var(--panel2); }
table.pipe td.cell .meta { color: var(--dim); font-size: 11px; margin-top: 2px; }
table.pipe td.cell.current { box-shadow: inset 0 -2px 0 var(--accent); }
table.pipe td.cell.waiting .pill { background: transparent; border: 1px dashed var(--line); color: var(--dim); }
table.pipe td.cell.missing a { color: var(--dim); font-size: 16px; }
table.pipe td.na { background: repeating-linear-gradient(45deg, transparent 0 6px, var(--panel) 6px 8px); border-left: 1px solid var(--panel2); }
table.pipe tr.grouprow td { background: var(--panel); color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding: 6px 8px; cursor: default; }
table.pipe tr:hover td.na { background: var(--panel); }
.meta { color: var(--dim); font-size: 12px; }
.overdue { color: var(--bad); font-weight: 600; }
.stage { display: inline-block; border: 1px solid var(--accent); color: var(--accent); border-radius: 10px; padding: 0 8px; font-size: 11px; }
.progress { background: var(--panel2); border-radius: 3px; height: 6px; width: 70px; overflow: hidden; }
.progress .fill { background: var(--ok); height: 100%; }
.strip { display: flex; flex-wrap: wrap; gap: 6px; }
.stripstep { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; font-size: 12px; text-align: center; min-width: 74px; cursor: pointer; display: grid; gap: 2px; justify-items: center; }
.stripstep.current { border-color: var(--accent); }
.stripstep.none { opacity: .5; cursor: default; }
/* Demo polish t_7d689301 (uxdesigner audit t_96bf4a12): Search, Reports, Inbox, sidebar, call lobby, board, drawer. Tokens only; the mark tint derives from --warn. */
/* ---- Card A: Search + Reports + Inbox page chrome (append to web/style.css) ---- */
/* Search results (search.js searchPanel: .main > .scroll:has(> form input[name="q"]) > form, p[role=status], div > section[data-search-type]) */
.main > .scroll:has(> form input[name="q"]) { flex: 1; min-height: 0; overflow: auto; padding: 16px 24px; }
.main > .scroll:has(> form input[name="q"]) > form { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.main > .scroll:has(> form input[name="q"]) > form label { display: flex; align-items: center; gap: 6px; color: var(--dim); font-size: 12px; }
.main > .scroll:has(> form input[name="q"]) > form label > * { color: var(--text); font-size: 14px; }
.main > .scroll:has(> form input[name="q"]) > p[role=status] { color: var(--dim); font-size: 12px; margin: 12px 0 0; }
section[data-search-type] h3 { margin: 16px 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); }
section[data-search-type] ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-width: 900px; }
section[data-search-type] li a { display: block; padding: 6px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; color: var(--text); text-decoration: none; }
section[data-search-type] li a:hover { border-color: var(--accent); }
section[data-search-type] mark { background: rgba(227, 179, 65, .28); color: var(--text); border-radius: 2px; padding: 0 1px; }
@media (min-width: 761px) {
  .shell:has(> .main > .scroll > form input[name="q"]) { grid-template-rows: minmax(0, 1fr); }
}

/* Reports (reports.js draw: .body[aria-live] > form, p, section > h2, p, h3, table, ul) */
.body[aria-live] { padding: 16px 24px; }
.body[aria-live] > form { display: flex; align-items: center; gap: 8px; }
.body[aria-live] > form input { width: 72px; }
.body[aria-live] > p { color: var(--dim); font-size: 12px; margin: 8px 0; }
.body[aria-live] > section { max-width: 560px; margin-top: 16px; padding: 4px 16px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.body[aria-live] > section > h2 { font-size: 16px; margin: 10px 0 0; }
.body[aria-live] > section > h2 + p { color: var(--dim); font-size: 12px; margin: 2px 0 0; }
.body[aria-live] > section > h3 { margin: 16px 0 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); }
.body[aria-live] > section > p { color: var(--dim); margin: 2px 0; }
.body[aria-live] table { border-collapse: collapse; width: 100%; }
.body[aria-live] th[scope=row] { text-align: left; font-weight: 400; padding: 3px 12px 3px 0; }
.body[aria-live] td { padding: 3px 0 3px 8px; text-align: right; white-space: nowrap; width: 1%; }
.body[aria-live] td button { min-width: 44px; }
.body[aria-live] ul { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 4px; justify-items: start; }

/* Inbox (inbox.js draw; needs class 'inbox' added: h('div',{class:'body inbox'}, ...)) */
.body.inbox { padding: 16px 24px; }
.body.inbox > h2 { font-size: 16px; margin: 0 0 12px; }
.body.inbox > details { margin: 12px 0; color: var(--dim); }
.body.inbox > p { display: flex; gap: 8px; margin: 0 0 6px; max-width: 900px; }
.body.inbox > p > button:first-child { flex: 1; text-align: left; padding: 8px 12px; }

/* ---- Card B: shell, calls, board, drawer, phone hero (append to web/style.css; last rule to web/home.css) ---- */
/* Sidebar: align Inbox and Studio reports cleanly with .item rows */
#side > button { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: calc(100% - 16px); margin: 1px 8px; background: none; border: 0; border-radius: 7px; padding: 6px 10px 6px 14px; color: var(--dim); text-align: left; font-size: 13.5px; }
#side > button:hover { background: var(--panel2); color: var(--text); }
/* Board: long codes overflow the column */
.col .card .c1 { min-width: 0; }
.col .card .code { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Drawer: Step pill stretches across the grid cell */
.drawer .row > .stage { justify-self: start; }

/* Responsive phone navigation (<= 760px, F_MOBILE) */
.mobile-nav-bar { display: none; }
@media (max-width: 760px) {
  .mobile-nav-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--panel); }
  .mobile-nav-bar .brand-title { font-weight: 700; font-size: 16px; }
  .side.nav-open > #side { display: block; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
  .top { flex-wrap: wrap; gap: 8px; }
  .top h2 { max-width: 100%; }
  .tabs { flex-wrap: wrap; margin-left: 0; }
}
