* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: #dfe1e3;
  color: #222;
}

header {
  background: #dfe1e3;
  color: #2d2d2d;
  padding: 12px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

header h1 {
  font-size: 0;
  line-height: 0;
}

.toolbar {
  align-items: center;
}

.toolbar-sep { flex: 1; }

.year-select,
.month-select {
  padding: 6px 30px 6px 12px;
  border: 1px solid #b0bec5;
  border-radius: 20px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #2d2d2d;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%232d2d2d'/%3E%3C/svg%3E") no-repeat right 10px center;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: border-color 0.2s;
}

.year-select:focus,
.month-select:focus {
  outline: none;
  border-color: #888;
  box-shadow: 0 0 0 3px rgba(100,100,100,0.15);
}

.nav-sheets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 32px;
  background: #dfe1e3;
  border-bottom: 1px solid #c4c8cc;
}

.nav-sheets a {
  text-decoration: none;
  color: #2d2d2d;
  font-size: 0.82rem;
  padding: 4px 14px;
  border-radius: 20px;
  border: 1px solid #b0b8c1;
  transition: all 0.2s;
}

.nav-sheets a:hover,
.nav-sheets a.active {
  background: #2d2d2d;
  color: #fff;
  border-color: #2d2d2d;
}

.nav-months {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 32px;
  background: #dfe1e3;
  border-bottom: 1px solid #cdd5df;
}

.nav-months a {
  text-decoration: none;
  color: #2d2d2d;
  font-size: 0.85rem;
  padding: 5px 12px;
  border-radius: 20px;
  background: #fff;
  border: 1px solid #b0bec5;
  transition: all 0.2s;
}

.nav-months a:hover,
.nav-months a.active {
  background: #2d2d2d;
  color: #fff;
  border-color: #2d2d2d;
}

.month-section {
  padding: 28px 32px;
  scroll-margin-top: 16px;
}

.month-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: #2d2d2d;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 3px solid #2d2d2d;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.week-block {
  margin-bottom: 24px;
  overflow-x: auto;
  border-radius: 8px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.1);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  min-width: 700px;
  table-layout: fixed;
}

thead th {
  background: #4a4a4a;
  color: #fff;
  padding: 10px 8px;
  font-size: 0.82rem;
  text-align: center;
  white-space: nowrap;
  border-right: 1px solid #666;
}

thead th:first-child {
  background: #2d2d2d;
  text-align: left;
  padding-left: 14px;
}

thead th .day-name {
  display: block;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

thead th .day-num {
  display: block;
  font-size: 1.1rem;
  font-weight: 300;
  margin-top: 2px;
}

tbody tr {
  border-bottom: 1px solid #e8ecf0;
  transition: background 0.15s;
}

tbody tr:hover {
  background: #f5f5f5;
}

tbody td {
  padding: 8px 10px;
  font-size: 0.8rem;
  vertical-align: top;
  border-right: 1px solid #e8ecf0;
  text-align: center;
}

tbody td:first-child {
  font-weight: 700;
  text-align: left;
  background: #f7f7f7;
  color: #2d2d2d;
  font-size: 0.85rem;
  padding-left: 14px;
  border-right: 2px solid #cdd5df;
  word-break: break-word;
}

.cell-event {
  display: inline-block;
  background: #efefef;
  color: #1f1f1f;
  border-radius: 5px;
  padding: 4px 7px;
  font-size: 0.76rem;
  line-height: 1.35;
  text-align: left;
  word-break: break-word;
  border-left: 3px solid #888;
  max-width: 180px;
}

.cell-event.long {
  max-width: 220px;
}

.cell-empty {
  display: none;
}

/* Різні кольори для різних типів програм */
.cell-event.emba    { background: #fff3e0; color: #7c4d00; border-left-color: #fb8c00; }
.cell-event.pmba    { background: #fce4ec; color: #7c0028; border-left-color: #e91e63; }
.cell-event.slp     { background: #e8f5e9; color: #1b5e20; border-left-color: #43a047; }
.cell-event.mbaf    { background: #ede7f6; color: #311b92; border-left-color: #7e57c2; }
.cell-event.school  { background: #e0f7fa; color: #004d40; border-left-color: #00acc1; }
.cell-event.ceo     { background: #fff8e1; color: #4e3300; border-left-color: #ffb300; }
.cell-event.corp    { background: #f3e5f5; color: #4a148c; border-left-color: #ab47bc; }

/* ── Live View ────────────────────────────────────────────────────────────────── */

/* Today fixed button */
#today-fixed-btn {
  position: fixed;
  top: 14px;
  right: 155px;
  z-index: 800;
  padding: 8px 20px;
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #2d2d2d;
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 24px;
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  transition: background 0.2s, box-shadow 0.2s;
  white-space: nowrap;
}
#today-fixed-btn:hover {
  background: rgba(255,255,255,0.95);
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
}

/* Live View trigger button */
#lv-trigger {
  position: fixed;
  top: 14px;
  right: 32px;
  z-index: 800;
  padding: 8px 20px;
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #2d2d2d;
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 24px;
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  transition: background 0.2s, box-shadow 0.2s;
  white-space: nowrap;
}
#lv-trigger:hover,
#lv-trigger.active {
  background: rgba(255,255,255,0.95);
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
}

/* Dropdown */
.lv-dropdown {
  position: fixed;
  top: 56px;
  right: 20px;
  z-index: 801;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.22);
  min-width: 260px;
  max-width: 340px;
  overflow: hidden;
  border: 1px solid #dde3ec;
  animation: lv-fade-in 0.15s ease;
}
.lv-hidden { display: none !important; }

@keyframes lv-fade-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.lv-dd-date {
  background: #2d2d2d;
  color: #fff;
  padding: 13px 18px;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.lv-dd-empty {
  padding: 20px 18px;
  color: #999;
  font-size: 0.86rem;
  text-align: center;
}

.lv-dd-list {
  list-style: none;
  margin: 0;
  padding: 6px 0;
  max-height: 60vh;
  overflow-y: auto;
}

.lv-dd-item {
  padding: 10px 18px;
  cursor: pointer;
  transition: background 0.12s;
  border-bottom: 1px solid #f0f2f5;
}
.lv-dd-item:last-child { border-bottom: none; }
.lv-dd-item:hover { background: #f4f4f4; }

.lv-dd-room {
  display: block;
  font-weight: 700;
  font-size: 0.9rem;
  color: #2d2d2d;
  margin-bottom: 2px;
}

.lv-dd-preview {
  display: block;
  font-size: 0.76rem;
  color: #7a8a9a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Fullscreen overlay */
.lv-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: linear-gradient(145deg, #1a1a1a 0%, #2d2d2d 55%, #3d3d3d 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  animation: lv-overlay-in 0.25s ease;
}

@keyframes lv-overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.lv-clock {
  position: absolute;
  top: 22px;
  left: 28px;
  font-size: clamp(1.6rem, 3.5vw, 2.6rem);
  font-weight: 200;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.75);
  font-variant-numeric: tabular-nums;
  font-family: 'Segoe UI', Arial, sans-serif;
}

.lv-close {
  position: absolute;
  top: 20px;
  right: 24px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}
.lv-close:hover { background: rgba(255,255,255,0.25); }

.lv-content {
  text-align: center;
  padding: 32px 40px;
  max-width: 720px;
  width: 100%;
}

.lv-date {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-bottom: 28px;
}

.lv-room {
  font-size: clamp(1.1rem, 2.6vw, 1.9rem);
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  margin-top: 22px;
}

.lv-events {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-bottom: 4px;
}

.lv-event {
  font-size: clamp(1.5rem, 4vw, 3rem);
  font-weight: 700;
  line-height: 1.25;
  color: #fff;
  text-align: center;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.13);
  border-left: 5px solid rgba(255,255,255,0.3);
  border-radius: 14px;
  padding: 22px 36px;
  max-width: 680px;
  width: 100%;
  box-sizing: border-box;
  text-shadow: 0 1px 12px rgba(0,0,0,0.3);
}

/* Program-type accent colours */
.lv-event.emba   { border-left-color: #fb8c00; }
.lv-event.pmba   { border-left-color: #e91e63; }
.lv-event.slp    { border-left-color: #43a047; }
.lv-event.mbaf   { border-left-color: #7e57c2; }
.lv-event.school { border-left-color: #00acc1; }
.lv-event.ceo    { border-left-color: #ffb300; }
.lv-event.corp   { border-left-color: #ab47bc; }

.lv-free {
  font-size: 1.5rem;
  color: rgba(255,255,255,0.35);
  font-style: italic;
}

/* Bottom navigation */
.lv-nav {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  white-space: nowrap;
}

.lv-nav button {
  padding: 11px 26px;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 28px;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.85);
  font-size: 0.88rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
  letter-spacing: 0.02em;
}
.lv-nav button:hover { background: rgba(255,255,255,0.2); border-color: rgba(255,255,255,0.45); }
.lv-nav button.lv-today-active {
  background: rgba(255,255,255,0.22);
  border-color: rgba(255,255,255,0.6);
  color: #fff;
}

/* Fullscreen API support */
.lv-overlay:fullscreen,
.lv-overlay:-webkit-full-screen,
.lv-overlay:-moz-full-screen {
  width: 100vw;
  height: 100vh;
}

/* Mobile tweaks */
@media (max-width: 600px) {
  .lv-content { padding: 20px 20px; }
  .lv-event   { padding: 12px 18px; }
  .lv-nav     { bottom: 24px; gap: 6px; }
  .lv-nav button { padding: 9px 16px; font-size: 0.8rem; }
}
