[hidden] { display: none !important; }
:root {
  --brand: #0F7A63; --brand-dark: #0B5C4A; --bg: #F3F5F4; --card: #fff; --text: #1C2421; --muted: #6B7772;
  --line: #E1E6E4; --red: #D64545; --amber: #D98A1E; --blue: #2F6FDB; --radius: 14px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
.loading { padding: 80px 20px; text-align: center; color: var(--muted); }

.top { position: sticky; top: 0; z-index: 5; background: var(--brand-dark); color: #fff; display: flex; align-items: center; gap: 8px; padding: 12px 12px; padding-top: max(12px, env(safe-area-inset-top)); min-height: 56px; }
.top h1 { font-size: 18px; margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .sub { font-size: 13px; opacity: .8; font-weight: 400; }
.icon-btn { background: none; border: 0; color: inherit; font-size: 22px; width: 40px; height: 40px; border-radius: 10px; cursor: pointer; flex: none; }
.icon-btn:active { background: rgba(255,255,255,.15); }
.wrap { max-width: 720px; margin: 0 auto; padding: 14px 14px 90px; }

.hello { margin: 4px 2px 14px; }
.hello b { font-size: 20px; display: block; }
.hello span { color: var(--muted); font-size: 14px; }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 560px) { .tiles { grid-template-columns: repeat(3, 1fr); } }
.tile { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 14px; text-align: left; cursor: pointer; min-height: 112px; display: flex; flex-direction: column; justify-content: space-between; text-decoration: none; color: inherit; }
.tile:active { transform: scale(.98); }
.tile .ico { font-size: 30px; }
.tile .name { font-weight: 600; font-size: 16px; }
.tile .hint { color: var(--muted); font-size: 12.5px; }
.badge { position: absolute; top: 10px; right: 10px; background: var(--red); color: #fff; border-radius: 999px; min-width: 22px; height: 22px; padding: 0 6px; font-size: 12.5px; font-weight: 700; display: grid; place-items: center; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; }
.list .item { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 8px; cursor: pointer; }
.item .grow { flex: 1; min-width: 0; }
.item .title { font-weight: 600; }
.item .meta { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .pill { flex: none; }
.muted { color: var(--muted); font-size: 14px; }
.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 16px 2px 8px; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }

label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=tel], input[type=password], input[type=search], select, textarea {
  width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); }
textarea { min-height: 110px; resize: vertical; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 12px 18px; border: 0; border-radius: 10px; background: var(--brand); color: #fff; font-weight: 600; cursor: pointer; }
.btn.block { width: 100%; }
.btn.ghost { background: #E8F1EE; color: var(--brand-dark); }
.btn.danger { background: #FBE9E9; color: var(--red); }
.btn.small { padding: 8px 12px; font-size: 14px; }
.btn:disabled { opacity: .55; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.err { color: var(--red); font-size: 14px; margin: 8px 0; }

.pill { display: inline-block; font-size: 12.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: #EEF1F0; color: var(--muted); }
.pill.new { background: #FBE9E9; color: var(--red); }
.pill.work { background: #FFF2DE; color: var(--amber); }
.pill.done { background: #E3F4EE; color: var(--brand); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; }
.chip { flex: none; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 13px; font-size: 14px; cursor: pointer; }
.chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }

/* чат */
.chat { display: flex; flex-direction: column; height: 100dvh; }
.msgs { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.msg { max-width: 82%; background: #fff; border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; padding: 8px 11px; align-self: flex-start; word-wrap: break-word; }
.msg .t { white-space: pre-wrap; }
.msg.mine { align-self: flex-end; background: #DDF2EA; border-color: #C5E7DA; border-radius: 14px 14px 4px 14px; }
.msg .who { font-size: 12.5px; font-weight: 700; color: var(--brand-dark); margin-bottom: 2px; }
.msg .time { font-size: 11px; color: var(--muted); text-align: right; margin-top: 2px; }
.msg img { display: block; max-width: 100%; max-height: 300px; border-radius: 10px; margin: 4px 0; }
.msg.deleted { color: var(--muted); font-style: italic; }
.day { align-self: center; font-size: 12px; color: var(--muted); background: #E7ECEA; padding: 3px 10px; border-radius: 999px; margin: 6px 0; }
.composer { display: flex; gap: 6px; padding: 8px; padding-bottom: max(8px, env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); align-items: flex-end; }
.composer textarea { min-height: 44px; max-height: 140px; height: 44px; padding: 10px 12px; border-radius: 22px; }
.composer .icon-btn { color: var(--brand-dark); }
.preview-photo { padding: 6px 10px; background: #fff; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.preview-photo img { height: 56px; border-radius: 8px; }

/* статья */
.article h2 { margin: 4px 0 6px; }
.article .body { white-space: pre-wrap; line-height: 1.55; }
.article img { max-width: 100%; border-radius: 12px; margin: 10px 0; }
.ai-answer { white-space: pre-wrap; }
.bubble-q { background: #DDF2EA; border-radius: 14px; padding: 10px 12px; margin: 10px 0 6px auto; max-width: 85%; width: fit-content; }
.bubble-a { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; margin-bottom: 6px; white-space: pre-wrap; }
.contact a.call { flex: none; text-decoration: none; font-size: 22px; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: #E8F1EE; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #222; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 50; max-width: 90vw; }
.login { max-width: 380px; margin: 0 auto; padding: 48px 20px; }
.login .logo { font-size: 46px; text-align: center; }
.login h1 { text-align: center; margin: 6px 0 4px; }
.login p.muted { text-align: center; margin-bottom: 22px; }
.fab { position: fixed; right: 18px; bottom: max(18px, env(safe-area-inset-bottom)); width: 58px; height: 58px; border-radius: 50%; background: var(--brand); color: #fff; border: 0; font-size: 28px; box-shadow: 0 6px 18px rgba(0,0,0,.2); cursor: pointer; }
