:root {
  --bg: #0b0d12; --card: #141922; --line: #232a36; --text: #e8ebf2; --muted: #8b95a7;
  --accent: #4f7cff; --ok: #2ecc71; --warn: #f0b429; --bad: #ff6b6b;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
header.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 12px 20px; background: rgba(11,13,18,.92); border-bottom: 1px solid var(--line); backdrop-filter: blur(8px); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; letter-spacing: .2px; }
.brand .dot { width: 10px; height: 10px; border-radius: 3px; background: var(--accent); box-shadow: 0 0 14px var(--accent); }
.brand small { color: var(--muted); font-weight: 500; font-size: 12px; margin-left: 4px; }
.spacer { flex: 1; }
.userbox { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.role-chip { padding: 3px 9px; border: 1px solid var(--line); border-radius: 999px; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--text); }
.layout { display: grid; grid-template-columns: 220px 1fr; max-width: 1280px; margin: 0 auto; gap: 20px; padding: 20px; }
nav.side { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 78px; align-self: start; }
nav.side button { text-align: left; padding: 10px 12px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--muted); font-size: 14px; cursor: pointer; font-weight: 500; }
nav.side button.active { background: var(--card); border-color: var(--line); color: var(--text); }
main { min-width: 0; }
h1 { font-size: 20px; margin: 0 0 4px; }
.sub { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 14px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.kpi .v { font-size: 22px; font-weight: 700; }
.kpi .l { color: var(--muted); font-size: 12px; }
.list { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row .t { flex: 1; min-width: 0; }
.row .t b { display: block; font-size: 14px; }
.row .t span { color: var(--muted); font-size: 12px; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; border: 1px solid var(--line); color: var(--muted); }
.pill.ok { color: var(--ok); border-color: rgba(46,204,113,.4); }
.pill.warn { color: var(--warn); border-color: rgba(240,180,41,.4); }
.pill.bad { color: var(--bad); border-color: rgba(255,107,107,.4); }
button.btn { padding: 8px 12px; border-radius: 9px; border: 1px solid var(--line); background: #1c2330; color: var(--text); cursor: pointer; font-size: 13px; font-weight: 600; }
button.btn:hover { border-color: #33405a; }
button.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.btn.ok { border-color: rgba(46,204,113,.5); color: var(--ok); background: transparent; }
button.btn.bad { border-color: rgba(255,107,107,.5); color: var(--bad); background: transparent; }
input, select, textarea { width: 100%; padding: 9px 11px; margin: 5px 0 10px; background: #0d1118; color: var(--text); border: 1px solid var(--line); border-radius: 9px; font: inherit; }
label { font-size: 12px; color: var(--muted); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
tr.click { cursor: pointer; }
tr.click:hover { background: #1a1f2a; }
.stagebar { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.stage { padding: 5px 10px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line); color: var(--muted); }
.stage.done { color: var(--ok); border-color: rgba(46,204,113,.45); }
.stage.now { color: var(--text); border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.tag { font-size: 12px; color: var(--muted); }
.finding { font-size: 13px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.finding.bad { color: var(--bad); }
.finding.warn { color: var(--warn); }
.hero { text-align: center; padding: 60px 20px 30px; }
.hero h1 { font-size: 34px; margin-bottom: 10px; }
.hero p { color: var(--muted); max-width: 640px; margin: 0 auto 22px; font-size: 16px; }
.features { max-width: 1000px; margin: 0 auto; padding: 10px 20px 40px; display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.muted { color: var(--muted); }
/* 3-панельный кабинет */
.ws { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
.ws-list { border: 1px solid var(--line); border-radius: 14px; background: var(--card); display: flex; flex-direction: column; max-height: calc(100vh - 150px); position: sticky; top: 78px; overflow: hidden; }
.quick { display: flex; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.quick input { margin: 0; flex: 1; }
.quick .btn { white-space: nowrap; }
.ws-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px; overflow: auto; }
.ws-tile { border: 1px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; background: #12161e; }
.ws-tile:hover { border-color: #33405a; }
.ws-tile.sel { border-color: var(--accent); }
.ws-tile .t b { font-size: 14px; display: block; margin: 8px 0 4px; }
.ws-tile .muted { font-size: 12px; }
@media (max-width: 1200px) { .ws-grid { grid-template-columns: 1fr; } }
.ws-head { padding: 12px 12px 6px; }
.ws-head input { margin: 0; }
.ws-list .chips { padding: 0 12px 8px; margin: 0; }
.ws-count { padding: 0 12px 8px; font-size: 12px; }
.ws-items { overflow: auto; border-top: 1px solid var(--line); }
.ws-item { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 11px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.ws-item:hover { background: #1a1f2a; }
.ws-item.sel { background: #1c2433; box-shadow: inset 2px 0 0 var(--accent); }
.ws-item .t { min-width: 0; }
.ws-item .t b { display: block; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-item .t span { color: var(--muted); font-size: 11.5px; }
.ws-detail { border: 1px solid var(--line); border-radius: 14px; background: var(--card); padding: 16px; min-height: 60vh; }
.ws-detail .empty { color: var(--muted); padding: 60px 20px; text-align: center; }
/* Просмотрщик документов */
.docviewer { position: fixed; inset: 0; background: rgba(5, 7, 10, .78); z-index: 50; display: flex; flex-direction: column; padding: 24px; }
.docviewer[hidden] { display: none; }
.dv-head { display: flex; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 12px 12px 0 0; padding: 10px 14px; }
.dv-head b { flex: 1; }
.dv-body { flex: 1; background: #0d1118; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 12px 12px; overflow: auto; }
.dv-body iframe { width: 100%; height: 100%; border: 0; }
.dv-md { max-width: 900px; margin: 0 auto; padding: 20px 24px; line-height: 1.55; }
.dv-md h1 { font-size: 20px; } .dv-md h2 { font-size: 17px; margin-top: 18px; } .dv-md h3 { font-size: 15px; }
.dv-md .li { margin: 4px 0; padding-left: 6px; }
.dv-md mark { background: #3a4a1f; color: #eaffb0; padding: 0 2px; border-radius: 3px; }
.linkbtn { background: none; border: 0; color: var(--accent); font-size: 12px; cursor: pointer; padding: 0 4px; }
/* Дашборд */
.bar { display: flex; align-items: center; gap: 10px; margin: 7px 0; }
.bar-l { width: 150px; font-size: 12px; color: var(--muted); }
.bar-t { flex: 1; height: 10px; background: #0d1118; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.bar-f { height: 100%; background: var(--accent); }
.bar-n { width: 34px; text-align: right; font-size: 12px; }
@media (max-width: 1000px) {
  .ws { grid-template-columns: 1fr; }
  .ws-list { position: static; max-height: none; }
  .docviewer { padding: 8px; }
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }
.chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; }
.chip.active { background: var(--card); color: var(--text); border-color: var(--accent); }
.tabbar { display: flex; gap: 6px; margin: 14px 0; border-bottom: 1px solid var(--line); }
.tab { padding: 9px 14px; background: transparent; border: 0; border-bottom: 2px solid transparent; color: var(--muted); cursor: pointer; font-weight: 600; font-size: 13px; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.inbox-item { display: flex; align-items: center; gap: 14px; }
.inbox-item .t { flex: 1; min-width: 0; }
.inbox-item .t b { display: block; font-size: 14px; }
.inbox-item .t span { color: var(--muted); font-size: 12px; }
.inbox-item .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.agent-chip { padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; }
.agent-chip.tehnar { color: #7fb0ff; border: 1px solid rgba(79,124,255,.45); }
.agent-chip.lawyer { color: #f0b429; border: 1px solid rgba(240,180,41,.45); }
.agent-chip.secretary { color: #2ecc71; border: 1px solid rgba(46,204,113,.45); }
@media (max-width: 900px) {
  .inbox-item { flex-direction: column; align-items: flex-start; }
  .inbox-item .acts { width: 100%; }
}
.center { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.authcard { width: 100%; max-width: 420px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 26px; }
.authcard h1 { font-size: 22px; margin-bottom: 6px; }
.err { color: var(--bad); font-size: 13px; min-height: 18px; }
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding: 12px; }
  nav.side { position: static; flex-direction: row; overflow-x: auto; padding-bottom: 6px; }
  nav.side button { white-space: nowrap; }
  .grid2, .grid3, .features { grid-template-columns: 1fr; }
  header.top { padding: 10px 12px; }
  .userbox .name { display: none; }
  .hero h1 { font-size: 26px; }
}
