/* ==========================================================================
   Дом культуры — планировщик
   Оформление: тёплая «бумажная» палитра, сливовый акцент, крупная типографика.
   ========================================================================== */

:root {
  --bg: #f4f1ea;
  --surface: #fffdf9;
  --surface-2: #faf7f1;
  --surface-3: #f1ece2;
  --ink: #241f2e;
  --ink-2: #3c3549;
  --muted: #6e6779;
  --muted-2: #8d8698;
  --line: #e4ddd1;
  --line-2: #d6cdbd;

  --plum-900: #241d35;
  --plum-800: #2c2340;
  --plum-700: #3a2f52;
  --plum-600: #4a3c68;
  --plum-500: #5d4d80;

  --accent: #c8873a;
  --accent-strong: #a86a24;
  --accent-soft: #f8ecd8;

  --ok: #2f7d5f;
  --ok-soft: #e2f0e9;
  --warn: #a3812f;
  --warn-soft: #f7eed5;
  --danger: #b3403a;
  --danger-soft: #f9e5e3;

  --radius-lg: 18px;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 7px;

  --shadow-sm: 0 1px 2px rgba(36, 31, 46, .05);
  --shadow: 0 2px 4px rgba(36, 31, 46, .04), 0 12px 28px -18px rgba(36, 31, 46, .35);
  --shadow-lg: 0 24px 64px -24px rgba(24, 19, 38, .45);

  --serif: Georgia, 'Times New Roman', 'PT Serif', serif;
  --sans: 'Segoe UI', system-ui, -apple-system, 'Inter', Roboto, Arial, sans-serif;

  --sidebar-w: 268px;
  --topbar-h: 78px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 420px at 88% -8%, rgba(200, 135, 58, .10), transparent 70%),
    radial-gradient(700px 400px at 0% 100%, rgba(74, 60, 104, .07), transparent 70%);
  z-index: 0;
}

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; margin: 0; letter-spacing: -.01em; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--plum-600); }

/* --------------------------------------------------------------------------
   Каркас
   -------------------------------------------------------------------------- */

.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 16px 16px;
  color: #efe9f6;
  background:
    radial-gradient(420px 260px at 110% -10%, rgba(200, 135, 58, .22), transparent 65%),
    linear-gradient(178deg, #332a4b 0%, #241d35 62%, #201a2f 100%);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, .05);
  overflow: hidden;
}

.sidebar::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: .5;
  mask-image: linear-gradient(180deg, #000, transparent 55%);
}

.brand { display: flex; align-items: center; gap: 12px; padding: 2px 6px 0; position: relative; z-index: 1; }

.brand-mark {
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: .02em;
  color: #f4d7ab;
  background: linear-gradient(160deg, rgba(200, 135, 58, .34), rgba(200, 135, 58, .10));
  border: 1px solid rgba(226, 178, 110, .38);
  box-shadow: 0 8px 18px -10px rgba(0, 0, 0, .8);
}

.brand-text { min-width: 0; }
.brand-title {
  font-family: var(--serif);
  font-size: 14.5px;
  line-height: 1.25;
  color: #fdfaf5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.brand-sub { font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: #b9aecb; margin-top: 3px; }

.nav { display: flex; flex-direction: column; gap: 3px; position: relative; z-index: 1; }

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 11px;
  color: #cfc6dd;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: background .16s ease, color .16s ease, border-color .16s ease;
}
.nav-link svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav-link:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-link.is-active {
  background: linear-gradient(90deg, rgba(200, 135, 58, .22), rgba(200, 135, 58, .06));
  border-color: rgba(200, 135, 58, .28);
  color: #fff;
}
.nav-link.is-active svg { opacity: 1; color: #ecc48a; }
.nav-link.is-active::before {
  content: '';
  position: absolute;
  left: -16px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 22px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.nav-count {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(255, 255, 255, .12);
  color: #f0eaf8;
}

.sidebar-foot { margin-top: auto; position: relative; z-index: 1; display: flex; flex-direction: column; gap: 10px; }

.who {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .09);
  width: 100%;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.who:hover { background: rgba(255, 255, 255, .11); border-color: rgba(226, 178, 110, .35); }
.who .avatar { background: rgba(200, 135, 58, .28); color: #ffe3bc; border-color: rgba(226, 178, 110, .35); }
.who-text { min-width: 0; flex: 1; }
.who-name { display: block; font-size: 13px; font-weight: 600; color: #fdfaf5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-role { display: block; font-size: 11.5px; color: #b9aecb; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.storage {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: #b3a9c5;
  padding: 0 4px;
}
.storage .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(47, 125, 95, .18); }
.storage.is-local .dot { background: var(--warn); box-shadow: 0 0 0 3px rgba(163, 129, 47, .2); }

/* --------------------------------------------------------------------------
   Шапка и контент
   -------------------------------------------------------------------------- */

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 32px;
  background: rgba(244, 241, 234, .82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-title { min-width: 0; flex: 1; }
.topbar h1 { font-size: 25px; line-height: 1.15; }
.topbar-sub { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.view { padding: 24px 32px 72px; max-width: 1560px; width: 100%; }
.view:focus { outline: none; }

.loading { color: var(--muted); padding: 40px 0; }

/* --------------------------------------------------------------------------
   Кнопки
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background .15s ease, border-color .15s ease, transform .12s ease, color .15s ease;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { background: #fff; border-color: var(--muted-2); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(180deg, var(--plum-600), var(--plum-700));
  border-color: var(--plum-700);
  color: #fffaf3;
  box-shadow: 0 10px 20px -14px rgba(36, 29, 53, .9);
}
.btn-primary:hover { background: linear-gradient(180deg, #55457a, var(--plum-600)); border-color: var(--plum-600); color: #fff; }
.btn-accent {
  background: linear-gradient(180deg, #d39244, var(--accent-strong));
  border-color: var(--accent-strong);
  color: #fff;
  box-shadow: 0 10px 20px -14px rgba(168, 106, 36, .9);
}
.btn-accent:hover { filter: brightness(1.05); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-3); color: var(--ink); border-color: transparent; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: rgba(179, 64, 58, .35); color: var(--danger); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 9px; }
.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 9px;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--muted);
}
.btn-icon:hover { background: var(--surface-3); color: var(--ink); border-color: transparent; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* --------------------------------------------------------------------------
   Поля ввода
   -------------------------------------------------------------------------- */

.input, .select, .textarea {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 13.5px;
  color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
  min-width: 0;
}
.textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.45; }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(200, 135, 58, .18);
}
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.select {
  appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236e6779' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
}
.input-sm, .select-sm { height: 34px; font-size: 12.5px; padding: 0 10px; }
.select-sm { padding-right: 28px; }

.search { position: relative; display: flex; align-items: center; }
.search svg { position: absolute; left: 11px; width: 15px; height: 15px; color: var(--muted-2); pointer-events: none; }
.search .input { padding-left: 33px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field[hidden] { display: none; }
.field > label { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .01em; }
.field-hint { font-size: 11.5px; color: var(--muted-2); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid .span-3 { grid-column: 1 / -1; }

.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--plum-600); }

/* --------------------------------------------------------------------------
   Общие блоки
   -------------------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.section { margin-bottom: 22px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h2 { font-size: 18px; }
.section-head .muted { font-size: 12.5px; }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { flex-wrap: wrap; }

.avatar {
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--plum-700);
  background: #efe9f7;
  border: 1px solid #e0d6ef;
}
.avatar-lg { width: 40px; height: 40px; font-size: 13px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--surface-3);
  color: var(--ink-2);
  border: 1px solid transparent;
  white-space: nowrap;
}
.chip-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.chip-room { background: color-mix(in srgb, var(--c, #6b5b95) 12%, #fff); color: var(--c, #6b5b95); border-color: color-mix(in srgb, var(--c, #6b5b95) 26%, #fff); }
.chip-click { cursor: pointer; }
.chip-click:hover { border-color: var(--muted-2); }
.chip.is-on { box-shadow: inset 0 0 0 1.5px currentColor; }
.chip.is-on.chip-room { background: color-mix(in srgb, var(--c, #6b5b95) 18%, #fff); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .01em;
  white-space: nowrap;
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-draft { background: var(--warn-soft); color: var(--warn); }
.badge-cancel { background: var(--danger-soft); color: var(--danger); }
.badge-soft { background: var(--surface-3); color: var(--muted); }
.badge-budget { background: #e6efe3; color: #47663c; }
.badge-paid { background: #f7e7cf; color: #8a5a18; }
.badge-live { background: #fbe3d8; color: #b1542c; }
.badge-live::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #d4622f; animation: pulse 1.8s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .45; transform: scale(.82); }
}

/* --------------------------------------------------------------------------
   Панель фильтров
   -------------------------------------------------------------------------- */

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.toolbar .search { min-width: 220px; max-width: 320px; flex: 1 1 220px; }
.toolbar .select, .toolbar .input { width: auto; min-width: 150px; }
.toolbar-spacer { flex: 1; }

.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--surface-3);
  border-radius: 11px;
  border: 1px solid var(--line);
}
.segmented button {
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.segmented button:hover { color: var(--ink); }
.segmented button.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.seg-count {
  display: inline-block;
  margin-left: 5px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted-2);
}
.segmented button.is-active .seg-count { color: var(--ink-2); }

/* --------------------------------------------------------------------------
   Главная «Сегодня»
   -------------------------------------------------------------------------- */

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }

.kpi {
  position: relative;
  overflow: hidden;
  padding: 16px 18px 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.kpi::after {
  content: '';
  position: absolute;
  right: -30px;
  top: -34px;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--kpi-tint, rgba(200, 135, 58, .1));
}
.kpi-label { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .01em; }
.kpi-value { font-family: var(--serif); font-size: 34px; line-height: 1.1; margin-top: 6px; letter-spacing: -.02em; }
.kpi-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.kpi.is-alert .kpi-value { color: var(--danger); }
.kpi.is-ok .kpi-value { color: var(--ok); }

.dash { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; align-items: start; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}
.panel-head h2 { font-size: 16px; }
.panel-head .muted { font-size: 12px; }
.panel-body { padding: 8px 8px 10px; }
.panel-body.flush { padding: 0; }
.panel-foot { padding: 10px 18px 14px; border-top: 1px solid var(--line); }

.timeline { display: flex; flex-direction: column; }
.tl-item {
  display: grid;
  grid-template-columns: 74px 3px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: stretch;
  padding: 11px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: background .14s ease;
}
.tl-item:hover { background: var(--surface-2); }
.tl-time { font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--muted); padding-top: 1px; }
.tl-time b { display: block; color: var(--ink); font-size: 13px; font-weight: 700; }
.tl-bar { border-radius: 3px; background: var(--c, var(--plum-500)); }
.tl-main { min-width: 0; }
.tl-title { font-weight: 600; font-size: 13.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tl-meta { font-size: 12px; color: var(--muted); margin-top: 3px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tl-side { display: flex; align-items: center; }

.task-line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 11px;
  cursor: pointer;
}
.task-line:hover { background: var(--surface-2); }
.task-check {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border-radius: 6px;
  border: 1.5px solid var(--line-2);
  background: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: transparent;
  transition: all .15s ease;
}
.task-check:hover { border-color: var(--ok); }
.task-check.is-done { background: var(--ok); border-color: var(--ok); color: #fff; }
.task-check svg { width: 11px; height: 11px; }
.task-line-main { min-width: 0; flex: 1; }
.task-line-title { font-size: 13px; font-weight: 500; }
.task-line.is-done .task-line-title { text-decoration: line-through; color: var(--muted-2); }
.task-line-meta { font-size: 11.5px; color: var(--muted); margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; }
.overdue { color: var(--danger); font-weight: 600; }

.free-room {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 11px;
  font-size: 12.5px;
}
.free-room:hover { background: var(--surface-2); }
.free-room .chip-room { flex: none; max-width: 60%; overflow: hidden; text-overflow: ellipsis; }
.free-room .free-time { margin-left: auto; color: var(--ok); font-weight: 600; font-size: 12px; }

/* --------------------------------------------------------------------------
   Календарь
   -------------------------------------------------------------------------- */

.cal-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.cal-title { font-family: var(--serif); font-size: 20px; min-width: 190px; }
.cal-legend { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-left: auto; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}
.cal-weekdays div {
  padding: 0 4px 4px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.cal-weekdays div.is-weekend { color: #b98a5a; }

.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }

.cal-cell {
  position: relative;
  min-height: 124px;
  padding: 7px 7px 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .14s ease, box-shadow .14s ease, background .14s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
}
.cal-cell:hover { border-color: #c9bda8; box-shadow: var(--shadow); }
.cal-cell.is-out { background: transparent; border-color: transparent; opacity: .5; }
.cal-cell.is-out:hover { border-color: var(--line); background: var(--surface-2); }
.cal-cell.is-weekend { background: #fdfaf4; }
.cal-cell.is-today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset, var(--shadow); }
.cal-cell.is-selected { border-color: var(--plum-600); }

.cal-daynum {
  align-self: flex-start;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-2);
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
}
.cal-cell.is-today .cal-daynum { background: var(--accent); color: #fff; }
.cal-cell.is-weekend .cal-daynum { color: #a8763f; }
.cal-cell.is-today .cal-daynum { color: #fff; }

.cal-ev {
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  padding: 3px 6px 3px 7px;
  border-radius: 6px;
  font-size: 11px;
  line-height: 1.3;
  font-weight: 600;
  color: color-mix(in srgb, var(--c) 78%, #241f2e);
  background: color-mix(in srgb, var(--c) 13%, #fff);
  border-left: 2.5px solid var(--c);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-ev:hover { background: color-mix(in srgb, var(--c) 22%, #fff); }
.cal-ev.is-cancel { text-decoration: line-through; opacity: .6; }
.cal-ev .t { font-variant-numeric: tabular-nums; opacity: .75; font-weight: 600; margin-right: 3px; }
.cal-more { font-size: 10.5px; font-weight: 700; color: var(--muted); padding-left: 3px; margin-top: auto; }

/* Неделя */

.week-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }
.week-head { display: grid; grid-template-columns: 58px repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--line); background: var(--surface-2); }
.week-head .wh { padding: 9px 6px; text-align: center; font-size: 11.5px; border-left: 1px solid var(--line); }
.week-head .wh:first-child { border-left: 0; }
.week-head .wh b { display: block; font-family: var(--serif); font-size: 16px; font-weight: 600; }
.week-head .wh.is-today { background: var(--accent-soft); }
.week-head .wh.is-today b { color: var(--accent-strong); }
.week-head .wh .dow { color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-size: 10.5px; font-weight: 700; }

.week-body { position: relative; display: grid; grid-template-columns: 58px repeat(7, minmax(0, 1fr)); }
.week-hours { position: relative; }
.hour-label {
  position: absolute;
  right: 7px;
  transform: translateY(-50%);
  font-size: 10.5px;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
}
.week-col {
  position: relative;
  border-left: 1px solid var(--line);
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--hour-h) - 1px), var(--line) calc(var(--hour-h) - 1px), var(--line) var(--hour-h));
  min-height: calc(var(--hour-h) * 14);
}
.week-col.is-today { background-color: #fffaf0; }
.week-col.is-weekend { background-color: #fdfaf4; }
.week-ev {
  position: absolute;
  left: 3px;
  right: 3px;
  padding: 4px 6px;
  border-radius: 7px;
  font-size: 10.5px;
  line-height: 1.25;
  font-weight: 600;
  overflow: hidden;
  cursor: pointer;
  border-left: 3px solid var(--c);
  background: color-mix(in srgb, var(--c) 16%, #fff);
  color: color-mix(in srgb, var(--c) 76%, #241f2e);
  box-shadow: 0 1px 2px rgba(36, 31, 46, .06);
}
.week-ev:hover { background: color-mix(in srgb, var(--c) 26%, #fff); }
.week-ev b { display: block; font-variant-numeric: tabular-nums; font-weight: 700; opacity: .85; }
.week-ev span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.week-ev.is-cancel { opacity: .55; text-decoration: line-through; }

/* --------------------------------------------------------------------------
   Кабинеты
   -------------------------------------------------------------------------- */

.day-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.day-nav .date-label { font-family: var(--serif); font-size: 17px; min-width: 250px; }

.rooms-list { display: flex; flex-direction: column; gap: 14px; }

.room-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }
.room-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, color-mix(in srgb, var(--c) 8%, #fff), var(--surface) 60%);
  flex-wrap: wrap;
}
.room-name { font-family: var(--serif); font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 9px; }
.room-swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex: none; }
.room-meta { font-size: 12px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.room-meta span { display: inline-flex; align-items: center; gap: 4px; }
.room-load { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }

.track-wrap { padding: 14px 16px 16px; }
.track {
  position: relative;
  height: 78px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  cursor: crosshair;
  background-image: repeating-linear-gradient(to right, transparent 0, transparent calc(100% / 14 - 1px), rgba(36, 31, 46, .06) calc(100% / 14 - 1px), rgba(36, 31, 46, .06) calc(100% / 14));
}
.track-hours { position: relative; height: 16px; margin-bottom: 5px; }
.track-hours span {
  position: absolute;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
}
.track-hours span:first-child { transform: none; }
.track-hours span:last-child { transform: translateX(-100%); }

.track-ev {
  position: absolute;
  top: 5px;
  bottom: 5px;
  padding: 6px 8px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--c) 20%, #fff);
  border: 1px solid color-mix(in srgb, var(--c) 42%, #fff);
  border-left: 3px solid var(--c);
  font-size: 11.5px;
  font-weight: 600;
  color: color-mix(in srgb, var(--c) 80%, #241f2e);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 1px;
  transition: filter .14s ease;
  z-index: 1;
}
.track-ev:hover { filter: brightness(.97); z-index: 3; box-shadow: 0 6px 16px -8px rgba(36, 31, 46, .5); }
.track-ev small { font-size: 10px; opacity: .8; font-variant-numeric: tabular-nums; font-weight: 600; }
.track-ev.is-cancel { opacity: .5; text-decoration: line-through; }
.track-ev.is-draft { border-style: dashed; }
.track-now {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 2px;
  background: var(--danger);
  z-index: 4;
  pointer-events: none;
}
.track-now::before {
  content: '';
  position: absolute;
  top: -3px;
  left: 50%;
  transform: translateX(-50%);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--danger);
}
.track-empty-hint { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11.5px; color: var(--muted-2); pointer-events: none; }

.room-foot { display: flex; align-items: center; gap: 12px; padding: 0 16px 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.free-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }

/* --------------------------------------------------------------------------
   Мероприятия (таблица)
   -------------------------------------------------------------------------- */

.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; table-layout: fixed; min-width: 940px; }
.tbl th, .tbl td { overflow: hidden; }
.tbl thead th {
  text-align: left;
  padding: 11px 14px;
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted-2);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-weight: 700;
  white-space: nowrap;
}
.tbl tbody td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 13px; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr { cursor: pointer; transition: background .12s ease; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl .title-cell { font-weight: 600; }
.tbl .title-cell > div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl .title-cell .sub { max-width: none; }
.tbl .sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.tbl .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .actions { text-align: right; white-space: nowrap; }
.tbl .actions .btn-icon { width: 30px; height: 30px; }
.tbl .actions .btn-icon svg { width: 15px; height: 15px; }
.tbl-empty { padding: 46px 20px; text-align: center; color: var(--muted); }

.person { display: flex; align-items: center; gap: 8px; min-width: 0; }
.person span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --------------------------------------------------------------------------
   Задачи (канбан)
   -------------------------------------------------------------------------- */

.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.col { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-lg); display: flex; flex-direction: column; min-height: 220px; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 10px; }
.col-head h3 { font-size: 14px; font-family: var(--sans); font-weight: 700; }
.col-count { font-size: 11.5px; font-weight: 700; color: var(--muted); background: var(--surface-3); border-radius: 999px; padding: 1px 7px; }
.col-head .btn-icon { margin-left: auto; }
.col-body { display: flex; flex-direction: column; gap: 9px; padding: 0 10px 12px; min-height: 60px; flex: 1; }
.col-body.is-drop { background: var(--accent-soft); border-radius: 12px; outline: 2px dashed rgba(200, 135, 58, .5); outline-offset: -4px; }

.task-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color .14s ease, box-shadow .14s ease, transform .12s ease;
}
.task-card:hover { border-color: var(--line-2); box-shadow: var(--shadow); }
.task-card.is-dragging { opacity: .45; transform: rotate(1deg); }
.task-card.is-done .task-title { text-decoration: line-through; color: var(--muted-2); }
.task-title { font-size: 13px; font-weight: 600; line-height: 1.35; }
.task-desc { font-size: 11.5px; color: var(--muted); margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.task-foot { display: flex; align-items: center; gap: 8px; margin-top: 9px; flex-wrap: wrap; }
.task-foot .due { font-size: 11px; color: var(--muted); margin-left: auto; font-variant-numeric: tabular-nums; }
.prio { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.prio-Высокий { background: var(--danger); }
.prio-Средний { background: var(--accent); }
.prio-Низкий { background: var(--muted-2); }
.col-empty { padding: 14px 8px; text-align: center; font-size: 12px; color: var(--muted-2); }

/* --------------------------------------------------------------------------
   Справочники
   -------------------------------------------------------------------------- */

.refs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.refs .panel-body { padding: 0; }
.ref-row { display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-bottom: 1px solid var(--line); }
.ref-row:last-child { border-bottom: 0; }
.ref-row .grow { min-width: 0; }
.ref-name { font-size: 13px; font-weight: 600; }
.ref-sub { font-size: 11.5px; color: var(--muted); }
.ref-actions { display: flex; gap: 2px; margin-left: auto; }
.settings-panel { grid-column: 1 / -1; }
.settings-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding: 16px; }
.settings-grid .span-3 { grid-column: 1 / -1; }

/* --------------------------------------------------------------------------
   Коллективы
   -------------------------------------------------------------------------- */

.coll-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }

.coll-card {
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 15px 18px 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--c);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.coll-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.coll-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex: none; }
.coll-title {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.coll-head .badge { flex: none; }
.coll-head .btn-icon { width: 28px; height: 28px; flex: none; }
.coll-head .btn-icon svg { width: 14px; height: 14px; }
.coll-head .btn-icon:first-of-type { margin-left: auto; }

.coll-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.coll-meta .person { max-width: 190px; }
.coll-stat { display: inline-flex; align-items: center; gap: 4px; }
.coll-desc { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.coll-price { font-size: 12px; font-weight: 600; color: #8a5a18; white-space: nowrap; }
.coll-sched { border-top: 1px dashed var(--line); padding-top: 10px; }
.coll-sched-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 7px;
}
.coll-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.swatch-label { position: relative; cursor: pointer; display: inline-flex; }
.swatch-label input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.swatch {
  display: block;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06);
}

.slot-list { display: flex; flex-direction: column; gap: 7px; }
.slot-row { display: grid; grid-template-columns: 84px 94px 10px 94px minmax(0, 1fr) 34px; gap: 6px; align-items: center; }
.slot-empty {
  padding: 12px;
  border: 1px dashed var(--line-2);
  border-radius: 10px;
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
}

.avail-line {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 11px;
  border-radius: 10px;
  font-size: 12.5px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  line-height: 1.4;
}
.avail-line svg { flex: none; }
.avail-line.is-ok { background: var(--ok-soft); border-color: rgba(47, 125, 95, .2); color: #21614a; }
.avail-line.is-warn { background: var(--warn-soft); border-color: rgba(163, 129, 47, .28); color: #6f5518; }
.avail-line.is-bad { background: var(--danger-soft); border-color: rgba(179, 64, 58, .25); color: #8f2f2a; }

.gen-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  padding: 9px 11px;
  border-radius: 10px;
  margin-bottom: 6px;
  line-height: 1.45;
}
.gen-line svg { flex: none; margin-top: 1px; }
.gen-line.is-ok { background: var(--ok-soft); color: #21614a; }
.gen-line.is-warn { background: var(--warn-soft); color: #6f5518; }
.gen-list { margin: 0 0 0 18px; padding: 0; font-size: 12px; color: var(--muted); line-height: 1.55; }

.wh-sub { font-size: 10.5px; color: var(--muted); margin-top: 2px; font-weight: 500; }

.week-ev small { display: block; font-size: 10px; opacity: .82; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.week-ev.is-collective { border-left-style: dashed; }

.day-lessons { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.day-item.is-lesson { background: var(--surface-2); border-style: dashed; }

.track-slot {
  position: absolute;
  top: 5px;
  bottom: 5px;
  border-radius: 8px;
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c) 9%, #fff) 0 6px, #fff 6px 12px);
  border: 1px dashed color-mix(in srgb, var(--c) 45%, #fff);
  color: color-mix(in srgb, var(--c) 75%, #241f2e);
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  z-index: 0;
  cursor: pointer;
}
.track-slot:hover { background: color-mix(in srgb, var(--c) 16%, #fff); }
.track-slot > span { min-width: 0; width: 100%; }

/* --------------------------------------------------------------------------
   Вход в систему
   -------------------------------------------------------------------------- */

body.is-auth { overflow: hidden; }
body.is-auth .app { display: none; }

.auth-root {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow-y: auto;
  background:
    radial-gradient(720px 420px at 82% 8%, rgba(200, 135, 58, .28), transparent 62%),
    radial-gradient(620px 420px at 8% 96%, rgba(107, 91, 149, .38), transparent 65%),
    linear-gradient(165deg, #332a4b, #241d35 70%);
}
.auth-root[hidden] { display: none; }

.auth-card {
  width: min(430px, 100%);
  background: var(--surface);
  border-radius: 22px;
  padding: 28px 30px 24px;
  box-shadow: 0 32px 80px -30px rgba(0, 0, 0, .7);
  border: 1px solid rgba(255, 255, 255, .12);
  animation: pop .22s cubic-bezier(.2, .9, .3, 1.2);
}

.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.auth-mark {
  width: 46px;
  height: 46px;
  font-size: 17px;
  color: #f3cb96;
  background: linear-gradient(160deg, #3a2f52, #241d35);
  border-color: rgba(200, 135, 58, .45);
  box-shadow: 0 10px 20px -12px rgba(36, 29, 53, .9);
}
.auth-org { font-family: var(--serif); font-size: 17px; line-height: 1.2; color: var(--ink); }
.auth-sub { font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted-2); margin-top: 3px; }
.auth-card h1 { font-size: 23px; margin-bottom: 6px; }
.auth-hint { margin: 0 0 18px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.auth-card form { display: flex; flex-direction: column; gap: 12px; }
.auth-submit { height: 44px; width: 100%; margin-top: 4px; font-size: 14px; }
.auth-card .form-msg { margin: 0; }
.auth-foot {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.6;
  text-align: center;
}

/* --------------------------------------------------------------------------
   Доступ и учётная запись
   -------------------------------------------------------------------------- */

.role-help { display: grid; gap: 10px; }
.role-row {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 12px;
  font-size: 12.5px;
  padding-bottom: 9px;
  border-bottom: 1px dashed var(--line);
}
.role-row:last-child { border-bottom: 0; padding-bottom: 0; }
.role-name { font-weight: 600; color: var(--ink-2); }
.role-hint { color: var(--muted); }

.account-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.account-name { font-family: var(--serif); font-size: 18px; }
.account-grid { display: flex; flex-direction: column; gap: 10px; }
.account-row { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 10px; font-size: 12.5px; }
.account-row > span { color: var(--muted); }

.perm-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}
.perm-grid .check { align-items: flex-start; gap: 8px; }
.perm-grid .check span { line-height: 1.35; }
.perm-grid .check.is-off { opacity: .5; }

.is-readonly input:disabled,
.is-readonly select:disabled,
.is-readonly textarea:disabled {
  background: var(--surface-2);
  color: var(--ink-2);
  opacity: 1;
  -webkit-text-fill-color: var(--ink-2);
}
.is-readonly .slot-row .btn-icon { display: none; }

.storage .text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --------------------------------------------------------------------------
   Важные ссылки и сеть
   -------------------------------------------------------------------------- */

.link-tree { padding: 6px 8px 8px; }

.link-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px 7px calc(8px + var(--depth, 0) * 20px);
  border-radius: 10px;
  cursor: pointer;
  transition: background .12s ease;
}
.link-row:hover { background: var(--surface-2); }
.link-row.is-group .link-title { font-weight: 600; }

.link-caret { width: 18px; height: 18px; display: grid; place-items: center; color: var(--muted-2); flex: none; }
.link-caret.is-empty { visibility: hidden; }

.link-icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--surface-3);
  color: var(--muted);
  flex: none;
}
.link-icon.is-web { background: #e7eef8; color: #3f6ba8; }
.link-icon.is-file { background: #f7ecdc; color: #a8762f; }
.link-icon.is-folder { background: #e8f0e4; color: #587a46; }

.link-main { flex: 1; min-width: 0; }
.link-title { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-sub { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-path { color: var(--muted-2); }
.link-type { text-transform: lowercase; flex: none; }

.link-actions { display: flex; gap: 2px; opacity: .5; transition: opacity .12s ease; flex: none; }
.link-row:hover .link-actions { opacity: 1; }
.link-actions .btn-icon { width: 28px; height: 28px; }
.link-actions .btn-icon svg { width: 15px; height: 15px; }

.net-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 12.5px;
  flex-wrap: wrap;
}
.net-row:last-child { border-bottom: 0; }
.net-label { color: var(--muted); min-width: 160px; display: inline-flex; align-items: center; gap: 6px; }
.mono { font-family: Consolas, 'Courier New', monospace; font-size: 12.5px; color: var(--ink-2); }
.net-row .btn-icon { margin-left: auto; width: 28px; height: 28px; }

.net-help h3 { font-family: var(--sans); font-size: 14px; font-weight: 700; margin: 16px 0 6px; }
.net-help p { margin: 0 0 8px; font-size: 13px; line-height: 1.55; }
.net-help ol { margin: 0 0 8px 18px; padding: 0; font-size: 13px; line-height: 1.6; }
.net-help code { background: var(--surface-3); padding: 1px 5px; border-radius: 5px; font-size: 12px; }
.net-lead { color: var(--muted); }
.net-note { color: var(--muted); font-size: 12.5px; }
.net-warn {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--warn-soft);
  color: #6f5518;
  font-size: 12.5px;
  line-height: 1.5;
}
.net-warn ul { margin: 6px 0 0 18px; padding: 0; }

/* --------------------------------------------------------------------------
   Модальные окна, тосты, пустые состояния
   -------------------------------------------------------------------------- */

.modal-root { position: relative; z-index: 60; }

.modal-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(28, 22, 40, .5);
  backdrop-filter: blur(3px);
  animation: fadeIn .16s ease;
  z-index: 60;
  overflow-y: auto;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: min(600px, 100%);
  max-height: min(90vh, 860px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  animation: pop .18s cubic-bezier(.2, .9, .3, 1.2);
  overflow: hidden;
}
.modal.is-wide { width: min(780px, 100%); }
.modal.is-narrow { width: min(430px, 100%); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }

.modal-head { display: flex; align-items: flex-start; gap: 14px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 19px; }
.modal-head .muted { font-size: 12px; margin-top: 3px; }
.modal-close { margin-left: auto; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; gap: 9px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); }
.modal-foot .spacer { flex: 1; }

.form-msg { display: none; padding: 10px 12px; border-radius: 10px; font-size: 12.5px; margin-top: 4px; }
.form-msg.is-error { display: block; background: var(--danger-soft); color: #8f2f2a; border: 1px solid rgba(179, 64, 58, .25); }
.form-msg.is-warn { display: block; background: var(--warn-soft); color: #7c5f1c; border: 1px solid rgba(163, 129, 47, .28); }

.toast-root { position: fixed; right: 22px; bottom: 22px; display: flex; flex-direction: column; gap: 8px; z-index: 90; }
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 16px;
  border-radius: 12px;
  background: var(--plum-800);
  color: #f8f4ff;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 18px 40px -18px rgba(24, 19, 38, .8);
  animation: toastIn .22s ease;
  max-width: 380px;
}
.toast svg { width: 16px; height: 16px; flex: none; }
.toast.is-ok svg { color: #8fdcb6; }
.toast.is-error { background: #7d2a26; }
.toast.is-error svg { color: #ffc4bf; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.empty { padding: 46px 20px; text-align: center; color: var(--muted); }
.empty .empty-icon { width: 46px; height: 46px; margin: 0 auto 12px; display: grid; place-items: center; border-radius: 14px; background: var(--surface-3); color: var(--muted-2); }
.empty .empty-icon svg { width: 22px; height: 22px; }
.empty h3 { font-size: 16px; margin-bottom: 5px; color: var(--ink-2); }
.empty p { margin: 0; font-size: 12.5px; }

/* День (модалка) */
.day-list { display: flex; flex-direction: column; gap: 6px; }
.day-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 11px; border: 1px solid var(--line); background: #fff; cursor: pointer; font: inherit; color: inherit; width: 100%; }
.day-item:hover { border-color: var(--line-2); background: var(--surface-2); }
.day-item .di-time { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--muted); min-width: 92px; }
.day-item .di-main { min-width: 0; flex: 1; }
.day-item .di-title { font-size: 13px; font-weight: 600; }
.day-item .di-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* --------------------------------------------------------------------------
   Адаптив
   -------------------------------------------------------------------------- */

@media (max-width: 1240px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash { grid-template-columns: minmax(0, 1fr); }
  .refs { grid-template-columns: minmax(0, 1fr); }
  .settings-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 1040px) {
  :root { --sidebar-w: 224px; }
  .view { padding: 20px 22px 64px; }
  .topbar { padding: 12px 22px; }
  .topbar h1 { font-size: 22px; }
  .board { grid-template-columns: minmax(0, 1fr); }
  .coll-grid { grid-template-columns: minmax(0, 1fr); }
  .cal-cell { min-height: 104px; }
}

@media (max-width: 820px) {
  .app { display: block; }
  .sidebar {
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    overflow: visible;
    position: sticky;
    top: 0;
    z-index: 30;
  }
  .brand { flex: none; }
  .brand-text { display: none; }
  .brand-mark { width: 38px; height: 38px; font-size: 14px; }
  .nav { flex-direction: row; gap: 4px; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-link { padding: 8px 10px; white-space: nowrap; }
  .nav-link span.label { display: none; }
  .nav-link.is-active::before { display: none; }
  .nav-count { display: none; }
  .sidebar-foot { margin-top: 0; margin-left: auto; flex: none; }
  .who { display: flex; width: auto; padding: 4px; }
  .who-text { display: none; }
  .who .avatar { width: 32px; height: 32px; font-size: 11px; }
  .storage span.text { display: none; }
  .topbar { position: static; flex-wrap: wrap; }
  .week-wrap { overflow-x: auto; }
  .week-head, .week-body { min-width: 720px; }
  .cal-cell { min-height: 88px; padding: 5px; }
  .cal-ev { font-size: 10px; }
  .cal-weekdays div { font-size: 10px; }
  .form-grid { grid-template-columns: 1fr; }
  .modal-foot { flex-wrap: wrap; }
}

@media (max-width: 640px) {
  .view { padding: 16px 14px 56px; }
  .topbar {
    padding: 12px 14px;
    min-height: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .topbar-title { flex: none; }
  .topbar h1 { font-size: 20px; }
  .topbar-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar-actions { justify-content: flex-start; }
  .topbar-actions .btn { flex: 1 1 auto; }
  .cal-bar .row-wrap {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin-left: 0;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .cal-bar .row-wrap::-webkit-scrollbar { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-value { font-size: 26px; }
  .toolbar .search { max-width: none; }
  .tbl .hide-sm { display: none; }
  .cal-cell { min-height: 56px; padding: 4px; border-radius: 10px; }
  .cal-grid, .cal-weekdays { gap: 4px; }
  .cal-daynum { width: 20px; height: 20px; font-size: 11.5px; }
  .cal-more { font-size: 9.5px; padding-left: 0; text-align: center; }
  .cal-more .more-label { display: none; }
  .cal-ev { display: none; }
  .cal-cell.has-ev .cal-daynum::after {
    content: '';
    display: block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent);
    margin: 2px auto 0;
  }
  .cal-cell .cal-more { display: block; margin-top: auto; }
  .settings-grid { grid-template-columns: 1fr; }
  .coll-title {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  .coll-head { flex-wrap: wrap; }
  .slot-row { display: flex; flex-wrap: wrap; }
  .slot-row select[data-slot-field="weekday"] { width: 76px; }
  .slot-row input[type="time"] { width: 92px; }
  .slot-row [data-slot-field="roomId"] { flex: 1 1 140px; width: auto; }
  .day-item .di-time { min-width: 74px; font-size: 11px; }
  .tl-item { grid-template-columns: 62px 3px minmax(0, 1fr); }
  .tl-side { display: none; }
}

/* --------------------------------------------------------------------------
   Печать
   -------------------------------------------------------------------------- */

@media print {
  body { background: #fff; }
  body::before { display: none; }
  .sidebar, .topbar, .toolbar, .day-nav, .btn, .track-hours, .free-chips { display: none !important; }
  .app { display: block; }
  .view { padding: 0; max-width: none; }
  .room-card, .panel, .week-wrap, .table-wrap { box-shadow: none; border-color: #bbb; break-inside: avoid; }
  .rooms-list { gap: 10px; }
  .track { height: 62px; }
  .print-title { display: block !important; margin-bottom: 14px; }
}

.print-title { display: none; font-family: var(--serif); font-size: 20px; margin-bottom: 14px; }

/* --------------------------------------------------------------------------
   Мелкие утилиты
   -------------------------------------------------------------------------- */

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.kbd {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 5px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  font-size: 11px;
  font-family: var(--sans);
  color: var(--muted);
}
