/* CRM АРТ: светлая тема по дизайну Stitch. Тёмно-синий текст, тёплая бумага, золотые акценты. */
:root {
  --bg: #f7f5f0; --surface: #fff; --chrome: #fbfaf6; --head: #efebe2; --zebra: #faf8f3; --line: #e4ddcf;
  --text: #0f1e3b; --muted: #5b6680; --disabled: #9aa3b5;
  --navy: #0f1e3b; --navy-hover: #182c52; --gold: #d9b978; --gold-hover: #cfad67; --gold-ink: #8c6420;
  --sage: #3f7d5c; --sage-bg: #e6f2ea; --amber: #a8701a; --amber-bg: #fbf0db;
  --coral: #b8483a; --coral-bg: #f9e5e1; --steel: #3d6aa8; --steel-bg: #e3ecf7;
  --accent: var(--gold-ink); --danger: var(--coral);
  --radius: 14px; --radius-sm: 8px;
  --shadow-1: 0 1px 3px rgba(15, 30, 59, .04), 0 1px 2px rgba(15, 30, 59, .02);
  --shadow-2: 0 8px 16px -2px rgba(15, 30, 59, .06), 0 4px 6px -2px rgba(15, 30, 59, .03);
  --serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 var(--sans); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: var(--gold-ink); text-decoration-thickness: 1px; text-underline-offset: 2px; }
h1, h2 { font-family: var(--serif); font-weight: 600; color: var(--navy); letter-spacing: -.01em; }
h1 { font-size: 26px; line-height: 1.25; margin: 4px 0 18px; }
h2 { font-size: 19px; margin: 28px 0 12px; }
h3 { font-size: 16px; margin: 20px 0 8px; }
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 13px; }
.right { text-align: right; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* --- Каркас ------------------------------------------------------------- */
.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--navy); }
.brand-tile { width: 40px; height: 40px; border-radius: 10px; background: var(--navy); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.brand-tile img { width: 28px; height: auto; display: block; }
.brand-name { display: block; font-family: var(--serif); font-weight: 600; font-size: 17px; line-height: 1.1; }
.brand-sub { display: block; font-size: 12px; color: var(--muted); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--navy); color: var(--gold); font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; flex: none; text-decoration: none; }
.avatars { display: flex; gap: 4px; margin-top: 8px; }

.main { padding: 16px 16px 96px; max-width: 1180px; margin: 0 auto; }
.topbar { position: sticky; top: 0; z-index: 9; display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar .brand-tile { width: 34px; height: 34px; border-radius: 9px; }
.topbar .brand-tile img { width: 24px; }
.topbar-user { width: 34px; height: 34px; font-size: 14px; }

.nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; display: flex; align-items: stretch; background: var(--surface); border-top: 1px solid var(--line); padding: 4px 6px calc(4px + env(safe-area-inset-bottom)); }
.nav > a, .nav > .nav-more-btn { position: relative; flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px 8px; text-decoration: none; color: var(--muted); font: inherit; font-size: 11px; letter-spacing: -.01em; font-weight: 500; background: none; border: 0; cursor: pointer; }
.nav > a.active, .nav > .nav-more-btn.active { color: var(--navy); }
.nav > a.active::after, .nav > .nav-more-btn.active::after { content: ""; position: absolute; bottom: 2px; width: 4px; height: 4px; border-radius: 50%; background: var(--gold); }
.nav > a span, .nav > .nav-more-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.nav .ico { width: 22px; height: 22px; }
.nav-brand, .nav-foot, .nav-desktop-only { display: none !important; }
.nav-badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--coral); color: #fff; font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; }
.nav > a .nav-badge, .nav > .nav-more-btn .nav-badge { position: absolute; top: 2px; left: 50%; margin-left: 8px; }

.nav-drawer[hidden] { display: none; }
.nav-drawer { position: fixed; inset: 0; z-index: 20; background: rgba(15, 30, 59, .38); display: flex; align-items: flex-end; }
.nav-drawer-sheet { width: 100%; background: var(--surface); border-radius: 18px 18px 0 0; padding: 14px 16px calc(20px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 30px rgba(15, 30, 59, .18); }
.nav-drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; color: var(--navy); font-size: 15px; }
.nav-drawer-close { border: 0; background: var(--head); color: var(--navy); width: 32px; height: 32px; border-radius: 50%; font-size: 20px; line-height: 1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.nav-drawer-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.nav-drawer-grid a { position: relative; display: flex; align-items: center; gap: 10px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--chrome); text-decoration: none; color: var(--navy); font-weight: 500; font-size: 14px; }
.nav-drawer-grid a.active { border-color: var(--gold); background: #fbf4e4; }
.nav-drawer-grid a .nav-badge { margin-left: auto; }

.settings-group { margin-top: 22px; }
.settings-group:first-of-type { margin-top: 6px; }
.settings-group-title { font-family: var(--sans); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 8px 4px; }

@media (min-width: 900px) {
  .topbar, .nav-more-btn, .nav-drawer { display: none !important; }
  .nav { top: 0; right: auto; width: 232px; flex-direction: column; gap: 2px; background: var(--chrome); border-top: 0; border-right: 1px solid var(--line); padding: 18px 12px; }
  .nav-desktop-only { display: flex !important; }
  .nav > a.nav-brand { display: flex !important; flex: none; flex-direction: row; align-items: center; gap: 10px; padding: 0 6px 18px; margin-bottom: 8px; border-bottom: 1px solid var(--line); color: var(--navy); }
  .nav > a:not(.nav-brand) { flex: none; flex-direction: row; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 15px; }
  .nav > a:not(.nav-brand):hover { background: rgba(15, 30, 59, .04); color: var(--navy); }
  .nav > a.active { background: var(--head); box-shadow: inset 3px 0 0 var(--gold); }
  .nav > a.active::after { display: none; }
  .nav > a .nav-badge { position: static; margin-left: auto; }
  .nav-profile { display: none !important; }
  .nav-foot { display: flex !important; margin-top: auto; align-items: center; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
  .nav-user { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--navy); font-size: 14px; font-weight: 500; }
  .nav-user span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav-logout { margin: 0; }
  .nav-logout button { display: flex; background: none; border: 0; padding: 6px; border-radius: 6px; color: var(--muted); cursor: pointer; }
  .nav-logout button:hover { color: var(--navy); background: var(--head); }
  .nav-logout button span { display: none; }
  .main { margin-left: 232px; padding: 28px 40px 48px; max-width: none; }
}

.mobile-only { margin-top: 28px; }
@media (min-width: 900px) { .mobile-only { display: none; } }

/* --- Базовые блоки ------------------------------------------------------ */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow-1); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.spread { justify-content: space-between; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input[type=search] { flex: 1 1 240px; }
.toolbar select { flex: 1 1 calc(50% - 4px); width: auto; min-width: 0; }
@media (min-width: 900px) { .toolbar select { flex: 0 1 190px; } }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 500; color: var(--muted); }
input[type=text], input[type=search], input[type=tel], input[type=password], input[type=date], input[type=time], input[type=number], input[type=datetime-local], input[type=url], select, textarea {
  font: inherit; color: var(--text); padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; width: 100%; min-height: 44px;
}
input::placeholder, textarea::placeholder { color: var(--disabled); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(217, 185, 120, .25); }
input[type=checkbox], input[type=radio] { accent-color: var(--navy); width: 18px; height: 18px; }
textarea { min-height: 88px; }
.checks { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.option { display: flex; gap: 8px; align-items: center; padding: 4px 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; min-height: 44px; padding: 10px 18px; border-radius: var(--radius-sm); border: 1px solid var(--gold); background: var(--gold); color: var(--navy); text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--gold-hover); border-color: var(--gold-hover); }
.btn-ghost { background: transparent; border-color: var(--navy); color: var(--navy); font-weight: 500; }
.btn-ghost:hover { background: rgba(15, 30, 59, .04); border-color: var(--navy); }
.btn-danger { background: transparent; border-color: var(--coral); color: var(--coral); font-weight: 500; }
.btn-danger:hover { background: var(--coral-bg); border-color: var(--coral); }
.btn-small { min-height: 34px; padding: 6px 12px; font-size: 14px; }

.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 14px; background: var(--amber-bg); color: #6f4a10; border: 1px solid #f0dfba; }
.alert-error { background: var(--coral-bg); color: var(--coral); border-color: #efc9c2; }

/* Метки и статусы */
.tag, .badge, .pill { display: inline-block; font-size: 12px; font-weight: 500; line-height: 1.5; padding: 2px 9px; border-radius: 999px; margin: 2px 4px 2px 0; white-space: nowrap; }
.tag { background: var(--steel-bg); color: var(--steel); }
.badge { background: var(--sage-bg); color: var(--sage); }
.badge-warn { background: var(--amber-bg); color: var(--amber); }
.badge-danger { background: var(--coral-bg); color: var(--coral); }
.badge-archived { background: var(--head); color: var(--muted); }
.pill { background: var(--head); color: var(--navy); }

/* Списки */
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; text-decoration: none; color: inherit; box-shadow: var(--shadow-1); transition: box-shadow .15s, border-color .15s; }
a.list-item:hover { box-shadow: var(--shadow-2); border-color: #d6ccb9; }
.list-item.overdue { border-color: #efc9c2; background: #fffaf9; }
.list-item.overdue strong { color: var(--coral); }
.list-item.cancelled { opacity: .55; }
.note { border-top: 1px solid var(--line); padding: 12px 0; }
.note-text { white-space: pre-line; }

/* Переключатели */
.segmented { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: 10px; background: var(--head); }
.segmented a { padding: 7px 16px; border-radius: 7px; text-decoration: none; color: var(--muted); font-weight: 500; }
.segmented a.active { background: var(--surface); color: var(--navy); box-shadow: var(--shadow-1); }
.chip { display: inline-flex; align-items: center; min-height: 36px; padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--muted); background: var(--surface); font-size: 14px; }
.chip-on { border-color: var(--gold); color: var(--navy); background: #fbf4e4; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 14px 0 18px; overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.tabs a.active { color: var(--navy); border-bottom-color: var(--gold); }

/* Таблицы */
.table-scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table.audit, table.grid { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
table.audit th, table.grid th { background: var(--head); color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
table.audit th, table.audit td { border-bottom: 1px solid var(--line); padding: 10px 12px; text-align: left; vertical-align: top; }
table.grid th, table.grid td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: center; white-space: nowrap; }
table.grid tbody tr:nth-child(even) td { background: var(--zebra); }
table.grid td.left { text-align: left; }
table.grid tr.total td { font-weight: 600; background: var(--head); }
table.grid .sticky { position: sticky; left: 0; background: var(--surface); text-align: left; z-index: 1; }
table.grid th.sticky { background: var(--head); }
.mark { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; color: var(--navy); font-size: 18px; cursor: pointer; }
.mark-on { background: var(--gold); border-color: var(--gold); }

/* Канбан */
.kanban { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px; padding: 0 16px 10px; }
.kanban-col { flex: 0 0 86%; scroll-snap-align: start; background: var(--head); border-radius: var(--radius); padding: 10px; }
.kanban-title { font-family: var(--sans); font-size: 14px; font-weight: 600; margin: 4px 6px 10px; color: var(--navy); }
.kanban-cards { min-height: 60px; display: flex; flex-direction: column; gap: 8px; }
.kcard { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow-1); }
.kcard:hover { box-shadow: var(--shadow-2); }
/* Вся карточка ведёт туда же, куда заголовок; ручка и выбор этапа лежат поверх. */
.kcard-title::after { content: ""; position: absolute; inset: 0; border-radius: 12px; }
.kcard-move, .kcard-handle { position: relative; z-index: 1; }
.kcard-handle { display: none; float: right; margin: -4px -6px 0 6px; padding: 6px; border-radius: 6px; color: var(--disabled); cursor: grab; touch-action: none; }
.kcard-handle:hover { color: var(--navy); background: var(--head); }
.kcard-handle .ico { width: 18px; height: 18px; }
.kcard-title { display: block; font-family: var(--serif); font-weight: 600; font-size: 16px; line-height: 1.3; color: var(--navy); text-decoration: none; margin-bottom: 4px; }
.kcard-move { margin-top: 8px; }
.kcard-move select { min-height: 36px; padding: 6px 10px; font-size: 14px; }
.sortable-ghost { opacity: .4; outline: 2px dashed var(--gold); }
@media (min-width: 900px) {
  .kanban { margin: 0; padding: 0 0 10px; scroll-snap-type: none; }
  .kanban-col { flex: 1 1 0; min-width: 190px; }
  .kcard { cursor: pointer; }
  .kcard-handle { display: inline-flex; }
  .kcard-move { display: none; }
}

/* Деньги и сводки */
.money-line { margin-top: 8px; font-variant-numeric: tabular-nums; }
.progress { height: 4px; background: var(--head); border-radius: 2px; overflow: hidden; margin: 5px 0; }
.progress span { display: block; height: 100%; background: var(--gold); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 14px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; color: var(--muted); font-size: 13px; box-shadow: var(--shadow-1); }
.tile strong { display: block; font-family: var(--serif); font-size: 24px; font-weight: 600; color: var(--navy); margin-top: 4px; font-variant-numeric: tabular-nums; }
.bar-row { display: grid; grid-template-columns: 110px 1fr auto; gap: 10px; align-items: center; padding: 6px 0; }
.bar { height: 8px; background: var(--head); border-radius: 4px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--gold); }
.part-row { margin-bottom: 8px; flex-wrap: nowrap; }
.part-row .amount-input { flex: 1 1 120px; }
.part-row select, .part-row input[type=date] { flex: 1 1 140px; width: auto; }
.amount-input { font-variant-numeric: tabular-nums; }
.delta-up { color: var(--sage); font-size: 12px; }
.delta-down { color: var(--coral); font-size: 12px; }

/* Дела */
.task-row { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; margin-bottom: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-1); }
.task-row form { margin: 0; }
.check { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid #c9c0ad; background: #fff; padding: 0; cursor: pointer; flex: none; margin-top: 1px; }
.check:hover { border-color: var(--gold); }
.check-on { display: inline-block; background: var(--gold); border-color: var(--gold); }
.task-main { flex: 1; min-width: 0; color: inherit; text-decoration: none; }
.task-main .muted { color: var(--steel); }
.task-title { font-weight: 500; font-size: 16px; color: var(--navy); }
.task-due { white-space: nowrap; text-align: right; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.task-done .task-main, .task-done .task-title { color: var(--disabled); }
.task-done .task-title { text-decoration: line-through; }
.due-overdue { display: inline-block; padding: 1px 9px; border-radius: 999px; background: var(--coral-bg); color: var(--coral); font-weight: 500; }
.group-title { font-family: var(--sans); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; margin: 22px 0 8px; color: var(--muted); }
.group-overdue { color: var(--coral); }
.quick-add { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 6px; box-shadow: var(--shadow-1); }
.quick-add input[type=text] { flex: 1; border: 0; box-shadow: none; }
.drag { cursor: grab; color: var(--disabled); padding: 0 6px; user-select: none; touch-action: none; }
.days-input { width: 90px; }
.vk-code { font-family: ui-monospace, "Cascadia Mono", monospace; font-size: 32px; letter-spacing: .12em; font-weight: 700; color: var(--navy); }

/* Вход */
.page-login .main { margin: 0; padding: 0; max-width: none; }
.login-wrap { min-height: 100vh; display: grid; grid-template-rows: auto 1fr; }
.login-side { background: radial-gradient(circle at 30% 20%, #1a2d55 0%, var(--navy) 60%); color: #f2efe6; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 36px 24px 32px; }
.login-logo { width: 116px; padding: 20px 22px; border-radius: 22px; background: var(--navy); border: 1px solid rgba(217, 185, 120, .35); box-shadow: 0 18px 40px rgba(0, 0, 0, .3); }
.login-logo img { width: 100%; height: auto; display: block; }
.login-kicker { margin: 22px 0 6px; color: var(--gold); letter-spacing: .3em; font-size: 13px; font-weight: 600; }
.login-title { font-family: var(--serif); font-style: italic; font-weight: 600; font-size: 24px; line-height: 1.25; margin: 0; }
.login-rule { width: 56px; height: 1px; background: rgba(217, 185, 120, .6); margin: 18px auto 0; }
.login-main { display: flex; align-items: flex-start; justify-content: center; padding: 28px 16px 40px; }
.login { width: 100%; max-width: 420px; padding: 28px 24px; }
.login h1 { text-align: center; margin-bottom: 22px; }
.login .btn { width: 100%; margin-top: 6px; }
@media (min-width: 900px) {
  .login-wrap { grid-template-rows: none; grid-template-columns: 1fr 1fr; }
  .login-side { padding: 48px; }
  .login-logo { width: 170px; padding: 28px 32px; border-radius: 26px; }
  .login-title { font-size: 34px; }
  .login-main { align-items: center; }
  .login { padding: 40px 44px; }
}

/* Таблица клиентов: на компьютере таблица, на телефоне карточки. Вся строка ведёт в карточку клиента. */
.ctable { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; font-variant-numeric: tabular-nums; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-1); }
.ctable th { background: var(--head); color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; text-align: left; padding: 10px 14px; white-space: nowrap; }
.ctable td { padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: top; }
.ctable tbody tr { position: relative; }
.ctable tbody tr:hover td { background: var(--zebra); }
.ctable .num { text-align: right; white-space: nowrap; }
.c-link { font-family: var(--serif); font-weight: 600; font-size: 16px; color: var(--navy); text-decoration: none; margin-right: 4px; }
.c-link::after { content: ""; position: absolute; inset: 0; }
.c-phone { white-space: nowrap; color: var(--muted); }
.c-last .muted { font-size: 13px; margin: 0 4px; }
.c-label { display: none; color: var(--muted); }
.debt { color: var(--coral); font-weight: 500; }
.status { display: inline-block; font-size: 12px; font-weight: 500; padding: 1px 8px; border-radius: 999px; background: var(--head); color: var(--navy); white-space: nowrap; }
.status-lead { background: var(--steel-bg); color: var(--steel); }
.status-enrolled { background: var(--amber-bg); color: var(--amber); }
.status-attended { background: var(--sage-bg); color: var(--sage); }
.status-declined, .status-no_show { background: var(--coral-bg); color: var(--coral); }
@media (max-width: 899px) {
  .ctable, .ctable tbody, .ctable tr, .ctable td { display: block; }
  .ctable { background: none; border: 0; box-shadow: none; overflow: visible; }
  .ctable thead { display: none; }
  .ctable tbody tr { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; box-shadow: var(--shadow-1); }
  .ctable td { border: 0; padding: 2px 0; text-align: left !important; }
  .ctable td:empty, .ctable td:has(> .dash:only-child) { display: none; }
  .c-label { display: inline; }
}

/* Зоны в настройках: строка-форма */
.zone-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 14px; }
.zone-row input[type=text] { flex: 2 1 220px; width: auto; }
.zone-row select { flex: 1 1 200px; width: auto; }
.zone-row.cancelled { opacity: .6; }

/* Файлы задачи */
.file-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.file-row form { margin: 0 0 0 auto; }
.file-name { font-weight: 500; word-break: break-all; }
.file-upload { margin-top: 12px; }
.file-upload input[type=file] { flex: 1 1 220px; font: inherit; font-size: 14px; }
.template-pick { background: #fbf4e4; border-color: #ecdcb6; }

/* Календарь месяца. На телефоне: список дней, пустые дни вне месяца скрыты. */
.cal-toolbar .segmented a { padding: 7px 12px; }
.cal-search { flex: 1 1 220px; display: flex; }
.cal-search input { flex: 1; }
.cal-found { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line); }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--line); gap: 1px; }
.cal-head { background: var(--head); color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; }
.cal-day { background: var(--surface); min-height: 112px; padding: 6px 6px 8px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-out { background: var(--zebra); }
.cal-out .cal-num { color: var(--disabled); }
.cal-num { display: flex; align-items: center; gap: 4px; font-weight: 600; font-size: 13px; color: var(--navy); text-decoration: none; padding: 2px 4px; border-radius: 6px; font-variant-numeric: tabular-nums; }
.cal-num:hover { background: var(--head); }
.cal-add { opacity: 0; margin-left: auto; color: var(--gold-ink); font-size: 16px; line-height: 1; }
.cal-day:hover .cal-add { opacity: 1; }
.cal-today .cal-num { background: var(--navy); color: #fff; }
.cal-wd { display: none; }
.cal-item { display: block; font-size: 12px; line-height: 1.35; padding: 2px 6px; border-radius: 5px; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: #fbf4e4; color: var(--navy); border-left: 3px solid var(--gold); }
.cal-course { background: var(--steel-bg); border-left-color: var(--steel); }
.cal-online { background: var(--sage-bg); border-left-color: var(--sage); }
.cal-cont { opacity: .7; }
.cal-pending { background: transparent; border: 1px dashed var(--gold); border-left-width: 3px; color: var(--muted); }
@media (max-width: 899px) {
  .cal { display: block; background: none; border: 0; }
  .cal-head, .cal-out.cal-empty { display: none; }
  .cal-day { min-height: 0; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 6px; }
  .cal-empty .cal-num { color: var(--muted); font-weight: 500; }
  .cal-wd { display: inline; }
  .cal-add { opacity: 1; }
  .cal-item { white-space: normal; font-size: 14px; padding: 4px 8px; }
}

/* Пачка 29.10: срочные задачи и вкладки «Мои» */
.pill-urgent { background: var(--coral); color: #fff; font-weight: 600; letter-spacing: .02em; }
.option-urgent strong { color: var(--coral); }
.task-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 14px; }
.task-tabs a { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink, #1c2433); text-decoration: none; font-size: 14px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-tabs a.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.task-tabs a.active .muted { color: rgba(255,255,255,.7); }
.task-tabs a.tab-urgent:not(.active) { border-color: var(--coral); color: var(--coral); }
.back-row { margin: 0 0 10px; }
.btn-back::before { content: '←'; margin-right: 6px; }

/* Набор участников */
.kcard-low { border-color: var(--coral); background: var(--coral-bg); box-shadow: inset 4px 0 0 var(--coral), var(--shadow-1); }
.cap-low { color: var(--coral); font-weight: 600; }
.pill-full { background: var(--navy); color: #fff; }
.cal-item.cal-low { background: var(--coral-bg); color: var(--coral); border-left: 3px solid var(--coral); font-weight: 600; }

/* Клиент без телефона */
.ctable tr.c-nophone td { background: var(--coral-bg); }
.ctable tr.c-nophone td.c-phone { color: var(--coral); font-weight: 600; }

/* Аренда залов */
.cal-item.cal-rent { background: var(--steel-bg); color: var(--steel); border-left: 3px solid var(--steel); white-space: normal; overflow: visible; }
.loud-ico { width: 14px; height: 14px; vertical-align: -2px; fill: none; stroke: var(--coral); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.alert-loud { background: #fff4e0; border-color: #f0d6a8; color: #7a4b00; }
.cal-room select { min-height: 38px; padding: 6px 10px; width: auto; }
fieldset.renter { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; }
fieldset.renter legend { padding: 0 6px; font-weight: 500; }

.inline-rename { flex: 1; gap: 8px; }
.inline-rename input[type=text] { flex: 1; min-height: 38px; padding: 6px 10px; }

/* Дни и часы */
.period-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 6px; }
.period-row .field { flex: 1 1 130px; margin: 0; }
.period-remove { min-height: 44px; padding: 0 14px; }

/* Журнал действий */
.audit-filter { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.audit-filter .field { flex: 1 1 150px; margin: 0; }
.audit-lines .list-item { align-items: flex-start; gap: 12px; }

/* Контент-план */
.cal-post { white-space: normal; overflow: visible; }
.cal-post-meta { display: block; font-size: 11px; color: var(--muted); }
.cal-post-published { background: var(--sage-bg); border-left-color: var(--sage); }
.cal-post-paused, .cal-post-partial { background: var(--amber-bg); border-left-color: var(--amber); }
.cal-post-failed { background: var(--coral-bg); border-left-color: var(--coral); }
.cal-post-draft { background: var(--head); border-left-color: var(--muted); }
.cal-slot { display: block; font-size: 11px; line-height: 1.3; padding: 4px 6px; border-radius: 6px; border: 1px dashed var(--sage); color: var(--sage); background: rgba(230, 242, 234, .45); text-decoration: none; }
.cal-slot:hover { background: var(--sage-bg); }
.cal-slot-head { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.cal-slot-hint { display: block; color: var(--muted); margin-top: 2px; font-size: 10.5px; line-height: 1.25; }
.cal-branch-tag { display: inline-block; font-size: 10px; font-weight: 600; padding: 1px 5px; border-radius: 4px; background: var(--head); color: var(--ink); margin-right: 3px; }
.editor-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.emoji-panel { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px; margin-bottom: 8px; background: var(--zebra); border: 1px solid var(--line); border-radius: 8px; }
.emoji-btn { background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 4px 6px; font-size: 18px; line-height: 1; cursor: pointer; }
.emoji-btn:hover { background: var(--card); border-color: var(--line); }
.post-preview { margin-top: 8px; padding: 12px 14px; background: var(--zebra); border: 1px solid var(--line); border-radius: 10px; white-space: pre-wrap; line-height: 1.5; }
.impersonate-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 16px; border-radius: 10px; background: var(--amber-bg); border: 1px solid var(--amber); color: var(--ink); font-size: 14px; }
.post-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.post-photo { border: 1px solid var(--line); border-radius: 10px; padding: 6px; background: var(--zebra); }
.post-photo img { width: 100%; height: 110px; object-fit: cover; border-radius: 6px; display: block; margin-bottom: 6px; }
.suggestion-card { border-left: 3px solid var(--gold); }
