/* Файдес — стили (на основе uragents.ru: sidebar + светлый header + темно-синие акценты) */
:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f9fafc;
  --fg: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #6E4F96;
  --primary-dark: #5A3F7C;
  --primary-light: #efe9f7;
  --lilac: #7C5AA6;
  --lilac-deep: #6E4F96;
  --lilac-soft: #F7F4FC;
  --petrol: #0F5A63;
  --petrol-deep: #0B3D44;
  --petrol-light: #E2EFF0;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #1A7A85;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.08);
  --sidebar-w: 240px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PT Sans', Roboto, sans-serif; background: var(--bg); color: var(--fg); font-size: 14px; line-height: 1.5; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 12px; font-weight: 600; }
h1 { font-size: 24px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }

/* ============= LOGIN ============= */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; background: linear-gradient(135deg, #0B3D44 0%, #7C5AA6 100%); }
.login-card { background: white; border-radius: 16px; padding: 40px; max-width: 420px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.login-card .brand { text-align: center; margin-bottom: 32px; }
.login-card .brand__logo { font-size: 56px; margin-bottom: 8px; }
.login-card .brand h1 { font-size: 28px; margin: 0 0 4px; color: var(--primary); }
.login-card .brand__sub { color: var(--muted); margin: 0; font-size: 14px; }
.login-card label { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin: 16px 0 6px; text-transform: uppercase; letter-spacing: 0.05em; }
.login-card input { width: 100%; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 15px; transition: all 0.15s; }
.login-card input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.login-card button { width: 100%; margin-top: 24px; padding: 14px; background: var(--primary); color: white; border: none; border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer; transition: all 0.15s; }
.login-card button:hover { background: var(--primary-dark); }
.login-card .error { color: var(--danger); font-size: 13px; text-align: center; margin: 12px 0 0; min-height: 18px; }
.login-card .hint { margin-top: 24px; padding: 12px; background: var(--surface-2); border-radius: 6px; }
.login-card .hint summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.login-card .hint small { display: block; margin-top: 8px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.login-card .hint code { background: var(--border); padding: 2px 6px; border-radius: 4px; font-size: 11px; }

/* ============= LAYOUT ============= */
.app-layout { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; overflow-y: auto; }
.sidebar__brand { padding: 20px 20px 16px; border-bottom: 1px solid var(--border); }
.sidebar__brand h1 { font-size: 18px; color: var(--primary); margin: 0; }
.sidebar__brand small { color: var(--muted); font-size: 12px; }
.sidebar__section { padding: 16px 0 8px; }
.sidebar__section-title { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; padding: 0 20px 6px; font-weight: 600; }
.sidebar__link { display: flex; align-items: center; gap: 10px; padding: 10px 20px; color: var(--fg); font-size: 14px; cursor: pointer; transition: all 0.1s; border-left: 3px solid transparent; }
.sidebar__link:hover { background: var(--surface-2); text-decoration: none; }
.sidebar__link.is-active { background: var(--primary-light); color: var(--primary); border-left-color: var(--primary); font-weight: 500; }
.sidebar__link .ico { font-size: 18px; width: 20px; text-align: center; }
.sidebar__user { margin-top: auto; padding: 16px 20px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.sidebar__user-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary); color: white; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; }
.sidebar__user-info { flex: 1; min-width: 0; }
.sidebar__user-name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar__user-role { font-size: 11px; color: var(--muted); }
.sidebar__logout { background: none; border: none; cursor: pointer; color: var(--muted); padding: 4px; font-size: 16px; }
.sidebar__logout:hover { color: var(--danger); }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); padding: 24px 32px; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-header h1 { margin: 0; }
.page-header__actions { display: flex; gap: 8px; }

/* ============= BUTTONS ============= */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 1px solid var(--border); background: var(--surface); border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--fg); transition: all 0.1s; }
.btn:hover { background: var(--surface-2); }
.btn--primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn--primary:hover { background: var(--primary-dark); }
.btn--danger { color: var(--danger); border-color: var(--danger); }
.btn--danger:hover { background: var(--danger); color: white; }
.btn--success { color: var(--success); border-color: var(--success); }
.btn--small { padding: 4px 10px; font-size: 12px; }
.btn--lg { padding: 12px 20px; font-size: 15px; }

/* ============= CARDS ============= */
.card { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); padding: 20px; box-shadow: var(--shadow); }
.card__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.card__head h2, .card__head h3 { margin: 0; }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.dashboard-actions { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.dashboard-actions .btn { flex: 0 0 auto; }

/* ====== PERIOD SELECTOR ====== */
.period-selector {
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.period-selector__label { font-size: 13px; font-weight: 600; color: #6b7280; }
.period-selector__tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.period-tab {
  padding: 6px 12px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: #4b5563;
  cursor: pointer;
  transition: all .15s;
}
.period-tab:hover { background: #f3f4f6; border-color: #d1d5db; }
.period-tab--active { background: #0F5A63; color: #fff; border-color: #0F5A63; }
.period-tab--active:hover { background: #0B3D44; }
.period-selector__custom { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.period-selector__custom input[type="date"] { padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 12px; }
.period-selector__custom span { color: #9ca3af; font-size: 12px; }
.period-selector__current { width: 100%; font-size: 12px; color: #6b7280; padding-top: 4px; border-top: 1px solid #e5e7eb; }
.period-selector__current strong { color: #111827; }

/* ====== STAT CARD SUB ====== */
.stat-card__sub { font-size: 11px; color: #6b7280; margin-top: 4px; font-weight: 500; }
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.table-compact th, .table-compact td { padding: 6px 8px; font-size: 12px; }
.table-compact th { background: #f9fafb; font-weight: 600; text-align: left; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.stat-card__label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }
.stat-card__value { font-size: 28px; font-weight: 700; color: var(--fg); }
.stat-card__sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat-card--success .stat-card__value { color: var(--success); }
.stat-card--danger .stat-card__value { color: var(--danger); }
.stat-card--primary .stat-card__value { color: var(--primary); }

/* ============= TABLES ============= */
.table-wrap { overflow-x: auto; background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 12px 14px; background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--border); }
td { padding: 12px 14px; border-bottom: 1px solid var(--border); }
tr:hover td { background: var(--surface-2); }
tr:last-child td { border-bottom: none; }

/* ============= BADGES ============= */
.badge { display: inline-block; padding: 3px 8px; font-size: 11px; font-weight: 500; border-radius: 4px; background: var(--border); color: var(--fg); }
.badge--primary { background: var(--primary-light); color: var(--primary); }
.badge--success { background: #d1fae5; color: #065f46; }
.badge--warning { background: #fef3c7; color: #92400e; }
.badge--danger { background: #fee2e2; color: #991b1b; }
.badge--info { background: #E2EFF0; color: #0B3D44; }

/* ============= FORMS ============= */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.05em; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 14px; font-family: inherit; background: var(--surface); }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.form-group textarea { min-height: 80px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ============= MODAL ============= */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 24px; }
.modal { background: var(--surface); border-radius: 16px; max-width: 600px; width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal__head { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal__head h2 { margin: 0; font-size: 18px; }
.modal__close { background: none; border: none; cursor: pointer; font-size: 24px; color: var(--muted); }
.modal__body { padding: 24px; }
.modal__foot { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ============= TOAST ============= */
.toast-host { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; box-shadow: var(--shadow-lg); font-size: 13px; min-width: 240px; max-width: 400px; animation: slideIn 0.2s ease-out; }
.toast--success { border-left: 3px solid var(--success); }
.toast--error { border-left: 3px solid var(--danger); }
.toast--info { border-left: 3px solid var(--info); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ============= EMPTY ============= */
.empty { text-align: center; padding: 60px 24px; color: var(--muted); }
.empty__ico { font-size: 48px; margin-bottom: 12px; opacity: 0.4; }
.empty__title { font-size: 16px; font-weight: 500; margin-bottom: 4px; color: var(--fg); }
.empty__sub { font-size: 13px; }

/* ============= TABS ============= */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.tabs::-webkit-scrollbar { height: 6px; }
.tabs::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
.tab { padding: 10px 16px; background: none; border: none; cursor: pointer; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; transition: all 0.1s; }
.tab.is-active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }
.tab:hover:not(.is-active) { color: var(--fg); }

/* ============= FILTERS ============= */
.filters { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.filters input, .filters select { padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }

/* ============= LIST ITEM ============= */
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.1s; }
.list-item:hover { background: var(--surface-2); }
.list-item__avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; flex-shrink: 0; }
.list-item__body { flex: 1; min-width: 0; }
.list-item__title { font-weight: 500; font-size: 14px; margin-bottom: 2px; }
.list-item__sub { font-size: 12px; color: var(--muted); }
.list-item__meta { font-size: 12px; color: var(--muted); }

/* ============= DASHBOARD ============= */
.dashboard-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
@media (max-width: 1024px) { .dashboard-grid { grid-template-columns: 1fr; } }

/* ============= CLIENT CARD 2-COL ============= */
.client-grid { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
.client-main { min-width: 0; }
.client-aside { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; }
.client-aside .card { font-size: 13px; }
.client-aside .card h3 { font-size: 13px; }
/* Двухколонная карточка держится как можно дольше: сайдбар с блоками
   (Контакты, Судебные данные, РПО, Дела, Договоры, Команда) остаётся справа
   от «Что будет сделано» — так карточка компактнее и не вытягивается вниз. */
/* Блоки справа (Контакты, Судебные данные, РПО, Дела, Команда) держатся справа до 901 px —
   так просил Вероника 22.10 и снова 30.10: «верни обратно справа». На «План и факт» при
   узкой ширине остаётся мало места, поэтому таблица прокручивается по горизонтали
   (.pf-table min-width + .pf-block overflow-x) — колонки «сделано»/«будет» не слипаются. */
@media (max-width: 1180px) and (min-width: 901px) {
  .client-grid { grid-template-columns: minmax(0, 1fr) 236px; gap: 12px; }
  /* правые блоки (Контакты, Дела, РПО, Команда) — компактными «квадратиками» */
  .client-aside .card { padding: 8px 10px; margin-bottom: 8px; font-size: 12px; }
  .client-aside .card h3 { font-size: 12px; margin-bottom: 6px !important; }
}
@media (max-width: 900px) {
  .client-grid { grid-template-columns: 1fr; }
  .client-aside { position: static; max-height: none; overflow: visible; }
}
@media (max-width: 768px) {
  .client-topbar { flex-direction: column; align-items: stretch; }
  .client-topbar > div { display: flex; flex-wrap: wrap; gap: 4px; }
  .client-topbar button { font-size: 12px; padding: 6px 10px; }
}

/* ============= KANBAN (заготовка) ============= */
.kanban { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.kanban__col { background: var(--surface-2); border-radius: 8px; padding: 12px; min-height: 200px; }
.kanban__col-title { font-weight: 600; font-size: 13px; margin-bottom: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* ============= RESPONSIVE ============= */
/* Документ никогда не уезжает вбок: широкие таблицы и панели скроллятся внутри себя */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
@media (max-width: 900px) {
  html, body { overflow-x: hidden; }
  .table-overview { min-width: 700px; }
  .card, .dashboard-grid, .client-grid { max-width: 100%; }
  /* Таймер не должен накрывать кнопки внизу экрана */
  /* Панель периодов и фильтров переносится, кнопки не режутся */
  .card > div[style*="flex-wrap"] > button { white-space: nowrap; }
  .form-row > div, .form-row-3 > div { min-width: 0; }
  .table-overview { font-size: 12px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr !important; }
  .page-header__actions { gap: 6px; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.2s; z-index: 100; }
  .sidebar.is-open { transform: translateX(0); }
  .main { margin-left: 0; padding: 16px; }
  .page-header, .page-title, .page-header h1 { padding-left: 48px; }
  .page-header__actions { padding-left: 48px; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
}

.mobile-burger { display: none; }
@media (max-width: 768px) {
  .mobile-burger { display: inline-flex; position: fixed; top: 12px; left: 12px; z-index: 101; background: var(--primary); color: white; border: none; border-radius: 8px; width: 40px; height: 40px; align-items: center; justify-content: center; font-size: 20px; cursor: pointer; }
}

/* ============= 10 НОВЫХ ФИШЕК — СТИЛИ ============= */

/* ===== Канбан ===== */
.kanban-board { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; padding: 8px 0; }
.kanban-col { background: #f5f7fb; border-radius: 12px; padding: 12px; min-height: 400px; }
.kanban-col__head { font-weight: 600; font-size: 14px; color: #1a1f36; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; }
.kanban-col__count { background: #fff; padding: 2px 10px; border-radius: 12px; font-size: 12px; color: #6b7280; }
.kanban-col__list { min-height: 200px; transition: background 0.2s; padding: 4px; border-radius: 8px; }
.kanban-col__list.is-over { background: #e0e7ff; }
.kanban-card { background: #fff; border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); cursor: grab; border-left: 4px solid #7C5AA6; transition: transform 0.15s, box-shadow 0.15s; }
.kanban-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.kanban-card.is-dragging { opacity: 0.5; }
.kanban-card__title { font-weight: 600; font-size: 14px; color: #1a1f36; margin-bottom: 4px; }
.kanban-card__sub { font-size: 12px; color: #6b7280; margin-bottom: 2px; }
.kanban-card__foot { display: flex; justify-content: space-between; font-size: 11px; color: #6b7280; margin-top: 8px; padding-top: 8px; border-top: 1px solid #e5e7eb; }
.kanban-empty { color: #9ca3af; font-size: 12px; text-align: center; padding: 16px 0; }

/* ===== Ctrl+K Поиск ===== */
.search-modal { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: flex-start; justify-content: center; padding-top: 10vh; }
.search-modal__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px); }
.search-modal__panel { position: relative; background: #fff; border-radius: 16px; padding: 20px; width: 90%; max-width: 600px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.search-modal__panel input { width: 100%; padding: 14px 16px; font-size: 16px; border: 2px solid #e5e7eb; border-radius: 10px; outline: none; }
.search-modal__panel input:focus { border-color: #7C5AA6; }
.search-modal__results { margin-top: 12px; max-height: 50vh; overflow-y: auto; }
.search-modal__hint { font-size: 12px; color: #9ca3af; text-align: center; margin-top: 12px; padding-top: 12px; border-top: 1px solid #e5e7eb; }
.search-result { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 8px; cursor: pointer; transition: background 0.1s; }
.search-result.is-selected, .search-result:hover { background: #f0f1ff; }
.search-result__type { font-size: 11px; color: #6b7280; padding: 2px 8px; background: #f3f4f6; border-radius: 12px; }
.search-result__main { flex: 1; }
.search-result__main .t { font-weight: 600; color: #1a1f36; }
.search-result__main .s { font-size: 12px; color: #6b7280; }

/* ===== Таймер ===== */
.timer-fab { position: fixed; bottom: 24px; right: 24px; width: 56px; height: 56px; background: linear-gradient(135deg, #7C5AA6, #8C6BB8); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 24px; cursor: pointer; box-shadow: 0 6px 20px rgba(72, 52, 212, 0.4); z-index: 1000; transition: transform 0.15s; }
.timer-fab:hover { transform: scale(1.08); }
.timer-widget { position: fixed; bottom: 24px; right: 24px; background: #fff; border-radius: 14px; padding: 12px 16px; display: flex; align-items: center; gap: 12px; box-shadow: 0 6px 20px rgba(0,0,0,0.15); z-index: 1000; min-width: 280px; border-left: 4px solid #16a34a; animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 6px 20px rgba(22, 163, 74, 0.2); } 50% { box-shadow: 0 6px 30px rgba(22, 163, 74, 0.4); } }
.timer-widget__icon { font-size: 24px; }
.timer-widget__info { flex: 1; }
.timer-widget__label { font-size: 12px; color: #6b7280; }
.timer-widget__time { font-size: 20px; font-weight: 700; color: #16a34a; font-family: monospace; }
.timer-widget__stop { background: #fee2e2; color: #dc2626; border: none; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.timer-widget__stop:hover { background: #fecaca; }

/* ===== Сроки ===== */
.deadlines-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-chip { padding: 6px 14px; background: #fff; border: 1px solid #e5e7eb; border-radius: 20px; cursor: pointer; font-size: 13px; color: #6b7280; }
.filter-chip.is-active { background: #7C5AA6; color: #fff; border-color: #7C5AA6; }
.deadlines-list { display: flex; flex-direction: column; gap: 10px; }
.deadline-card { display: flex; align-items: center; gap: 16px; background: #fff; border-radius: 12px; padding: 14px 18px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); border-left: 4px solid #6b7280; }
.deadline-card.urgency-overdue { border-left-color: #dc2626; background: #fef2f2; }
.deadline-card.urgency-urgent { border-left-color: #ea580c; background: #fff7ed; }
.deadline-card.urgency-soon { border-left-color: #ca8a04; }
.deadline-card.urgency-normal { border-left-color: #16a34a; }
.deadline-card__date { text-align: center; min-width: 70px; }
.deadline-card__date .d { font-size: 24px; font-weight: 700; color: #1a1f36; }
.deadline-card__date .l { font-size: 10px; color: #6b7280; text-transform: uppercase; }
.deadline-card__body { flex: 1; }
.deadline-card__title { font-weight: 600; color: #1a1f36; }
.deadline-card__sub { font-size: 13px; color: #6b7280; margin-top: 2px; }
.deadline-card__type { font-size: 11px; color: #7C5AA6; margin-top: 4px; }

/* ===== Выручка ===== */
.period-tabs { display: flex; gap: 6px; }
.revenue-content { padding: 8px 0; }
.revenue-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 24px; }
.revenue-summary__card { background: linear-gradient(135deg, #f0f9ff, #e0f2fe); padding: 18px 22px; border-radius: 12px; border-left: 4px solid #145F68; }
.revenue-summary__card .l { color: #0c4a6e; font-size: 12px; text-transform: uppercase; }
.revenue-summary__card .v { color: #0c4a6e; font-size: 24px; font-weight: 700; margin-top: 4px; }
.revenue-bars { display: flex; flex-direction: column; gap: 14px; }
.revenue-bar { background: #fff; border-radius: 12px; padding: 14px 18px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.revenue-bar__head { display: flex; justify-content: space-between; margin-bottom: 6px; }
.revenue-bar__val { font-weight: 700; color: #16a34a; }
.revenue-bar__track { height: 10px; background: #f3f4f6; border-radius: 5px; overflow: hidden; }
.revenue-bar__fill { height: 100%; background: linear-gradient(90deg, #7C5AA6, #8C6BB8); border-radius: 5px; transition: width 0.5s; }
.revenue-bar__foot { display: flex; justify-content: space-between; font-size: 12px; color: #6b7280; margin-top: 6px; }

/* ===== Публичные ссылки ===== */
.public-links-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.public-link-card { background: #fff; border-radius: 10px; padding: 12px 16px; display: flex; align-items: center; gap: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.public-link-card__url { flex: 1; }
.public-link-card__url a { font-family: monospace; color: #7C5AA6; text-decoration: none; font-weight: 600; }
.public-link-card__meta { font-size: 12px; color: #6b7280; }

/* ===== Чек-лист ===== */
.checklist-templates { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; padding: 12px; background: #f9fafb; border-radius: 10px; }
.checklist-templates .muted { font-size: 13px; margin-right: 4px; }
.checklist-progress { height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; margin: 8px 0; }
.checklist-progress__bar { height: 100%; background: linear-gradient(90deg, #16a34a, #22c55e); transition: width 0.3s; }
.checklist-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: #fff; border-radius: 8px; margin-bottom: 6px; box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
.checklist-item.is-done { opacity: 0.6; text-decoration: line-through; }
.checklist-item input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; }
.checklist-item span { flex: 1; }
.checklist-item button { background: transparent; border: none; cursor: pointer; opacity: 0.4; }
.checklist-item button:hover { opacity: 1; }

/* ===== Скан/OCR ===== */
.scan-form { background: #fff; border-radius: 10px; padding: 18px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.scan-form textarea { width: 100%; padding: 12px; border: 1px solid #e5e7eb; border-radius: 8px; font-family: inherit; resize: vertical; }
.scan-result { background: linear-gradient(135deg, #f0fdf4, #dcfce7); border-radius: 10px; padding: 18px; }
.scan-result h3 { margin: 0 0 12px; color: #166534; }
.scan-field { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid rgba(22, 163, 74, 0.2); }
.scan-field:last-of-type { border: 0; }
.scan-field .l { color: #166534; font-weight: 600; text-transform: capitalize; }
.scan-field .v { color: #1a1f36; font-family: monospace; }

/* ===== AI-резюме ===== */
.ai-summary { background: linear-gradient(135deg, #faf5ff, #F5EFFB); border-radius: 12px; padding: 20px 24px; margin-bottom: 16px; border-left: 4px solid #9333ea; }
.ai-summary__text p { margin: 0 0 10px; line-height: 1.6; color: #1a1f36; }
.ai-summary__text p:last-child { margin-bottom: 0; }

/* ===== Прочие мелочи ===== */
.muted { color: #6b7280; font-size: 13px; }
.btn--small { padding: 4px 10px; font-size: 12px; }
.btn--danger { background: #fee2e2; color: #dc2626; }
.btn--danger:hover { background: #fecaca; }

/* ============= CLIENT LINK (кликабельное ФИО) ============= */
.client-link { color: var(--primary); text-decoration: none; font-weight: 500; }
.client-link:hover { text-decoration: underline; color: var(--primary-dark); }

/* ============= TABLE OVERVIEW (договоры/объединённый вид) ============= */
.table-overview { width: 100%; min-width: 1100px; border-collapse: collapse; font-size: 13px; }
.table-overview thead { background: #f3f4f6; }
.table-overview th { padding: 10px 12px; text-align: left; font-weight: 600; color: #6b7280; text-transform: uppercase; font-size: 11px; letter-spacing: 0.05em; border-bottom: 2px solid #e5e7eb; white-space: nowrap; }
.table-overview td { padding: 8px 12px; border-bottom: 1px solid #f3f4f6; vertical-align: top; }
.table-overview tr:hover { background: #fafbfc; }
.table-overview .badge { font-size: 11px; padding: 3px 8px; border-radius: 10px; display: inline-block; white-space: nowrap; }

/* ============= AUDIT LOG ============= */
.audit-list { display: flex; flex-direction: column; gap: 18px; }
.audit-day__head { font-size: 14px; color: var(--muted); margin: 0 0 8px; display: flex; align-items: center; gap: 10px; }
.audit-day__count { font-size: 12px; color: #9ca3af; font-weight: 400; }
.audit-row { display: grid; grid-template-columns: 60px 180px 220px 140px 1fr; gap: 10px; padding: 8px 12px; border-radius: 8px; background: #fafbfc; align-items: center; font-size: 13px; margin-bottom: 4px; }
.audit-row__time { font-family: monospace; color: #6b7280; font-size: 12px; }
.audit-row__user { font-weight: 500; color: #111827; }
.audit-row__short { font-size: 11px; color: #9ca3af; margin-left: 4px; }
.audit-row__action { color: #374151; }
.audit-row__entity { color: #6b7280; font-size: 12px; }
.audit-row__details { color: #9ca3af; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 900px) {
  .audit-row { grid-template-columns: 1fr; gap: 4px; }
  .table-overview { min-width: 700px; }
}

/* ============= CALENDAR (новый формат) ============= */
.cal-page { padding: 0; }
.cal-layout { display: grid; grid-template-columns: 260px 1fr; gap: 16px; padding: 0 24px 24px; }
.cal-layout--manager { grid-template-columns: 1fr 260px; }

/* Левая колонка — юрист/представитель */
.cal-sidebar { display: flex; flex-direction: column; gap: 16px; }
.mini-cal { background: var(--surface); border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); padding: 10px; }
.mini-cal__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.mini-cal__nav { background: none; border: none; cursor: pointer; font-size: 13px; color: var(--muted); padding: 2px 6px; border-radius: 4px; }
.mini-cal__nav:hover { background: #f3f4f6; }
.mini-cal__title { font-weight: 600; font-size: 12px; letter-spacing: 0.05em; }
.mini-cal__week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; margin-bottom: 2px; font-size: 10px; color: var(--muted); text-align: center; }
.mini-cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; }
.cal-cell { aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 11px; cursor: pointer; border-radius: 4px; position: relative; transition: background 0.15s; }
.cal-cell:hover { background: #f3f4f6; }
.cal-cell--empty { cursor: default; }
.cal-cell--today { font-weight: 700; color: var(--primary); }
.cal-cell--selected { background: var(--primary); color: #fff; }
.cal-cell--selected .cal-cell__count { background: rgba(255,255,255,0.3); color: #fff; }
.cal-cell__day { line-height: 1; }
.cal-cell__count { position: absolute; top: 1px; right: 1px; font-size: 8px; background: #d1fae5; color: #065f46; border-radius: 6px; padding: 0 3px; line-height: 1.3; min-width: 10px; text-align: center; }

/* Офисный селектор */
.office-selector { display: flex; flex-direction: column; gap: 8px; }
.office-btn { background: linear-gradient(135deg, #8b5cf6, #6E4F96); color: #fff; border: none; padding: 10px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 500; transition: transform 0.1s; }
.office-btn:hover { transform: translateY(-1px); }
.office-btn--active { box-shadow: 0 0 0 3px #C9B8E6; }

/* Статусные карточки */
.status-cards { display: flex; flex-direction: column; gap: 8px; }
.status-card { border-radius: 12px; padding: 16px; color: #fff; display: grid; grid-template-columns: 50px 1fr auto; gap: 8px; align-items: center; }
.status-card__face { font-size: 32px; text-align: center; }
.status-card__label { font-size: 13px; opacity: 0.95; }
.status-card__count { font-size: 32px; font-weight: 700; line-height: 1; }

/* Правая колонка — менеджер */
.manager-stats { background: var(--surface); border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); padding: 20px; display: flex; flex-direction: column; gap: 16px; width: 320px; max-width: 100%; }
.manager-stats__head { font-size: 16px; font-weight: 600; }
.manager-stats__date { font-size: 13px; color: var(--muted); }
.manager-stats__period { display: flex; gap: 4px; padding: 4px; background: #f3f4f6; border-radius: 8px; }
.period-tab { flex: 1; background: none; border: none; padding: 6px; border-radius: 6px; font-size: 12px; cursor: pointer; color: var(--muted); }
.period-tab--active { background: #fff; color: var(--primary); box-shadow: 0 1px 2px rgba(0,0,0,0.1); }
.manager-stats__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ms-card { border-radius: 10px; padding: 12px; color: #fff; }
.ms-card--blue { background: linear-gradient(135deg, #1A7A85, #0B3D44); }
.ms-card--green { background: linear-gradient(135deg, #10b981, #047857); }
.ms-card--orange { background: linear-gradient(135deg, #f59e0b, #b45309); }
.ms-card--violet { background: linear-gradient(135deg, #8b5cf6, #6E4F96); }
.ms-card__label { font-size: 11px; opacity: 0.9; text-transform: uppercase; letter-spacing: 0.05em; }
.ms-card__value { font-size: 22px; font-weight: 700; line-height: 1.2; margin-top: 4px; }

/* Расписание */
.cal-main { background: var(--surface); border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); overflow: hidden; }
.schedule__head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.schedule__title { font-size: 15px; font-weight: 600; }
.schedule__date { font-size: 13px; color: var(--muted); }
.schedule__body { padding: 8px 0; }
.hour-row { display: grid; grid-template-columns: 64px 1fr; padding: 4px 12px; border-bottom: 1px solid #f9fafb; min-height: 36px; align-items: start; }
.hour-row__time { font-weight: 600; color: var(--muted); font-size: 12px; padding-top: 4px; }
.hour-row__count { font-size: 10px; color: #9ca3af; margin-top: 1px; }
.hour-row__cards { display: flex; flex-direction: column; gap: 4px; }

/* Карточка события */
.ev-card { border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.ev-card--ref { display: block; margin-bottom: 4px; cursor: pointer; }
.ev-card--ref:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.ev-card--ref .ev-card__head { padding: 4px 10px; display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: #fff; gap: 6px; }
.ev-card--ref .ev-card__head .ev-card__right { display: flex; align-items: center; gap: 6px; flex: 1; justify-content: flex-end; min-width: 0; }
.ev-card--ref .ev-card__time { font-weight: 700; }
.ev-card--ref .ev-card__status { font-weight: 500; opacity: 0.95; }
.ev-card--ref .ev-card__goal { font-size: 10px; background: rgba(255,255,255,0.22); padding: 2px 6px; border-radius: 8px; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-card--ref .ev-card__body { padding: 6px 10px; background: #fff; display: flex; flex-direction: column; gap: 2px; }
.ev-card--ref .ev-card__line { font-size: 11px; color: #374151; line-height: 1.5; display: flex; align-items: center; gap: 6px; }
.ev-card--ref .ev-card__line a { color: #1976d2; text-decoration: none; }
.ev-card--ref .ev-card__icon { display: inline-block; width: 14px; text-align: center; flex-shrink: 0; }
.ev-card--mini { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 12px; font-size: 11px; background: #fff; }
.ev-card--mini .ev-card__dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.ev-card--mini .ev-card__name { font-weight: 600; }
.ev-card--mini .ev-card__time { font-size: 10px; color: var(--muted); }
.ev-card--mini .ev-card__person { font-size: 10px; }
.ev-card__head { padding: 3px 8px; display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: #fff; }
.ev-card__time { font-weight: 600; }
.ev-card__body { padding: 5px 8px; background: #fff; display: flex; flex-direction: column; gap: 2px; }
.ev-card__name { font-weight: 600; font-size: 12px; color: #111827; }
.ev-card__line { font-size: 11px; color: var(--muted); }
.ev-card__line a { color: #1976d2; text-decoration: none; }
.ev-card__actions { padding: 4px 8px; background: #fafbfc; border-top: 1px solid #f3f4f6; }
.ev-card__select { width: 100%; padding: 3px 5px; border: 1px solid var(--border); border-radius: 4px; font-size: 11px; background: #fff; }

/* Цвета карточек по статусу */
.ev-card--office .ev-card__head { background: #10b981; }
.ev-card--wait .ev-card__head { background: #f59e0b; }
.ev-card--noshow .ev-card__head { background: #84cc16; }
.ev-card--signed .ev-card__head { background: #d946ef; }
.ev-card--issue .ev-card__head { background: #06b6d4; }
.ev-card--topay .ev-card__head { background: #1A7A85; }
.ev-card--consult .ev-card__head { background: #8b5cf6; }
.ev-card--court .ev-card__head { background: #ef4444; }
.ev-card--default .ev-card__head { background: #6b7280; }

@media (max-width: 1100px) {
  .cal-layout, .cal-layout--manager { grid-template-columns: 1fr; }
}

/* ============= CALENDAR: селектор периода ============= */
.period-block { background: var(--surface); border-radius: 10px; padding: 10px 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.period-block__title { font-size: 11px; text-transform: uppercase; color: var(--muted); letter-spacing: 0.05em; margin-bottom: 6px; }
.period-block .period-tab { width: 100%; padding: 6px; font-size: 12px; background: #f3f4f6; border: none; border-radius: 6px; margin-bottom: 4px; cursor: pointer; color: var(--muted); }
.period-block .period-tab--active { background: var(--primary); color: #fff; }
.period-block .period-tab:last-child { margin-bottom: 0; }

/* ============= CALENDAR: финансовые карточки ============= */
.fin-cards { display: flex; flex-direction: column; gap: 6px; }
.fin-card { display: grid; grid-template-columns: 32px 1fr 48px; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; color: #fff; cursor: pointer; transition: transform 0.1s; }
.fin-card:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,0.12); }
.fin-card--paid { background: linear-gradient(135deg, #10b981, #047857); }
.fin-card--waiting { background: linear-gradient(135deg, #f59e0b, #b45309); }
.fin-card--cancelled { background: linear-gradient(135deg, #ef4444, #991b1b); }
.fin-card__face { font-size: 20px; text-align: center; }
.fin-card__label { font-size: 12px; opacity: 0.95; }
.fin-card__sum { font-size: 11px; opacity: 0.85; margin-top: 1px; }
.fin-card__count { font-size: 24px; font-weight: 700; text-align: right; line-height: 1; }

/* ============= CALENDAR: список актов ============= */
.acts-block { background: var(--surface); border-radius: 10px; padding: 10px 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.acts-block__title { font-size: 11px; text-transform: uppercase; color: var(--muted); letter-spacing: 0.05em; margin-bottom: 8px; }
.acts-block__empty { color: var(--muted); font-size: 12px; text-align: center; padding: 12px 0; }
.acts-block__list { display: flex; flex-direction: column; gap: 4px; max-height: 280px; overflow-y: auto; }
.act-row { display: grid; grid-template-columns: 56px 1fr auto; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 12px; }
.act-row:hover { background: #f3f4f6; }
.act-row__date { color: var(--muted); font-weight: 600; }
.act-row__client { font-weight: 500; color: #111827; }
.act-row__num { color: var(--muted); font-size: 11px; }
.act-row__sum { font-weight: 600; color: #047857; }

/* ============= CALENDAR: модалка с клиентами ============= */
.modal-clients { display: flex; flex-direction: column; gap: 12px; }
.modal-clients__head { font-size: 14px; color: var(--muted); }
.modal-clients__table { width: 100%; border-collapse: collapse; }
.modal-clients__table th { text-align: left; padding: 8px 6px; border-bottom: 2px solid var(--border); font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.modal-clients__table td { padding: 8px 6px; border-bottom: 1px solid #f3f4f6; font-size: 13px; vertical-align: top; }
.modal-clients__table tbody tr:hover { background: #f9fafb; }

/* Rep без левой колонки: mini-cal уменьшаем */
.cal-sidebar--rep { width: 320px; }

/* ============= CALENDAR: range picker ============= */
.range-block { background: var(--surface); border-radius: 10px; padding: 10px 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.range-block__title { font-size: 11px; text-transform: uppercase; color: var(--muted); letter-spacing: 0.05em; margin-bottom: 6px; }
.range-block__inputs { display: flex; align-items: center; gap: 4px; }
.range-block__inputs input[type="date"] { flex: 1; padding: 5px 6px; border: 1px solid var(--border); border-radius: 6px; font-size: 12px; font-family: inherit; background: #fff; min-width: 0; }
.range-block__sep { color: var(--muted); font-size: 12px; }
.range-block__apply { width: 100%; margin-top: 6px; padding: 6px 10px; background: var(--primary); color: #fff; border: none; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; }
.range-block__apply:hover { filter: brightness(0.95); }
.range-block__quick { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 6px; }
.range-block__quick button { padding: 4px 6px; font-size: 11px; background: #f3f4f6; border: 1px solid var(--border); border-radius: 5px; cursor: pointer; color: var(--muted); }
.range-block__quick button:hover { background: #e5e7eb; color: #111827; }

/* Бейджи людей в карточке события */
.ev-card__line { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.ev-person { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; line-height: 1.4; }
.ev-person--jur { background: #E2EFF0; color: #0B3D44; border: 1px solid #B9D5D8; }
.ev-person--rep { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.ev-person--both { background: linear-gradient(135deg, #E2EFF0 0%, #fef3c7 100%); color: #581c87; border: 1px solid #a78bfa; }

/* ============= NOTIFICATIONS BELL ============= */
.bell { position: relative; background: transparent; border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; cursor: pointer; font-size: 18px; line-height: 1; transition: all 0.15s; }
.bell:hover { background: var(--surface-2); }
.bell__badge { position: absolute; top: -2px; right: -2px; min-width: 18px; height: 18px; padding: 0 5px; background: #dc2626; color: #fff; border-radius: 9px; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px #fff; }
.notif-panel { position: fixed; top: 60px; right: 16px; width: 360px; max-height: 70vh; background: #fff; border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,0.18); z-index: 1000; overflow-y: auto; padding: 8px 0; }
.notif-section__head { padding: 8px 16px 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.notif-item { display: flex; gap: 10px; padding: 10px 16px; text-decoration: none; color: var(--fg); border-top: 1px solid #f3f4f6; transition: background 0.1s; }
.notif-item:hover { background: #f9fafb; }
.notif-item__icon { font-size: 18px; flex-shrink: 0; width: 24px; text-align: center; }
.notif-item__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notif-item__title { font-size: 13px; font-weight: 600; color: #111827; }
.notif-item__sub { font-size: 11px; color: #6b7280; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-empty { padding: 32px 16px; text-align: center; color: #6b7280; font-size: 14px; }

/* ============= TIMELINE (карточка клиента) ============= */
.timeline { position: relative; padding: 8px 0 8px 24px; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 0; bottom: 0; width: 2px; background: linear-gradient(180deg, #d1d5db 0%, #e5e7eb 100%); }
.tl-item { position: relative; padding: 8px 12px; margin-bottom: 6px; background: #fff; border-radius: 8px; border: 1px solid #e5e7eb; }
.tl-item::before { content: ''; position: absolute; left: -20px; top: 14px; width: 12px; height: 12px; border-radius: 50%; background: #9ca3af; box-shadow: 0 0 0 2px #fff; }
.tl-item--done { opacity: 0.7; background: #f9fafb; }
.tl-item--done::before { background: #16a34a; }
.tl-item--today::before { background: #f59e0b; box-shadow: 0 0 0 2px #fff, 0 0 0 5px rgba(245,158,11,0.3); }
.tl-item--overdue { background: #fef2f2; border-color: #fecaca; }
.tl-item--overdue::before { background: #dc2626; box-shadow: 0 0 0 2px #fff, 0 0 0 5px rgba(220,38,38,0.3); animation: pulse-red 1.5s infinite; }
.tl-item--future { background: #EAF3F4; border-color: #bfdbfe; }
.tl-item--future::before { background: #1A7A85; }
@keyframes pulse-red { 0%, 100% { box-shadow: 0 0 0 2px #fff, 0 0 0 5px rgba(220,38,38,0.3); } 50% { box-shadow: 0 0 0 2px #fff, 0 0 0 8px rgba(220,38,38,0.1); } }
.tl-item__head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.tl-item__title { font-weight: 600; font-size: 13px; color: #111827; }
.tl-item__date { font-size: 11px; color: #6b7280; white-space: nowrap; }
.tl-item__sub { font-size: 12px; color: #4b5563; line-height: 1.4; }
.tl-item__status { display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 10px; font-weight: 600; text-transform: uppercase; margin-left: 4px; }
.tl-item__status--done { background: #d1fae5; color: #065f46; }
.tl-item__status--overdue { background: #fee2e2; color: #991b1b; }
.tl-item__status--today { background: #fef3c7; color: #92400e; }
.tl-item__status--future { background: #E2EFF0; color: #0B3D44; }

/* ============= DOCUMENT THUMBS ============= */
.doc-thumb { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px; background: #fff; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; transition: all 0.15s; width: 110px; text-align: center; }
.doc-thumb:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(0,0,0,0.08); transform: translateY(-1px); }
.doc-thumb__icon { font-size: 32px; }
.doc-thumb__name { font-size: 11px; color: #374151; line-height: 1.2; max-height: 28px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.doc-thumb__date { font-size: 10px; color: #9ca3af; }
.docs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }

/* ============= ALL CASES (Менеджер) ============= */
.all-cases { display: flex; flex-direction: column; gap: 12px; }
.all-cases__legend { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; background: #fff; padding: 8px 14px; border-radius: 8px; font-size: 12px; color: #4b5563; }
.all-cases__legend-item { display: inline-flex; align-items: center; gap: 6px; }
.all-cases__legend-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.all-cases__filter { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: #f9fafb; padding: 10px 14px; border-radius: 8px; }
.all-cases__filter input, .all-cases__filter select { padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; font-family: inherit; font-size: 13px; }
.case-row { background: #fff; border-radius: 10px; padding: 12px 16px; border-left: 4px solid #e5e7eb; transition: all 0.15s; cursor: pointer; }
.case-row:hover { background: #f9fafb; border-left-color: var(--primary); }
.case-row--urgent { border-left-color: #dc2626; }
.case-row--warning { border-left-color: #f59e0b; }
.case-row__head { display: flex; justify-content: space-between; align-items: start; gap: 8px; margin-bottom: 6px; }
.case-row__client { font-weight: 600; font-size: 14px; color: #111827; }
.case-row__sub { font-size: 12px; color: #6b7280; margin-top: 2px; }
.case-row__meta { display: flex; gap: 8px; flex-wrap: wrap; font-size: 11px; color: #4b5563; }
.case-row__meta-item { display: inline-flex; align-items: center; gap: 3px; padding: 2px 6px; background: #f3f4f6; border-radius: 4px; }
.case-row__next { font-size: 12px; color: #dc2626; margin-top: 4px; font-weight: 500; }

/* ============= АДАПТИВНОСТЬ ДЛЯ ПОЖИЛЫХ ============= */
@media (min-width: 1280px) {
  body { font-size: 15px; }
  .btn { padding: 8px 14px; font-size: 14px; }
  .form-group label { font-size: 13px; }
  .form-group input, .form-group select, .form-group textarea { font-size: 14px; padding: 8px 10px; }
}

/* === Календарь: маленький слева + большая колонка справа с секциями === */
.cal-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  align-items: start;
}
.cal-layout--manager {
  grid-template-columns: 280px minmax(0, 1fr) auto;
}
.cal-sidebar {
  position: sticky;
  top: 8px;
  align-self: start;
}
.cal-main {
  min-width: 0;
  max-height: none;
  overflow-y: visible;
}

/* Секции внутри main */
.cal-section {
  background: var(--surface, #fff);
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
}
.cal-section__head {
  margin: 0 0 10px 0;
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 6px;
}
.cal-section__count {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
}
.cal-section__empty {
  color: #9ca3af;
  font-size: 12px;
  padding: 16px 8px;
  text-align: center;
  font-style: italic;
}
.cal-section__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}

/* Мини-карточка */
.cal-mini-card {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) 28px;
  gap: 8px;
  align-items: start;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 3px solid #1A7A85;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
}
.cal-mini-card:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}
.cal-mini-card__when {
  font-size: 11px;
  font-weight: 600;
  color: #1A7A85;
  white-space: nowrap;
}
.cal-mini-card__body {
  min-width: 0;
}
.cal-mini-card__client {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  text-decoration: none;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: anywhere;
}
.cal-mini-card__client:hover { text-decoration: underline; }
.cal-mini-card__where {
  font-size: 11px;
  color: #475569;
  margin-top: 2px;
}
.cal-mini-card__purpose {
  font-size: 11px;
  color: #6b7280;
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cal-mini-card__team {
  font-size: 10px;
  color: #475569;
  margin-top: 4px;
}
.cal-mini-card__edit {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 2px;
  color: #64748b;
  align-self: start;
}
.cal-mini-card__edit:hover { color: #0f172a; }

/* Знак судебного заседания */
.cal-mini-card--court {
  border-left: 3px solid #ef4444;
  background: #fef2f2;
}
.cal-mini-card--court .cal-mini-card__when { color: #dc2626; }
.cal-mini-card__tag {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #b91c1c;
  background: #fee2e2;
  border: 1px solid #fecaca;
  border-radius: 4px;
  padding: 1px 5px;
  margin-bottom: 3px;
  white-space: nowrap;
}
.ev-card__court {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #fff;
  background: rgba(0, 0, 0, 0.28);
  border-radius: 4px;
  padding: 1px 5px;
  white-space: nowrap;
}

/* Цветовые акценты для разных секций */
.cal-section:has(.cal-mini-card) { border-left: 4px solid #cbd5e1; }
.cal-section:nth-of-type(2) { border-left-color: #1A7A85; }
.cal-section:nth-of-type(3) { border-left-color: #7C5AA6; }
.cal-section:nth-of-type(4) { border-left-color: #16a34a; }

/* === Нижние секции (выезда/суды/документы) — компактно === */
.cal-bottom-sections {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.cal-bottom-sections .cal-section {
  margin-bottom: 0;
  padding: 8px;
}
.cal-bottom-sections .cal-section__head {
  font-size: 12px;
  margin-bottom: 6px;
}
.cal-bottom-sections .cal-section__list {
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  max-height: none;
  overflow-y: visible;
  padding-right: 4px;
}
.cal-bottom-sections .cal-mini-card {
  padding: 4px 6px;
  grid-template-columns: 60px minmax(0, 1fr) 22px;
  font-size: 11px;
}
.cal-bottom-sections .cal-mini-card__client {
  font-size: 11px;
}
.cal-bottom-sections .cal-mini-card__where,
.cal-bottom-sections .cal-mini-card__purpose,
.cal-bottom-sections .cal-mini-card__team {
  font-size: 9px;
}
.cal-bottom-sections .cal-mini-card__edit {
  font-size: 12px;
}

/* === Активность за период (вверху календаря) === */
.activity-section {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
}
.activity-section__head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.activity-section__head h3 {
  font-size: 12px;
  font-weight: 600;
  color: #0f172a;
  margin: 0;
}
.activity-section__period {
  font-size: 12px;
  color: #64748b;
}
.activity-section__cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}
.act-group {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.act-group__title {
  font-size: 11px;
  font-weight: 600;
  color: #475569;
  white-space: nowrap;
  min-width: 0;
  flex-shrink: 1;
}
.act-trio {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  flex: 1;
  min-width: 0;
}
.act-card {
  border-radius: 6px;
  padding: 4px 6px;
  text-align: center;
  min-width: 0;
}
.act-card__label {
  font-size: 9px;
  color: rgba(255,255,255,0.9);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.act-card__val {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  margin-top: 1px;
  line-height: 1;
}
.act-card--green { background: #16a34a; }
.act-card--orange { background: #ea580c; }
.act-card--indigo { background: #6E4F96; }


/* === Календарь — умещаем всё в экран === */
.cal-page {
  margin-top: 4px;
}
/* Статистика дня: 4 квадрата меньше */
.cal-stat-sidebar, .day-stat {
  font-size: 11px;
}
.cal-stat-sidebar .day-stat__val, .day-stat__val {
  font-size: 16px !important;
}

/* /cash: компактный вид "По дням" на мобиле */
@media (max-width: 768px) {
  .cash-days-card { padding: 8px !important; }
  .cash-days-card table { font-size: 12px !important; }
  .cash-days-card th, .cash-days-card td { padding: 4px 6px !important; }
  .cash-days-card thead { display: none; }
  .cash-days-card tbody tr {
    display: grid !important;
    grid-template-columns: 80px 1fr 90px !important;
    gap: 2px 6px !important;
    align-items: center !important;
    padding: 6px 0 !important;
    border-bottom: 1px solid #f1f5f9 !important;
  }
  .cash-days-card tbody td { display: block !important; padding: 0 !important; border: none !important; text-align: left !important; }
  .cash-days-card tbody td:nth-child(1) { grid-column: 1 / 2; font-size: 12px; font-weight: 600; }
  .cash-days-card tbody td:nth-child(2) { grid-column: 2 / 3; font-size: 10px; color: #6b7280; }
  .cash-days-card tbody td:nth-child(3) { grid-column: 1 / 2; font-size: 14px; color: #16a34a; font-weight: 600; }
  .cash-days-card tbody td:nth-child(4) { grid-column: 2 / 3; font-size: 14px; color: #dc2626; font-weight: 600; }
  .cash-days-card tbody td:nth-child(5) { grid-column: 3 / 4; text-align: right !important; font-size: 14px; font-weight: 600; }
}

/* Касса по дням: компактные бейджи */
.cash-badge {
  display: inline-block;
  color: #fff;
  padding: 3px 10px;
  border-radius: 6px;
  margin-left: 6px;
  font-size: 12px;
  white-space: nowrap;
}
.cash-badge--in { background: #16a34a; }
.cash-badge--out { background: #dc2626; }
.cash-badge--ops { background: #0F5A63; }
.cash-badge--total { background: #7C5AA6; }
.cash-badge--kassa { background: #475569; }

/* Мобильная версия: "Касса по дням" — компактнее */
@media (max-width: 768px) {
  /* Контейнер дней — 2 колонки на мобиле */
  .cash-day-block { break-inside: avoid; }
  .cash-day-head {
    padding: 6px 10px !important;
    margin-bottom: 6px !important;
    border-radius: 8px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 4px;
  }
  .cash-day-head h3 { font-size: 14px !important; }
  .cash-day-head > span { 
    float: none !important; 
    font-size: 11px !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 3px !important;
  }
  .cash-badge {
    padding: 2px 6px !important;
    font-size: 10px !important;
    margin-left: 0 !important;
  }
  
  /* Таблица операций — компактный вид */
  .cash-day-table thead { display: none; }
  .cash-day-table table { font-size: 11px; }
  .cash-day-table tbody tr {
    display: block;
    padding: 6px 8px;
    border-bottom: 1px solid #f1f5f9;
  }
  .cash-day-table tbody td {
    display: inline-block !important;
    padding: 1px 4px !important;
    border: none !important;
    font-size: 11px !important;
  }
  .cash-day-table tbody td:nth-child(1) { /* Клиент */
    display: block !important;
    font-size: 12px;
    font-weight: 600;
    color: #1e293b;
  }
  .cash-day-table tbody td:nth-child(2),
  .cash-day-table tbody td:nth-child(3),
  .cash-day-table tbody td:nth-child(4) { /* Предмет, Юристы, № договора */
    background: #f8fafc;
    border-radius: 4px;
    margin: 1px;
  }
  .cash-day-table tbody td:nth-child(5),
  .cash-day-table tbody td:nth-child(6) { /* Доход, Расход */
    float: right;
    font-weight: 600;
  }
}

/* Касса по дням: grid-обёртка для 2 колонок на мобиле */
.cash-days-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 500px) and (max-width: 900px) {
  .cash-days-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
}

/* Мобильная адаптация календаря (представитель) */
@media (max-width: 700px) {
  .hour-row { grid-template-columns: 52px 1fr; padding: 4px 8px; }
  .hour-row__time { font-size: 11px; }
  .hour-row__count { font-size: 9px; }
  .ev-card--ref .ev-card__head { padding: 3px 8px; font-size: 10px; }
  .ev-card--ref .ev-card__body { padding: 4px 8px; }
  .ev-card--ref .ev-card__line { font-size: 10px; }
  .schedule__title { font-size: 13px; }
  .schedule__date { font-size: 12px; }
}
/* ФРОНТ РАБОТЫ — на всю ширину */
.front-work { margin-bottom: 16px; }
.front-work .timeline { display: flex; flex-direction: column; gap: 4px; }
.front-work .tl-item { background: #fff; border-radius: 6px; }

/* === Календарь: адаптив (в конце файла, чтобы перекрыть базовую сетку выше) ===
   Базовые правила .cal-layout / .cal-bottom-sections объявлены выше медиазапросов
   и из-за одинаковой специфичности перебивали их. Поэтому правим здесь. */
.cal-layout > * { min-width: 0; }
.cal-bottom-sections > * { min-width: 0; }

/* текст в карточке события переносится, а не режется многоточием */
.ev-card--ref .ev-card__line { flex-wrap: wrap; min-width: 0; }
.ev-card--ref .ev-card__line > * { min-width: 0; overflow-wrap: anywhere; }
.ev-card--ref .ev-card__body { min-width: 0; }
.ev-card--ref .ev-card__name { overflow-wrap: anywhere; }

@media (max-width: 1400px) {
  .cal-layout--manager { grid-template-columns: 280px minmax(0, 1fr); }
  .cal-layout--manager > .manager-stats { grid-column: 1 / -1; width: 100%; }
}

@media (max-width: 1100px) {
  .cal-layout, .cal-layout--manager { grid-template-columns: minmax(0, 1fr); }
  .cal-sidebar { position: static; width: auto; }
  .cal-main { width: 100%; }
  .cal-layout--manager > .manager-stats { grid-column: auto; }
}

@media (max-width: 900px) {
  .cal-bottom-sections { grid-template-columns: minmax(0, 1fr); }
  .activity-section__cards { grid-template-columns: minmax(0, 1fr); }
  .act-group { flex-wrap: wrap; }
}

@media (max-width: 700px) {
  .cal-bottom-sections .cal-section__list { grid-template-columns: minmax(0, 1fr); }
  .cal-section { padding: 10px; }
  .schedule__head { padding: 12px 14px; flex-wrap: wrap; gap: 6px; }
  .ev-card--ref .ev-card__line { font-size: 11px; }
  .ev-card--ref .ev-card__goal { max-width: 100%; }
}

/* ============= Итог события в календаре ============= */
.ev-card__outcome { color: #0f172a; background: #f0fdf4; border-left: 3px solid #16a34a; border-radius: 4px; padding: 3px 7px; margin-bottom: 3px; }
.ev-card__next { color: #0B3D44; background: #EAF3F4; border-left: 3px solid #0F5A63; border-radius: 4px; padding: 3px 7px; margin-bottom: 3px; }
.cal-mini-card__outcome { font-size: 11px; color: #166534; background: #f0fdf4; border-radius: 4px; padding: 2px 6px; margin: 3px 0; }

/* ============= План и факт: редактируемые пункты ============= */
.pf-edit {
  cursor: pointer;
  border-bottom: 1px dashed #94a3b8;
  border-radius: 2px;
  transition: background .12s ease, border-color .12s ease;
}
.pf-edit:hover {
  background: #eef2ff;
  border-bottom-color: #6366f1;
}
.pf-edit:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 1px;
}

/* ============= МОБИЛЬНЫЕ ПОПРАВКИ (в конце файла, чтобы побеждать базовые правила) ============= */
@media (max-width: 900px) {
  .bell { margin-right: 8px; padding-right: 14px; }
  .bell__badge { right: 0; }
  .timer-fab { width: 44px; height: 44px; font-size: 19px; bottom: 12px; right: 12px; }
  .timer-widget { min-width: 0; width: calc(100% - 24px); right: 12px; bottom: 12px; padding: 10px 12px; }
  .page-header, .page-title, .page-header h1 { padding-left: 48px; }
  .page-header__actions { padding-left: 48px; }
}

/* ============ ПЛАН И ФАКТ: строки и разграничение колонок ============ */
.pf-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.pf-table th, .pf-table td { vertical-align: top; }
.pf-th-done {
  width: 50%;
  padding: 7px 10px;
  font-size: 11px;
  text-align: left;
  color: #166534;
  background: #dcfce7;
  border-bottom: 1px solid #e2e8f0;
  border-right: 2px solid #e2e8f0;
}
.pf-th-plan {
  width: 50%;
  padding: 7px 10px;
  font-size: 11px;
  text-align: left;
  color: #b45309;
  background: #fef3c7;
  border-bottom: 1px solid #e2e8f0;
}
.pf-cell-done {
  padding: 8px 10px;
  background: #f6fef9;
  border-bottom: 1px solid #f1f5f9;
  border-right: 2px solid #e2e8f0;
}
.pf-cell-plan {
  padding: 8px 10px;
  background: #fffdf5;
  border-bottom: 1px solid #f1f5f9;
}
/* строка пункта: метка · текст · кнопки — кнопки никогда не лезут под текст */
.pf-row {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  font-size: 12px;
  padding: 3px 0;
}
.pf-row__mark { flex: 0 0 auto; line-height: 1.35; }
.pf-row__date { flex: 0 0 auto; font-size: 11px; white-space: nowrap; color: #0f766e; }
.pf-row__text {
  flex: 1 1 auto;
  min-width: 0;
  /* именно break-word, а не anywhere: anywhere роняет min-content до одного символа,
     и колонка схлопывается в букву, если рядом длинное имя файла */
  overflow-wrap: break-word;
  word-break: normal;
  line-height: 1.35;
}
.pf-row__acts {
  flex: 0 0 auto;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding-left: 6px;
  white-space: nowrap;
  font-size: 11px;
  opacity: .55;
}
.pf-row:hover .pf-row__acts { opacity: 1; }
.pf-row__file { color: #0B3D44; text-decoration: none; }
.pf-row__case { color: #94a3b8; }
/* пункт = строка текста + прикреплённые документы ПОД ней (просьба Вероники от 23.10) */
.pf-item { margin-bottom: 2px; }
.pf-files {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 0 0 4px 22px;
  padding: 2px 6px;
  border-left: 2px solid #bfdbfe;
  background: #f8fbff;
  border-radius: 0 6px 6px 0;
  font-size: 11px;
  line-height: 1.4;
}
.pf-files__list { flex: 1 1 auto; min-width: 0; overflow-wrap: break-word; word-break: normal; }
.pf-files__list a { color: #0B3D44; text-decoration: none; }
.pf-files__add { flex: 0 0 auto; display: inline-flex; gap: 4px; }
@media (max-width: 700px) {
  .pf-cell-done, .pf-cell-plan, .pf-th-done, .pf-th-plan { padding: 7px 8px; }
}

/* Таблица договоров в карточке клиента: 13 колонок не влезали, правые обрезались (23.10) */
.ct-compact th, .ct-compact td { padding: 6px 7px !important; font-size: 11.5px !important; line-height: 1.35; }
.ct-compact th { white-space: nowrap; }
.ct-compact .badge { font-size: 10px !important; padding: 1px 6px !important; }
@media (max-width: 1280px) {
  .ct-compact th, .ct-compact td { padding: 5px 5px !important; font-size: 11px !important; }
}

/* На узких экранах прячем второстепенные колонки договоров — иначе правый край обрезан (23.10) */
@media (max-width: 1400px) {
  .ct-compact .ct-opt { display: none !important; }
  .ct-compact th, .ct-compact td { padding: 4px 4px !important; font-size: 10.5px !important; }
  .ct-compact .badge { padding: 1px 4px !important; font-size: 9.5px !important; }
}
@media (max-width: 1300px) {
  .ct-compact th, .ct-compact td { padding: 3px 3px !important; font-size: 10px !important; }
  .ct-compact .badge { padding: 1px 3px !important; font-size: 9px !important; }
}

/* «План и факт»: всегда две колонки — слева «Что сделано», справа «Что будет сделано».
   Раньше на ширине ≤1300 колонки складывались в одну (вниз) — 30.10: Вероника попросила
   вернуть вправо. На узких экранах колонки остаются, но компактнее. */
@media (max-width: 1300px) {
  .pf-table { table-layout: fixed; }
  .pf-cell-done, .pf-cell-plan { padding: 6px 7px; }
  .pf-cell-done { border-right: 2px solid #e2e8f0; border-bottom: 1px solid #f1f5f9; }
  .pf-cell-plan { border-bottom: 1px solid #f1f5f9; }
  .pf-row { font-size: 11.5px; }
}
/* ---------- Правая колонка карточки клиента: компактные квадратики ----------
   Контакты, РПО, Дела и Команда показываются маленькими квадратиками (30.10, просьба
   Вероники); полный блок открывается по клику. Остальные блоки справа остаются как были. */
.aside-tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}
.aside-tile {
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 4px 2px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
}
.aside-tile:hover { transform: translateY(-1px); box-shadow: 0 3px 10px rgba(15,23,42,.12); }
.aside-tile__ico { font-size: 17px; line-height: 1; }
.aside-tile__t { font-size: 9.5px; color: #475569; text-align: center; line-height: 1.1; }
.aside-tile__n {
  position: absolute;
  transform: translate(14px, -12px);
  background: #7C5AA6;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 8px;
  padding: 0 4px;
  line-height: 13px;
}
/* полные блоки, спрятанные за квадратиками */
#asideContacts, #asideMail, #asideCases, #asideTeam { display: none; }

/* Блок «План и факт» прокручивается по горизонтали: колонки «сделано» и «будет» остаются
   рядом, но каждая сохраняет читаемую ширину (иначе на телефоне текст идёт по буквам).
   min-width задан вне медиазапроса — на сжатом ноутбуке/телефоне контейнер может оказаться
   уже 480 px, и колонки всё равно должны оставаться читаемыми. */
.pf-block { overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; }
/* Колонки «сделано»/«будет» не должны схлопываться в одну букву: строкам задаётся
   минимальная ширина, а таблице — минимальная ширина, при которой текст ещё читаем.
   Блок при нехватке места прокручивается по горизонтали сам (без «перетягивания»). */
.pf-row__text { min-width: 140px; }
.pf-row { flex-wrap: wrap; }
/* Колонки всегда 50/50: обе видны целиком, без обрезания правой.
   31.10 (Вероника): колонки шире — текст переносится меньше, страница короче,
   листать вниз приходится меньше. Если места не хватает — блок прокручивается
   по горизонтали сам. */
.pf-table { table-layout: fixed; width: 100%; min-width: 560px; }
.pf-table > tbody > tr > td { width: 50%; }
.pf-th-done, .pf-th-plan { white-space: normal; }
@media (max-width: 1100px) { .pf-block { overflow-x: auto; } }
@media (max-width: 760px) {
  /* Колонки остаются рядом (слева сделано, справа будет) и остаются широкими:
     текст переносится по словам, а не по буквам. */
  .pf-block { overflow-x: auto; overflow-y: hidden; }
  .pf-table { table-layout: fixed; min-width: 470px; width: 100%; }
  .pf-th-done, .pf-th-plan { padding: 6px 6px; font-size: 10px; }
  .pf-cell-done, .pf-cell-plan { padding: 6px 6px; }
  .pf-cell-done { border-right: 2px solid #e2e8f0; border-bottom: 1px solid #f1f5f9; }
  .pf-cell-plan { border-bottom: 1px solid #f1f5f9; }
  .pf-row { font-size: 11px; gap: 4px; flex-wrap: wrap; }
  /* кнопки действий уходят под текст — иначе они съедают ширину и текст рвётся по буквам */
  .pf-row__text { flex: 1 1 100%; min-width: 90px; }
  .pf-row__acts { margin-left: 0; padding-left: 0; }
}

/* ============= ПОЛЯ ФОРМ (были без правил — лейблы и инпуты слипались) 23.10 ============= */
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #475569;
  margin: 8px 0 3px;
  line-height: 1.3;
}
.form-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 7px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: #0f172a;
}
.form-input:focus { outline: none; border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99, 102, 241, .14); }
.form-input:disabled { background: #f1f5f9; color: #94a3b8; }
select.form-input { cursor: pointer; padding-right: 26px; }
textarea.form-input { min-height: 84px; resize: vertical; line-height: 1.45; }
input[type="date"].form-input { min-height: 36px; }
input[type="checkbox"].form-input { width: 18px; height: 18px; padding: 0; margin: 0; flex: 0 0 auto; }
/* две колонки в широких формах не должны сжиматься в узкие полоски */
.form-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.form-cols > div { min-width: 0; }
.form-h { font-weight: 700; font-size: 13px; margin: 0 0 10px; padding-bottom: 6px; border-bottom: 2px solid #e2e8f0; }
@media (max-width: 700px) { .form-cols { grid-template-columns: 1fr; } }

/* ─── Плавающая плашка перематывания широких таблиц ─────────────── */
.fscr { position: fixed; left: 50%; transform: translateX(-50%); bottom: 16px; z-index: 1100;
  display: none; align-items: center; gap: 8px; padding: 7px 12px; background: rgba(255,255,255,.95);
  border: 1px solid var(--border); border-radius: 999px; box-shadow: 0 8px 26px rgba(15,23,42,.18);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.fscr.show { display: flex; }
.fscr__btn { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border); background: #fff;
  color: #334155; font-size: 16px; line-height: 1; cursor: pointer; display: flex; align-items: center;
  justify-content: center; flex: none; padding: 0; }
.fscr__btn:hover { background: #eef2ff; color: #5A3F7C; border-color: #c7d2fe; }
.fscr__track { position: relative; width: min(42vw, 300px); height: 26px; cursor: pointer; touch-action: none; }
.fscr__rail { position: absolute; top: 11px; left: 0; right: 0; height: 6px; border-radius: 3px; background: #e2e8f0; }
.fscr__thumb { position: absolute; top: 8px; height: 12px; border-radius: 6px; min-width: 30px;
  background: linear-gradient(135deg, #7C5AA6, #8C6BB8); box-shadow: 0 1px 4px rgba(124,90,166,.45); }
.fscr__hint { font-size: 11px; color: #64748b; min-width: 34px; text-align: center; }
@media (max-width: 900px) {
  .fscr { bottom: 10px; padding: 6px 10px; gap: 6px; }
  .fscr__track { width: 38vw; }
  .fscr__btn { width: 28px; height: 28px; font-size: 15px; }
  .fscr__hint { display: none; }
}

/* ============= ТАБЕЛЬ РАБОЧЕГО ВРЕМЕНИ ============= */
.ts-table { font-size: 12px; border-collapse: collapse; width: max-content; min-width: 100%; }
.ts-table th, .ts-table td { border: 1px solid #e5e7eb; padding: 0; }
.ts-table thead th { background: #f5f7fb; position: sticky; top: 0; z-index: 2; font-weight: 600; }
.ts-day { width: 34px; text-align: center; line-height: 1.15; padding: 4px 2px !important; }
.ts-dow { display: block; font-size: 9px; color: #94a3b8; font-weight: 400; }
.ts-weekend { background: #fafafa; }
.ts-sticky { position: sticky; left: 0; background: #fff; z-index: 3; text-align: left; padding: 6px 10px !important; min-width: 160px; }
.ts-name { font-weight: 600; padding: 6px 10px !important; white-space: nowrap; }
.ts-role { display: block; font-weight: 400; font-size: 10px; color: #94a3b8; }
.ts-cell { text-align: center; cursor: pointer; height: 30px; }
.ts-cell:hover { outline: 2px solid #7C5AA6; outline-offset: -2px; }
.ts-dot { display: inline-block; min-width: 30px; padding: 2px 4px; border-radius: 4px; font-size: 10px; font-weight: 700; line-height: 1.4; }
.ts-work { background: #dcfce7; color: #166534; }
.ts-absent { background: #fee2e2; color: #b91c1c; }
.ts-empty { background: #f1f5f9; width: 10px; height: 10px; border-radius: 50%; min-width: 0; padding: 0; }

/* ---------- Мини-календарь активности клиента ----------
   Показывает дни работы с клиентом за месяц: насыщенность цвета = число записей,
   клик по дню открывает окно «Что сделали». Используется и в CRM, и в клиентских
   страницах (личный кабинет, публичная ссылка). */
.mcal { font-size: 12px; }
.mcal__head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 6px; }
.mcal__title { font-weight: 600; font-size: 13px; text-transform: capitalize; }
.mcal__nav {
  width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--border);
  background: #fff; cursor: pointer; font-size: 15px; line-height: 1; color: #334155;
}
.mcal__nav:hover { background: #f1f5f9; }
.mcal__dows { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 2px; }
.mcal__dows span { text-align: center; font-size: 9.5px; color: #94a3b8; font-weight: 600; }
.mcal__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.mcal__cell {
  position: relative; aspect-ratio: 1 / 1; border-radius: 6px; border: 1px solid transparent;
  background: #f8fafc; color: #94a3b8; font-size: 11px; cursor: default; padding: 0;
  font-family: inherit;
}
.mcal__cell--empty { background: transparent; border: none; }
.mcal__cell.has-items { cursor: pointer; color: #0f172a; font-weight: 600; }
.mcal__cell--l1 { background: #dbeafe; border-color: #bfdbfe; }
.mcal__cell--l2 { background: #93c5fd; border-color: #60a5fa; color: #0f172a; }
.mcal__cell--l3 { background: #3b82f6; border-color: #1d4ed8; color: #fff; }
.mcal__cell.has-items:hover { outline: 2px solid #4834d4; }
.mcal__cell.is-today { box-shadow: 0 0 0 2px #f59e0b inset; }
.mcal__plan { position: absolute; right: 2px; bottom: 2px; width: 5px; height: 5px; border-radius: 50%; background: #f59e0b; }
.mcal__loading { color: #94a3b8; font-size: 12px; padding: 8px 0; }
.mcal__items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.mcal__item { display: flex; gap: 8px; align-items: flex-start; }
.mcal__ico { font-size: 15px; line-height: 1.3; }
.mcal__txt { display: flex; flex-direction: column; }
.mcal__txt em { color: #64748b; font-style: normal; font-size: 12px; }
.mcal__empty { color: #94a3b8; font-style: italic; }
.mcal__pop { font-size: 13px; }
.mcal__pophead { font-weight: 600; margin-bottom: 10px; color: #334155; }

/* ============= Календарь: календарь выше и компактнее, выезды/суды — справа ============= */
.cal-layout--split { grid-template-columns: 240px minmax(0, 1fr) 340px; gap: 12px; align-items: start; }
.cal-layout--manager.cal-layout--split { grid-template-columns: 240px minmax(0, 1fr) 340px; }
.cal-mini-col { min-width: 0; }
.cal-mini-col .mini-cal { padding: 10px; }
.cal-mini-col .mini-cal__head { margin-bottom: 6px; }
.cal-mini-col .mini-cal__title { font-size: 12px; letter-spacing: 0.02em; }
.cal-mini-col .mini-cal__nav { font-size: 12px; padding: 0 5px; }
.cal-mini-col .mini-cal__week { font-size: 10px; gap: 2px; }
.cal-mini-col .mini-cal__grid { gap: 2px; }
.cal-mini-col .cal-cell { font-size: 12px; border-radius: 4px; }
.cal-mini-col .cal-cell__count { font-size: 8.5px; min-width: 11px; padding: 0 2px; }
.cal-side-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.cal-bottom-sections--side { grid-template-columns: minmax(0, 1fr); margin-top: 0; gap: 8px; }
/* Компактные карточки в правой колонке календаря */
.cal-bottom-sections--side .cal-mini-card { padding: 6px 8px; grid-template-columns: 62px minmax(0, 1fr) 20px; gap: 6px; font-size: 11px; }
.cal-bottom-sections--side .cal-mini-card__client { font-size: 11.5px; line-height: 1.25; }
.cal-bottom-sections--side .cal-mini-card__where,
.cal-bottom-sections--side .cal-mini-card__purpose,
.cal-bottom-sections--side .cal-mini-card__team { font-size: 9.5px; line-height: 1.3; }
.cal-bottom-sections--side .cal-section { padding: 8px; }


/* Всё помещается на экране: колонки прокручиваются внутри себя, страница — нет */
.cal-page { min-width: 0; }
.cal-layout--split > .cal-main, .cal-layout--split > .cal-side-col { max-height: calc(100vh - 245px); overflow-y: auto; }
.cal-layout--split > .cal-main { min-width: 0; }
.cal-layout--split > .cal-main .schedule { min-width: 0; }
.cal-layout--split > .cal-main .ev-card__body, .cal-layout--split > .cal-main .ev-card__line { overflow-wrap: anywhere; }
/* Чтобы содержимое «Мои записи» не резалось в узкой колонке */
.cal-layout--split .hour-row { grid-template-columns: 56px minmax(0, 1fr); }
.cal-layout--split .ev-card, .cal-layout--split .ev-card__head, .cal-layout--split .ev-card__body { min-width: 0; }
.cal-layout--split .ev-card__head { flex-wrap: wrap; row-gap: 2px; }
.cal-layout--split .ev-card__line, .cal-layout--split .ev-card__body { overflow-wrap: anywhere; word-break: break-word; }
.cal-layout--split .schedule__head { flex-wrap: wrap; row-gap: 6px; }


@media (max-width: 1400px) {
  .cal-layout--split, .cal-layout--manager.cal-layout--split { grid-template-columns: 220px minmax(0, 1fr) 300px; }
}
@media (max-width: 1100px) {
  .cal-layout--split, .cal-layout--manager.cal-layout--split { grid-template-columns: minmax(0, 1fr) 240px; }
  .cal-layout--split > .cal-mini-col { grid-column: 1 / -1; order: -1; }
  .cal-layout--split > .cal-mini-col .mini-cal { max-width: 240px; }
  .cal-layout--manager.cal-layout--split > .manager-stats { grid-column: 1 / -1; width: 100%; }
}
@media (max-width: 900px) {
  .cal-layout--split, .cal-layout--manager.cal-layout--split { grid-template-columns: minmax(0, 1fr); }
  .cal-layout--split > .cal-side-col { grid-column: auto; }
  .cal-bottom-sections--side { grid-template-columns: minmax(0, 1fr); }
  .cal-layout--split > .cal-main, .cal-layout--split > .cal-side-col { max-height: none; overflow-y: visible; }
}

/* === Выезда / Суды / Документы — в один ряд + поле «Доплата» === */
.cal-sections-row { padding: 0 24px 24px; }
.cal-bottom-sections--row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 0; }
.cal-bottom-sections--row .cal-section { display: flex; flex-direction: column; min-width: 0; }
.cal-bottom-sections--row .cal-section__list { max-height: 320px; overflow-y: auto; }
.doplat-card {
  margin: 0 24px 12px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
}
.doplat-card__head {
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 8px;
}
.doplat-card__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.doplat-card__item {
  border-radius: 8px;
  padding: 6px 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  min-width: 0;
}
.doplat-card__label { font-size: 11px; color: #64748b; }
.doplat-card__val { font-size: 17px; font-weight: 700; color: #0f172a; margin-top: 2px; }
.doplat-card__item--plan .doplat-card__val { color: #1d4ed8; }
.doplat-card__item--got .doplat-card__val { color: #16a34a; }
.doplat-card__item--rest .doplat-card__val { color: #ea580c; }
.doplat-card__item--total .doplat-card__val { color: #7c3aed; }
.doplat-card__items { margin-top: 8px; border-top: 1px solid #e2e8f0; padding-top: 6px; }
.doplat-card__row { display: flex; align-items: center; gap: 8px; font-size: 12px; padding: 2px 0; color: #334155; }
.doplat-card__row span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doplat-card__cn { color: #94a3b8; font-size: 11px; }
.doplat-card__empty { margin-top: 6px; font-size: 11px; color: #94a3b8; }
@media (max-width: 1100px) {
  .cal-bottom-sections--row { grid-template-columns: minmax(0, 1fr); }
  .doplat-card__grid { grid-template-columns: minmax(0, 1fr); }
}

/* ===== Лента сообщений (отчёты задач) ===== */
.sidebar__link.has-feed { animation: faydesFeedPulse 1.6s ease-in-out infinite; }
.sidebar__link.has-feed .ico { animation: faydesFeedDot 1.6s ease-in-out infinite; }
@keyframes faydesFeedPulse {
  0%, 100% { background: transparent; color: var(--fg); }
  50% { background: #FFF4D6; color: #A66300; }
}
@keyframes faydesFeedDot {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.25); }
}
.sidebar__feed-badge {
  margin-left: auto; background: #E8A33D; color: #fff; font-size: 11px; font-weight: 600;
  border-radius: 10px; padding: 1px 7px; min-width: 18px; text-align: center;
}
.feed-card { margin-bottom: 16px; }
.feed-card .card__title { display: flex; align-items: center; gap: 8px; }
.feed-list { display: flex; flex-direction: column; gap: 10px; max-height: 420px; overflow-y: auto; }
.feed-item { border: 1px solid var(--border, #E4E9EC); border-radius: 8px; padding: 10px 12px; background: var(--surface-2, #F7F9FA); }
.feed-item--new { border-color: #E8A33D; background: #FFF9EC; }
.feed-item__head { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-bottom: 4px; }
.feed-item__when { color: #7A8A90; font-size: 12px; white-space: nowrap; }
.feed-item__body { font-size: 13px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
