/* IM CRM — «афиша праздников»: тёплая бумага, плотные чернила, сделки — как билеты с корешком цвета этапа.
   Шрифты свои (OFL): Unbounded — заголовки и время, Golos Text — всё остальное. Без фреймворков. */
@font-face { font-family: Golos; src: url(../fonts/golos-cyrillic.woff2) format('woff2'); font-weight: 400 700; font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: Golos; src: url(../fonts/golos-latin.woff2) format('woff2'); font-weight: 400 700; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+20BD, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Unbounded; src: url(../fonts/unbounded-cyrillic.woff2) format('woff2'); font-weight: 400 800; font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: Unbounded; src: url(../fonts/unbounded-latin.woff2) format('woff2'); font-weight: 400 800; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+20BD, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --paper: #f5efe3; --paper-2: #ece4d3; --card: #fffdf8; --ink: #1d1a14; --ink-2: #5d564a; --ink-3: #8f8676;
  --line: #ddd3c0; --line-2: #c9bda5; --accent: #e5482c; --accent-ink: #fff; --accent-soft: #fbe1d9;
  --teal: #0f5e5a; --ok: #2f7d32; --warn: #b26a00; --bad: #c62828; --focus: #1f6feb;
  --shadow: 0 1px 0 rgba(29,26,20,.06), 0 6px 18px -10px rgba(29,26,20,.35);
  --r: 14px; --r-sm: 9px; --tap: 44px;
  --font: Golos, system-ui, sans-serif; --display: Unbounded, Golos, system-ui, sans-serif;
  --side: 232px; --top: 60px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --paper: #14130f; --paper-2: #1c1a15; --card: #211f19; --ink: #f2ecdf; --ink-2: #bdb4a2; --ink-3: #8a826f;
  --line: #34302a; --line-2: #48423a; --accent: #ff6a4d; --accent-soft: #3a1f17; --teal: #59b8b1;
  --shadow: 0 1px 0 rgba(0,0,0,.4), 0 8px 22px -12px rgba(0,0,0,.8); color-scheme: dark; } }
:root[data-theme="dark"] {
  --paper: #14130f; --paper-2: #1c1a15; --card: #211f19; --ink: #f2ecdf; --ink-2: #bdb4a2; --ink-3: #8a826f;
  --line: #34302a; --line-2: #48423a; --accent: #ff6a4d; --accent-soft: #3a1f17; --teal: #59b8b1;
  --shadow: 0 1px 0 rgba(0,0,0,.4), 0 8px 22px -12px rgba(0,0,0,.8); color-scheme: dark; }

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font: 400 15px/1.45 var(--font); -webkit-text-size-adjust: 100%; }
body { min-height: 100dvh; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { font-size: 16px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.hidden { display: none !important; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; letter-spacing: -.01em; margin: 0; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); font-weight: 600; }

/* ── каркас: ПК — меню слева; телефон — вкладки снизу ── */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100dvh; }
.side { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 4px; padding: 18px 12px;
  border-right: 1px solid var(--line); background: var(--paper-2); }
.logo { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-family: var(--display); font-weight: 800; font-size: 19px; text-decoration: none; }
.logo i { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); display: grid; place-items: center; color: #fff; font-style: normal; font-size: 13px; }
.nav a { display: flex; align-items: center; gap: 12px; min-height: var(--tap); padding: 0 12px; border-radius: 11px; text-decoration: none; color: var(--ink-2); font-weight: 500; }
.nav a:hover { background: var(--card); color: var(--ink); }
.nav a.on { background: var(--ink); color: var(--paper); }
.nav a .badge { margin-left: auto; }
.nav svg, .tabs svg { width: 22px; height: 22px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side .me { margin-top: auto; padding: 10px 12px; font-size: 13px; color: var(--ink-3); }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; height: var(--top); padding: 0 24px;
  background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top h1 { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .back { display: none; }
.content { padding: 22px 24px 40px; width: 100%; max-width: 1400px; }
.content.wide { max-width: none; }
.tabs { display: none; }
.offline { position: fixed; left: 50%; top: 10px; transform: translateX(-50%); z-index: 100; padding: 8px 14px; border-radius: 99px;
  background: var(--bad); color: #fff; font-weight: 600; font-size: 14px; box-shadow: var(--shadow); }

/* ── поиск в шапке ── */
.search { position: relative; margin-left: auto; width: min(420px, 100%); }
.search input { width: 100%; height: 40px; padding: 0 14px 0 38px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); }
.search svg { position: absolute; left: 12px; top: 10px; width: 20px; height: 20px; stroke: var(--ink-3); fill: none; stroke-width: 2; }
.search-pop { position: absolute; right: 0; top: 46px; width: min(560px, 92vw); max-height: 70dvh; overflow: auto; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 8px; z-index: 40; }

/* ── кнопки и поля ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 0 18px; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--card); font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.danger { color: var(--bad); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn svg, .view-switch svg, .kv svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.icon-btn { width: var(--tap); height: var(--tap); display: inline-grid; place-items: center; border-radius: 12px; border: 0; background: transparent; cursor: pointer; }
.icon-btn:hover { background: var(--paper-2); }
.icon-btn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.input, select.input, textarea.input { width: 100%; min-height: var(--tap); padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 11px; background: var(--card); }
textarea.input { min-height: 90px; resize: vertical; }
.input:focus { border-color: var(--focus); outline: 0; box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent); }
label.lbl { display: block; font-size: 13px; color: var(--ink-2); margin: 0 0 6px; font-weight: 500; }
.check { display: flex; align-items: center; gap: 10px; min-height: var(--tap); cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.err { color: var(--bad); font-weight: 500; }

.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border-radius: 99px; font-size: 13px; font-weight: 600;
  background: var(--paper-2); color: #1d1a14; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.chip.stage { cursor: pointer; border: 1px solid rgba(0,0,0,.08); }
.badge { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 99px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700;
  display: inline-grid; place-items: center; }
.badge.quiet { background: var(--paper-2); color: var(--ink-2); }

/* ── фильтры одной кнопкой ── */
.filters { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 12px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters button { flex: none; height: 38px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--card); font-weight: 600; font-size: 14px; cursor: pointer; }
.filters button.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ── билет-сделка ── */
.ticket { position: relative; display: grid; grid-template-columns: 6px minmax(0, 1fr) auto; gap: 0 12px; padding: 12px 14px 12px 0; background: var(--card);
  border-radius: var(--r); box-shadow: var(--shadow); text-decoration: none; color: inherit; cursor: pointer; user-select: none; -webkit-user-select: none;
  border: 1px solid transparent; transition: transform .12s ease, border-color .12s; }
.ticket:hover { border-color: var(--line-2); }
.ticket:active { transform: scale(.995); }
.ticket .stub { grid-row: 1 / span 3; border-radius: var(--r) 0 0 var(--r); background: var(--stage, var(--line-2)); }
.ticket .t-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket .t-sub { color: var(--ink-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket .t-side { grid-row: 1 / span 2; grid-column: 3; text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.ticket .when { font-family: var(--display); font-weight: 600; font-size: 13px; letter-spacing: -.01em; }
.ticket .when.today { color: var(--accent); }
.ticket .money { font-size: 13px; color: var(--ink-2); }
.ticket .overdue { color: var(--bad); font-size: 12px; font-weight: 600; }
.ticket .marks { grid-column: 2 / -1; display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.mark { display: inline-block; font-size: 11px; line-height: 1.3; padding: 2px 7px; border-radius: 99px; background: var(--paper-2); color: var(--ink-2); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mark.warn { background: #fff1c2; color: #6b4a00; }
.ticket::after { content: ""; position: absolute; left: 6px; top: 8px; bottom: 8px; border-left: 2px dashed color-mix(in srgb, var(--paper) 70%, transparent); }
.list { display: grid; gap: 10px; }
.more { display: block; margin: 14px auto 0; }
.empty { padding: 36px 16px; text-align: center; color: var(--ink-3); }

/* ── «Сегодня»: афиша ── */
.playbill { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 22px; align-items: start; }
.bill-head { display: flex; align-items: baseline; gap: 14px; margin: 4px 0 14px; }
.bill-head .big { font-family: var(--display); font-size: 40px; font-weight: 800; line-height: 1; letter-spacing: -.03em; }
.bill-head .dow { font-family: var(--display); font-size: 15px; color: var(--accent); font-weight: 700; text-transform: uppercase; }
.event { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 12px; padding: 12px; background: var(--card); border-radius: var(--r); box-shadow: var(--shadow);
  text-decoration: none; color: inherit; border-left: 6px solid var(--stage, var(--line-2)); }
.event .time { font-family: var(--display); font-size: 22px; font-weight: 700; line-height: 1.05; }
.event .tz { font-size: 11px; color: var(--ink-3); margin-top: 3px; }
.event .acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.section { margin-bottom: 26px; }
.section > h3 { margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.task { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; background: var(--card); border-radius: var(--r-sm); box-shadow: var(--shadow); }
.task .box { position: relative; width: 44px; height: 44px; flex: none; margin: -9px -6px -9px -10px; border: 0; background: transparent; cursor: pointer; }
.task .box::before { content: ""; position: absolute; inset: 9px; border: 2px solid var(--line-2); border-radius: 8px; }
.task .box:hover::before { border-color: var(--ok); }
.task.done .box::before { background: var(--ok); border-color: var(--ok); }
.task.done .box::after { content: '✓'; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-weight: 700; }
.task.done { opacity: .6; }
.task.late .due { color: var(--bad); font-weight: 600; }
.task a { text-decoration: none; }

/* ── воронка ── */
.pipes { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(270px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 14px; align-items: start; }
.col { background: var(--paper-2); border-radius: var(--r); padding: 10px; min-height: 120px; }
.col.drop { outline: 2px dashed var(--accent); outline-offset: -2px; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px 10px; border-bottom: 3px solid var(--stage, var(--line-2)); margin-bottom: 10px; }
.col-head b { font-size: 13px; letter-spacing: .03em; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-head .sum { margin-left: auto; font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.col .list { gap: 8px; }
/* в узкой колонке воронки: название во всю ширину, дата и сумма — строкой ниже */
.col .ticket { grid-template-columns: 6px minmax(0, 1fr); }
.col .ticket .t-name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.col .ticket .t-side { grid-row: auto; grid-column: 2; flex-direction: row; justify-content: space-between; align-items: baseline; margin-top: 4px; }
.col.closed { opacity: .85; }
.stage-tape { display: none; }
.view-switch { margin-left: auto; display: flex; gap: 4px; background: var(--paper-2); padding: 4px; border-radius: 12px; }
.view-switch button { height: 36px; padding: 0 12px; border-radius: 9px; border: 0; background: transparent; font-weight: 600; cursor: pointer; }
.view-switch button.on { background: var(--card); box-shadow: var(--shadow); }

/* ── карточка сделки ── */
.deal { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 22px; align-items: start; }
.deal-head { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 16px; border-top: 6px solid var(--stage, var(--line-2)); }
.deal-head .title { font-family: var(--display); font-size: 21px; font-weight: 700; line-height: 1.2; outline: 0; border-radius: 8px; padding: 2px 4px; margin: -2px -4px; }
.deal-head input.title { min-height: 44px; }
.chip.stage { min-height: 36px; padding: 0 14px; }
.deal-head .title:focus { background: var(--paper-2); }
.deal-head .meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.deal-head .event-big { font-family: var(--display); font-weight: 700; color: var(--accent); }
.panel { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 16px; }
.panel > h3 { margin-bottom: 8px; }
.fields { display: grid; gap: 2px; }
.field { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 10px; align-items: center; min-height: var(--tap); border-bottom: 1px dashed var(--line); padding: 4px 0; }
.field:last-child { border-bottom: 0; }
.field .k { color: var(--ink-2); font-size: 14px; }
.field .v { min-width: 0; }
.field .v .input { min-height: 40px; padding: 7px 10px; border-color: transparent; background: transparent; }
.field .v .input:hover { border-color: var(--line); }
.field .v .input:focus { background: var(--card); }
.field.saving .v .input { border-color: var(--warn); }
.field.saved .v .input { border-color: var(--ok); }
.field .ro { padding: 0 10px; color: var(--ink-2); overflow-wrap: anywhere; }
details.svc > summary { cursor: pointer; color: var(--ink-3); font-size: 13px; padding: 8px 0; list-style: none; }
details.svc > summary::before { content: "▸ "; }
details.svc[open] > summary::before { content: "▾ "; }
.seg { display: flex; gap: 4px; background: var(--paper-2); padding: 4px; border-radius: 12px; margin-bottom: 14px; }
.seg button { flex: 1; height: 38px; border: 0; border-radius: 9px; background: transparent; font-weight: 600; cursor: pointer; }
.seg button.on { background: var(--card); box-shadow: var(--shadow); }
.note { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.note:last-child { border-bottom: 0; }
.note .h { font-size: 12px; color: var(--ink-3); margin-bottom: 3px; }
.note .b { white-space: pre-wrap; overflow-wrap: anywhere; }
.hist { font-size: 13px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.hist .h { color: var(--ink-3); }
.hist del { color: var(--ink-3); }
.client-deals a { display: flex; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--line); text-decoration: none; }
.client-deals a:last-child { border-bottom: 0; }
.repeat { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--ink); margin-bottom: 12px; font-weight: 500; }
.phones a { font-family: var(--display); font-weight: 600; font-size: 15px; text-decoration: none; }
.actionbar { display: none; }

/* ── переписка ── */
.chat-list { max-height: 420px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 4px 2px 8px; }
.bubble { max-width: 86%; padding: 8px 11px; border-radius: 14px; background: var(--paper-2); align-self: flex-start; overflow-wrap: anywhere; }
.bubble.out { align-self: flex-end; background: color-mix(in srgb, var(--teal) 16%, var(--card)); }
.bubble.del { opacity: .55; font-style: italic; }
.bubble .txt { white-space: pre-wrap; }
.bubble .meta { font-size: 11px; color: var(--ink-3); margin-top: 3px; }
.bubble img { display: block; max-width: 100%; max-height: 260px; border-radius: 10px; margin-bottom: 4px; }
.chat-input { display: flex; gap: 8px; align-items: flex-end; margin-top: 8px; }
.chat-input textarea { min-height: 44px; }

/* ── календарь ── */
.cal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.cal-head .m { font-family: var(--display); font-size: 20px; font-weight: 700; min-width: 210px; text-align: center; text-transform: capitalize; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal .dn { font-size: 12px; text-transform: uppercase; color: var(--ink-3); text-align: center; font-weight: 600; letter-spacing: .05em; }
.day { min-height: 116px; background: var(--card); border-radius: 11px; padding: 6px; box-shadow: var(--shadow); overflow: hidden; }
.day.other { opacity: .45; }
.day.today { outline: 2px solid var(--accent); }
.day .d { font-family: var(--display); font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.day .ev { display: block; font-size: 12px; padding: 3px 6px; border-radius: 6px; margin-bottom: 3px; background: var(--stage, var(--paper-2)); color: #1d1a14;
  text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day .more-ev { font-size: 12px; color: var(--ink-2); }
.agenda { display: none; }

/* ── нижний лист / окно ── */
.sheet-bg { position: fixed; inset: 0; z-index: 60; background: rgba(20,18,14,.45); display: flex; align-items: center; justify-content: center; animation: fade .15s ease; }
.sheet { width: min(520px, 94vw); max-height: 86dvh; overflow: auto; background: var(--card); border-radius: 18px; padding: 18px; box-shadow: var(--shadow); animation: up .18s ease; }
.sheet h2 { margin-bottom: 14px; }
.sheet .opts { display: grid; gap: 6px; }
.sheet .opt { display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); cursor: pointer; text-align: left; font-weight: 600; }
.sheet .opt:hover { border-color: var(--ink-3); }
.sheet .opt .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--stage); border: 1px solid rgba(0,0,0,.15); }
.sheet .opt.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90; background: var(--ink); color: var(--paper); padding: 12px 18px;
  border-radius: 12px; box-shadow: var(--shadow); font-weight: 500; max-width: 92vw; animation: up .18s ease; }
.toast.bad { background: var(--bad); color: #fff; }
@keyframes up { from { transform: translate(var(--tx, 0), 14px); opacity: 0; } }
.toast { --tx: -50%; }
@keyframes fade { from { opacity: 0; } }

/* ── вход ── */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 500px at 110% -10%, var(--accent-soft), transparent 60%), var(--paper); }
.auth-card { width: min(420px, 100%); background: var(--card); border-radius: 22px; box-shadow: var(--shadow); padding: 28px 24px; }
.auth-card .logo { padding: 0 0 18px; }
.auth-card form { display: grid; gap: 14px; }
.auth-card .alt { display: grid; gap: 8px; margin-top: 14px; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; font-family: var(--display); font-size: 16px; margin: 14px 0; }
.codes span { padding: 10px; border: 1px dashed var(--line-2); border-radius: 10px; text-align: center; }
.fp { width: 84px; height: 84px; margin: 6px auto 14px; border-radius: 26px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.fp svg { width: 52px; height: 52px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; }

/* ── настройки ── */
.settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; align-items: start; }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); align-items: center; }
.kv:last-child { border-bottom: 0; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t td, table.t th { text-align: left; padding: 8px 6px; border-bottom: 1px dashed var(--line); vertical-align: top; }

/* ── планшет ── */
@media (max-width: 1024px) {
  :root { --side: 76px; }
  .side .logo span, .nav a span, .side .me { display: none; }
  .nav a { justify-content: center; padding: 0; }
  .nav a .badge { position: absolute; margin: -22px -26px 0 0; }
  .nav a { position: relative; }
  .deal { grid-template-columns: minmax(0, 1fr); }
}

/* ── телефон ── */
@media (max-width: 768px) {
  :root { --top: 56px; }
  body { font-size: 16px; }
  .shell { display: block; }
  .side { display: none; }
  .main { min-height: 100dvh; padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  .top { padding: 0 8px 0 14px; gap: 6px; }
  .top .back { display: inline-grid; margin-left: -8px; }
  .top h1 { font-size: 17px; flex: 1; }
  .search { width: auto; margin-left: 0; }
  .search input { width: 44px; padding: 0; border-color: transparent; background: transparent; color: transparent; cursor: pointer; }
  .search:not(.open) input::placeholder { color: transparent; }
  .btn.sm { min-height: 44px; min-width: 44px; }
  .chip.stage { min-height: 44px; }
  .search svg { left: 11px; top: 11px; pointer-events: none; }
  .search.open { position: fixed; inset: 0 0 auto 0; height: var(--top); background: var(--paper); z-index: 50; padding: 8px 10px; display: flex; }
  .search.open input { width: 100%; padding: 0 14px 0 38px; color: var(--ink); background: var(--card); border-color: var(--line); cursor: text; }
  .search.open svg { left: 22px; top: 18px; }
  .search-pop { position: fixed; left: 0; right: 0; top: var(--top); width: auto; max-height: calc(100dvh - var(--top)); border-radius: 0; border: 0; }
  .content { padding: 14px 12px 24px; }
  .tabs { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); }
  .tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px; text-decoration: none;
    font-size: 11px; font-weight: 600; color: var(--ink-3); position: relative; border-radius: 12px; }
  .tabs a.on { color: var(--ink); }
  .tabs a.on svg { stroke: var(--accent); }
  .tabs a .badge { position: absolute; top: 2px; left: calc(50% + 6px); height: 18px; min-width: 18px; font-size: 11px; padding: 0 5px; }
  .playbill { grid-template-columns: 1fr; gap: 6px; }
  .bill-head .big { font-size: 34px; }
  .board { display: none; }
  .stage-tape { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 12px; scrollbar-width: none; }
  .stage-tape::-webkit-scrollbar { display: none; }
  .stage-tape button { flex: none; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line-2);
    background: var(--card); font-weight: 600; font-size: 14px; cursor: pointer; border-bottom: 4px solid var(--stage, var(--line-2)); }
  .stage-tape button.on { background: var(--ink); color: var(--paper); border-color: var(--ink); border-bottom-color: var(--stage); }
  .stage-tape .n { font-size: 12px; opacity: .7; }
  .view-switch { display: none; }
  .deal-head { margin: -14px -12px 12px; border-radius: 0; position: sticky; top: var(--top); z-index: 10; padding: 12px 14px; }
  .deal-head .title { font-size: 18px; }
  .field { grid-template-columns: 1fr; gap: 2px; padding: 8px 0; }
  .field .k { font-size: 13px; }
  .field .v .input { padding: 8px 0; border-radius: 0; border: 0; border-bottom: 1px solid var(--line); }
  .actionbar { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 25;
    background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -8px 20px -16px rgba(0,0,0,.4); }
  .actionbar a, .actionbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 54px;
    font-size: 12px; font-weight: 600; text-decoration: none; border: 0; background: transparent; cursor: pointer; }
  .actionbar svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .actionbar .call { color: var(--ok); }
  .deal-page { padding-bottom: 64px; }
  .chat-list { max-height: none; }
  .cal { display: none; }
  .agenda { display: grid; gap: 14px; }
  .agenda .ad h3 { margin-bottom: 8px; }
  .agenda .ad.today h3 { color: var(--accent); }
  .cal-head .m { min-width: 0; flex: 1; font-size: 17px; }
  .sheet-bg { align-items: flex-end; }
  .sheet { width: 100%; max-width: none; border-radius: 20px 20px 0 0; padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  .settings { grid-template-columns: 1fr; }
  .toast { bottom: calc(80px + env(safe-area-inset-bottom)); }
}
@media (min-width: 1441px) { .content { margin: 0 auto; } .content.wide { margin: 0; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.support-bar { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; padding: 8px 12px; background: #fff1c2; color: #6b4a00; font-weight: 600; font-size: 14px; }
.grow.wide { flex: 1 1 200px; }
