@font-face { font-family: 'Montserrat'; src: url('/fonts/Montserrat-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Montserrat'; src: url('/fonts/Montserrat-Medium.ttf') format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Montserrat'; src: url('/fonts/Montserrat-SemiBold.ttf') format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Montserrat'; src: url('/fonts/Montserrat-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }

:root {
  --bg: #F5F4F0; --surface: #FFFFFF; --surface-2: #EFEDE7; --ink: #1B1D22; --muted: #6B6F78; --faint: #9A9DA4; --line: #E4E1DA;
  --accent: #E4572E; --accent-ink: #FFFFFF; --accent-soft: #FCE9E2;
  --red: #D23B2A; --red-soft: #FBE7E4; --amber: #B97300; --amber-soft: #FBF0D9; --green: #2C8A57; --green-soft: #E2F3E9; --blue: #3B5BA5; --blue-soft: #E6ECF8;
  --shadow: 0 1px 2px rgba(20, 20, 30, .05), 0 4px 16px rgba(20, 20, 30, .05);
  --r: 16px; --nav-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111214; --surface: #1A1B1E; --surface-2: #232428; --ink: #ECECEE; --muted: #A2A5AD; --faint: #6E717A; --line: #2B2D31;
    --accent: #F06A43; --accent-soft: #3A221B; --red: #F0675A; --red-soft: #3A1E1B; --amber: #E3A33B; --amber-soft: #352A15; --green: #4DBB7F; --green-soft: #17301F; --blue: #8AA6E8; --blue-soft: #1E2638;
    --shadow: none; color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); overflow-x: hidden; }
body { font-family: 'Montserrat', system-ui, sans-serif; font-size: 15px; line-height: 1.45; min-height: 100vh; overflow-x: hidden; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: inherit; }
h1 { font-size: 24px; line-height: 1.2; margin: 0; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0; font-weight: 700; }
h3 { font-size: 15px; margin: 0; font-weight: 600; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.hidden { display: none !important; }

#app { max-width: 720px; margin: 0 auto; padding: 16px 16px calc(var(--nav-h) + 96px + env(safe-area-inset-bottom)); }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 8px 0 4px; }
.hint { color: var(--muted); font-size: 13.5px; margin: 4px 0 18px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; margin-bottom: 8px; }

.section { margin: 22px 0 10px; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.section h2 { font-size: 15px; text-transform: none; }
.section .count { color: var(--faint); font-weight: 500; margin-left: 6px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow); }
.card + .card { margin-top: 10px; }
.stack > * + * { margin-top: 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.top { align-items: flex-start; }
.grow { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: 12px; font-weight: 600; background: var(--surface-2); color: var(--ink); white-space: nowrap; max-width: 100%; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; }
.btn.danger { color: var(--red); }
.btn:disabled { opacity: .5; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.icon-btn:active, .btn:active { transform: scale(.97); }
svg.i { width: 20px; height: 20px; flex: none; }

.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 13.5px; font-weight: 500; white-space: nowrap; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin: 0 -16px 12px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }

.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.tag.red { background: var(--red-soft); color: var(--red); }
.tag.amber { background: var(--amber-soft); color: var(--amber); }
.tag.green { background: var(--green-soft); color: var(--green); }
.tag.blue { background: var(--blue-soft); color: var(--blue); }
.tag.accent { background: var(--accent-soft); color: var(--accent); }

/* Ввод */
.composer { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 12px; box-shadow: var(--shadow); }
.composer textarea { width: 100%; border: 0; outline: 0; resize: none; background: transparent; min-height: 78px; max-height: 40vh; font-size: 16px; padding: 4px 4px 8px; }
.composer .tools { display: flex; align-items: center; gap: 6px; }
.composer .ctx { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); background: var(--surface-2); border-radius: 8px; padding: 4px 8px; margin: 0 0 8px; }
.attach-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.attach-list .chip { height: 28px; font-size: 12.5px; }
.attach-list img { width: 28px; height: 28px; border-radius: 6px; object-fit: cover; margin-left: -8px; }

.mic-fab { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 14px + env(safe-area-inset-bottom)); width: 68px; height: 68px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 20px rgba(228, 87, 46, .35); z-index: 30; }
.mic-fab svg { width: 30px; height: 30px; }
.mic-fab:active { transform: translateX(-50%) scale(.95); }

.rec { position: fixed; inset: 0; z-index: 60; background: rgba(10, 10, 12, .72); backdrop-filter: blur(6px); display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding: 24px 24px calc(48px + env(safe-area-inset-bottom)); color: #fff; text-align: center; }
.rec .big { font-size: 22px; font-weight: 700; }
.rec .time { font-variant-numeric: tabular-nums; opacity: .8; margin: 6px 0 28px; }
.rec .level { width: 160px; height: 160px; border-radius: 50%; background: radial-gradient(circle, rgba(240, 106, 67, .55), rgba(240, 106, 67, 0) 70%); display: flex; align-items: center; justify-content: center; transition: transform .08s; margin-bottom: 26px; }
.rec .stop { width: 84px; height: 84px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; }
.rec .stop span { width: 26px; height: 26px; border-radius: 6px; background: #fff; }
.rec .cancel { margin-top: 18px; color: rgba(255, 255, 255, .75); font-weight: 600; padding: 10px; }

/* Ответы секретаря */
.talk { display: flex; flex-direction: column; gap: 10px; }
.msg-me { align-self: flex-end; max-width: 88%; background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 16px 16px 4px 16px; white-space: pre-wrap; word-wrap: break-word; }
.msg-me .files { font-size: 12.5px; opacity: .75; margin-top: 4px; }
.msg-ai { align-self: flex-start; max-width: 94%; background: var(--surface); border: 1px solid var(--line); padding: 12px 14px; border-radius: 16px 16px 16px 4px; }
.msg-ai .reply { white-space: pre-wrap; }
.msg-ai .changes { margin-top: 8px; border-top: 1px dashed var(--line); padding-top: 8px; font-size: 13px; color: var(--muted); }
.msg-ai .changes li { margin: 2px 0; }
.msg-ai .changes ul { margin: 0; padding-left: 18px; }
.msg-ai .meta { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 12px; color: var(--faint); flex-wrap: wrap; }
.msg-ai .meta button { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.thinking { display: inline-flex; gap: 4px; align-items: center; }
.thinking i { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); animation: blink 1.2s infinite both; }
.thinking i:nth-child(2) { animation-delay: .2s; } .thinking i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* Фокус */
.focus { background: var(--ink); color: var(--bg); border-radius: 20px; padding: 16px 18px; }
.focus .label { font-size: 12px; font-weight: 600; opacity: .6; text-transform: uppercase; letter-spacing: .06em; }
.focus .summary { margin: 6px 0 10px; opacity: .92; }
.focus ol { margin: 0; padding-left: 20px; }
.focus li { margin: 8px 0; }
.focus li .why { opacity: .6; font-size: 13px; }
.focus .foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; font-size: 12px; opacity: .6; }
.focus .foot button { color: inherit; font-weight: 600; opacity: 1; }

/* Вопросы */
.q { border-left: 4px solid var(--blue); }
.q.gap { border-left-color: var(--amber); }
.q .opts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.q .answer-row { display: flex; gap: 8px; margin-top: 10px; }
.q input { flex: 1; min-width: 0; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); padding: 0 12px; }

/* Задачи */
.task { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; }
.check { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--faint); flex: none; margin-top: 1px; display: flex; align-items: center; justify-content: center; }
.check.p1 { border-color: var(--red); } .check.p2 { border-color: var(--amber); }
.check.done { background: var(--green); border-color: var(--green); color: #fff; }
.task .title { font-weight: 500; }
.task .sub { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.task.done .title { text-decoration: line-through; color: var(--faint); }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.list > * + * { border-top: 1px solid var(--line); }
.list-item { display: flex; align-items: center; gap: 12px; padding: 13px 14px; width: 100%; text-align: left; }
.list-item .chev { color: var(--faint); }

/* Проекты */
.proj { display: block; width: 100%; text-align: left; }
.proj .stats { display: flex; gap: 14px; margin-top: 8px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.proj .stats b { color: var(--ink); font-weight: 600; }
.kind-group { margin-top: 14px; }
.kind-group > .head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 2px 8px; }
.item { padding: 12px 14px; display: block; width: 100%; text-align: left; }
.item .fields { display: grid; grid-template-columns: minmax(90px, auto) 1fr; gap: 3px 12px; margin-top: 6px; font-size: 13.5px; }
.item .fields dt { color: var(--muted); }
.item .fields dd { margin: 0; word-break: break-word; }

/* Документы */
.doc .formats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.textbox { white-space: pre-wrap; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-size: 14px; max-height: 50vh; overflow: auto; }

/* Нижнее меню */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.nav .in { max-width: 720px; margin: 0 auto; height: var(--nav-h); display: grid; grid-template-columns: 1fr 1fr 84px 1fr 1fr; }
.nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--faint); font-size: 11px; font-weight: 600; letter-spacing: -.01em; position: relative; }
.nav a.on { color: var(--ink); }
.nav a .dot { position: absolute; top: 9px; right: calc(50% - 18px); min-width: 17px; height: 17px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 10.5px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }

/* Шторка */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; background: rgba(10, 10, 12, .45); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--surface); width: 100%; max-width: 720px; max-height: 92vh; overflow: auto; border-radius: 22px 22px 0 0; padding: 10px 18px calc(22px + env(safe-area-inset-bottom)); animation: up .18s ease-out; }
@keyframes up { from { transform: translateY(30px); opacity: .5; } }
.sheet .grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 12px; }
.field { display: block; margin: 12px 0; }
.field > span { display: block; font-size: 12.5px; color: var(--muted); font-weight: 600; margin-bottom: 5px; }
.field input, .field textarea, .field select { width: 100%; min-height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); padding: 10px 12px; outline: 0; }
.field textarea { min-height: 84px; resize: vertical; }
.field input:focus, .field textarea:focus, .composer:focus-within { border-color: var(--ink); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.seg button { height: 40px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); font-size: 13px; font-weight: 600; }
.seg button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.kv { display: grid; grid-template-columns: 1fr 1.6fr 36px; gap: 6px; align-items: center; margin-bottom: 6px; }
.kv input { min-height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); padding: 0 10px; width: 100%; }

.banner { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 14px; background: var(--accent-soft); margin: 8px 0 14px; font-size: 14px; }
.empty { text-align: center; color: var(--muted); padding: 28px 16px; }
.empty .ex { display: inline-block; text-align: left; margin-top: 10px; font-size: 13.5px; background: var(--surface); border: 1px dashed var(--line); border-radius: 12px; padding: 10px 14px; color: var(--ink); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 100px + env(safe-area-inset-bottom)); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 70; max-width: calc(100% - 32px); box-shadow: 0 6px 20px rgba(0, 0, 0, .2); }

/* Вход */
.auth { max-width: 380px; margin: 12vh auto 0; }
.auth .logo { width: 64px; height: 64px; border-radius: 18px; margin-bottom: 18px; }
.msg-ai .meta button, .focus .foot button, .back, .chip button { display: inline-flex; align-items: center; gap: 4px; }
.msg-ai .meta svg.i, .focus .foot svg.i, .chip svg.i { width: 14px; height: 14px; }
.field input[type="datetime-local"], .field input[type="date"] { font-size: 14px; padding: 8px 10px; }
