/* #84 WiK Codex — Weekly Schedule, V2 common shell.
   Shared Header, Hero, Footer and fixed backdrop are owned by wik-* CSS.
   This file owns the Main schedule controls, board and dialogs only.
   No CSS gap; no standalone Header/Hero declarations. */
body.wik-v2.schedule-visual {
  --schedule-bg: #101110;
  --schedule-edge: rgba(255, 255, 255, 0.16);
  --schedule-gold: #d6aa4f;
  --schedule-text: #f2f2f2;
}
body.schedule-visual .schedule-main {
  min-width: 0;
  margin-top: 0;
  padding-bottom: 0.8125rem;
}

/* ---------------------------------------------------------
   3. Week selector
   Two equal grid tracks, contained within parent width.
   --------------------------------------------------------- */

.schedule-week-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
}

.schedule-week-tab {
  display: block;
  box-sizing: border-box;
  width: calc(100% - 8px);
  min-width: 0;
  min-height: 65px;
  margin: 0 4px;
  padding: 9px 5px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 5px;
  background: rgba(18, 19, 18, 0.78);
  color: #e9e9e5;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.schedule-week-tab small {
  display: block;
  min-width: 0;
  margin-top: 5px;
  color: #c8c8c4;
  font-size: 11px;
  font-weight: 450;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.schedule-week-tab.is-active {
  border-color: rgba(243, 210, 122, 0.78);
  background: linear-gradient(
    135deg,
    rgba(214, 170, 79, 0.23),
    rgba(214, 170, 79, 0.07)
  );
  color: #f3d27a;
}

/* ---------------------------------------------------------
   4. Time zone / Officer access
   Two contained 50% regions.
   --------------------------------------------------------- */

.schedule-toolbar {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  margin-top: 15px;
}

.schedule-zone {
  display: flex;
  flex: 0 0 auto;
  box-sizing: border-box;
  width: auto;
  min-width: 0;
  margin: 0;
  padding: 2px;
  border: 1px solid var(--schedule-edge);
  border-radius: 5px;
  background: rgba(15, 16, 15, 0.82);
}

.schedule-zone-button {
  display: block;
  flex: 0 0 auto;
  box-sizing: border-box;
  min-width: 0;
  min-height: 36px;
  margin: 0;
  padding: 0 3px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #c8c8c4;
  font: inherit;
  font-size: 11px;
  line-height: 1.2;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;
}

#scheduleLocal {
  width: 92px;
}

#scheduleServer {
  width: 86px;
}

.schedule-zone-button.is-active {
  background: rgba(214, 170, 79, 0.18);
  color: #f3d27a;
}

.schedule-access-button {
  display: block;
  flex: 0 0 102px;
  box-sizing: border-box;
  width: 102px;
  min-width: 0;
  min-height: 40px;
  margin: 0 0 0 auto;
  padding: 4px 6px;
  border: 1px solid #d6aa4f;
  border-radius: 5px;
  background: linear-gradient(180deg, #e4bb69, #c79945);
  color: #12100c;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
}
/* ---------------------------------------------------------
   5. Officer-only SVS toggle
   --------------------------------------------------------- */

.schedule-officer-tools {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  margin-top: 15px;
}

.schedule-time-note {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  margin: 7px 0 0;
  color: #b9b8b0;
  font-size: 11px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.schedule-checkbox-line {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: 6px 0;
  color: #e1d7c5;
  font-size: 12px;
  line-height: 1.45;
  cursor: pointer;
}

.schedule-checkbox-line input {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  margin: 0 9px 0 0;
  accent-color: #d6aa4f;
}

.schedule-checkbox-line span {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------
   6. Connection / Save status
   --------------------------------------------------------- */

.schedule-feedback {
  box-sizing: border-box;
  min-width: 0;
  min-height: 18px;
  margin: 10px 1px;
  color: #c8c8c4;
  font-size: 11px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.schedule-feedback.is-error {
  color: #f0a9a5;
}

/* ---------------------------------------------------------
   7. Weekly schedule board
   Day column + two equal event columns.
   --------------------------------------------------------- */

.schedule-board {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(214, 170, 79, 0.55);
  border-radius: 5px;
  background: rgba(9, 10, 9, 0.97);
}

.schedule-day {
  display: flex;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 61px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(11, 12, 11, 0.72);
}

.schedule-day:nth-child(even) {
  background: rgba(21, 21, 19, 0.57);
}

.schedule-day:last-child {
  border-bottom: 0;
}

/* Day column: constant width regardless of event text. */

.schedule-day-label {
  display: flex;
  flex: 0 0 clamp(64px, 19vw, 74px);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: 0;
  padding: 9px 3px;
  border-right: 1px solid rgba(214, 170, 79, 0.22);
  background: rgba(214, 170, 79, 0.035);
  color: var(--schedule-gold);
  font-size: clamp(12px, 3.2vw, 14px);
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  white-space: nowrap;
}

.schedule-day-label small {
  display: block;
  margin-top: 5px;
  color: #a9a7a1;
  font-size: 10px;
  font-weight: 450;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

/* Grid prevents either event column expanding beyond 50%. */

.schedule-day-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  flex: 1 1 0%;
  box-sizing: border-box;
  width: 0;
  min-width: 0;
}

.schedule-day-timed,
.schedule-day-untimed {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 8px 5px;
}

/* ---------------------------------------------------------
   8. Event chips
   --------------------------------------------------------- */

.schedule-chip {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 28px;
  margin: 0 0 5px;
  padding: 6px 5px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 4px;
  background: rgba(37, 38, 36, 0.78);
  color: var(--schedule-text);
  font: inherit;
  font-size: clamp(10px, 2.85vw, 11.5px);
  line-height: 1.35;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}

.schedule-chip:last-child {
  margin-bottom: 0;
}

.schedule-chip-time {
  display: inline;
  margin-right: 4px;
  color: #e6c382;
  font-size: 0.94em;
  font-variant-numeric: tabular-nums;
  white-space: normal;
  overflow-wrap: anywhere;
}

button.schedule-chip {
  cursor: pointer;
}

.schedule-chip.is-editable {
  border-color: rgba(214, 170, 79, 0.5);
}

.schedule-chip.is-editable::after {
  content: "✎";
  margin-left: 4px;
  color: #e3bc71;
}

.schedule-day-add {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 29px;
  margin: 6px 0 0;
  padding: 4px;
  border: 1px dashed rgba(214, 170, 79, 0.65);
  border-radius: 4px;
  background: transparent;
  color: #e7c58b;
  font: inherit;
  font-size: 11px;
  line-height: 1.3;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.schedule-empty {
  display: block;
  padding: 5px 1px;
  color: #777a74;
  font-size: 11px;
}

/* ---------------------------------------------------------
   9. Download button
   --------------------------------------------------------- */

.schedule-download {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 49px;
  margin: 18px 0 0;
  padding: 10px 12px;
  border: 1px solid #d6aa4f;
  border-radius: 5px;
  background: linear-gradient(180deg, #e4bb69, #b98a3c);
  color: #12100c;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
}

.schedule-download:disabled {
  opacity: 0.45;
  cursor: default;
}

/* ---------------------------------------------------------
   10. Dialogs
   --------------------------------------------------------- */

.schedule-modal {
  box-sizing: border-box;
  width: min(440px, calc(100% - 24px));
  max-width: calc(100% - 24px);
  max-height: 88dvh;
  margin: auto;
  padding: 0;
  overflow-y: auto;
  border: 1px solid rgba(214, 170, 79, 0.58);
  border-radius: 6px;
  background: #121311;
  color: #f2f2f2;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.55);
}

.schedule-modal::backdrop {
  background: rgba(0, 0, 0, 0.75);
}

.schedule-modal-body {
  box-sizing: border-box;
  min-width: 0;
  padding: 18px;
}

.schedule-modal-body h2 {
  margin: 0 0 10px;
  color: #f2f2f2;
  font-size: 17px;
  font-weight: 600;
}

.schedule-modal-body p {
  margin: 0 0 15px;
  color: #bebfba;
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.schedule-modal-body label {
  display: block;
  margin: 12px 0 6px;
  color: #e1d7c5;
  font-size: 12px;
}

.schedule-modal-body input:not([type="checkbox"]),
.schedule-modal-body select {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 46px;
  margin: 0;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, 0.31);
  border-radius: 4px;
  background: #080909;
  color: #f2f2f2;
  font: inherit;
  font-size: 15px;
}

.schedule-modal-body input:focus,
.schedule-modal-body select:focus {
  border-color: #d6aa4f;
  outline: 2px solid rgba(214, 170, 79, 0.16);
}

.schedule-modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  box-sizing: border-box;
  min-width: 0;
  margin-top: 20px;
}

.schedule-modal-actions button {
  min-width: 0;
  min-height: 43px;
  margin: 0 0 5px 7px;
  padding: 8px 12px;
  border-radius: 4px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.schedule-cancel {
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: transparent;
  color: #f2f2f2;
}

.schedule-confirm {
  border: 1px solid #d6aa4f;
  background: #c9a25a;
  color: #10100e;
}

.schedule-delete {
  margin-right: auto !important;
  border: 1px solid rgba(230, 130, 130, 0.5);
  background: transparent;
  color: #f2b3b3;
}

/* ---------------------------------------------------------
   11. Focus / Hidden
   --------------------------------------------------------- */

.schedule-week-tab:focus-visible,
.schedule-zone-button:focus-visible,
.schedule-access-button:focus-visible,
.schedule-download:focus-visible,
.schedule-chip:focus-visible,
.schedule-day-add:focus-visible,
.schedule-modal-actions button:focus-visible {
  outline: 2px solid #f3d27a;
  outline-offset: 2px;
}

.schedule-modal [hidden],
.schedule-main [hidden] {
  display: none !important;
}

/* ---------------------------------------------------------
   12. Small-screen typography
   Geometry stays unchanged.
   --------------------------------------------------------- */

@media (max-width: 360px) {
  .schedule-day-label {
    font-size: 12px;
  }

  .schedule-day-timed,
  .schedule-day-untimed {
    padding-right: 4px;
    padding-left: 4px;
  }

  .schedule-chip {
    padding: 5px 4px;
    font-size: 10px;
    letter-spacing: -0.015em;
  }

  #scheduleLocal {
    width: 84px;
  }

  #scheduleServer {
    width: 82px;
  }

  .schedule-zone-button {
    font-size: 10px;
  }

  .schedule-access-button {
    flex-basis: 94px;
    width: 94px;
    padding: 4px;
    font-size: 10px;
  }
}

/* Day-specific JPG button. Keep the existing day-column width. */
.schedule-day-download {
  display: inline-flex;
  position: relative;
  flex: 0 0 auto;
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 8px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #d6aa4f;
  cursor: pointer;
}
.schedule-day-download::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  box-sizing: border-box;
  width: 35px;
  height: 35px;
  border: 1px solid rgba(214,170,79,.75);
  border-radius: 6px;
  background: rgba(214,170,79,.07);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.schedule-day-download svg { position: relative; display: block; width: 17px; height: 17px; }
.schedule-day-download:hover::before, .schedule-day-download:focus-visible::before {
  border-color: #f3d27a;
  background: rgba(214,170,79,.14);
}
.schedule-day-download:hover, .schedule-day-download:focus-visible { color: #f3d27a; }
.schedule-day-download:focus-visible { outline: 2px solid #f3d27a; outline-offset: 2px; }
.schedule-day-download:disabled { opacity: .45; cursor: default; }
