/* The cabinet of the owner (design/project/*.dc.html): a dark header, a white sheet with a round top, a dock of four places (a column at the left on a wide screen). Loaded after pico and style.css,
   so it only overrides what the new frame changes. No external fonts (the page policy allows only itself): the system face stands in for the Manrope of the design. */
:root {
  --ink:#111113; --ink2:#3A3A40; --mute:#6B6E78; --line:#ECECF0; --soft:#F2F2F5; --field:#F7F7F9; --night:#161618; --night2:#26262A; --night3:#3A3A40; --dim:#9C9EA6;
  --c-green:#DDF2E4; --c-green-i:#155C34; --c-blue:#DCEBFA; --c-blue-i:#2C4E73; --c-yellow:#F7E7A6; --c-yellow-i:#5C4A00; --c-red:#FDE1E1; --c-red-i:#8A1C1C; --c-violet:#E4DEFA; --c-violet-i:#4A4560; --c-pink:#FBE3F1; --c-pink-i:#7A1F55;
  --pico-font-family: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
body.app { margin:0; background:var(--night); color:var(--ink); font-family:var(--pico-font-family); min-height:100vh; display:flex; flex-direction:column; padding-bottom:0; }
body.app a { color:inherit; }
body.app a:hover { color:inherit; }

/* header */
.hero { display:flex; align-items:center; gap:10px; padding:calc(14px + env(safe-area-inset-top)) 16px 16px; color:#fff; }
.hero-t { flex:1; min-width:0; display:flex; flex-direction:column; gap:4px; }
.hero h1 { margin:0; font-size:26px; line-height:1.1; font-weight:800; letter-spacing:-.02em; color:#fff; overflow-wrap:anywhere; }
body.app.in .hero h1 { font-size:26px; }
.hero-s { color:var(--dim); font-size:13px; font-weight:700; display:flex; align-items:center; gap:6px; overflow-wrap:anywhere; }
.hero-s.ok { color:#9DDDB4; }
.dot { width:7px; height:7px; border-radius:99px; background:#23A05A; display:inline-block; flex:none; }
.round { width:44px; height:44px; border-radius:99px; border:1px solid var(--night3); background:var(--night2); color:#fff; display:inline-flex; align-items:center; justify-content:center; cursor:pointer; flex:none; text-decoration:none; padding:0; margin:0; }
.round:hover { color:#fff; background:var(--night3); }
.hero .round + .hero-t h1 { font-size:18px; }

/* the sheet */
.sheet { flex:1; background:#fff; border-radius:32px 32px 0 0; padding:16px 14px calc(110px + env(safe-area-inset-bottom)); min-height:0; max-width:none; width:100%; box-sizing:border-box; }
.sheet > * { max-width:760px; width:100%; box-sizing:border-box; margin-left:auto; margin-right:auto; }
body.app:not(.in) .sheet { padding-bottom:40px; }
.sheet h2 { font-size:16px; font-weight:800; margin:18px 0 8px; }
.sheet h3 { font-size:15px; font-weight:800; }
.sheet .card { background:var(--field); border:0; box-shadow:none; border-radius:18px; }
.sheet .muted, .sheet .help { color:var(--mute); }
.sheet input, .sheet textarea, .sheet select { border-radius:14px; background:var(--field); border-color:#E6E6EA; color:var(--ink); }
.sheet button, .sheet [type="submit"], .sheet .btn { border-radius:99px; font-weight:700; }
.sheet button:not(.secondary):not(.link):not(.pill):not(.round):not([aria-pressed]), .sheet [type="submit"]:not(.secondary):not(.pill):not([aria-pressed]), .sheet a.btn:not(.secondary) { background:var(--ink); border-color:var(--ink); color:#fff; }
.sheet button.secondary, .sheet a.btn.secondary { background:var(--soft); border-color:var(--soft); color:var(--ink); }
.sheet .flash { border-radius:16px; border:0; background:var(--soft); }
.sheet .flash.ok { background:var(--c-green); color:var(--c-green-i); }
.sheet .flash.error { background:var(--c-red); color:var(--c-red-i); }
.sheet .badge { border:0; border-radius:99px; background:var(--soft); color:var(--ink2); font-weight:700; padding:3px 10px; font-size:12px; }
.sheet .badge.on { background:var(--c-green); color:var(--c-green-i); }
.sheet .badge.warn { background:var(--c-yellow); color:var(--c-yellow-i); }
.sheet .badge.bad { background:var(--c-red); color:var(--c-red-i); }

/* chips and pills */
.chip { display:inline-flex; align-items:center; gap:6px; font-size:12px; font-weight:700; padding:4px 10px; border-radius:99px; background:var(--soft); color:var(--ink2); line-height:1.4; }
.chip.green { background:var(--c-green); color:var(--c-green-i); } .chip.blue { background:var(--c-blue); color:var(--c-blue-i); } .chip.yellow { background:var(--c-yellow); color:var(--c-yellow-i); }
.chip.red { background:var(--c-red); color:var(--c-red-i); } .chip.violet { background:var(--c-violet); color:var(--c-violet-i); } .chip.pink { background:var(--c-pink); color:var(--c-pink-i); }
.pills { display:flex; gap:6px; overflow-x:auto; padding:0 4px 2px; -webkit-overflow-scrolling:touch; }
.pills.small { padding-top:4px; align-items:center; }
.pills .lab { color:var(--mute); font-size:12px; font-weight:700; flex:none; }
.pill { display:inline-flex; align-items:center; justify-content:center; gap:8px; min-height:38px; padding:0 14px; border-radius:99px; border:0; background:var(--soft); color:var(--ink); font:inherit; font-size:13px; font-weight:700; cursor:pointer; text-decoration:none; white-space:nowrap; flex:none; }
.pill.on { background:var(--ink); color:#fff; }
.pills.small .pill { min-height:32px; padding:0 12px; font-size:12px; }
.pill.green { background:var(--c-green); color:var(--c-green-i); } .pill.blue { background:var(--c-blue); color:var(--c-blue-i); } .pill.pink { background:var(--c-pink); color:var(--c-pink-i); }
.pill.green.on, .pill.blue.on, .pill.pink.on { outline:2px solid var(--ink); outline-offset:-2px; }
a.pill.dark, .pill.dark { background:var(--ink); color:#fff; min-height:48px; padding:0 20px; font-size:14px; }
.pill.soft { background:var(--soft); color:var(--ink); }

/* list rows (dialogs, deals, questions) */
.rows { display:flex; flex-direction:column; gap:8px; margin:8px 0 12px; }
.row-card { display:flex; gap:12px; padding:12px; border-radius:18px; text-decoration:none; color:var(--ink); }
.row-card:hover, .row-card:active { background:var(--field); }
.row-card .av { flex:none; width:44px; height:44px; border-radius:14px; display:flex; align-items:center; justify-content:center; font-weight:800; }
.row-card .main { flex:1; min-width:0; display:flex; flex-direction:column; gap:4px; }
.row-card .rtop { display:flex; justify-content:space-between; gap:8px; }
.row-card .rtop b { font-size:15px; font-weight:800; overflow-wrap:anywhere; }
.row-card .when { color:var(--mute); font-size:12px; font-weight:700; flex:none; }
.row-card .last { font-size:14px; color:var(--ink2); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.row-card .chips { display:flex; flex-wrap:wrap; gap:4px; margin-top:2px; }
.deal-card { display:flex; flex-direction:column; gap:6px; padding:14px; border-radius:18px; border:1px solid var(--line); text-decoration:none; color:var(--ink); }
.deal-card:hover { background:var(--field); }
.deal-card .rtop { display:flex; justify-content:space-between; gap:8px; font-weight:800; font-size:15px; }
.deal-card .sub { color:var(--ink2); font-size:13px; font-weight:600; overflow-wrap:anywhere; }
.soon { display:flex; gap:10px; overflow-x:auto; padding:0 2px 6px; -webkit-overflow-scrolling:touch; }
.slot { flex:none; width:150px; border-radius:20px; padding:14px; display:flex; flex-direction:column; gap:10px; text-decoration:none; color:var(--ink); box-sizing:border-box; }
.slot .t { font-weight:800; font-size:22px; letter-spacing:-.02em; }
.slot .n { font-weight:800; font-size:13px; } .slot .c { font-size:12px; font-weight:700; }
.slot.g { background:var(--c-green); } .slot.g .c { color:var(--c-green-i); } .slot.b { background:var(--c-blue); } .slot.b .c { color:var(--c-blue-i); } .slot.v { background:var(--c-violet); } .slot.v .c { color:var(--c-violet-i); }
.qcard { border:1px solid var(--line); border-radius:20px; padding:14px; display:flex; flex-direction:column; gap:8px; margin:0 0 10px; background:#fff; }
.qcard .rtop { display:flex; justify-content:space-between; gap:8px; font-size:13px; font-weight:800; }
.qcard p { margin:0; font-size:14px; line-height:1.45; }

/* chat */
.chat { display:flex; flex-direction:column; gap:8px; margin:6px 0 12px; }
.bubble { border:0; border-radius:20px; padding:10px 14px; font-size:14px; line-height:1.45; font-weight:500; max-width:82%; background:var(--soft); }
.bubble.client { align-self:flex-start; border-radius:20px 20px 20px 6px; background:var(--soft); }
.bubble.agent { align-self:flex-end; border-radius:20px 20px 6px 20px; background:var(--c-blue); }
.bubble.owner { align-self:flex-end; border-radius:20px 20px 6px 20px; background:var(--ink); color:#fff; border-style:solid; }
.bubble .muted { font-size:11px; font-weight:700; margin-bottom:2px; }
.bubble.agent .muted { color:var(--c-blue-i); } .bubble.owner .muted { color:#C3C5CC; }
.turn { align-self:flex-end; width:min(100%, 460px); }
.turn > summary { list-style:none; display:inline-flex; align-items:center; gap:6px; min-height:32px; padding:0 10px; border-radius:99px; font-size:12px; font-weight:700; color:var(--mute); cursor:pointer; float:right; }
.turn > summary::-webkit-details-marker { display:none; }
.turn[open] > summary { color:var(--ink); }
.turn .why { clear:both; background:var(--night); color:#fff; border-radius:18px; padding:14px 16px; font-size:12px; font-weight:600; line-height:1.5; overflow-wrap:anywhere; }
.chatbar { position:sticky; bottom:calc(86px + env(safe-area-inset-bottom)); background:#fff; padding-top:10px; display:flex; flex-direction:column; gap:10px; border-top:1px solid #F0F0F3; }
.chatbar form { margin:0; }
.chatbar .state { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.chatbar .send { display:flex; gap:8px; align-items:flex-end; }
.chatbar .send textarea { flex:1; min-height:48px; margin:0; resize:vertical; }
.chatbar .send button { width:48px; height:48px; padding:0; margin:0; display:inline-flex; align-items:center; justify-content:center; border-radius:99px; flex:none; }

/* facts list of a record */
.facts { margin:0 0 12px; display:flex; flex-direction:column; gap:0; }
.facts div { display:flex; gap:12px; padding:10px 4px; border-bottom:1px solid var(--line); }
.facts dt { flex:none; width:96px; color:var(--mute); font-size:13px; font-weight:700; }
.facts dd { margin:0; font-size:14px; font-weight:700; overflow-wrap:anywhere; }
.stages { display:flex; flex-direction:column; gap:8px; margin:6px 0 12px; }
.stages form { margin:0; }
.stages button { width:100%; display:flex; align-items:center; justify-content:space-between; min-height:52px; padding:0 18px; border-radius:16px; background:var(--field); color:var(--ink); border:1px solid var(--line); font-weight:800; font-size:15px; margin:0; }
.stages button[aria-pressed="true"] { background:var(--ink); color:#fff; border-color:var(--ink); }
.stages button:not(.secondary) { background:var(--field); color:var(--ink); border-color:var(--line); }
.stages button[aria-pressed="true"]:not(.secondary) { background:var(--ink); color:#fff; border-color:var(--ink); }
.actions { display:flex; gap:8px; flex-wrap:wrap; margin:6px 0 14px; }

/* «Ещё» */
.tiles { display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:8px; margin-bottom:8px; }
.tile { border-radius:20px; padding:14px; min-height:92px; box-sizing:border-box; display:flex; flex-direction:column; justify-content:space-between; text-decoration:none; color:var(--ink); font-weight:800; font-size:15px; background:var(--soft); }
.tile.violet { background:var(--c-violet); } .tile.yellow { background:var(--c-yellow); } .tile.green { background:var(--c-green); } .tile.blue { background:var(--c-blue); } .tile.night { background:var(--night); color:#fff; }
.menu { display:flex; align-items:center; gap:12px; min-height:52px; padding:0 12px; border-radius:16px; background:var(--field); text-decoration:none; color:var(--ink); margin:0 0 8px; font-size:15px; font-weight:800; }
.menu .sub { margin-left:auto; color:var(--mute); font-size:13px; font-weight:700; }
.menu .ic { width:34px; height:34px; border-radius:10px; background:#fff; display:flex; align-items:center; justify-content:center; flex:none; }

/* the dock */
.dock { position:fixed; left:16px; right:16px; bottom:calc(14px + env(safe-area-inset-bottom)); z-index:20; background:var(--night); border-radius:99px; padding:6px; display:flex; gap:4px; box-shadow:0 10px 30px rgba(0,0,0,.25); max-width:520px; margin:0 auto; }
.dk { position:relative; flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px; min-height:52px; border-radius:99px; text-decoration:none; font-size:11px; font-weight:700; color:var(--dim) !important; }
.dk.on { background:#fff; color:var(--ink) !important; }
.dk-n { position:absolute; top:4px; margin-left:30px; min-width:18px; height:18px; padding:0 4px; box-sizing:border-box; border-radius:99px; background:var(--c-yellow); color:var(--ink); font-size:11px; font-weight:800; display:flex; align-items:center; justify-content:center; }

/* a wide screen: the dock is a column at the left */
@media (min-width: 900px) {
  body.app.in { padding-left:104px; }
  .dock { left:16px; right:auto; top:16px; bottom:16px; width:72px; max-width:none; margin:0; flex-direction:column; justify-content:flex-start; border-radius:28px; padding:8px 4px; }
  .dk { flex:none; min-height:58px; border-radius:18px; }
  .dk-n { margin-left:26px; }
  .sheet { padding-bottom:40px; border-radius:32px 0 0 0; }
  .hero { padding-left:28px; padding-right:28px; }
  .chatbar { bottom:0; }
  .tiles { grid-template-columns:repeat(4, minmax(0,1fr)); }
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --pico-background-color:#fff; } }

/* small helpers (no inline styles on the pages: the policy forbids them) */
.av0 { background:#F7E7A6; } .av1 { background:#FBE3F1; } .av2 { background:#FDE1E1; } .av3 { background:#E4DEFA; } .av4 { background:#DDF2E4; } .av5 { background:#DCEBFA; }
.chips-row { display:flex; flex-wrap:wrap; gap:6px; padding:0 2px 8px; }
.chips { display:flex; flex-wrap:wrap; gap:4px; }
.round.night { background:var(--night); border-color:var(--night); color:#fff; }
.pill.nightbtn { background:var(--night2); color:#fff; min-height:40px; }
.pill.wide { width:100%; }
label.grow { flex:1; }
.sheet .why { margin:0; }
.why div { display:flex; gap:10px; padding:2px 0; }
.why dt { flex:none; width:96px; color:var(--dim); }
.why dd { margin:0; color:#fff; }
.filters { margin:6px 0 4px; }
.filters input[type="search"] { margin:0; }
.sheet .rows .row-card .av { color:var(--ink); }
.sr { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); }

.sheet button.pill, .sheet a.pill { width:auto; margin:0; }
.actions .pill, .state .pill { width:auto; margin:0; }
.actions { align-items:center; }
.sheet details.card > summary { margin:0; padding:0; min-height:0; }
.sheet details.card[open] > summary { margin-bottom:8px; }
.tile { padding:12px; font-size:14px; overflow-wrap:normal; min-width:0; }
.tile span { overflow-wrap:normal; }
.sheet .check { gap:10px; font-size:13px; color:var(--mute); font-weight:600; }
.sheet .check input { margin:0; width:22px; height:22px; flex:none; }
.sheet .qcard textarea { margin:0; }
.sheet .qcard form, .sheet form.qcard { margin:0 0 10px; }

.stages button[disabled] { opacity:1; cursor:default; }
.stages button[aria-pressed="true"] { background:var(--ink); color:#fff; border-color:var(--ink); }

.sheet button.pill.wide { width:100%; }
