/* Главная руководителя 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: четыре рабочих блока участвуют в одной сетке. При раскрытом центре
   события занимают свободное место под очередью, поэтому слева больше не
   возникает визуально «обрезанная» колонка с большим пустым провалом. */
@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-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; }
}
