:root {
  --navy: #0f3d5e; --navy-2: #163f5f; --accent: #1f8a70; --accent-2: #167a62; --bg: #f3f5f8; --card: #fff;
  --text: #16212b; --muted: #6b7786; --line: #e5e9ef; --warn: #b7791f; --warn-bg: #fff6e5; --bad: #c0392b; --bad-bg: #fdecea; --ok: #1f8a70; --ok-bg: #e7f6f1;
  --radius: 16px; --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; -webkit-text-size-adjust: 100%; }
button { font: inherit; }
a { color: var(--accent); }
.app { min-height: 100vh; max-width: 560px; margin: 0 auto; padding: 0 0 calc(74px + var(--safe-b)); }
.app:not(.authed) { padding-bottom: 24px; }
.boot { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100vh; color: var(--muted); }
.boot-logo, .auth-logo { width: 72px; height: 72px; border-radius: 20px; background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 22px; letter-spacing: .5px; margin: 0 auto 12px; }
.screen { padding: 16px 16px 8px; }
.top { display: flex; align-items: flex-start; justify-content: space-between; margin: 4px 0 16px; }
.hello { font-size: 22px; font-weight: 700; }
.sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.icon-btn { border: 0; background: #fff; width: 40px; height: 40px; border-radius: 12px; font-size: 20px; color: var(--navy); box-shadow: 0 1px 3px rgba(0,0,0,.06); cursor: pointer; }
.loader { text-align: center; color: var(--muted); padding: 32px 0; }
.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card h3 { margin: 0 0 6px; font-size: 17px; }
.card p { margin: 0 0 8px; }
.block-title { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin-bottom: 8px; font-weight: 600; }
.case-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.case-title { font-weight: 700; font-size: 15px; color: var(--navy); }
.case-since { color: var(--muted); font-size: 13px; }
.stage-title { margin: 12px 0 4px; font-size: 20px; }
.stage-text { color: #3b4652; margin: 0 0 8px; }
.action { background: var(--ok-bg); color: #145c4b; border-radius: 12px; padding: 10px 12px; font-size: 15px; margin: 8px 0; display: flex; gap: 8px; }
.action-ico { font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 12px; font-size: 14px; cursor: pointer; color: var(--navy); }
.chip.warn { background: var(--warn-bg); border-color: #f1d9a8; color: #8a5a0b; font-weight: 600; }
.stepper-wrap { margin: 4px 0 10px; }
.stepper { display: flex; margin: 0 0 8px; }
.step { flex: 1 1 0; text-align: center; position: relative; min-width: 0; }
.step .dot { width: 26px; height: 26px; border-radius: 50%; margin: 0 auto; background: #e2e7ee; color: #7a8694; font-size: 12px; display: flex; align-items: center; justify-content: center; font-weight: 700; position: relative; z-index: 1; }
.step.done .dot { background: var(--accent); color: #fff; }
.step.cur .dot { background: var(--navy); color: #fff; box-shadow: 0 0 0 4px rgba(15,61,94,.15); }
.step::before { content: ""; position: absolute; top: 12px; left: -50%; right: 50%; height: 2px; background: #e2e7ee; }
.step:first-child::before { display: none; }
.step.done::before, .step.cur::before { background: var(--accent); }
.step-caption { font-size: 13px; color: var(--muted); }
.step-caption b { color: var(--navy); }
.block { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 12px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 15px; border-bottom: 1px dashed var(--line); }
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--muted); }
.kv b { font-weight: 600; text-align: right; }
.kv b.soon { color: var(--bad); }
.kv b small { color: var(--muted); font-weight: 400; }
.link-row { text-decoration: none; color: inherit; }
.events { margin-top: 6px; }
.event { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.event-date { color: var(--muted); font-size: 12px; }
.event-text { white-space: pre-line; }
.proc-stage { font-weight: 700; margin: 6px 0 2px; }
.manager { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.m-name { font-weight: 600; } .m-pos { color: var(--muted); font-size: 13px; }
.link { border: 0; background: none; color: var(--accent); padding: 4px 0; cursor: pointer; font-size: 15px; }
.link:disabled { color: var(--muted); }
.btn { border: 0; border-radius: 12px; padding: 13px 16px; font-weight: 600; cursor: pointer; background: #e9eef4; color: var(--navy); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:active { background: var(--accent-2); }
.btn.small { padding: 9px 14px; font-size: 14px; margin-top: 8px; }
.btn.ghost { background: #fff; border: 1px solid var(--line); }
.btn.full { width: 100%; margin-top: 10px; }
.btn:disabled { opacity: .6; }
.hint { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.tile { background: #fff; border-radius: 14px; padding: 12px 10px; }
.tile.ok .t-v { color: var(--ok); } .tile.bad .t-v { color: var(--bad); }
.t-l { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.t-v { font-weight: 700; font-size: 15px; margin-top: 4px; white-space: nowrap; }
.next-amount { font-size: 30px; font-weight: 800; color: var(--navy); }
.next-due { color: var(--muted); margin: 2px 0 12px; }
.next-due.bad { color: var(--bad); font-weight: 600; }
.sheet-bg { position: fixed; inset: 0; background: rgba(10,20,30,.45); z-index: 30; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--card); width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; border-radius: 20px 20px 0 0; padding: 16px 16px calc(16px + var(--safe-b)); }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; }
.sheet-amount { font-size: 28px; font-weight: 800; color: var(--navy); }
.tabs { display: flex; background: #eef2f6; border-radius: 12px; padding: 4px; margin: 12px 0; }
.tabs button { flex: 1; border: 0; background: none; padding: 8px 6px; border-radius: 9px; font-weight: 600; color: var(--muted); cursor: pointer; display: flex; flex-direction: column; align-items: center; }
.tabs button small { font-weight: 400; font-size: 11px; }
.tabs button.on { background: #fff; color: var(--navy); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.qr { display: flex; justify-content: center; margin: 8px 0 12px; }
.qr svg { width: 220px; height: 220px; background: #fff; border-radius: 12px; }
.req .kv { cursor: pointer; }
.req .kv b { word-break: break-all; }
.copy { font-style: normal; color: var(--accent); margin-left: 4px; }
.list-title { font-weight: 700; margin: 16px 4px 8px; display: flex; align-items: center; gap: 8px; }
.count { background: var(--warn-bg); color: #8a5a0b; border-radius: 999px; padding: 1px 8px; font-size: 13px; }
.inv-row { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.inv-title { font-weight: 600; } .inv-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.inv-sub.bad { color: var(--bad); } .inv-sub.ok { color: var(--ok); }
.inv-amount { font-weight: 700; white-space: nowrap; }
.muted { opacity: .85; }
.doc-title { font-weight: 600; font-size: 16px; }
.doc-hint { color: var(--muted); font-size: 13px; margin-top: 4px; }
.doc-comment { background: var(--bad-bg); color: #8f2b22; border-radius: 10px; padding: 8px 10px; margin-top: 8px; font-size: 14px; }
.doc .btn { margin-top: 10px; width: 100%; }
.doc.rejected { border: 1px solid #f3c2bb; }
.ok-line .doc-title { color: var(--ok); }
.files { margin-top: 8px; }
.file { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.file a { text-decoration: none; word-break: break-all; }
.file span { color: var(--muted); white-space: nowrap; }
.notif { cursor: pointer; }
.notif.unread { border-left: 4px solid var(--accent); }
.notif-title { font-weight: 600; } .notif-body { margin-top: 2px; } .notif-date { color: var(--muted); font-size: 12px; margin-top: 6px; }
.faq-q { width: 100%; text-align: left; border: 0; background: none; padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; cursor: pointer; font-weight: 500; }
.faq-a { padding: 8px 0 12px; color: #3b4652; font-size: 15px; }
.version { text-align: center; color: var(--muted); font-size: 12px; margin: 16px 0; }
.nav { position: fixed; bottom: 0; left: 0; right: 0; max-width: 560px; margin: 0 auto; background: #fff; border-top: 1px solid var(--line); display: flex; padding: 6px 4px calc(6px + var(--safe-b)); z-index: 10; }
.nav button { flex: 1; border: 0; background: none; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; padding: 4px 0; position: relative; cursor: pointer; }
.nav button i { font-style: normal; font-size: 20px; line-height: 1; }
.nav button.on { color: var(--navy); font-weight: 700; }
.nav em { position: absolute; top: 0; right: 18%; background: var(--bad); color: #fff; font-style: normal; font-size: 11px; border-radius: 999px; padding: 0 5px; min-width: 16px; }
.bell { position: fixed; top: 12px; right: 68px; z-index: 5; border: 0; background: #fff; width: 40px; height: 40px; border-radius: 12px; font-size: 18px; box-shadow: 0 1px 3px rgba(0,0,0,.06); cursor: pointer; }
.bell em { position: absolute; top: -4px; right: -4px; background: var(--bad); color: #fff; font-style: normal; font-size: 11px; border-radius: 999px; padding: 0 5px; min-width: 16px; }
@media (min-width: 561px) { .bell { right: calc(50% - 280px + 68px); } }
.chat-screen { display: flex; flex-direction: column; height: calc(100vh - 74px - var(--safe-b)); padding-bottom: 0; }
.chat-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px 0 12px; }
.msg { max-width: 84%; border-radius: 16px; padding: 10px 12px; background: #fff; box-shadow: 0 1px 2px rgba(16,24,40,.04); align-self: flex-start; }
.msg.me { background: var(--accent); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.msg.staff { border-bottom-left-radius: 4px; }
.msg.system { background: transparent; box-shadow: none; color: var(--muted); font-size: 13px; text-align: center; align-self: center; max-width: 100%; }
.msg-text { white-space: pre-wrap; word-break: break-word; }
.msg-files a { color: inherit; } .msg-files span { font-size: 12px; opacity: .7; }
.msg-at { font-size: 11px; opacity: .65; margin-top: 4px; text-align: right; }
.chat-input { display: flex; gap: 8px; padding: 8px 0 10px; border-top: 1px solid var(--line); background: var(--bg); position: sticky; bottom: 0; }
.chat-input textarea { flex: 1; border: 1px solid #cfd6df; border-radius: 14px; padding: 10px 12px; font: inherit; resize: none; max-height: 120px; background: #fff; }
.chat-input .btn { padding: 0 16px; font-size: 18px; }
.toast { position: fixed; left: 50%; bottom: calc(84px + var(--safe-b)); transform: translateX(-50%); background: #1f2a36; color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 20; max-width: 90%; text-align: center; }
.offline { background: #fde68a; color: #7c5a00; text-align: center; font-size: 13px; padding: 6px; }
.auth { padding-top: 48px; text-align: center; }
.auth h1 { font-size: 24px; margin: 8px 0 4px; }
.auth-sub { color: var(--muted); margin: 0 0 20px; }
.auth .card { text-align: left; }
.auth label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.input { width: 100%; border: 1px solid #cfd6df; border-radius: 12px; padding: 13px 14px; font-size: 18px; margin-bottom: 10px; background: #fff; }
.input.code { letter-spacing: 8px; text-align: center; font-size: 24px; }
.input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.row-between { display: flex; justify-content: space-between; margin-top: 6px; }
.alt { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.alt .btn { margin: 6px 6px 0 0; }
.error { color: var(--bad); margin-top: 8px; font-size: 14px; }
.auth-foot { color: var(--muted); font-size: 13px; }
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f151c; --card: #18212b; --text: #e8edf2; --muted: #9aa7b5; --line: #273240; --ok-bg: #143a31; --warn-bg: #3b2d10; --bad-bg: #3d1c19; }
  .icon-btn, .chip, .btn.ghost, .tile, .nav, .input { background: #18212b; color: var(--text); }
  .tabs { background: #243040; } .tabs button.on { background: #18212b; color: #e8edf2; }
  .bell, .msg, .chat-input textarea { background: #18212b; color: var(--text); } .msg.me { background: var(--accent); color: #fff; }
  .btn { background: #243040; color: #e8edf2; }
  .step .dot { background: #2a3645; color: #8d9aa8; } .step::before { background: #2a3645; }
  .stage-text, .faq-a { color: #c7d0da; }
  .action { color: #a8e6d3; } .doc-comment { color: #f5b9b1; } .count { color: #f1d9a8; }
}
