:root {
  --bg: #f6f7f9; --panel: #ffffff; --ink: #14171f; --ink2: #4a5262; --ink3: #8189a0; --line: #e4e7ee; --line2: #eef0f5;
  --brand: #3b4cca; --brand-ink: #ffffff; --brand-soft: #eef0ff; --ok: #14804a; --ok-soft: #e4f6ec; --warn: #a15c07; --warn-soft: #fdf1dc;
  --bad: #b42318; --bad-soft: #fde8e6; --violet: #6d3fc4; --violet-soft: #f0eafc; --teal: #0e7c86; --teal-soft: #e0f4f5; --gray-soft: #eef0f4;
  --radius: 10px; --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 22px; line-height: 1.25; margin: 0; letter-spacing: -.01em; } h2 { font-size: 15px; margin: 0; } h3 { font-size: 13px; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--ink3); } .small { font-size: 12.5px; } .right { margin-left: auto; } .hidden { display: none !important; }
.row { display: flex; align-items: center; gap: 10px; } .wrap { flex-wrap: wrap; } .col { display: flex; flex-direction: column; gap: 10px; } .grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* shell */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: #12141c; color: #c9cede; padding: 18px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: #fff; font-weight: 650; font-size: 16px; letter-spacing: -.01em; }
.brand .mark { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, #5b6cf0, #2bb3c0); display: grid; place-items: center; font-size: 13px; font-weight: 800; color: #fff; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: #c9cede; font-weight: 500; }
.nav a:hover { background: #1c1f2b; text-decoration: none; color: #fff; }
.nav a.on { background: #262a3a; color: #fff; }
.nav .ico { width: 18px; text-align: center; opacity: .85; }
.nav .count { margin-left: auto; background: #5b6cf0; color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 7px; }
.nav .count.quiet { background: #343a50; }
.side .foot { margin-top: auto; padding: 10px; font-size: 12.5px; color: #8189a0; }
.side .foot button { background: none; border: 0; color: #c9cede; padding: 0; cursor: pointer; }
.main { padding: 26px 32px 60px; min-width: 0; }
.page { max-width: 1180px; margin: 0 auto; }
.crumbs { color: var(--ink3); font-size: 13px; margin-bottom: 8px; } .crumbs a { color: var(--ink2); } .crumbs span { margin: 0 6px; }
.head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.head .sub { color: var(--ink2); margin-top: 3px; }

/* building blocks */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 16px 18px; }
.card > .card-h { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.grid { display: grid; gap: 14px; } .g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 12px; font-weight: 550; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f8f9fb; text-decoration: none; } .btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; } .btn.primary:hover { background: #3343b8; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; } .btn.danger { color: var(--bad); border-color: #f1c4bf; } .btn.danger:hover { background: var(--bad-soft); }
.btn.sm { padding: 3px 9px; font-size: 12.5px; border-radius: 7px; } .btn.ghost { border-color: transparent; background: transparent; color: var(--ink2); }
input[type=text], input[type=password], input[type=number], input[type=search], select, textarea { border: 1px solid #d5d9e3; border-radius: 8px; padding: 7px 10px; background: #fff; width: 100%; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(59, 76, 202, .14); }
textarea { resize: vertical; min-height: 68px; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--ink2); font-weight: 550; }
.chip { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 600; background: var(--gray-soft); color: var(--ink2); white-space: nowrap; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.chip.plain::before { display: none; }
.st-open, .st-triaging { background: var(--gray-soft); color: #4a5262; }
.st-in_progress { background: var(--brand-soft); color: var(--brand); }
.st-on_staging { background: var(--warn-soft); color: var(--warn); }
.st-live, .st-closed { background: var(--ok-soft); color: var(--ok); }
.st-needs_architect, .st-proposed { background: var(--violet-soft); color: var(--violet); }
.st-rejected, .st-cancelled { background: #f1f2f5; color: #6b7386; }
.st-rolled_back { background: var(--bad-soft); color: var(--bad); }
.label { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; font-size: 11.5px; font-weight: 600; color: var(--ink2); background: #fff; }
.label.major { border-color: #dccdf6; color: var(--violet); background: var(--violet-soft); } .label.simple { border-color: #cfe9da; color: var(--ok); background: var(--ok-soft); }
.empty { padding: 34px 16px; text-align: center; color: var(--ink3); }
.stat { font-size: 22px; font-weight: 650; letter-spacing: -.02em; } .stat-l { font-size: 12px; color: var(--ink3); font-weight: 550; text-transform: uppercase; letter-spacing: .04em; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs a { padding: 8px 12px; color: var(--ink2); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { text-decoration: none; color: var(--ink); } .tabs a.on { color: var(--ink); border-color: var(--brand); }
.tabs .n { background: var(--gray-soft); border-radius: 999px; padding: 0 7px; font-size: 11.5px; margin-left: 4px; }

/* client cards */
.client { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; } .client:hover { border-color: #c9cee0; text-decoration: none; }
.client .name { font-size: 16px; font-weight: 650; color: var(--ink); }
.avatar { width: 36px; height: 36px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 700; flex: none; }
.avatar.sm { width: 26px; height: 26px; border-radius: 8px; font-size: 12px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 10px; font-size: 13px; } .kv dt { color: var(--ink3); } .kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* issue list */
.issues .bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fafbfc; border-radius: var(--radius) var(--radius) 0 0; flex-wrap: wrap; }
.issues .bar .seg a { padding: 4px 10px; border-radius: 7px; color: var(--ink2); font-weight: 600; } .issues .bar .seg a.on { color: var(--ink); background: #e9ecf3; } .issues .bar .seg a:hover { text-decoration: none; }
.issues .bar input[type=search] { width: 220px; padding: 5px 10px; } .issues .bar select { width: auto; padding: 5px 8px; }
.issue { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line2); align-items: start; color: inherit; }
.issue:last-child { border-bottom: 0; } .issue:hover { background: #fafbfd; text-decoration: none; }
.issue .dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ok); margin-top: 3px; } .issue.closed .dot { border-color: var(--violet); background: var(--violet); box-shadow: inset 0 0 0 3px #fff; }
.issue .t { font-weight: 620; font-size: 14.5px; color: var(--ink); } .issue .m { color: var(--ink3); font-size: 12.5px; margin-top: 2px; }
.issue .labels { display: inline-flex; gap: 5px; margin-left: 8px; vertical-align: 1px; }

/* ticket page */
.ticket { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 22px; align-items: start; }
.tl { position: relative; padding-left: 26px; } .tl::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.ev { position: relative; margin-bottom: 14px; } .ev .pin { position: absolute; left: -26px; top: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 2px solid var(--line); display: grid; place-items: center; font-size: 10px; color: var(--ink3); }
.ev.line { color: var(--ink2); font-size: 13px; padding: 1px 0; } .ev.line b { color: var(--ink); font-weight: 600; }
.ev .box { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; overflow: hidden; }
.ev .box .bh { padding: 8px 12px; background: #fafbfc; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--ink2); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ev .box .bb { padding: 10px 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ev.r-client .box .bh { background: #f3f6ff; } .ev.r-architect .box .bh { background: var(--violet-soft); } .ev.internal .box { border-style: dashed; } .ev.internal .box .bh { background: #fff9eb; }
.pin.ok { border-color: var(--ok); color: var(--ok); } .pin.bad { border-color: var(--bad); color: var(--bad); } .pin.go { border-color: var(--brand); color: var(--brand); } .pin.v { border-color: var(--violet); color: var(--violet); }
.who { font-weight: 650; color: var(--ink); } .tag { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 0 6px; border-radius: 5px; background: var(--gray-soft); color: var(--ink2); }
.tag.internal { background: #fdeecb; color: #8a5a00; }
.tag.ok { background: #dcf3e4; color: #17633a; } .tag.bad { background: var(--bad-soft); color: var(--bad); } .tag.warn { background: var(--warn-soft); color: #7a4a05; } .tag.info { background: var(--brand-soft); color: #2b3899; }
.diff { font-family: var(--mono); font-size: 12px; line-height: 1.55; overflow-x: auto; background: #fff; border-top: 1px solid var(--line); }
.diff .f { background: #f3f5f9; padding: 5px 12px; font-weight: 600; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); } .diff .f:first-child { border-top: 0; }
.diff .l { padding: 0 12px; white-space: pre; } .diff .a { background: #e6f6ec; } .diff .d { background: #fdecea; } .diff .hk { color: #6b7386; background: #f6f8ff; }
pre.out { margin: 0; padding: 10px 12px; background: #0f1320; color: #d7dcee; font: 12px/1.5 var(--mono); overflow-x: auto; white-space: pre-wrap; max-height: 260px; }
details > summary { cursor: pointer; color: var(--ink2); font-size: 12.5px; padding: 6px 12px; user-select: none; } details[open] > summary { border-bottom: 1px solid var(--line); }
.sidebox { padding: 14px 16px; } .sidebox + .sidebox { border-top: 1px solid var(--line); } .sidebox h3 { color: var(--ink3); text-transform: uppercase; letter-spacing: .05em; font-size: 11.5px; margin-bottom: 8px; }
.actions { display: flex; flex-direction: column; gap: 8px; } .actions .btn { width: 100%; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; } .thumbs img { width: 92px; height: 92px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }

/* tables */
table.t { width: 100%; border-collapse: collapse; } table.t th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink3); padding: 8px 14px; border-bottom: 1px solid var(--line); background: #fafbfc; font-weight: 650; }
table.t td { padding: 9px 14px; border-bottom: 1px solid var(--line2); vertical-align: middle; } table.t tr:last-child td { border-bottom: 0; }
.envs { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.env { padding: 16px 18px; } .env .rel { font-size: 26px; font-weight: 700; letter-spacing: -.02em; } .env.prod { border-top: 3px solid var(--ok); } .env.stag { border-top: 3px solid #e2a03f; }
.cur { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; } .cur.p { background: var(--ok-soft); color: var(--ok); } .cur.s { background: var(--warn-soft); color: var(--warn); }

/* chat (proposal thread, conversations) */
.chat { display: flex; flex-direction: column; gap: 10px; padding: 14px; overflow-y: auto; }
.msg { max-width: 82%; padding: 8px 12px; border-radius: 14px; background: #eef0f5; align-self: flex-start; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg .by { font-size: 11.5px; font-weight: 650; color: var(--ink3); margin-bottom: 2px; }
.msg.me { align-self: flex-end; background: var(--brand); color: #fff; } .msg.me .by { color: #cfd5ff; }
.msg.user { background: #e3f2e8; align-self: flex-end; } .msg.human { background: #fff3d6; } .msg.sys { align-self: center; background: none; color: var(--ink3); font-size: 12.5px; padding: 0; }
.msg .mcard { margin-top: 6px; border: 1px solid rgba(0, 0, 0, .09); background: #fff; color: var(--ink); border-radius: 10px; padding: 8px 10px; font-size: 12.5px; }
.msg img.att { display: block; max-width: 180px; border-radius: 8px; margin-top: 6px; }
.composer { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); background: #fff; border-radius: 0 0 var(--radius) var(--radius); }
.composer textarea { min-height: 40px; height: 40px; }
.split { display: grid; grid-template-columns: 320px 1fr; gap: 16px; align-items: start; }
.convlist a { display: block; padding: 11px 14px; border-bottom: 1px solid var(--line2); color: inherit; } .convlist a:hover { background: #fafbfd; text-decoration: none; } .convlist a.on { background: var(--brand-soft); }
.badge { background: var(--brand); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 0 6px; }
.banner { padding: 9px 14px; border-radius: 8px; background: var(--warn-soft); color: #7a4a05; font-weight: 550; display: flex; gap: 10px; align-items: center; }
.banner.info { background: var(--brand-soft); color: #2b3899; } .banner.bad { background: var(--bad-soft); color: var(--bad); }
.proposal h3 { margin: 16px 0 6px; color: var(--ink3); text-transform: uppercase; letter-spacing: .05em; font-size: 11.5px; } .proposal p { margin: 0; white-space: pre-wrap; } .proposal ul { margin: 0; padding-left: 18px; }

/* demo */
.demo { display: grid; grid-template-columns: auto minmax(300px, 1fr) minmax(360px, 1.25fr); gap: 18px; align-items: start; }
.phonewrap { min-width: 220px; }
.phone { width: 394px; height: 812px; border-radius: 46px; background: #0d0f16; padding: 11px; box-shadow: 0 24px 60px rgba(13, 15, 22, .28), inset 0 0 0 2px #2a2e3d; position: relative; }
.phone::before { content: ""; position: absolute; top: 20px; left: 50%; transform: translateX(-50%); width: 104px; height: 28px; border-radius: 999px; background: #0d0f16; z-index: 2; }
.phone iframe { width: 100%; height: 100%; border: 0; border-radius: 36px; background: #f7f6f3; }
.sitepane { display: flex; flex-direction: column; gap: 12px; }
.site { overflow: hidden; } .site .card-h { padding: 8px 12px; font-size: 12.5px; } .site iframe { width: 200%; height: 620px; border: 0; transform: scale(.5); transform-origin: 0 0; display: block; background: #fff; } .site .frame { height: 270px; overflow: hidden; }
.pulse { animation: pulse 1.2s ease-out 1; } @keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(59, 76, 202, .5); } 100% { box-shadow: 0 0 0 14px rgba(59, 76, 202, 0); } }
.dotlive { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: inline-block; }

/* new project */
.np { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 18px; align-items: start; }
.srclist { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; font-weight: 400; }
.src { display: flex; gap: 9px; align-items: flex-start; padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; color: var(--ink); background: #fff; font-size: 13.5px; }
.src:hover { border-color: #c9cee0; } .src.on { border-color: var(--brand); background: var(--brand-soft); } .src input { width: auto; margin-top: 3px; flex: none; }
#np-plan .kv dd code { overflow-wrap: anywhere; }

/* login + modal + toast */
.login { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 20% -10%, #e8ebff, transparent), var(--bg); }
.login .card { width: 360px; padding: 28px; } .login .brand { color: var(--ink); padding: 0 0 14px; font-size: 18px; }
.modal-bg { position: fixed; inset: 0; background: rgba(15, 19, 32, .45); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { width: 480px; max-width: 100%; padding: 22px; } .modal h2 { font-size: 17px; margin-bottom: 6px; }
.code { font: 700 30px/1 var(--mono); letter-spacing: .12em; padding: 16px; text-align: center; background: var(--brand-soft); color: var(--brand); border-radius: 10px; margin: 14px 0 10px; user-select: all; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #14171f; color: #fff; padding: 9px 16px; border-radius: 10px; z-index: 60; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); max-width: 80vw; }
.toast.bad { background: var(--bad); }

@media (max-width: 1100px) { .demo { grid-template-columns: auto 1fr; } .demo .sitepane { grid-column: 1 / -1; flex-direction: row; } .demo .sitepane > * { flex: 1; min-width: 0; } }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; } .side { position: static; height: auto; flex-direction: row; align-items: center; padding: 8px 10px; overflow-x: auto; gap: 2px; }
  .side .brand { padding: 0 8px 0 2px; } .side .brand span { display: none; } .nav { display: flex; gap: 2px; } .nav a { padding: 7px 9px; white-space: nowrap; } .nav a .txt { display: none; } .nav a.on .txt { display: inline; } .side .foot { display: none; }
  .main { padding: 16px 14px 60px; overflow-x: hidden; } .g2, .g3, .envs, .ticket, .split, .demo, .np { grid-template-columns: minmax(0, 1fr) !important; }
  .ev.line { overflow-wrap: anywhere; } .ev .box .bh .right { margin-left: 0; } .card { min-width: 0; } table.t { table-layout: fixed; } table.t td { overflow-wrap: anywhere; } .issues .bar input[type=search] { width: 100%; }
  .issue { grid-template-columns: 18px 1fr; } .issue > .chipcol { grid-column: 2; } h1 { font-size: 19px; } .demo .sitepane { flex-direction: column; } .phone { width: 100%; max-width: 394px; margin: 0 auto; }
  table.t th:nth-child(n+4), table.t td:nth-child(n+4) { display: none; } .kv { grid-template-columns: 92px 1fr; }
}
