/* Экран «День». Утверждён 02.12.2026: на компьютере — шкала по кабинетам
   (вариант А), на телефоне — табло кабинетов (docs/design/day-brand-*). */

.day {
  --ev-bg: #edf5fa;
  --ev-edge: #9cc4dc;
  --ev-meta: #4d586f;
  --ev-now-bg: #d7eaf5;
  --ev-now-edge: #2585b5;
  --ev-done-bg: #f1f3f6;
  --ev-done-ink: #687288;
  --shift-bg: #e8ebf0;
  --shift-ink: #26324a;
  --warn-stripe: rgb(217 164 65 / 0.28);
  --r-ev: 8px;
  --row-h: 48px;
}

/* ---------- заголовок дня ---------- */

.dayhead { display: flex; align-items: center; gap: 12px; padding: 24px 0 20px; }
.dayhead-title { display: flex; align-items: center; gap: 12px; }
.dayhead h1 { font-family: var(--display); font-weight: 600; font-size: 28px; line-height: 1.15; }
.date-short { display: none; }
.today-mark { color: var(--date); font-weight: 500; }
.dayhead-summary { margin-left: auto; color: var(--muted); }
.add-btn .icon { width: 18px; height: 18px; }

/* ---------- шкала (компьютер) ---------- */

.tl {
  --label: 144px;
  --pad-r: 20px;
  position: relative;
  isolation: isolate;
  padding-top: 40px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  overflow: hidden;
}
.tl-grid { position: absolute; inset: 0 var(--pad-r) 0 calc(var(--label) + 12px); pointer-events: none; }
.tl-hour { position: absolute; top: 0; bottom: 0; z-index: 0; border-left: 1px solid var(--line-soft); }
.tl-hour-label { position: absolute; top: 12px; transform: translateX(-50%); font-size: 12px; line-height: 16px; color: var(--muted); }
.tl-now { position: absolute; top: 8px; bottom: 0; z-index: 3; border-left: 2px solid var(--active); }
.tl-now-label {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--active);
  color: #fff;
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
}

.tl-rows { background: var(--surface); }
.tl-row {
  display: grid;
  grid-template-columns: var(--label) 1fr;
  column-gap: 12px;
  align-items: center;
  padding-right: var(--pad-r);
  border-top: 1px solid var(--line-soft);
}
.tl-label { display: flex; flex-wrap: wrap; align-items: center; column-gap: 8px; padding-left: 20px; min-width: 0; }
.tl-label-note { font-size: 12px; line-height: 16px; color: var(--date); font-weight: 500; }
.tl-label-warn { color: var(--warn-ink); }
.tl-track { position: relative; height: calc(var(--lanes, 1) * var(--row-h)); }

.ev {
  position: absolute;
  top: calc(var(--lane, 0) * var(--row-h) + 4px);
  height: calc(var(--row-h) - 8px);
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 8px;
  padding: 0 12px;
  overflow: hidden;
  background: var(--ev-bg);
  border-left: 4px solid var(--ev-edge);
  border-radius: var(--r-ev);
  color: var(--ink);
  white-space: nowrap;
}
.ev:hover { filter: brightness(0.97); box-shadow: 0 0 0 1px var(--ev-now-edge); }
.ev-title { font-weight: 500; font-size: 14px; line-height: 20px; overflow: hidden; text-overflow: ellipsis; }
.ev-time { font-size: 12px; line-height: 16px; color: var(--ev-meta); }
.ev-group { margin-left: 8px; }
.ev-tag {
  margin-right: 8px;
  padding: 0 6px;
  border-radius: 4px;
  background: var(--active);
  color: #fff;
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
}
.ev-now { background: var(--ev-now-bg); border-left-color: var(--ev-now-edge); }
.ev-done { background: var(--ev-done-bg); border-left-color: var(--line); color: var(--ev-done-ink); }
.ev-done .ev-time { color: var(--ev-done-ink); }

.tl-free {
  position: relative;
  z-index: 2; /* закрывает линии сетки */
  padding: 12px 20px;
  border-top: 1px solid var(--line-soft);
  background: var(--surface);
}
.tl-free-label { color: var(--muted); }

.tl-people { border-top: 1px solid var(--line); background: #fafbfd; }
.tl-section {
  position: relative;
  z-index: 2;
  padding: 16px 20px 8px;
  background: inherit;
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  color: var(--muted);
}
.tl-row-person { --row-h: 40px; border-top: 0; }
.tl-person { font-weight: 500; }
.shift {
  position: absolute;
  top: 8px;
  bottom: 8px;
  z-index: 1;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 6px;
  background: var(--shift-bg);
  color: var(--shift-ink);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
}
.tl-row-gap { --row-h: 44px; border-top: 1px dashed var(--line); }
.tl-gap-label { gap: 8px; color: var(--warn-ink); font-weight: 500; }
.gap {
  position: absolute;
  top: 8px;
  bottom: 8px;
  z-index: 1;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--warn-edge);
  border-radius: var(--r-ev);
  background: repeating-linear-gradient(135deg, var(--warn-stripe) 0 6px, transparent 6px 12px), var(--warn-bg);
  color: var(--warn-ink);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
}
.tl-empty { position: relative; z-index: 2; padding: 16px 20px; background: inherit; color: var(--muted); }

/* ---------- карточка брони / кабинета ---------- */

.is-clickable { cursor: pointer; }
.card-top { display: flex; align-items: center; gap: 12px; }
.room-plate-lg { padding: 4px 10px; font-size: 24px; line-height: 32px; border-radius: 8px; }
.card-kind { display: flex; flex-direction: column; font-size: 14px; line-height: 20px; color: var(--muted); }
.card-state { font-weight: 500; color: var(--ink); }
.card-state-now { color: var(--active); }
.card-state-done { color: var(--muted); font-weight: 400; }
.card-when { margin-top: -12px; color: var(--date); font-weight: 500; }
.card-when-room { margin-top: 0; }
.card-facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 16px;
  margin: 0;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}
.card-facts dt { color: var(--muted); }
.card-facts dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- телефон ---------- */

.ml, .fab { display: none; }

.ml-rows {
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
}
.ml-row {
  display: grid;
  grid-template-columns: 104px 1fr;
  grid-template-areas: "time title" "time room";
  column-gap: 12px;
  align-items: baseline;
  min-height: 48px;
  padding: 12px 16px;
  border-top: 1px solid var(--line-soft);
}
.ml-row:first-child { border-top: 0; }
.ml-row:hover { background: var(--raised); }
.ml-row-time { grid-area: time; font-weight: 500; }
.ml-row-title { grid-area: title; }
.ml-row-room { grid-area: room; color: var(--muted); font-size: 14px; line-height: 20px; }
.ml-row-done { color: var(--muted); }
.ml-row-done .ml-row-time { font-weight: 400; }
.ml-muted { color: var(--muted); }

@media (max-width: 767px) {
  .tl, .dayhead-summary, .add-btn { display: none; }
  .ml { display: flex; flex-direction: column; gap: 24px; padding-top: 16px; }

  .dayhead {
    position: sticky;
    top: 0;
    z-index: 5;
    justify-content: space-between;
    margin: 0 -16px;
    padding: 8px 12px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
  }
  .dayhead-title { flex-direction: column; gap: 0; }
  .dayhead h1 { font-size: 20px; line-height: 28px; }
  .date-long { display: none; }
  .date-short { display: inline; }
  .today-mark { font-size: 14px; line-height: 20px; }
  .today-btn {
    min-height: 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--date);
    font-size: 14px;
    line-height: 20px;
    text-decoration: underline;
  }

  .ml-block { display: flex; flex-direction: column; gap: 12px; }
  .ml-title { font-family: var(--display); font-weight: 600; font-size: 20px; line-height: 28px; }
  .ml-warn {
    padding: 12px 16px;
    border: 1px solid var(--warn-edge);
    border-radius: var(--r-card);
    background: var(--warn-bg);
    color: var(--warn-ink);
  }
  .ml-warn strong { font-weight: 600; }
  .ml-warn .icon { vertical-align: -3px; margin-right: 8px; }
  .ml-free-label { color: var(--muted); }

  .ml-done summary, .ml-more summary { list-style: none; cursor: pointer; }
  .ml-done summary::-webkit-details-marker, .ml-more summary::-webkit-details-marker { display: none; }
  .ml-done summary { display: flex; align-items: center; gap: 8px; min-height: 44px; color: var(--muted); }
  .ml-done summary::before {
    content: "";
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
  }
  .ml-done[open] summary::before { transform: rotate(45deg); }
  .ml-more summary { width: 100%; }
  .ml-more[open] summary { display: none; }

  .ml-people { margin: 0; padding: 0; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
  .ml-people li { display: flex; align-items: baseline; gap: 12px; min-height: 48px; padding: 12px 16px; border-top: 1px solid var(--line-soft); }
  .ml-people li:first-child { border-top: 0; }
  .ml-person { font-weight: 500; }
  .ml-person-time { color: var(--muted); }
  .ml-here { margin-left: auto; color: var(--date); font-weight: 500; font-size: 14px; line-height: 20px; }

  /* табло кабинетов */
  .board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; padding: 0; list-style: none; }
  .board-plate {
    display: flex;
    flex-direction: column;
    min-height: 64px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: var(--r-card);
    background: var(--surface);
  }
  .board-plate:hover { background: var(--raised); }
  .board-plate.is-busy { background: var(--ev-now-bg); border-color: var(--ev-now-bg); border-left: 4px solid var(--ev-now-edge); }
  .board-number {
    font-family: var(--display);
    font-weight: 600;
    font-size: 20px;
    line-height: 28px;
    color: var(--plate-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .board-state { font-weight: 500; font-size: 12px; line-height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .board-plate.is-free .board-state { color: var(--date); }

  .fab {
    position: fixed;
    right: 16px;
    bottom: calc(76px + env(safe-area-inset-bottom));
    z-index: 11;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    padding: 0 20px 0 16px;
    border-radius: 12px;
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 500;
    text-decoration: none;
    box-shadow: 0 8px 24px rgb(11 27 61 / 0.16);
  }
  .fab:hover { background: var(--accent-hover); }
}

/* ---------- этажи (04.12.2026) ---------- */

.floor-tabs { margin: 0 0 16px; }
.floor-tabs .seg-item { border: 0; background: none; font: inherit; font-weight: 500; cursor: pointer; }
.floor-tabs .seg-item[aria-current] { background: var(--surface); }

@media (max-width: 767px) {
  .floor-tabs { display: flex; width: 100%; margin: 12px 0 0; }
  .floor-tabs .seg-item { flex: 1; padding: 8px 4px; font-size: 14px; }
  .week .floor-tabs { margin-bottom: 0; }
}
