:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #f0efe9;
  --ink: #1c1c1a;
  --ink-2: #5d5d58;
  --ink-3: #9a9a93;
  --line: #e6e4dc;
  --accent: #0f6e63;
  --accent-2: #e2f1ee;
  --accent-ink: #0a4e46;
  --warn: #b7791f;
  --danger: #b43b3b;
  --danger-2: #fbe9e9;
  --radius: 14px;
  --radius-s: 10px;
  --shadow: 0 1px 2px rgba(20,20,10,.04), 0 6px 20px rgba(20,20,10,.06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15161a; --surface: #1e2025; --surface-2: #272a30; --ink: #ecebe6; --ink-2: #b0afa8; --ink-3: #74736d;
    --line: #2d3037; --accent: #3fb3a3; --accent-2: #173832; --accent-ink: #9fe0d4; --danger-2: #3a1f1f;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
[hidden] { display: none !important; }

/* ---------- базовые элементы ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: var(--radius-s); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 500; min-height: 42px; transition: background .15s, transform .05s; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.07); background: var(--accent); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-2); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { min-height: 34px; padding: 6px 12px; font-size: 14px; }
.btn.icon { width: 40px; min-width: 40px; padding: 0; border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.icon:hover { background: var(--surface-2); color: var(--ink); }
.btn:disabled { opacity: .5; cursor: default; }
.input, select.input, textarea.input { width: 100%; padding: 11px 13px; border-radius: var(--radius-s); border: 1px solid var(--line); background: var(--surface); outline: none; min-height: 44px; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-2); }
textarea.input { min-height: 72px; resize: vertical; }
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; font-weight: 500; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--ink-2); }
.tiny { font-size: 12px; color: var(--ink-3); }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 600; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 13.5px; white-space: nowrap; color: var(--ink-2); }
.chip:hover { background: var(--surface-2); }
.chip.on { background: var(--accent-2); border-color: transparent; color: var(--accent-ink); font-weight: 600; }
.chip .n { font-size: 12px; opacity: .7; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.empty { text-align: center; padding: 56px 20px; color: var(--ink-3); }
.empty .big { font-size: 40px; margin-bottom: 10px; }

/* ---------- логин (fallback / 2FA sheet) ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login .card { width: 100%; max-width: 380px; padding: 28px; box-shadow: var(--shadow); }
.brand { display: inline-flex; align-items: center; gap: 10px; letter-spacing: -.01em; text-decoration: none; color: inherit; }
.brand img { width: 30px; height: 30px; border-radius: 8px; display: block; }
.brand .brand-text { display: inline-flex; flex-direction: column; line-height: 1.1; }
.brand .brand-text b { font-weight: 700; font-size: 17px; }
.brand .brand-text small { font-size: 10.5px; color: var(--ink-3); letter-spacing: .04em; text-transform: uppercase; }
.error { color: var(--danger); font-size: 14px; margin-top: 8px; }

/* ====================================================================
   AUTH VIEW — taxlab.lv design system, scoped to .auth-view only
   ==================================================================== */
.auth-view {
  --paper:#F6F5F1; --card:#FFFFFF; --ink2:#1A1D21; --muted2:#5F6368; --rule:#DEDBD3;
  --band:#1F2B3A; --band-fg:#F2F0EC; --band-muted:#A9B3C0; --band-rule:#2E3C4F;
  --tx-accent:#F47A20; --tx-accent-text:#B4520A; --tx-accent-hover:#E0701D;
  --display:"Instrument Serif",Georgia,"Times New Roman",serif;
  --body-f:"Manrope",system-ui,-apple-system,"Segoe UI",sans-serif;
  --mono:"JetBrains Mono",ui-monospace,Menlo,monospace;
  --ease-out:cubic-bezier(0.23,1,0.32,1);
  background:var(--paper); color:var(--ink2);
  font:400 16px/1.65 var(--body-f);
  -webkit-font-smoothing:antialiased;
  min-height:100dvh; display:flex; flex-direction:column;
}
.auth-view *{box-sizing:border-box}
.auth-view a{color:inherit;text-decoration:none}
.auth-view :focus-visible{outline:2px solid var(--tx-accent);outline-offset:2px}
.auth-view .wrap{max-width:1180px;margin:0 auto;padding-inline:clamp(16px,4vw,40px);width:100%}

.auth-view h1,.auth-view h2,.auth-view h3{
  font-family:var(--display);font-weight:400;line-height:1.02;letter-spacing:-.01em;
  text-wrap:balance;margin:0;
}
.auth-view h1 em,.auth-view h2 em,.auth-view h3 em{font-style:italic;color:var(--tx-accent-text)}
.auth-view .band h1 em,.auth-view .band h2 em{color:var(--tx-accent)}
.auth-view p{margin:0}

.auth-view .eyebrow{
  display:block;font:500 12px/1.4 var(--mono);letter-spacing:.08em;
  text-transform:uppercase;color:var(--muted2);
}
.auth-view .band .eyebrow{color:var(--band-muted)}
.auth-view .muted2{color:var(--muted2)}

/* buttons (prefixed to avoid collision with docflow .btn) */
.auth-view .tx-btn{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  min-height:48px;padding:13px 22px;border-radius:999px;border:1px solid var(--ink2);
  font:600 15px/1.2 var(--body-f);text-decoration:none;cursor:pointer;user-select:none;
  background:var(--ink2);color:var(--paper);
  transition:transform 160ms var(--ease-out),background-color 200ms ease,color 200ms ease,border-color 200ms ease;
}
.auth-view .tx-btn:active{transform:scale(.97)}
.auth-view .tx-btn-light{background:var(--band-fg);border-color:var(--band-fg);color:var(--band)}
.auth-view .tx-btn-ghost{background:transparent;color:var(--ink2)}
.auth-view .tx-btn:disabled{opacity:.5;cursor:default}
@media (hover:hover) and (pointer:fine){
  .auth-view .tx-btn:hover{background:var(--band);border-color:var(--band)}
  .auth-view .tx-btn-light:hover{background:var(--tx-accent);border-color:var(--tx-accent);color:var(--ink2)}
  .auth-view .tx-btn-ghost:hover{background:var(--ink2);color:var(--paper)}
}

/* header */
.auth-view .site-header{
  position:sticky;top:env(safe-area-inset-top,0px);z-index:20;
  background:color-mix(in srgb,var(--paper) 90%,transparent);
  backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);
  border-bottom:1px solid var(--rule);
}
.auth-view .nav-row{display:flex;align-items:center;justify-content:space-between;gap:20px;min-height:68px}
.auth-view .logo-link{flex-shrink:0;display:block;margin-left:-10px}
.auth-view .logo-link img{height:50px;width:auto;display:block}
.auth-view .tools{display:flex;align-items:center;gap:14px}
.auth-view .lang{display:flex;gap:2px;font:500 12px var(--mono)}
.auth-view .lang button{
  all:unset;cursor:pointer;padding:4px 7px;border-radius:6px;color:var(--muted2);
  text-transform:uppercase;letter-spacing:.04em;
}
.auth-view .lang button[aria-current="true"]{background:var(--ink2);color:var(--paper)}
@media (hover:hover) and (pointer:fine){.auth-view .lang button:not([aria-current]):hover{color:var(--ink2)}}

/* hero */
.auth-view .page-hero{padding-block:clamp(48px,8vw,96px) clamp(40px,6vw,72px)}
.auth-view .page-hero h1{font-size:clamp(48px,8vw,104px);margin-top:20px}
.auth-view .page-hero p{max-width:56ch;margin-top:22px;font-size:18px;color:var(--muted2)}
.auth-view .crumbs{display:flex;flex-wrap:wrap;gap:8px;align-items:center;font:500 12px var(--mono);text-transform:uppercase;letter-spacing:.06em;color:var(--muted2)}
.auth-view .crumbs span[aria-hidden]{opacity:.5}
.auth-view .crumbs [aria-current]{color:var(--ink2)}

/* band */
.auth-view .s{padding-block:clamp(56px,8vw,96px)}
.auth-view .band{background:var(--band);color:var(--band-fg);flex:1}
.auth-view .band p.muted2{color:var(--band-muted)}

/* two-column auth grid */
.auth-view .auth-grid{
  display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:56px;align-items:start;
}
.auth-view .auth-grid h2{font-size:clamp(36px,5vw,60px);margin-top:14px}
.auth-view .auth-grid .lead{color:var(--band-muted);margin-top:18px;max-width:40ch}
.auth-view .auth-grid .next{margin-top:40px}
.auth-view .auth-grid .next h3{font-size:22px;margin-bottom:16px;color:var(--band-fg)}
.auth-view .steps{list-style:none;margin:0;padding:0;display:grid;gap:14px}
.auth-view .steps li{display:grid;grid-template-columns:auto 1fr;gap:14px;align-items:start}
.auth-view .steps .n{
  font:400 20px/1 var(--display);color:var(--tx-accent);
  padding-top:2px;font-variant-numeric:tabular-nums;min-width:28px;
}
.auth-view .steps .t{color:var(--band-muted);font-size:15px;line-height:1.5}
.auth-view .steps .t b{color:var(--band-fg);font-weight:600;display:block;margin-bottom:2px}
@media (max-width:860px){.auth-view .auth-grid{grid-template-columns:1fr;gap:40px}}

/* form on dark band */
.auth-view .tx-form{display:grid;gap:26px;align-content:start}
.auth-view .tx-form label{
  display:block;font:500 12px var(--mono);color:var(--band-muted);
  text-transform:uppercase;letter-spacing:.06em;margin-bottom:10px;
}
.auth-view .tx-form input{
  width:100%;background:transparent;color:var(--band-fg);border:0;
  border-bottom:1px solid #FFFFFF40;border-radius:0;padding:12px 0 14px;
  font:400 17px var(--body-f);outline:0;
}
.auth-view .tx-form input:focus{border-bottom-color:var(--tx-accent)}
.auth-view .tx-form input::placeholder{color:var(--band-muted);opacity:.5}
.auth-view .tx-form input[inputmode="numeric"]{
  font-size:28px;letter-spacing:.4em;text-align:center;
}
/* Chrome/Safari autofill — repaint to match dark band */
.auth-view .tx-form input:-webkit-autofill,
.auth-view .tx-form input:-webkit-autofill:hover,
.auth-view .tx-form input:-webkit-autofill:focus,
.auth-view .tx-form input:-webkit-autofill:active{
  -webkit-text-fill-color:var(--band-fg);
  -webkit-box-shadow:0 0 0 1000px var(--band) inset;
  caret-color:var(--band-fg);
  transition:background-color 99999s ease-in-out 0s, color 99999s ease-in-out 0s;
  border-radius:0;
  font:400 17px var(--body-f);
}
.auth-view .tx-form .err{color:#FF9A8A;font-size:14px;min-height:1em;margin:4px 0 0}
.auth-view .tx-form .ok{color:#8ADFC3;font-size:14px}
.auth-view .tx-form .tx-btn{justify-self:start;margin-top:10px}
.auth-view .tx-form .row-actions{display:flex;flex-wrap:wrap;gap:14px;align-items:center;margin-top:8px}

/* footer */
.auth-view .site-footer{
  border-top:1px solid var(--rule);padding-block:28px 24px;
  font-size:14px;color:var(--muted2);background:var(--paper);
}
.auth-view .foot-bottom{display:flex;justify-content:space-between;flex-wrap:wrap;gap:12px}
.auth-view .foot-bottom a{color:var(--muted2)}
.auth-view .foot-bottom a:hover{color:var(--ink2);text-decoration:underline}

/* floating chat pill */
.auth-view .chat{position:fixed;right:16px;bottom:calc(16px + env(safe-area-inset-bottom,0px));z-index:30;display:flex;gap:8px}
.auth-view .chat-btn{
  display:grid;place-items:center;width:52px;height:52px;border-radius:50%;
  background:#2CA5E0;color:#fff;box-shadow:0 8px 24px rgba(44,165,224,.4);
  transition:transform .15s var(--ease-out);
}
.auth-view .chat-btn:hover{transform:scale(1.06)}
.auth-view .chat-btn svg{width:26px;height:26px}

/* fade-in */
@keyframes authRise{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:none}}
.auth-view .page-hero>*{animation:authRise 600ms var(--ease-out) both}
.auth-view .page-hero>:nth-child(2){animation-delay:70ms}
.auth-view .page-hero>:nth-child(3){animation-delay:140ms}
.auth-view .band>.wrap>*{animation:authRise 600ms var(--ease-out) both;animation-delay:200ms}

@media (prefers-reduced-motion:reduce){.auth-view *{animation:none!important}}

/* ---------- каркас ---------- */
.shell { display: grid; grid-template-columns: 1fr; grid-template-rows: auto 1fr; min-height: 100dvh; }
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.topbar .in { display: flex; align-items: center; gap: 10px; padding: 10px 14px; max-width: 1200px; margin: 0 auto; }
.topbar .spacer { flex: 1; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-2); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; font-size: 14px; border: none; }
.layout { display: grid; grid-template-columns: 1fr; max-width: 1200px; margin: 0 auto; width: 100%; }
.side { display: none; }
.main { padding: 14px 14px calc(96px + var(--safe-b)); min-width: 0; }
@media (min-width: 900px) {
  .layout { grid-template-columns: 280px 1fr; gap: 20px; padding: 0 16px; }
  .side { display: block; position: sticky; top: 58px; align-self: start; height: calc(100dvh - 58px); overflow: auto; padding: 16px 0; }
  .main { padding: 16px 0 60px; }
  .fab { display: none !important; }
  .only-mobile { display: none !important; }
}
@media (max-width: 899px) { .only-desktop { display: none !important; } }

/* ---------- список клиентов ---------- */
.clients h3 { margin: 4px 10px 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.client { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-s); border: none; background: transparent; width: 100%; text-align: left; color: var(--ink); }
.client:hover { background: var(--surface-2); }
.client.on { background: var(--accent-2); color: var(--accent-ink); }
.client .avatar { width: 32px; height: 32px; font-size: 13px; background: var(--surface-2); color: var(--ink-2); flex: none; }
.client.on .avatar { background: var(--accent); color: #fff; }
.client .t { flex: 1; min-width: 0; }
.client .t b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.client .t small { color: var(--ink-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }

/* mobile client switcher */
.switcher { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); text-align: left; margin-bottom: 12px; }
.switcher .t b { display: block; font-weight: 600; }
.switcher .t small { color: var(--ink-3); font-size: 12px; }

/* ---------- заголовок и фильтры ---------- */
.head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.head h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; line-height: 1.2; }
.head .sub { color: var(--ink-3); font-size: 13px; }
.seg { display: flex; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 4px; margin-bottom: 12px; }
.seg button { flex: 1; border: none; background: transparent; padding: 9px 10px; border-radius: 9px; font-weight: 600; color: var(--ink-2); display: inline-flex; justify-content: center; gap: 8px; align-items: center; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.search { position: relative; margin-bottom: 10px; }
.search input { padding-left: 38px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.filters { margin-bottom: 8px; }

/* ---------- файлы ---------- */
.group { margin: 18px 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); display: flex; align-items: center; gap: 8px; }
.group::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.file { display: flex; align-items: center; gap: 12px; padding: 12px 10px 12px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; position: relative; transition: box-shadow .15s, border-color .15s; }
.file:hover { box-shadow: var(--shadow); }
.file.unread { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.file.unread::before { content: ""; position: absolute; left: -1px; top: 14px; bottom: 14px; width: 3px; border-radius: 3px; background: var(--accent); }
.ficon { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; font-size: 11px; font-weight: 800; letter-spacing: .02em; flex: none; background: var(--surface-2); color: var(--ink-2); }
.ficon.pdf { background: #fde8e6; color: #b3261e; }
.ficon.xls { background: #e3f3e8; color: #1e7a3c; }
.ficon.doc { background: #e3ecfa; color: #2a56b8; }
.ficon.img { background: #f2e9fb; color: #6f3fb3; }
.ficon.zip { background: #fbf1dc; color: #8d6410; }
@media (prefers-color-scheme: dark) {
  .ficon.pdf { background: #3a2220; color: #f08a82; } .ficon.xls { background: #1f3326; color: #7ad397; }
  .ficon.doc { background: #1f2a40; color: #8fb0f0; } .ficon.img { background: #2d2340; color: #c09bf0; } .ficon.zip { background: #3a2f1a; color: #e5bd5c; }
}
.file .t { flex: 1; min-width: 0; }
.file .t .n { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; color: var(--ink); }
.file .t .m { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; gap: 6px; align-items: center; }
.file .t .m .cat { color: var(--accent-ink); background: var(--accent-2); padding: 1px 7px; border-radius: 6px; font-weight: 600; }
.file .t .note { font-size: 13px; color: var(--ink-2); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file .acts { display: flex; gap: 2px; flex: none; }
@media (max-width: 899px) { .file .acts .btn.icon:not(.more) { display: none; } }
.file .acts .btn.icon { width: 36px; min-width: 36px; height: 36px; }

/* ---------- FAB ---------- */
.fab { position: fixed; right: 18px; bottom: calc(18px + var(--safe-b)); width: 58px; height: 58px; border-radius: 18px; background: var(--accent); color: #fff; border: none; box-shadow: 0 8px 24px rgba(15,110,99,.4); display: grid; place-items: center; z-index: 30; }
.fab:active { transform: scale(.96); }

/* ---------- drop zone ---------- */
.dropzone { border: 2px dashed var(--line); border-radius: var(--radius); padding: 22px; text-align: center; color: var(--ink-2); background: var(--surface); transition: .15s; cursor: pointer; }
.dropzone.over, .dropzone:hover { border-color: var(--accent); background: var(--accent-2); color: var(--accent-ink); }
.page-drop { position: fixed; inset: 0; z-index: 90; background: color-mix(in srgb, var(--accent) 15%, transparent); border: 4px dashed var(--accent); display: grid; place-items: center; font-size: 22px; font-weight: 700; color: var(--accent-ink); pointer-events: none; }

/* ---------- модалки / шторки ---------- */
.overlay { position: fixed; inset: 0; background: rgba(10,10,10,.42); z-index: 50; display: grid; place-items: end center; animation: fade .15s; }
@media (min-width: 640px) { .overlay { place-items: center; } }
.sheet { background: var(--surface); width: 100%; max-width: 520px; border-radius: 20px 20px 0 0; padding: 18px 18px calc(18px + var(--safe-b)); max-height: 92dvh; overflow: auto; animation: up .2s; }
@media (min-width: 640px) { .sheet { border-radius: 18px; padding: 24px; max-height: 88vh; } }
.sheet h2 { margin: 0 0 14px; font-size: 19px; }
.sheet .handle { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: -6px auto 14px; }
@media (min-width: 640px) { .sheet .handle { display: none; } }
.menu-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 10px; border: none; background: transparent; text-align: left; border-radius: var(--radius-s); font-size: 15.5px; }
.menu-item:hover { background: var(--surface-2); }
.menu-item.danger { color: var(--danger); }
.menu-item svg { color: var(--ink-2); flex: none; }
.menu-item.danger svg { color: var(--danger); }
@keyframes fade { from { opacity: 0 } }
@keyframes up { from { transform: translateY(24px); opacity: .6 } }

/* upload list */
.ufile { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.ufile:last-child { border-bottom: none; }
.ufile .n { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; margin: 12px 0; }
.progress i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.result { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.result:last-child { border-bottom: none; }
.result .n { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- админка ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.urow { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.urow:last-child { border-bottom: none; }
.urow .t { flex: 1; min-width: 0; }
.urow .t b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.urow .t small { color: var(--ink-3); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.role { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 3px 7px; border-radius: 6px; background: var(--surface-2); color: var(--ink-2); }
.role.admin { background: #fbe9d7; color: #8a4b0a; } .role.accountant { background: var(--accent-2); color: var(--accent-ink); }
.off { opacity: .5; }
.matrix { overflow: auto; }
.matrix table { border-collapse: collapse; min-width: 100%; font-size: 14px; }
.matrix th, .matrix td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.matrix th { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.matrix td.c { text-align: center; }
.matrix input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
.pw { font-family: ui-monospace, Menlo, monospace; background: var(--surface-2); padding: 10px 12px; border-radius: 8px; user-select: all; word-break: break-all; }

/* ---------- toasts ---------- */
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(90px + var(--safe-b)); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(92vw, 420px); }
@media (min-width: 900px) { #toasts { bottom: 24px; } }
.toast { background: var(--ink); color: var(--bg); padding: 11px 16px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow); animation: up .2s; max-width: 100%; }
.toast.err { background: var(--danger); color: #fff; }
.skeleton { height: 66px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; margin-bottom: 8px; }
@keyframes sk { to { background-position: -200% 0 } }

/* ---------- дашборд ---------- */
:root { --ok: #1f8a4c; --ok-2: #e4f4ea; --warn-2: #fbf0dc; }
@media (prefers-color-scheme: dark) { :root { --ok: #4fc47f; --ok-2: #16301f; --warn-2: #3a2d14; } }
.seg.nav button { gap: 6px; }
.seg.nav .badge { height: 18px; min-width: 18px; font-size: 11px; }
.light { display: flex; align-items: center; gap: 14px; padding: 18px; border-radius: 18px; border: 1px solid transparent; margin-bottom: 14px; }
.light.ok { background: var(--ok-2); color: var(--ok); } .light.attention { background: var(--warn-2); color: var(--warn); } .light.problem { background: var(--danger-2); color: var(--danger); }
.light .lamp { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 24px; color: #fff; flex: none; box-shadow: 0 0 0 6px color-mix(in srgb, currentColor 18%, transparent); }
.light.ok .lamp { background: var(--ok); animation: glow 2.4s ease-in-out infinite; } .light.attention .lamp { background: var(--warn); } .light.problem .lamp { background: var(--danger); }
@keyframes glow { 50% { box-shadow: 0 0 0 10px color-mix(in srgb, currentColor 10%, transparent); } }
.light .lt { font-weight: 700; font-size: 18px; letter-spacing: -.01em; } .light .ls { color: var(--ink-2); font-size: 14px; }
.light .btn { color: var(--ink); }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-align: left; display: flex; flex-direction: column; gap: 2px; color: var(--ink); }
.tile:hover { box-shadow: var(--shadow); }
.tile b { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1; }
.tile span { font-size: 12.5px; color: var(--ink-3); }
.tile.hot b { color: var(--accent); }
.req { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 10px 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; color: var(--ink); }
.req:hover { box-shadow: var(--shadow); }
.req .rdot { width: 10px; height: 10px; border-radius: 50%; background: var(--warn); flex: none; box-shadow: 0 0 0 4px var(--warn-2); }
.req.done .rdot { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-2); } .req.overdue .rdot { background: var(--danger); box-shadow: 0 0 0 4px var(--danger-2); }
.req.done { opacity: .7; }
.req .t { flex: 1; min-width: 0; } .req .t b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.req .m { font-size: 12.5px; color: var(--ink-3); display: flex; gap: 4px; align-items: center; white-space: nowrap; overflow: hidden; }
.req .m svg { width: 14px; height: 14px; }
.thread { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.msg { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); max-width: 92%; }
.msg.client { align-self: flex-end; background: var(--accent-2); }
.stat-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.sp { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; border-radius: 12px; border: 2px solid var(--line); cursor: pointer; font-size: 12px; text-align: center; color: var(--ink-2); }
.sp b { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 14px; }
.sp.ok b { background: var(--ok); } .sp.attention b { background: var(--warn); } .sp.problem b { background: var(--danger); }
.sp.on { border-color: var(--accent); background: var(--accent-2); color: var(--accent-ink); }
.avatar { position: relative; }
.dot { position: absolute; right: -2px; bottom: -2px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--bg); background: var(--ok); }
.dot.attention { background: var(--warn); } .dot.problem { background: var(--danger); }

/* ---------- v2: теги, реквизиты, чек-лист, ИИ ---------- */
.tag { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 6px; background: var(--surface-2); color: var(--ink-2); display: inline-flex; align-items: center; gap: 3px; }
.tag.warn { background: var(--warn-2); color: var(--warn); } .tag.ok { background: var(--ok-2); color: var(--ok); }
.tag svg { width: 12px; height: 12px; }
.file .meta { font-size: 13px; color: var(--ink-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file .meta .overdue { color: var(--danger); font-weight: 600; }
.checklist { margin-bottom: 14px; overflow: hidden; }
.checklist .bar { height: 6px; background: var(--surface-2); margin: 4px 14px 6px; border-radius: 3px; overflow: hidden; }
.checklist .bar i { display: block; height: 100%; background: var(--ok); transition: width .3s; }
.cl-item { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-top: 1px solid var(--line); font-size: 14.5px; }
.cl-item .cb { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; flex: none; color: #fff; }
.cl-item.done .cb { background: var(--ok); border-color: var(--ok); }
.cl-item.done .grow { color: var(--ink-2); }
.cl-item .cb svg { width: 14px; height: 14px; }
.ai-text { white-space: pre-wrap; line-height: 1.5; }
select[multiple].input { min-height: 110px; }
