/* ===== Design system — выровнено по бренду teledef.ikp-rao.ru ===== */
/* Источник: /wp-content/themes/teledef-theme/style.css                  */
/* Primary: #943d70 (мауве), фон #f1ece8 (тёплый кремовый), Montserrat   */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap');

:root {
  /* Brand */
  --color-primary: #943d70;
  --color-primary-dark: #7a3460;
  --color-primary-soft: #f5e6ee;
  --color-bg: #f1ece8;
  --color-surface: #ffffff;
  --color-surface-2: #faf7f4;
  --color-text: #1f1f25;
  --color-text-muted: #5f6270;
  --color-border: #ddd6d2;
  --color-divider: #ebe6e2;

  /* Status (как на боевом сайте) */
  --status-pending-bg: #e3f2fd;
  --status-pending-fg: #1976d2;
  --status-scheduled-bg: #fff3e0;
  --status-scheduled-fg: #e65100;
  --status-completed-bg: #e8f5e9;
  --status-completed-fg: #2e7d32;
  --status-new-bg: #f5e6ee;
  --status-new-fg: #943d70;

  /* Сервисы (внешние бренды — оставлены своими) */
  --bitrix: #2fc6f6;
  --bitrix-soft: #e0f7ff;
  --mts: #e30613;
  --mts-soft: #fee2e3;

  /* Утилитарные */
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --success: #2e7d32;
  --success-soft: #e8f5e9;

  --radius-lg: 8px;
  --radius-md: 6px;
  --radius-sm: 4px;

  --shadow-sm: 0 1px 2px rgba(31, 31, 37, 0.04);
  --shadow: 0 1px 3px rgba(31, 31, 37, 0.06), 0 1px 2px rgba(31, 31, 37, 0.04);
  --shadow-lg: 0 10px 24px -8px rgba(148, 61, 112, 0.18), 0 6px 10px -6px rgba(31, 31, 37, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

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

h1, h2, h3, h4 { margin: 0; color: var(--color-text); font-weight: 700; letter-spacing: -0.005em; }
h1 { font-size: 26px; line-height: 1.25; }
h2 { font-size: 21px; line-height: 1.3; }
h3 { font-size: 16px; line-height: 1.35; font-weight: 600; }
h4 { font-size: 13px; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }

p { margin: 0 0 8px 0; }

/* ===== Site header (двойной логотип Теледефектология + ИКП РАО) ===== */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.site-logo { height: 44px; width: auto; display: block; }
.site-header-divider {
  width: 1px; height: 38px; background: var(--color-divider);
}
.site-header-title {
  font-size: 13px; color: var(--color-text-muted); line-height: 1.3;
}
.site-header-title strong { color: var(--color-text); font-weight: 600; display: block; }
.site-header .grow { flex: 1; }
.site-header .search {
  width: 280px; max-width: 30vw;
  position: relative;
}
.site-header .search input {
  width: 100%; padding: 8px 12px 8px 36px;
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  background: var(--color-surface-2);
  font-size: 14px;
  font-family: inherit;
}
.site-header .search input:focus {
  outline: none; border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(148, 61, 112, 0.15);
}
.site-header .search svg {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--color-text-muted);
}

.icon-btn {
  width: 36px; height: 36px; border-radius: var(--radius-md);
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: none; cursor: pointer; color: var(--color-text-muted);
  position: relative;
}
.icon-btn:hover { background: var(--color-surface-2); color: var(--color-primary); }
.icon-btn .dot {
  position: absolute; top: 7px; right: 9px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--color-primary); border: 2px solid var(--color-surface);
}

.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-divider);
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--color-primary);
  color: #fff; font-weight: 600; font-size: 12.5px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.avatar.b { background: #7a3460; }
.avatar.c { background: #5f3050; }
.avatar.d { background: #ad5685; }
.user-chip .name { font-weight: 600; font-size: 13px; }
.user-chip .role { font-size: 11.5px; color: var(--color-text-muted); }

/* ===== Layout ===== */
.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: calc(100vh - 73px - 45px);
}
.sidebar {
  background: var(--color-surface);
  border-right: 1px solid var(--color-divider);
  padding: 20px 16px;
}
.sidebar h4 {
  padding: 8px 12px;
  margin-top: 14px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: 14px;
  cursor: pointer;
  margin-bottom: 2px;
  font-weight: 500;
}
.nav-item:hover { background: var(--color-surface-2); text-decoration: none; color: var(--color-primary); }
.nav-item:hover svg { color: var(--color-primary); }
.nav-item.active {
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-weight: 600;
}
.nav-item.active svg { color: var(--color-primary); }
.nav-item svg { color: var(--color-text-muted); flex-shrink: 0; }
.nav-item .badge { margin-left: auto; }
.sidebar .new-request-btn {
  width: 100%; margin-bottom: 16px;
  justify-content: center;
}

.content {
  padding: 28px 32px;
  max-width: none;
  width: 100%;
}
.content.narrow { max-width: 880px; margin: 0 auto; }

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 24px; margin-bottom: 24px; flex-wrap: wrap;
}
.page-head .subtitle { color: var(--color-text-muted); margin-top: 4px; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-md); border: 1px solid var(--color-border);
  font-size: 14px; font-weight: 500;
  cursor: pointer;
  background: var(--color-surface); color: var(--color-text);
  transition: all 0.15s ease;
  text-decoration: none;
  font-family: inherit;
}
.btn:hover { background: var(--color-surface-2); text-decoration: none; }
.btn-primary {
  background: var(--color-primary); color: #fff;
  border-color: var(--color-primary);
}
.btn-primary:hover { background: var(--color-primary-dark); color: #fff; border-color: var(--color-primary-dark); }
.btn-secondary {
  background: var(--color-surface); color: var(--color-text);
  border-color: var(--color-border);
}
.btn-mts {
  background: var(--mts); color: #fff; border-color: var(--mts);
}
.btn-mts:hover { background: #b1050f; color: #fff; border-color: #b1050f; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--color-surface-2); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 11px 22px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }

/* ===== Cards ===== */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.card-lg { padding: 28px; }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 12px;
}
.card-header h3 { font-size: 15px; }
.card-header .card-actions { display: flex; gap: 8px; align-items: center; }

/* ===== KPI tiles ===== */
.kpi-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-bottom: 24px;
}
.kpi {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); padding: 18px 20px;
  position: relative; overflow: hidden;
}
.kpi .label { font-size: 12.5px; color: var(--color-text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.kpi .value { font-size: 24px; font-weight: 700; color: var(--color-text); line-height: 1.15; }
.kpi .delta { font-size: 12px; color: var(--color-text-muted); margin-top: 6px; }
.kpi.accent {
  background: linear-gradient(135deg, var(--color-primary-soft), #faf2f6);
  border-color: var(--color-primary-soft);
}
.kpi.accent .value { color: var(--color-primary); }
.kpi.accent .label { color: var(--color-primary); opacity: 0.85; }

/* ===== Status badges (как на боевом сайте) ===== */
.badge {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.badge.new { background: var(--status-new-bg); color: var(--status-new-fg); }
.badge.scheduled { background: var(--status-scheduled-bg); color: var(--status-scheduled-fg); }
.badge.in-progress { background: var(--status-pending-bg); color: var(--status-pending-fg); }
.badge.completed { background: var(--status-completed-bg); color: var(--status-completed-fg); }
.badge.pending { background: #f3e8ff; color: #6d28d9; }

/* ===== Tables / lists ===== */
.list-card { padding: 0; overflow: hidden; }
.list-card .card-header { padding: 16px 24px; border-bottom: 1px solid var(--color-divider); margin: 0; }
.list-row {
  display: grid;
  grid-template-columns: 100px 1fr minmax(160px, 1.2fr) 110px 120px;
  align-items: center;
  padding: 14px 24px;
  border-bottom: 1px solid var(--color-divider);
  gap: 16px;
  font-size: 14px;
}
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: var(--color-surface-2); }
.list-row.header {
  color: var(--color-text-muted); font-size: 11.5px;
  text-transform: uppercase; letter-spacing: 0.05em;
  background: var(--color-surface-2); font-weight: 600;
}
.list-row .case-id { font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--color-text); font-weight: 600; }
.list-row .cell-expert,
.list-row .cell-date { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .topic { color: var(--color-text); }
.list-row .topic small { color: var(--color-text-muted); display: block; margin-top: 2px; font-size: 12.5px; }

/* ===== Forms ===== */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-weight: 600; font-size: 13.5px;
  margin-bottom: 6px; color: var(--color-text);
}
.form-group .hint { color: var(--color-text-muted); font-size: 12.5px; margin-top: 4px; }

/* ===== File dropzone (new request) ===== */
.file-dropzone {
  display: block;
  border: 2px dashed #c4bdb8;
  border-radius: 10px;
  padding: 24px;
  text-align: center;
  background: var(--color-surface-2);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.file-dropzone:hover,
.file-dropzone:focus-visible,
.file-dropzone.is-dragover {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
  outline: none;
}
.file-dropzone-icon { color: var(--color-text-muted); margin: 0 auto; display: block; }
.file-dropzone-title { margin: 10px 0 0; font-weight: 500; font-size: 14px; }
.file-dropzone-hint { font-size: 12.5px; color: var(--color-text-muted); margin: 4px 0 0; }
.file-dropzone-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.file-preview-list { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.file-preview-item {
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--color-surface);
}
.file-preview-item .file-icon { flex-shrink: 0; color: var(--color-primary); }
.file-preview-item .file-meta { flex: 1; min-width: 0; }
.file-preview-item .file-name {
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-preview-item .file-size { font-size: 12px; color: var(--color-text-muted); }
.file-preview-item .file-remove {
  flex-shrink: 0;
  border: none;
  background: transparent;
  padding: 4px;
  cursor: pointer;
  color: var(--color-text-muted);
  border-radius: var(--radius-sm);
  line-height: 0;
}
.file-preview-item .file-remove:hover { color: var(--color-danger, #c0392b); background: var(--color-surface-2); }
.form-group input[type=text],
.form-group input[type=email],
.form-group input[type=number],
.form-group input[type=password],
.form-group input[type=url],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  font-family: inherit;
  transition: border-color 0.15s ease;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none; border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(148, 61, 112, 0.15);
}
.form-group textarea { resize: vertical; min-height: 90px; }
.form-grid-2 {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}

.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 7px 14px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 13px;
  background: var(--color-surface);
  cursor: pointer;
  font-weight: 500;
  color: var(--color-text);
}
.chip:hover { border-color: var(--color-primary); color: var(--color-primary); }
.chip.selected,
.chip:has(input:checked) {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}
.chip input { display: none; }

/* ===== Callout boxes ===== */
.callout {
  border-left: 3px solid var(--color-primary);
  background: var(--color-primary-soft);
  padding: 14px 16px;
  border-radius: var(--radius-md);
  margin: 16px 0;
  font-size: 13.5px;
  color: var(--color-text);
}
.callout.warning { border-color: var(--warning); background: var(--warning-soft); }
.callout.success { border-color: var(--success); background: var(--success-soft); }
.callout.error { border-color: var(--danger, #c62828); background: #fdecea; color: #b71c1c; }
.callout.mts { border-color: var(--mts); background: var(--mts-soft); }
.callout strong { display: block; margin-bottom: 4px; }

/* ===== Service tags (Битрикс / МТС) ===== */
.service-tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.service-tag.bitrix { background: var(--bitrix-soft); color: #0e7c9c; }
.service-tag.mts { background: var(--mts-soft); color: var(--mts); }
.service-tag.wp { background: var(--color-primary-soft); color: var(--color-primary); }

/* ===== Bitrix embed mock ===== */
.bitrix-embed {
  border: 1px solid var(--bitrix);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #f0fcff, #fff);
  padding: 0;
  overflow: hidden;
}
.bitrix-embed .embed-head {
  background: linear-gradient(90deg, #2fc6f6, #19a1d6);
  color: #fff;
  padding: 10px 16px;
  font-size: 13px; font-weight: 500;
  display: flex; align-items: center; gap: 8px; justify-content: space-between;
}
.bitrix-embed .embed-head .b-logo {
  font-weight: 700; letter-spacing: 0.04em;
}
.bitrix-embed .embed-body { padding: 16px 18px; }
.bitrix-field {
  display: grid; grid-template-columns: 150px 1fr;
  padding: 8px 0;
  border-bottom: 1px dashed var(--color-divider);
  font-size: 13.5px;
}
.bitrix-field:last-child { border-bottom: none; }
.bitrix-field .label { color: var(--color-text-muted); }
.bitrix-field .value { color: var(--color-text); font-weight: 500; }
.bitrix-field .value.masked { font-family: ui-monospace, Menlo, monospace; color: var(--color-text-muted); }

/* ===== MTS Link video panel ===== */
.video-panel {
  background: #0b1220;
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  min-height: 360px;
  display: flex; align-items: center; justify-content: center;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(227, 6, 19, 0.18), transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(148, 61, 112, 0.22), transparent 40%);
}
.video-panel .video-overlay {
  text-align: center; color: #fff;
}
.video-panel .video-overlay .mts-logo {
  background: var(--mts);
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 16px;
}
.video-panel .video-overlay h3 { color: #fff; margin-bottom: 6px; font-size: 18px; }
.video-panel .video-overlay p { color: #c2b8b3; }
.video-panel .live-indicator {
  position: absolute; top: 16px; left: 16px;
  background: rgba(220, 38, 38, 0.92); color: #fff;
  padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  display: flex; align-items: center; gap: 6px;
}
.video-panel .live-indicator::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%; background: #fff;
  animation: pulse 1.5s infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.video-tiles {
  position: absolute; bottom: 16px; right: 16px;
  display: flex; gap: 8px;
}
.video-tiles .tile {
  width: 110px; height: 70px;
  border-radius: var(--radius-md);
  border: 2px solid rgba(255,255,255,0.15);
  background: linear-gradient(135deg, #1f1f25, #2d2530);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12px;
  position: relative;
}
.video-tiles .tile.self { border-color: var(--color-primary); }
.video-tiles .tile.self::after {
  content: 'Вы'; position: absolute; top: 4px; left: 6px;
  font-size: 10px; background: rgba(0,0,0,0.6);
  padding: 1px 5px; border-radius: 3px;
}

/* ===== Chat ===== */
.chat {
  display: flex; flex-direction: column;
  height: 100%;
}
.chat-messages {
  flex: 1; padding: 16px 20px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 14px;
}
.msg {
  max-width: 86%;
  background: var(--color-surface-2);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  font-size: 14px;
}
.msg .msg-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--color-text-muted);
  margin-bottom: 4px;
}
.msg .msg-head .author { color: var(--color-text); font-weight: 600; }
.msg.self { align-self: flex-end; background: var(--color-primary-soft); border-color: var(--color-primary-soft); }
.msg.self .author { color: var(--color-primary); }
.msg .attachment {
  margin-top: 6px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: var(--radius-sm);
  background: var(--color-surface); border: 1px solid var(--color-divider);
  font-size: 12.5px; color: var(--color-text-muted);
}
.chat-composer {
  border-top: 1px solid var(--color-divider);
  padding: 12px 16px;
  display: flex; gap: 8px; align-items: flex-end;
}
.chat-composer textarea {
  flex: 1; padding: 9px 12px; border: 1px solid var(--color-border);
  border-radius: var(--radius-md); resize: none; font-family: inherit; font-size: 14px;
}
.chat-composer textarea:focus {
  outline: none; border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(148, 61, 112, 0.15);
}

/* ===== Calendar mini ===== */
.calendar-mini { font-size: 13px; }
.calendar-mini .cal-head { display: flex; justify-content: space-between; margin-bottom: 8px; font-weight: 600; }
.calendar-mini .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.calendar-mini .cal-cell {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); font-size: 12.5px;
  position: relative;
}
.calendar-mini .cal-cell.dow { font-weight: 600; color: var(--color-text-muted); font-size: 11px; }
.calendar-mini .cal-cell.today { background: var(--color-primary); color: #fff; font-weight: 600; }
.calendar-mini .cal-cell.has-event::after {
  content: ''; position: absolute; bottom: 3px;
  width: 4px; height: 4px; border-radius: 50%; background: var(--color-primary);
}
.calendar-mini .cal-cell.today.has-event::after { background: #fff; }
.calendar-mini .cal-cell:hover:not(.dow) { background: var(--color-surface-2); cursor: pointer; }

/* ===== Calendar month view ===== */
.cal-month-layout {
  display: grid;
  grid-template-columns: 1fr minmax(260px, 320px);
  gap: 20px;
  align-items: start;
}
.cal-month-wrap { padding: 0; overflow: hidden; }
.cal-month-sidebar { padding: 18px 20px; }
.cal-month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--color-divider);
}
.cal-month-dow {
  padding: 10px 6px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--color-surface-2);
}
.cal-month-cell {
  min-height: 76px;
  max-height: 88px;
  padding: 6px 8px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  overflow: hidden;
  transition: background 0.12s ease;
  background: var(--color-surface);
}
.cal-month-cell.empty {
  background: #f8f9fb;
  pointer-events: none;
}
.cal-month-cell.weekend { background: #fafbfd; }
.cal-month-cell:hover:not(.empty) { background: var(--color-surface-2); }
.cal-month-cell.selected {
  box-shadow: inset 0 0 0 2px var(--color-primary);
  background: var(--color-primary-soft);
}
.cal-month-cell.today:not(.selected) { background: rgba(148, 61, 112, 0.06); }
.cal-month-num {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  min-width: 24px;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.cal-month-cell.today .cal-month-num {
  background: var(--color-primary);
  color: #fff;
}
.cal-month-events {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}
.cal-month-ev {
  display: block;
  width: 100%;
  font-size: 10.5px;
  line-height: 1.3;
  padding: 2px 5px;
  border-radius: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--color-primary-soft);
  color: var(--color-primary-dark);
  border-left: 2px solid var(--color-primary);
}
.cal-month-ev.accent {
  background: var(--status-pending-bg);
  color: var(--status-pending-fg);
  border-left-color: var(--status-pending-fg);
}
.cal-month-ev.success {
  background: var(--success-soft);
  color: var(--success);
  border-left-color: var(--success);
}
.cal-month-more {
  font-size: 10px;
  color: var(--color-text-muted);
  padding-left: 4px;
}
.cal-month-detail {
  display: block;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-divider);
  text-decoration: none;
  color: inherit;
  background: var(--color-surface);
}
.cal-month-detail:hover { background: var(--color-surface-2); }
.cal-month-detail.accent { border-left: 3px solid var(--status-pending-fg); }
.cal-month-detail.success { border-left: 3px solid var(--success); }
.cal-month-detail strong { display: block; margin-bottom: 4px; font-size: 13px; }
.cal-month-detail .text-muted { display: block; font-size: 12px; margin-bottom: 6px; }

@media (max-width: 900px) {
  .cal-month-layout { grid-template-columns: 1fr; }
  .cal-month-cell { min-height: 64px; max-height: 76px; }
}

/* ===== Calendar full week view ===== */
.cal-week {
  display: grid; grid-template-columns: 60px repeat(7, 1fr);
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  overflow: hidden;
}
.cal-week .day-head {
  padding: 10px 8px; text-align: center;
  border-bottom: 1px solid var(--color-divider); border-left: 1px solid var(--color-divider);
  font-size: 13px;
}
.cal-week .day-head .dow { color: var(--color-text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.cal-week .day-head .dom { font-weight: 700; font-size: 18px; margin-top: 2px; }
.cal-week .day-head.today .dom { color: var(--color-primary); }
.cal-week .time-col { background: var(--color-surface-2); border-right: 1px solid var(--color-divider); padding-top: 60px; }
.cal-week .time-slot {
  font-size: 11px; color: var(--color-text-muted); height: 56px; padding: 0 8px; text-align: right;
}
.cal-week .day-col { border-left: 1px solid var(--color-divider); position: relative; padding-top: 60px; }
.cal-week .day-col .slot { height: 56px; border-bottom: 1px dashed var(--color-divider); }
.cal-week .event {
  position: absolute;
  left: 4px; right: 4px;
  background: var(--color-primary-soft);
  border-left: 3px solid var(--color-primary);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--color-primary-dark);
  overflow: hidden;
  font-weight: 500;
}
.cal-week .event.accent { background: var(--status-pending-bg); border-color: var(--status-pending-fg); color: var(--status-pending-fg); }
.cal-week .event.success { background: var(--success-soft); border-color: var(--success); color: var(--success); }
.cal-week .event small { display: block; opacity: 0.85; font-size: 11px; font-weight: 400; }
.cal-week.cal-day { grid-template-columns: 60px 1fr; }
.cal-week .event { text-decoration: none; display: block; }

.cal-toolbar { flex-wrap: wrap; gap: 8px; align-items: center; }
.cal-view-switch { display: flex; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 8px; overflow: hidden; }
.cal-view-switch .btn { border-radius: 0; border: none; }
.cal-period-label { font-weight: 600; font-size: 15px; min-width: 140px; text-align: center; }

.calendar-mini-full .cal-cell { text-decoration: none; color: inherit; max-width: 42px; }
.calendar-mini-full { margin-bottom: 0; max-width: 320px; }
.calendar-mini-full .cal-cell { aspect-ratio: 1; }

.cal-legend { font-size: 13px; padding: 0 12px; }
.cal-legend-item { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.cal-legend .swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.cal-legend .swatch-accent { background: var(--status-pending-bg); border-left: 3px solid var(--status-pending-fg); }
.cal-legend .swatch-primary { background: var(--color-primary-soft); border-left: 3px solid var(--color-primary); }
.cal-legend .swatch-success { background: var(--success-soft); border-left: 3px solid var(--success); }

/* ===== Two-column layout ===== */
.col-2 {
  display: grid; gap: 20px;
  grid-template-columns: 1fr 360px;
}
.col-2-wide {
  display: grid; gap: 20px;
  grid-template-columns: 2fr 1fr;
}
.col-3 {
  display: grid; gap: 16px;
  grid-template-columns: repeat(3, 1fr);
}

/* ===== Auth (landing/login) ===== */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 480px;
  background: var(--color-bg);
}
.auth-promo {
  background: linear-gradient(135deg, #6e2a51 0%, #943d70 55%, #b35a8a);
  color: #fff;
  padding: 60px;
  display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.auth-promo::before {
  content: ''; position: absolute; top: -100px; right: -100px;
  width: 360px; height: 360px; border-radius: 50%;
  background: rgba(255,255,255,0.06);
}
.auth-promo::after {
  content: ''; position: absolute; bottom: -150px; left: -50px;
  width: 300px; height: 300px; border-radius: 50%;
  background: rgba(255,255,255,0.04);
}
.auth-promo .promo-header {
  display: flex; align-items: center; gap: 18px;
  position: relative; z-index: 1;
}
.auth-promo .promo-header img {
  height: 50px; width: auto;
  filter: brightness(0) invert(1);
}
.auth-promo .promo-divider {
  width: 1px; height: 38px; background: rgba(255,255,255,0.3);
}
.auth-promo .promo-content { position: relative; z-index: 1; }
.auth-promo h1 {
  color: #fff; font-size: 36px; line-height: 1.15; margin-bottom: 16px; font-weight: 700;
}
.auth-promo .lead { font-size: 16px; opacity: 0.88; max-width: 480px; }
.auth-promo .feature-list { margin-top: 28px; display: flex; flex-direction: column; gap: 14px; }
.auth-promo .feature { display: flex; gap: 12px; align-items: flex-start; }
.auth-promo .feature-icon {
  width: 36px; height: 36px; border-radius: var(--radius-md);
  background: rgba(255,255,255,0.16); display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.auth-promo .feature-text strong { display: block; font-size: 15px; font-weight: 600; }
.auth-promo .feature-text span { opacity: 0.75; font-size: 13.5px; }
.auth-promo .footnote { font-size: 12.5px; opacity: 0.6; position: relative; z-index: 1; }

.auth-form {
  padding: 60px; display: flex; flex-direction: column; justify-content: center;
  background: var(--color-surface);
}
.auth-form .form-logo {
  width: 60px;
    margin: 0 auto;
    margin-bottom: 28px;
}
.auth-form h2 { margin-bottom: 6px; }
.auth-form .sub { color: var(--color-text-muted); margin-bottom: 24px; }
.auth-tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--color-border); margin-bottom: 24px;
}
.auth-tabs a {
  padding: 10px 16px; font-size: 14px; color: var(--color-text-muted); font-weight: 600;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.auth-tabs a:hover { text-decoration: none; color: var(--color-text); }
.auth-tabs a.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }

/* ===== Architecture diagram ===== */
.arch-diagram {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 24px;
  padding: 32px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}
.arch-node {
  border-radius: var(--radius-lg);
  padding: 24px;
  border: 2px solid;
  text-align: center;
}
.arch-node.wp { border-color: var(--color-primary); background: var(--color-primary-soft); }
.arch-node.bitrix { border-color: var(--bitrix); background: var(--bitrix-soft); }
.arch-node.mts { border-color: var(--mts); background: var(--mts-soft); }
.arch-node .arch-icon {
  width: 56px; height: 56px;
  border-radius: var(--radius-lg); margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 17px;
}
.arch-node.wp .arch-icon { background: var(--color-primary); }
.arch-node.bitrix .arch-icon { background: var(--bitrix); }
.arch-node.mts .arch-icon { background: var(--mts); }
.arch-node h3 { margin-bottom: 8px; font-size: 17px; }
.arch-node ul { list-style: none; padding: 0; margin: 12px 0 0 0; text-align: left; font-size: 13.5px; }
.arch-node ul li {
  padding: 6px 0 6px 22px; position: relative; color: var(--color-text);
}
.arch-node ul li::before {
  content: ''; position: absolute; left: 0; top: 13px;
  width: 14px; height: 2px; background: var(--color-text-muted); opacity: 0.4;
}

/* ===== Misc ===== */
.row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.row.space-between { justify-content: space-between; }
.stack-sm > * + * { margin-top: 8px; }
.stack > * + * { margin-top: 16px; }
.text-muted { color: var(--color-text-muted); }
.text-success { color: var(--success); }
.text-mono { font-family: ui-monospace, Menlo, monospace; }

hr.sep { border: none; border-top: 1px solid var(--color-divider); margin: 20px 0; }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-promo { display: none; }
  .col-2, .col-2-wide { grid-template-columns: 1fr; }
  .arch-diagram { grid-template-columns: 1fr; }
  .site-header { padding: 12px 16px; }
}
