/* BOARD-06: third Journal view. All rules stay under the schedule section. */
#journal-schedule-section.hidden,
#journal-mode-segments.hidden { display: none !important; }
#journal-mode-toggle-btn.hidden { display: none !important; }
#journal-scroll-root.jb-active { display: block !important; }
#journal-scroll-root.jb-active #journal-pending-section,
#journal-scroll-root.jb-active #journal-calendar-section,
#journal-scroll-root.jb-active #journal-list-section { display: none !important; }
#journal-scroll-root.jb-active #journal-schedule-section { display: block; }
#journal-mode-segments { display: none; align-items: center; gap: 2px; padding: 3px; background: #f3f4f6; border-radius: 12px; }
#journal-mode-segments button { border: 0; background: transparent; color: #6b7280; border-radius: 9px; padding: 9px 13px; font-size: 12px; cursor: pointer; white-space: nowrap; }
#journal-mode-segments button[aria-selected="true"] { background: #fff; color: #111827; box-shadow: 0 1px 3px #0002; font-weight: 700; }
#journal-schedule-section { --jb-day: 30px; --jb-room: 212px; background: #fff; color: #111827; min-width: 0; padding-bottom: calc(80px + max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px))); }
#journal-schedule-section * { box-sizing: border-box; }
#journal-schedule-section button { cursor: pointer; }
.jb-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid #e5e7eb; flex-wrap: wrap; }
.jb-nav,.jb-periods,.jb-legend { display: flex; align-items: center; gap: 6px; }
.jb-nav button { width: 34px; height: 34px; border: 0; border-radius: 50%; background: #f3f4f6; color: #4b5563; }
.jb-nav strong { min-width: 115px; text-align: center; font-size: 14px; line-height: 34px; white-space: nowrap; }
.jb-nav .jb-range { width: auto; min-width: 115px; height: 34px; padding: 0 8px; border-radius: 10px; background: transparent; color: #111827; font-size: 14px; font-weight: 700; white-space: nowrap; }
.jb-nav .jb-range::after { content: " ▾"; color: #6b7280; font-size: 11px; }
.jb-periods { padding: 3px; border-radius: 12px; background: #f3f4f6; }
.jb-periods button { border: 0; background: transparent; border-radius: 9px; min-width: 34px; height: 30px; color: #6b7280; }
.jb-periods button[aria-pressed="true"] { background: white; color: #111827; font-weight: 700; box-shadow: 0 1px 3px #0002; }
.jb-legend { gap: 12px; padding: 10px 16px; flex-wrap: wrap; color: #6b7280; font-size: 11px; }
.jb-legend i { display: inline-block; width: 14px; height: 10px; border-radius: 3px; vertical-align: -1px; margin-right: 4px; }
.jb-legend .conflict { background: repeating-linear-gradient(135deg,#dc262699 0 3px,#fff 3px 6px); border: 1px solid #dc2626; }
.jb-request { width: calc(100% - 32px); margin: 10px 16px 0; border: 1px solid #fcd34d; background: #fffbeb; color: #78350f; border-radius: 11px; padding: 10px 12px; display: flex; align-items: center; gap: 10px; text-align: left; font-size: 12px; }
.jb-request b { color: #d97706; white-space: nowrap; }
.jb-request span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jb-request em { margin-left: auto; color: #2563eb; font-style: normal; white-space: nowrap; }
.jb-message { padding: 26px 16px; color: #6b7280; text-align: center; }
.jb-message button { margin-top: 10px; border: 0; color: #2563eb; background: transparent; }
.jb-scroll { overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
.jb-table { min-width: calc(var(--jb-room) + var(--jb-days) * var(--jb-day)); }
.jb-dates,.jb-row { display: grid; grid-template-columns: var(--jb-room) calc(var(--jb-days) * var(--jb-day)); }
.jb-dates { position: sticky; top: 0; z-index: 3; background: white; border-block: 1px solid #e5e7eb; }
.jb-corner,.jb-room { position: sticky; left: 0; z-index: 2; background: #fff; border-right: 1px solid #e5e7eb; }
.jb-corner { padding: 14px 16px; font-size: 12px; font-weight: 700; }
.jb-resize { position: absolute; top: 0; right: -6px; width: 12px; height: 100%; border: 0; background: transparent; cursor: col-resize !important; touch-action: none; }
.jb-days { display: flex; height: 46px; }
.jb-day { flex: 0 0 var(--jb-day); width: var(--jb-day); text-align: center; border-right: 1px solid #f0f1f4; font-size: 12px; font-weight: 700; padding-top: 4px; }
.jb-day small { display: block; color: #9ca3af; font-size: 9px; text-transform: uppercase; }
.jb-day.weekend { background: #fef2f2; }
.jb-day.weekend small { color: #f87171; }
.jb-day.today { background: #eef4ff; color: #2563eb; }
.jb-row { min-height: 66px; border-bottom: 1px solid #eef0f3; }
.jb-row.draft { opacity: .55; }
.jb-room { padding: 13px 16px; min-width: 0; }
.jb-room b,.jb-mobile-heading b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.jb-room small { display: block; color: #6b7280; font-size: 11px; margin-top: 2px; }
.jb-status.free { color: #16a34a; }
.jb-status.arrival { color: #0d9488; }
.jb-status.draft { color: #9ca3af; }
.jb-track { position: relative; height: 66px; width: calc(var(--jb-days) * var(--jb-day)); background: repeating-linear-gradient(to right,#fff 0,#fff calc(var(--jb-day) - 1px),#f0f1f4 calc(var(--jb-day) - 1px),#f0f1f4 var(--jb-day)); }
.jb-weekend { position: absolute; top: 0; bottom: 0; width: calc(var(--jb-day) - 1px); background: #fef2f2; pointer-events: none; }
.jb-today { position: absolute; top: 0; bottom: 0; width: var(--jb-day); background: #eef4ff88; border-inline: 1px solid #bfd3fe; pointer-events: none; }
.jb-bar { position: absolute; top: 18px; height: 28px; border-radius: 7px; border: 1px solid; border-left-width: 3px; display: flex; align-items: center; padding: 0 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 11px; font-weight: 700; text-align: left; }
.jb-bar.booking.own,.jb-legend .own { background: #d3f3e0; color: #14532d; border-color: #9bddb6; border-left-color: #16a34a; }
.jb-bar.booking.airbnb,.jb-legend .airbnb { background: #ffe4e6; color: #9f1239; border-color: #fda4af; border-left-color: #ff5a5f; }
.jb-bar.booking.bookingcom,.jb-legend .bookingcom { background: #dce6fd; color: #1e3a8a; border-color: #a9c1f7; border-left-color: #1a52e1; }
.jb-bar.hold,.jb-legend .hold { background: repeating-linear-gradient(135deg,#fde9b8 0 5px,#fff6df 5px 10px); color: #7a4e0a; border-color: #d99a1e; border-style: dashed; }
.jb-bar.blocked,.jb-bar.frozen,.jb-bar.external,.jb-legend .blocked { background: repeating-linear-gradient(135deg,#e5e7eb 0 4px,#f5f6f8 4px 8px); color: #4b5563; border-color: #d1d5db; }
.jb-conflict { position: absolute; top: 14px; height: 36px; border: 1.5px solid #dc2626; border-radius: 5px; background: repeating-linear-gradient(135deg,#dc262677 0 3px,#dc262611 3px 6px); display: grid; place-items: center; color: white; font-weight: 800; z-index: 2; pointer-events: none; }
.jb-conflict span { display: grid; place-items: center; background: #dc2626; border-radius: 50%; width: 15px; height: 15px; font-size: 10px; }
.jb-bang { color: #dc2626; margin-left: 4px; }
.jb-mobile-heading { display: none; }
.jb-foot { padding: 10px 16px; color: #6b7280; font-size: 11px; }
@media (min-width: 1024px) and (hover: hover) and (pointer: fine) {
  #journal-mode-segments:not(.hidden) { display: flex; }
  #journal-mode-segments { order: 1; }
  #journal-filter-btn { order: 2; }
  #journal-sort-btn { order: 3; }
  #journal-mode-toggle-btn { display: none !important; }
  #journal-schedule-section { padding-bottom: 20px; }
}
@media (max-width: 1023px), (hover: none), (pointer: coarse) {
  #journal-schedule-section { --jb-room: 0px; }
  .jb-toolbar { flex-wrap: nowrap; padding: 10px 16px; }
  .jb-nav strong,.jb-nav .jb-range { min-width: 100px; }
  .jb-nav button { flex: none; }
  .jb-legend,.jb-foot,.jb-corner,.jb-room { display: none; }
  .jb-scroll { overflow-x: visible; }
  .jb-table { min-width: 0; }
  .jb-dates,.jb-row { display: block; width: 100%; }
  .jb-dates,.jb-track-wrap { overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .jb-dates::-webkit-scrollbar,.jb-track-wrap::-webkit-scrollbar { display: none; }
  .jb-dates { height: 35px; }
  .jb-days { height: 34px; }
  .jb-day { padding-top: 1px; }
  .jb-row { min-height: 0; }
  .jb-mobile-heading { height: 31px; display: flex; align-items: center; gap: 4px; padding: 0 16px; }
  .jb-mobile-heading b { flex: 1; min-width: 0; }
  .jb-mobile-heading .jb-status { flex: none; font-size: 11px; }
  /* Ячейка дня близка к квадрату при любом масштабе: высота дорожки идёт за шириной дня. */
  .jb-track { height: clamp(28px, var(--jb-day), 48px); }
  .jb-bar { top: 4px; height: calc(100% - 8px); }
  .jb-conflict { top: 2px; height: calc(100% - 4px); }
  .jb-request { margin: 6px 16px 10px; min-height: 44px; }
  .jb-request em { display: none; }
  .jb-request::after { content: "›"; margin-left: auto; color: #d97706; font-size: 22px; line-height: 1; font-weight: 600; }
}
