/* Главная руководителя v288. Все правила замкнуты на .home3, чтобы не
   затрагивать рабочие разделы портала и главную обычного сотрудника. */
.home3 {
  display: grid;
  gap: 18px;
  align-content: start;
  --home3-wine: #8f163f;
  --home3-wine-soft: #f7e9ee;
  --home3-teal: #087c70;
  --home3-teal-soft: #e8f6f2;
  --home3-gold: #a86d08;
  --home3-gold-soft: #fff3d9;
}

.home3-overview {
  display: grid;
  grid-template-columns: minmax(220px, .95fr) minmax(420px, 1.45fr) auto;
  align-items: center;
  gap: 24px;
  min-width: 0;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(105deg, color-mix(in srgb, var(--home3-wine-soft) 88%, var(--surface-card)), var(--surface-card) 46%, color-mix(in srgb, var(--home3-teal-soft) 70%, var(--surface-card)));
  box-shadow: var(--shadow);
}
.home3-today { min-width: 0; }
.home3-today span, .home3-kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--home3-wine);
  font-size: 9.5px;
  font-weight: 850;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.home3-today b { display: block; overflow: hidden; font-size: 18px; letter-spacing: -.02em; text-overflow: ellipsis; white-space: nowrap; }
.home3-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); min-width: 0; }
.home3-metrics > div { min-width: 0; padding: 2px 20px; border-left: 1px solid var(--line); }
.home3-metrics b { display: block; font-size: 24px; font-variant-numeric: tabular-nums; letter-spacing: -.035em; }
.home3-metrics span { display: block; margin-top: 1px; overflow: hidden; color: var(--muted); font-size: 10.5px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.home3-metrics .is-alert b { color: var(--home3-wine); }
.home3-schedule {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  min-height: 42px; padding: 0 16px; border-radius: 11px;
  background: var(--home3-wine); color: #fff; font-size: 11.5px; font-weight: 800; white-space: nowrap;
  box-shadow: 0 8px 18px rgba(143,22,63,.18);
}
.home3-schedule:hover { background: #781133; }
.home3-schedule span { font-size: 16px; }

.home3-primary-grid, .home3-secondary-grid { display: grid; gap: 18px; align-items: start; min-width: 0; }
.home3-primary-grid { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); }
.home3-secondary-grid { grid-template-columns: minmax(0, 1.45fr) minmax(300px, .55fr); }
.home3-card {
  min-width: 0; padding: 18px 20px; border: 1px solid var(--line); border-radius: 18px;
  background: var(--surface-card); box-shadow: var(--shadow);
}
.home3-card > header { display: flex; align-items: center; gap: 16px; margin-bottom: 15px; }
.home3-card > header > div { min-width: 0; }
.home3-card h2 { margin: 0; font-size: 17px; letter-spacing: -.02em; }
.home3-badge {
  display: grid; place-items: center; min-width: 30px; height: 30px; margin-left: auto;
  border-radius: 10px; background: var(--surface-hover); color: var(--muted); font-size: 12px; font-weight: 850;
}
.home3-badge.is-alert { background: var(--home3-wine-soft); color: var(--home3-wine); }
.home3-hint { margin-left: auto; color: var(--muted); font-size: 10.5px; font-weight: 700; white-space: nowrap; }
.home3-footnote { margin: 11px 2px 0; color: var(--muted); font-size: 10.5px; }
.home3-empty { margin: 10px 0; color: var(--muted); font-size: 11.5px; }
.home3-header-link { margin-left: auto; color: var(--home3-wine); font-size: 11px; font-weight: 800; white-space: nowrap; }

/* Очередь использует проверенную разметку home2, но получает более спокойный
   вид внутри нового рабочего стола. */
.home3 .home2-queue { gap: 9px; }
.home3 .home2-q { min-height: 62px; grid-template-columns: 3px 58px minmax(0, 1fr) auto; border-radius: 12px; box-shadow: none; }
.home3 .home2-q .age b { font-size: 20px; }
.home3 .home2-q .body b { font-size: 12.5px; }

.home3-centers { display: grid; gap: 9px; }
.home3-center { overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-card-2); }
.home3-center.is-expanded { border-color: color-mix(in srgb, var(--home3-teal) 32%, var(--line)); }
.home3-center-head {
  display: grid; grid-template-columns: 8px minmax(0, 1fr) auto 26px; align-items: center; gap: 12px;
  width: 100%; min-height: 64px; padding: 10px 12px; text-align: left;
}
.home3-center-head:hover { background: var(--surface-hover); }
.home3-center-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--state-idle); }
.home3-center.is-open .home3-center-dot { background: var(--home3-teal); box-shadow: 0 0 0 4px color-mix(in srgb, var(--home3-teal) 12%, transparent); }
.home3-center.is-warn .home3-center-dot { background: var(--home3-gold); }
.home3-center.is-next .home3-center-dot { background: #75839a; }
.home3-center-copy { min-width: 0; }
.home3-center-copy b { display: block; font-size: 13px; }
.home3-center-copy small { display: block; margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 10.5px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.home3-center-state {
  padding: 5px 9px; border-radius: 999px; background: var(--state-idle-bg); color: var(--state-idle);
  font-size: 9px; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap;
}
.home3-center.is-open .home3-center-state { background: var(--home3-teal-soft); color: var(--home3-teal); }
.home3-center.is-warn .home3-center-state { background: var(--home3-gold-soft); color: var(--home3-gold); }
.home3-center-arrow { display: grid; place-items: center; width: 26px; height: 26px; color: var(--muted); font-size: 17px; font-weight: 500; }
.home3-center-detail { padding: 0 14px 13px 32px; border-top: 1px solid var(--line-soft); }
.home3-center-day { display: flex; align-items: baseline; gap: 8px; padding: 10px 0 7px; }
.home3-center-day b { color: var(--home3-teal); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.home3-center-day span { color: var(--muted); font-size: 10px; }
.home3-people { display: grid; }
.home3-person { position: relative; display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 51px; padding: 7px 3px; border-top: 1px solid var(--line-soft); border-radius: 9px; }
.home3-person.is-duty { margin: 3px 0; padding: 8px 7px; border-top-color: transparent; background: linear-gradient(90deg, var(--home3-gold-soft), color-mix(in srgb, var(--home3-gold-soft) 30%, transparent) 62%, transparent); box-shadow: inset 3px 0 0 var(--home3-gold); }
.home3-avatar { position: relative; display: grid; place-items: center; width: 36px; height: 36px; overflow: hidden; border: 2px solid var(--surface-card); border-radius: 50%; background: var(--surface-hover); color: var(--muted); font-size: 9px; font-weight: 850; box-shadow: 0 0 0 1px var(--line); }
.home3-avatar .ava-img { display: block; width: 100%; height: 100%; object-fit: cover; }
.home3-person.is-duty .home3-avatar { border-color: #fff8e5; background: var(--home3-gold-soft); color: var(--home3-gold); box-shadow: 0 0 0 2px color-mix(in srgb, var(--home3-gold) 44%, transparent); }
.home3-person-copy { min-width: 0; }
.home3-person-name { display: flex; align-items: center; gap: 7px; min-width: 0; }
.home3-person-copy b, .home3-person-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home3-person-copy b { font-size: 11.5px; }
.home3-person-copy small { margin-top: 2px; color: var(--muted); font-size: 9.5px; }
.home3-duty-badge { display: inline-flex; flex: none; align-items: center; gap: 4px; padding: 3px 7px; border: 1px solid color-mix(in srgb, var(--home3-gold) 28%, transparent); border-radius: 999px; background: #f0b934; color: #493100; font-size: 8px; font-style: normal; font-weight: 900; letter-spacing: .035em; text-transform: uppercase; box-shadow: 0 3px 8px rgba(168,109,8,.16); }
.home3-duty-badge i { font-size: 8px; font-style: normal; }
.home3-person-meta { display: grid; justify-items: end; gap: 4px; }
.home3-person-time { font-size: 10.5px; font-weight: 850; font-variant-numeric: tabular-nums; white-space: nowrap; }
.home3-person-status { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 8.5px; font-weight: 800; white-space: nowrap; }
.home3-person-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--state-idle); box-shadow: 0 0 0 3px color-mix(in srgb, var(--state-idle) 11%, transparent); }
.home3-person-status.is-active { color: var(--home3-teal); }
.home3-person-status.is-active i { background: #13a477; box-shadow: 0 0 0 3px rgba(19,164,119,.14), 0 0 8px rgba(19,164,119,.3); animation: home3-status-pulse 2.2s ease-in-out infinite; }
.home3-person-status.is-upcoming { color: var(--home3-gold); }
.home3-person-status.is-upcoming i { background: #e6a51b; box-shadow: 0 0 0 3px rgba(230,165,27,.14); }
.home3-person-status.is-ended { color: #7d899b; }
.home3-person-status.is-ended i { background: #9aa5b5; box-shadow: 0 0 0 3px rgba(154,165,181,.14); }
.home3-person-status.is-future { color: #4f78ba; }
.home3-person-status.is-future i { background: #5e8bd2; box-shadow: 0 0 0 3px rgba(94,139,210,.14); }
@keyframes home3-status-pulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.78); opacity: .62; } }
.home3-text-button { margin: 8px 0 0; color: var(--home3-wine); font-size: 10.5px; font-weight: 800; }

.home3-events { display: grid; }
.home3-event { display: grid; grid-template-columns: 50px minmax(0, 1fr) auto; align-items: center; gap: 13px; min-height: 62px; padding: 7px 2px; border-top: 1px solid var(--line-soft); }
.home3-event.is-clickable { cursor: pointer; border-radius: 10px; transition: background-color .16s ease, box-shadow .16s ease; }
.home3-event.is-clickable:hover { background: color-mix(in srgb, var(--home3-wine-soft) 42%, transparent); }
.home3-event.is-clickable:focus-visible { outline: 2px solid color-mix(in srgb, var(--home3-wine) 42%, transparent); outline-offset: 2px; }
.home3-event:first-child { border-top: 0; }
.home3-event-date { display: grid; grid-template-rows: auto auto; align-content: center; justify-items: center; width: 48px; height: 48px; min-height: 48px; padding: 3px 2px; overflow: hidden; border-radius: 11px; background: var(--home3-wine-soft); color: var(--home3-wine); text-align: center; }
.home3-event-date b { display: block; width: 100%; font-size: 17px; line-height: 1; text-align: center; font-variant-numeric: tabular-nums; }
.home3-event-date small { display: block; width: 100%; margin-top: 3px; font-size: 7.2px; line-height: 1; letter-spacing: -.025em; text-align: center; text-transform: uppercase; white-space: nowrap; }
.home3-event-copy { min-width: 0; }
.home3-event-copy b, .home3-event-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home3-event-copy b { font-size: 12px; }
.home3-event-copy small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.home3-event-kind { padding: 4px 8px; border-radius: 999px; background: var(--state-info-bg); color: var(--state-info); font-size: 8.5px; font-weight: 850; text-transform: uppercase; white-space: nowrap; }
.home3-event-kind.bus { background: var(--home3-gold-soft); color: var(--home3-gold); }
.home2-ev.is-clickable { cursor: pointer; border-radius: 10px; transition: background-color .16s ease, box-shadow .16s ease; }
.home2-ev.is-clickable:hover { background: color-mix(in srgb, var(--home3-wine-soft) 42%, transparent); }
.home2-ev.is-clickable:focus-visible { outline: 2px solid color-mix(in srgb, var(--home3-wine) 42%, transparent); outline-offset: 2px; }

.home3-quick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.home3-quick > button { display: grid; grid-template-columns: 26px minmax(0, 1fr); align-items: center; gap: 8px; min-height: 48px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-card-2); text-align: left; }
.home3-quick > button:hover { border-color: color-mix(in srgb, var(--home3-wine) 38%, var(--line)); }
.home3-quick > button span { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--home3-wine-soft); color: var(--home3-wine); font-size: 12px; }
.home3-quick > button b { overflow: hidden; font-size: 10.5px; line-height: 1.25; text-overflow: ellipsis; }

[data-theme=dark] .home3 { --home3-wine:#e88ca5; --home3-wine-soft:rgba(160,28,76,.2); --home3-teal:#67c9b8; --home3-teal-soft:rgba(22,139,119,.18); --home3-gold:#e8c16b; --home3-gold-soft:rgba(168,109,8,.18); }
[data-theme=dark] .home3-overview { background: linear-gradient(105deg, rgba(137,21,61,.22), var(--surface-card) 48%, rgba(14,111,96,.14)); }
[data-theme=dark] .home3-person.is-duty .home3-avatar { border-color: #3a3020; }
[data-theme=dark] .home3-duty-badge { background: #d9a62e; color: #231700; border-color: rgba(255,222,128,.28); }

@media (max-width: 1100px) {
  .home3-overview { grid-template-columns: minmax(200px, 1fr) auto; }
  .home3-metrics { grid-column: 1 / -1; grid-row: 2; }
  .home3-metrics > div:first-child { border-left: 0; padding-left: 0; }
  .home3-primary-grid, .home3-secondary-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .home3 { gap: 12px; }
  .home3-overview { grid-template-columns: 1fr; gap: 14px; padding: 16px; }
  .home3-schedule { width: 100%; }
  .home3-metrics { grid-column: auto; grid-row: auto; }
  .home3-metrics > div { padding: 0 10px; }
  .home3-metrics > div:first-child { padding-left: 0; }
  .home3-metrics > div:last-child { padding-right: 0; }
  .home3-metrics b { font-size: 20px; }
  .home3-metrics span { white-space: normal; }
  .home3-card { padding: 15px; }
  .home3-card > header { align-items: flex-start; }
  .home3-hint { display: none; }
  .home3-center-head { grid-template-columns: 8px minmax(0, 1fr) 26px; gap: 9px; }
  .home3-center-state { grid-column: 2; justify-self: start; }
  .home3-center-arrow { grid-column: 3; grid-row: 1 / span 2; }
  .home3-center-detail { padding-left: 20px; }
  .home3-event { grid-template-columns: 50px minmax(0, 1fr); }
  .home3-event-kind { grid-column: 2; justify-self: start; }
  .home3-quick { grid-template-columns: 1fr; }
  .home3 .home2-q { grid-template-columns: 3px 48px minmax(0, 1fr); }
  .home3 .home2-q .go { grid-column: 3; justify-self: start; }
  .home3-person { grid-template-columns: 34px minmax(0, 1fr); }
  .home3-avatar { width: 34px; height: 34px; }
  .home3-person-meta { grid-column: 2; grid-row: 2; display: flex; justify-content: space-between; width: 100%; }
  .home3-person-name { align-items: flex-start; flex-direction: column; gap: 3px; }
}

@media (prefers-reduced-motion: reduce) {
  .home3-person-status.is-active i { animation: none; }
}

/* v290: четыре рабочих блока участвуют в одной сетке. При раскрытом центре
   события занимают свободное место под очередью, поэтому слева больше не
   возникает визуально «обрезанная» колонка с большим пустым провалом.

   v294: блоки главной переехали в свою сетку виджетов (.home-grid), и это
   правило осталось только для страниц, где ещё живут прежние карточки. На
   самой главной оно разносило сетку и «Что изменилось» по двум колонкам —
   поэтому там колонка одна, см. ниже .home3:has(.home-grid). */
@media (min-width: 1101px) {
  .home3 {
    grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
    grid-template-areas:
      "overview overview"
      "attention centers"
      "events links";
  }
  .home3:has(.home-grid) { grid-template-columns: minmax(0, 1fr); grid-template-areas: none; }
  .home3-overview { grid-area: overview; }
  .home3-primary-grid,
  .home3-secondary-grid { display: contents; }
  .home3-attention { grid-area: attention; }
  .home3-centers-card { grid-area: centers; }
  .home3-secondary-grid > .home3-card:first-child { grid-area: events; }
  .home3-secondary-grid > .home3-card:last-child { grid-area: links; }

  .home3:has(.home3-center.is-expanded) {
    grid-template-areas:
      "overview overview"
      "attention centers"
      "events centers"
      "events links";
  }

  .home3-secondary-grid > .home3-card:first-child,
  .home3-secondary-grid > .home3-card:last-child { align-self: start; }
  .home3-quick { gap: 10px; }
  .home3-quick > button {
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 11px;
    min-height: 66px;
    padding: 11px 13px;
    border-radius: 13px;
    box-shadow: 0 5px 14px rgba(30, 48, 73, .035);
    transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
  }
  .home3-quick > button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(30, 48, 73, .08);
  }
  .home3-quick > button span {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    font-size: 15px;
  }
  .home3-quick > button b {
    display: -webkit-box;
    overflow: hidden;
    font-size: 11.5px;
    line-height: 1.3;
    text-overflow: ellipsis;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
}

/* v291: «Сейчас в ЦМД» заменяет повторяющиеся числовые метрики. */
.home3-live {
  display: block;
  min-width: 0;
  padding: 18px 20px 15px;
  background: linear-gradient(105deg, color-mix(in srgb, var(--home3-wine-soft) 56%, var(--surface-card)), var(--surface-card) 44%, color-mix(in srgb, var(--home3-teal-soft) 48%, var(--surface-card)));
}
.home3-live-head { display: flex; align-items: center; gap: 18px; min-width: 0; }
.home3-live-title { min-width: 210px; }
.home3-live-title > span { display: block; margin-bottom: 4px; color: var(--home3-wine); font-size: 8.5px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.home3-live-title > div { display: flex; align-items: baseline; gap: 10px; }
.home3-live-title h2 { margin: 0; font-size: 18px; letter-spacing: -.025em; }
.home3-live-title time { color: var(--muted); font-size: 13px; font-weight: 850; font-variant-numeric: tabular-nums; }
.home3-live-tabs { display: inline-flex; min-width: 0; padding: 3px; border: 1px solid var(--line); border-radius: 11px; background: color-mix(in srgb, var(--surface-card) 84%, transparent); }
.home3-live-tabs button { display: inline-flex; align-items: center; gap: 7px; min-height: 31px; padding: 0 11px; border-radius: 8px; color: var(--muted); font-size: 10.5px; font-weight: 800; white-space: nowrap; }
.home3-live-tabs button.is-on { background: var(--home3-wine); color: #fff; box-shadow: 0 5px 12px rgba(143,22,63,.14); }
.home3-live-tabs em { padding-left: 7px; border-left: 1px solid currentColor; opacity: .72; font-size: 8.5px; font-style: normal; }
.home3-live-calendar { margin-left: auto; color: var(--home3-wine); font-size: 10.5px; font-weight: 850; white-space: nowrap; }
.home3-live-phase { margin: 11px 0 7px; color: var(--muted); font-size: 9.5px; font-weight: 750; }
.home3-live-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 11px; }
.home3-live-phase + .home3-live-list { margin-top: 0; }
.home3-live-event { position: relative; display: grid; align-content: start; min-width: 0; min-height: 108px; padding: 12px 13px 11px; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: color-mix(in srgb, var(--surface-card-2) 88%, transparent); box-shadow: 0 5px 14px rgba(30,48,73,.025); }
.home3-live-event::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--home3-teal); opacity: .8; }
.home3-live-event.is-upcoming::before { background: var(--home3-gold); }
.home3-live-time { color: var(--text); font-size: 10.5px; font-weight: 900; font-variant-numeric: tabular-nums; }
.home3-live-event > b { display: -webkit-box; min-width: 0; margin-top: 5px; overflow: hidden; font-size: 11.5px; line-height: 1.25; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.home3-live-location { margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 9.5px; text-overflow: ellipsis; white-space: nowrap; }
.home3-live-status { display: inline-flex; align-items: center; gap: 6px; margin-top: auto; padding-top: 9px; color: var(--home3-teal); font-size: 9px; font-weight: 850; }
.home3-live-status i { width: 7px; height: 7px; border-radius: 50%; background: #13a477; box-shadow: 0 0 0 3px rgba(19,164,119,.12); }
.home3-live-event.is-upcoming .home3-live-status { color: var(--home3-gold); }
.home3-live-event.is-upcoming .home3-live-status i { background: #e6a51b; box-shadow: 0 0 0 3px rgba(230,165,27,.12); }
.home3-live-more { display: block; margin: 10px auto 0; color: var(--home3-wine); font-size: 9.5px; font-weight: 850; }
.home3-live-empty { display: grid; gap: 3px; margin-top: 12px; padding: 14px 16px; border: 1px dashed var(--line); border-radius: 13px; background: color-mix(in srgb, var(--surface-card-2) 72%, transparent); }
.home3-live-empty b { font-size: 12px; }
.home3-live-empty span { color: var(--muted); font-size: 10px; }

[data-theme=dark] .home3-live { background: linear-gradient(105deg, rgba(137,21,61,.18), var(--surface-card) 48%, rgba(14,111,96,.12)); }

@media (max-width: 1100px) {
  .home3-live { display: block; }
  .home3-live-head { flex-wrap: wrap; }
  .home3-live-tabs { order: 3; width: 100%; overflow-x: auto; }
  .home3-live-calendar { margin-left: auto; }
  .home3-live-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home3-live-event:nth-child(3) { grid-column: 1 / -1; }
}

@media (max-width: 700px) {
  .home3-live { padding: 15px; }
  .home3-live-head { gap: 11px; }
  .home3-live-title { min-width: 0; flex: 1; }
  .home3-live-title > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .home3-live-calendar { font-size: 9.5px; }
  .home3-live-tabs { padding: 3px; scrollbar-width: none; }
  .home3-live-tabs::-webkit-scrollbar { display: none; }
  .home3-live-tabs button { flex: 1; justify-content: center; }
  .home3-live-list { grid-auto-flow: column; grid-auto-columns: minmax(245px, 84%); grid-template-columns: none; overflow-x: auto; padding-bottom: 3px; scroll-snap-type: x proximity; scrollbar-width: none; }
  .home3-live-list::-webkit-scrollbar { display: none; }
  .home3-live-event, .home3-live-event:nth-child(3) { grid-column: auto; scroll-snap-align: start; }
}


/* ============================================================
   ГЛАВНАЯ ИЗ ВИДЖЕТОВ

   Три клетки в строку; карточка занимает 1–3 клетки в ширину и 1–2 в высоту.
   Высота клетки задана жёстко, чтобы соседние карточки вставали ровно, а что
   не поместилось внутри — прокручивается. Размер человек тянет за уголок.
   ============================================================ */
.home-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 268px; grid-auto-flow: row dense; gap: 14px; align-items: stretch;
}
.home-w {
  position: relative; display: flex; flex-direction: column; min-width: 0; overflow: hidden;
  padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px;
  background: var(--surface-card); box-shadow: var(--shadow);
}
.home-w[data-w="1"] { grid-column: span 1; }
.home-w[data-w="2"] { grid-column: span 2; }
.home-w[data-w="3"] { grid-column: span 3; }
.home-w[data-h="1"] { grid-row: span 1; }
.home-w[data-h="2"] { grid-row: span 2; }

/* Картинка в карточке: абстракция уходит вправо, слева остаётся поле под
   текст. Переход мягкий, поэтому надписи ни на что не наезжают. */
.home-w.has-art {
  background-image:
    linear-gradient(100deg, var(--surface-card) 0%, var(--surface-card) 34%,
                    color-mix(in srgb, var(--surface-card) 62%, transparent) 55%,
                    color-mix(in srgb, var(--surface-card) 18%, transparent) 78%,
                    color-mix(in srgb, var(--surface-card) 6%, transparent) 100%),
    url("/home-art-v1.webp");
  background-size: auto, cover;
  background-position: center, right center;
  background-repeat: no-repeat;
}

.home-w-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex: none; }
.home-w-ico {
  display: grid; place-items: center; width: 30px; height: 30px; flex: none;
  border-radius: 9px; background: var(--home3-wine-soft); font-size: 14px;
}
.home-w-title { min-width: 0; flex: 1 1 auto; }
.home-w-title h2 { margin: 0; font-size: 14px; font-weight: 800; }
.home-w-title small { display: block; overflow: hidden; color: var(--muted);
  font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap; }
/* Содержимое живёт в своей области: не влезло — прокручивается, а размер
   карточки остаётся тем, который выбрал человек. */
.home-w-body { flex: 1 1 auto; min-height: 0; overflow: auto; margin-right: -4px; padding-right: 4px; }
.home-w-body::-webkit-scrollbar { width: 6px; }
.home-w-body::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }

.home-w-tools { display: none; gap: 4px; margin-left: auto; }
.home3.is-tuning .home-w-tools { display: flex; }
.home-w-tools button {
  display: grid; place-items: center; width: 26px; height: 26px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface-card);
  color: var(--muted); font-size: 12px;
}
.home-w-tools button:hover { border-color: var(--home3-wine); color: var(--home3-wine); }
.home3.is-tuning .home-w { border-style: dashed; cursor: grab; }
.home3.is-tuning .home-w:active { cursor: grabbing; }
.home-w.is-drag { opacity: .35; }
.home-w.is-over { outline: 2px dashed var(--home3-wine); outline-offset: 3px; }
.home-w.is-sizing { outline: 2px solid var(--home3-wine); outline-offset: 2px; z-index: 4; }

/* Уголок для растягивания — как у окна на рабочем столе. */
.home-w-grip { position: absolute; right: 0; bottom: 0; z-index: 3; display: none;
  width: 26px; height: 26px; cursor: nwse-resize; touch-action: none; }
.home3.is-tuning .home-w-grip { display: block; }
.home-w-grip::before { content: ''; position: absolute; right: 6px; bottom: 6px;
  width: 11px; height: 11px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  border-radius: 0 0 3px 0; opacity: .55; }
.home-w-grip:hover::before, .home-w.is-sizing .home-w-grip::before { border-color: var(--home3-wine); opacity: 1; }

.home-size-hint { position: fixed; z-index: 90; display: none; padding: 4px 9px;
  border-radius: 8px; background: #101828; color: #fff; font-size: 12px; font-weight: 700;
  font-variant-numeric: tabular-nums; pointer-events: none;
  box-shadow: 0 6px 18px rgba(16,24,40,.28); }
.home-size-hint.is-on { display: block; }

.home-tune, .home-tray { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.home-tune { padding: 10px 14px; margin-bottom: 4px; border: 1px solid #f0d9b5;
  border-radius: 12px; background: #fff7ed; color: #7a5312; font-size: 12.5px; }
.home-tune-spacer { flex: 1 1 auto; }
.home-tray { margin-bottom: 4px; font-size: 12px; color: var(--muted); }
.home-tray button { padding: 5px 11px; border: 1px dashed var(--line); border-radius: 999px;
  background: var(--surface-card); color: var(--muted); cursor: pointer; font-size: 12px; }
.home-tray button:hover { border-color: var(--home3-wine); color: var(--home3-wine); }

.home-tune-btn { padding: 7px 13px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-card); cursor: pointer; font-size: 12.5px; white-space: nowrap; }
.home-tune-btn:hover { border-color: var(--home3-wine); color: var(--home3-wine); }
.home-tune-btn.is-on { background: var(--home3-wine); border-color: var(--home3-wine); color: #fff; }

/* Шапка «Сейчас в ЦМД» внутри виджета: заголовок уже есть у карточки,
   поэтому здесь остаются только вкладки центров и дата. */
.home3-live-head.is-plain { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 0; border: 0; background: none; }
.home3-live-day { color: var(--muted); font-size: 11px; }

@media (max-width: 1320px) {
  .home-grid { grid-template-columns: repeat(2, 1fr); }
  .home-w[data-w="3"] { grid-column: span 2; }
}
@media (max-width: 760px) {
  /* Настройка — работа для большого экрана: на телефоне карточки идут в том
     порядке, который человек задал у себя в профиле. */
  .home-grid { grid-template-columns: 1fr; grid-auto-rows: auto; }
  .home-w, .home-w[data-w="2"], .home-w[data-w="3"] { grid-column: span 1; }
  .home-w[data-h="1"], .home-w[data-h="2"] { grid-row: span 1; }
  .home-w-body { overflow: visible; }
  .home-w-grip, .home3.is-tuning .home-w-grip,
  .home-w-tools, .home3.is-tuning .home-w-tools,
  .home-tune, .home-tray, .home-tune-btn { display: none; }
  .home3.is-tuning .home-w { border-style: solid; cursor: default; }
}

/* Дети главной с виджетами занимают всю ширину: у старых браузеров без
   :has() сетка иначе делилась бы пополам. */
.home3 > .home-grid, .home3 > .portal-changes, .home3 > .home-tune, .home3 > .home-tray {
  grid-column: 1 / -1;
}


/* ─── Дата, часы и погода в шапке главной (v401) ────────────────────────── */
.home-head-info { display: flex; align-items: center; gap: 16px; }
.home-head-weather { display: flex; align-items: center; gap: 7px; }
.home-head-weather i { font-style: normal; font-size: 19px; }
.home-head-weather b { font-size: 15px; font-weight: 800; }
.home-head-weather small { color: var(--muted); font-size: 10.5px; }
.home-head-when { text-align: right; line-height: 1.15; }
.home-head-when b { display: block; font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.home-head-when small { color: var(--muted); font-size: 10.5px; }

.home-weather-big { display: flex; align-items: center; gap: 14px; padding: 6px 0; }
.home-weather-ico { font-size: 40px; line-height: 1; }
.home-weather-big b { display: block; font-size: 30px; font-weight: 800; line-height: 1.05; }
.home-weather-big small { display: block; color: var(--muted); font-size: 11px; }

/* На телефоне в шапке остаётся только температура: дата и часы там есть
   в системной строке, а место в заголовке дорого. */
@media (max-width: 760px) {
  .home-head-when { display: none; }
  .home-head-weather small { display: none; }
  .home-head-info { gap: 8px; }
}


/* ─── Виджет «Мой график» (v403) ────────────────────────────────────────── */
.myw { display: grid; gap: 12px; }
.myw-today { display: flex; align-items: stretch; gap: 12px; }
.myw-date { flex: none; min-width: 84px; padding: 8px 12px; border-radius: 12px;
  background: var(--home3-wine-soft); text-align: left; }
.myw-date small { display: block; color: var(--home3-wine); font-size: 10px; font-weight: 800; }
.myw-date b { display: block; margin: 1px 0; font-size: 26px; font-weight: 800; line-height: 1.05; }
.myw-state { flex: 1 1 auto; display: flex; align-items: center; gap: 12px; min-width: 0;
  padding: 10px 14px; border-radius: 12px; background: var(--surface-hover); }
.myw-state.is-work { background: var(--home3-teal-soft); }
.myw-state.is-vacation { background: #f0ecff; }
.myw-ico { font-size: 22px; line-height: 1; }
.myw-state b { display: block; font-size: 15px; }
.myw-state small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }

.myw-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.myw-day { padding: 8px 6px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-card-2); text-align: left; min-width: 0; }
.myw-day small { display: block; color: var(--muted); font-size: 10px; }
.myw-day b { display: block; margin: 2px 0 4px; font-size: 16px; font-weight: 800; }
.myw-day em { display: block; overflow: hidden; font-style: normal; font-size: 10px;
  color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.myw-day.is-work { background: var(--home3-teal-soft); border-color: transparent; }
.myw-day.is-work em { color: var(--home3-teal); font-weight: 700; }
.myw-day.is-vacation { background: #f0ecff; border-color: transparent; }
.myw-day.is-vacation em { color: #6a4fd0; font-weight: 700; }
.myw-day.is-today { outline: 2px solid var(--home3-wine); outline-offset: -1px; }
.myw-total { margin: 0; color: var(--muted); font-size: 11px; }

/* Узкая карточка: неделя в две строки, иначе дни сжимаются до полосок. */
@media (max-width: 1320px) {
  .home-w[data-w="1"] .myw-week { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .home-w[data-w="1"] .myw-today { flex-direction: column; }
}
@media (max-width: 760px) {
  .myw-week { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .myw-today { flex-direction: column; }
}


/* ─── Погода на несколько дней (v406) ───────────────────────────────────── */
.home-weather { display: grid; gap: 12px; align-content: start; }
.home-weather-days { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.home-weather-days.is-wide { grid-template-columns: repeat(auto-fit, minmax(62px, 1fr)); }
.home-weather-day { padding: 8px 6px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-card-2); text-align: center; }
.home-weather-day small { display: block; color: var(--muted); font-size: 10px; }
.home-weather-day i { display: block; margin: 3px 0; font-style: normal; font-size: 19px; }
.home-weather-day b { font-size: 13px; font-weight: 800; }
.home-weather-day em { margin-left: 4px; color: var(--muted); font-style: normal; font-size: 11px; }

/* ─── Автобусы списком (v406) ───────────────────────────────────────────── */
.home-bus-list { display: grid; }
.home-bus { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center;
  gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--line-soft); }
.home-bus:last-child { border-bottom: 0; }
.home-bus.is-clickable { cursor: pointer; border-radius: 8px; }
.home-bus.is-clickable:hover { background: var(--surface-hover); }
.home-bus-date { padding: 4px 0; border-radius: 8px; background: var(--home3-wine-soft); text-align: center; }
.home-bus-date b { display: block; color: var(--home3-wine); font-size: 13px; font-weight: 800; line-height: 1.1; }
.home-bus-date small { display: block; color: var(--home3-wine); font-size: 8.5px; text-transform: uppercase; }
.home-bus-copy { min-width: 0; }
.home-bus-copy b, .home-bus-copy small { display: block; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.home-bus-copy b { font-size: 12px; }
.home-bus-copy small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.home-bus-kind { padding: 3px 8px; border-radius: 999px; background: var(--idle-bg, #eef1f6);
  color: var(--muted); font-size: 8.5px; font-weight: 800; letter-spacing: .03em;
  text-transform: uppercase; white-space: nowrap; }
.home-bus-kind.bus-good { background: var(--home3-teal-soft); color: var(--home3-teal); }
.home-bus-kind.bus-bonus { background: var(--home3-gold-soft); color: var(--home3-gold); }


/* ─── Погода в карточке 1×1 (v407) ──────────────────────────────────────────
   Три дня прогноза помещаются в одну клетку ровно впритык: стоит описанию
   погоды перенестись на вторую строку — и появляется прокрутка. Поэтому в
   самой маленькой карточке текущая погода набрана компактнее. */
.home-w[data-w="1"][data-h="1"] .home-weather { gap: 8px; }
.home-w[data-w="1"][data-h="1"] .home-weather-ico { font-size: 30px; }
.home-w[data-w="1"][data-h="1"] .home-weather-big { gap: 10px; padding: 0; }
.home-w[data-w="1"][data-h="1"] .home-weather-big b { font-size: 24px; }
.home-w[data-w="1"][data-h="1"] .home-weather-day { padding: 6px 4px; }
.home-w[data-w="1"][data-h="1"] .home-weather-day i { margin: 2px 0; font-size: 17px; }
