select,
input,
textarea {
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  max-width: 100%;
  min-width: 0;
}
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 3px solid #347cba;
  outline-offset: 3px;
}
input[type="checkbox"] {
  accent-color: #245c91;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
form {
  display: grid;
  gap: 16px;
}
form label {
  display: grid;
  gap: 7px;
  font-weight: 600;
  font-size: 13px;
}
form .form-row {
  display: flex;
}
form input:not([type="checkbox"]),
form select,
form textarea {
  width: 100%;
  box-sizing: border-box;
}
form .button {
  justify-self: start;
}
fieldset {
  border: 0;
  padding: 0;
  margin: 0;
}
legend {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 12px;
}
.form-error {
  color: #a42c32;
  font-size: 13px;
  white-space: pre-line;
}
.form-error:empty {
  display: none;
}
.form-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.toolbar {
  flex-wrap: wrap;
  gap: 12px;
}
.toolbar label,
.date-control {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
}
.warning {
  padding: 14px 16px;
  background: #fff5dc;
  color: #73530a;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.8;
  margin: 16px 0;
}
.info-note {
  line-height: 1.8;
}
.info-note a,
.prose a,
.preview-footer a {
  color: #245c91;
  text-decoration: underline;
}
.empty-state {
  padding: 32px 18px;
}
.empty-state h2 {
  font-size: 18px;
}
.empty-state .button {
  margin-top: 16px;
}
.empty-state .icon {
  margin-bottom: 12px;
}
.week-scroll {
  overflow-x: auto;
  overscroll-behavior-x: contain;
}
.week-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 4px;
  table-layout: fixed;
  min-width: 420px;
}
.week-table th {
  font-size: 12px;
  text-align: center;
  font-weight: 700;
  color: #5b6e84;
  padding: 9px 0;
}
.week-table th:first-child {
  width: 54px;
}
.week-table th small {
  display: block;
  font-size: 10px;
  font-weight: 500;
  margin-top: 8px;
  line-height: 1.5;
}
.week-table td {
  padding: 0;
  vertical-align: top;
  height: 107px;
}
.week-cell {
  width: 100%;
  height: 100%;
  min-height: 104px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 9px;
  padding: 9px 7px;
  border-radius: 9px;
  overflow-wrap: anywhere;
  text-align: left;
  font-size: 12px;
  color: #28435e;
}
.week-cell strong {
  font-size: 12px;
  line-height: 1.5;
}
.week-cell small {
  font-size: 10px;
  line-height: 1.5;
}
.week-cell.vacant-cell {
  border: 1px solid #e5ebf1;
  background: #f9fbfd;
  color: #7d8b9d;
  font-size: 11px;
  align-items: center;
}
.week-table td:has(.week-cell:nth-child(2)) .week-cell {
  height: auto;
  min-height: 60px;
  margin-bottom: 3px;
}
.daily-table .schedule-cell + .schedule-cell {
  margin-top: 6px;
}
.daily-table .schedule-cell {
  height: auto;
  min-height: 106px;
}
.table-bottom {
  gap: 12px;
  flex-wrap: wrap;
}
.slot-picker {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.slot-picker > div {
  display: flex;
  flex-direction: column;
  gap: 5px;
  text-align: center;
}
.slot-picker strong {
  font-size: 12px;
  margin-bottom: 5px;
}
.slot-picker label {
  position: relative;
  display: block;
}
.slot-picker input {
  position: absolute;
  opacity: 0;
}
.slot-picker span {
  padding: 9px 0;
  display: block;
  border: 1px solid #dae3ec;
  border-radius: 6px;
  font-size: 11px;
  color: #657286;
}
.slot-picker input:checked + span {
  background: #245c91;
  color: white;
  border-color: #245c91;
}
.slot-picker input:focus-visible + span {
  outline: 3px solid #347cba;
  outline-offset: 1px;
}
.date-control input {
  padding: 7px 9px;
}
.mini-map img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.mini-map {
  width: 100%;
  padding: 0;
  border: 0;
}
.stack > .panel h2 + .subtitle {
  margin: 12px 0 20px;
}
.friend-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}
.friend-row p {
  font-size: 12px;
  color: var(--muted);
  margin-top: 7px;
}
.friend-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.friend-actions .button {
  font-size: 11px;
  padding: 9px;
}
.friend-row:last-child {
  border: 0;
}
#main > .panel + .panel {
  margin-top: 24px;
}
.prose h2 {
  margin: 28px 0 16px;
}
.prose h2:first-child {
  margin-top: 0;
}
.prose p,
.prose li {
  font-size: 14px;
  line-height: 2;
}
.prose ol {
  padding-left: 24px;
}
.prose p {
  margin-bottom: 20px;
}
.prose .button {
  margin: 5px;
}
.budget {
  width: 100px;
  display: block;
  margin-top: 6px;
}
.menu-header label {
  font-size: 11px;
}
.food-store p {
  line-height: 1.8;
  white-space: normal;
}
.cart small {
  display: block;
}
.menu-item {
  gap: 12px;
}
.menu-item h3 {
  line-height: 1.6;
}
.price {
  white-space: nowrap;
}
#campus-map {
  height: 570px;
  border: 1px solid var(--line);
  border-radius: 16px;
  z-index: 0;
  background: #f0f4ed;
}
.facility-marker {
  color: white;
  background: #245c91;
  border: 2px solid white;
  border-radius: 50%;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 6px #24334733;
}
.facility-marker .icon {
  width: 17px;
  height: 17px;
}
.facility-marker.machine {
  background: #99702e;
}
.facility-marker.building {
  background: #667887;
}
.leaflet-popup-content p {
  font-family: inherit;
  line-height: 1.8;
}
.location-list {
  max-height: 470px;
  overflow: auto;
}
.location-item {
  overflow-wrap: anywhere;
}
.room-results {
  max-height: 480px;
  overflow: auto;
}
.loading {
  padding: 60px;
  text-align: center;
  color: #657286;
}
.brand-mark svg {
  width: 28px;
  height: 34px;
}
.preview-footer {
  line-height: 1.8;
}
.button:disabled {
  opacity: 0.5;
  cursor: wait;
}
.leaflet-control-zoom a {
  font-family: inherit !important;
}
.panel h2 {
  line-height: 1.5;
}
details summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  padding: 12px 0;
}
details .form-columns {
  margin-top: 10px;
}
.search-box {
  margin-bottom: 18px;
}
.search-box input {
  border: 0;
  min-width: 0;
}
#invite-form {
  margin-top: 16px;
}
.daily-table strong,
.summary-main h2 {
  overflow-wrap: anywhere;
}
.button {
  white-space: normal;
}
.day-picker button {
  min-width: 0;
}
a.button {
  display: inline-flex;
}
.time-separator {
  font-size: 9px;
}
.daily-table th time {
  font-size: 11px;
}
.daily-table .remaining {
  font-size: 10px;
}
#main {
  min-width: 0;
}
.leaflet-control-attribution {
  font-size: 10px;
}
@media (max-width: 650px) {
  .friend-row {
    display: block;
  }
  .friend-actions {
    justify-content: flex-start;
    margin-top: 12px;
  }
  .form-columns {
    gap: 8px;
  }
  .toolbar label {
    flex-wrap: wrap;
  }
  .toolbar > label:has(#board-select) {
    width: 100%;
  }
  #board-select {
    flex: 1;
  }
  .food-layout {
    display: flex;
    flex-direction: column;
  }
  .food-stores {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }
  .food-store {
    padding: 14px !important;
  }
  .food-store h3 {
    font-size: 13px;
  }
  .food-store p {
    font-size: 11px;
  }
  .food-store .open-state {
    font-size: 10px;
  }
  .map-layout {
    display: flex;
    flex-direction: column;
  }
  #campus-map {
    height: 440px;
    width: 100%;
  }
  .location-list {
    max-height: 270px;
  }
  .week-table {
    min-width: 380px;
  }
  .daily-table th:first-child {
    width: 65px;
  }
  .slot-picker {
    gap: 3px;
  }
  .dialog-body {
    padding-top: 12px;
  }
  .prose li,
  .prose p {
    font-size: 13px;
  }
  .page-heading {
    gap: 10px;
  }
  .page-heading .button {
    font-size: 11px;
    padding: 9px;
  }
  .current-summary {
    gap: 14px;
    flex-wrap: wrap;
  }
  .countdown strong {
    font-size: 24px;
  }
  .summary-main h2 {
    font-size: 21px;
  }
  .menu-item .price {
    font-size: 14px;
  }
  .menu-item h3 {
    font-size: 13px;
  }
  .menu-header {
    align-items: start;
  }
  .quantity {
    gap: 5px;
  }
  .quantity button {
    width: 32px;
    height: 32px;
  }
  .form-row {
    gap: 12px;
  }
  .date-control {
    font-size: 12px;
  }
  .day-picker button {
    padding: 9px 5px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

.food-stores.single-store {
  display: block;
}
.single-store .food-store {
  width: 100%;
}


/* KOMAPOKE_TIMETABLE_CLEANUP_2026 */
.week-cell.blue { background: #eef6ff; color: #355f82; border-color: #d7e8f7; }
.week-cell.mint { background: #eef9f5; color: #376a58; border-color: #d8eee5; }
.week-cell.peach { background: #fff7e5; color: #7b6231; border-color: #f2e4bf; }
.week-cell.lavender { background: #f5f2ff; color: #5f5687; border-color: #e5ddfa; }
.week-cell.pink { background: #eff6ff; color: #3f648b; border-color: #dce9f7; }
.heading-actions { display: flex; gap: 8px; align-items: center; }
.timetable-switcher { display: flex; align-items: center; margin: 0 0 14px; }
.semester-picker { position: relative; min-width: 170px; }
.semester-picker > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 160px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; font-weight: 700; }
.semester-picker > summary::-webkit-details-marker, .semester-year > summary::-webkit-details-marker { display: none; }
.semester-picker > summary .icon { width: 15px; height: 15px; transform: rotate(90deg); }
.semester-picker[open] > summary .icon { transform: rotate(-90deg); }
.semester-menu { position: absolute; z-index: 25; top: calc(100% + 6px); left: 0; width: min(280px, calc(100vw - 48px)); padding: 8px; border: 1px solid var(--line); border-radius: 11px; background: #fff; box-shadow: 0 12px 36px #20334c20; }
.semester-year { border-bottom: 1px solid #edf0f4; padding: 3px 0; }
.semester-year:last-child { border-bottom: 0; }
.semester-year > summary { cursor: pointer; list-style: none; padding: 9px 8px; font-size: 13px; font-weight: 700; }
.semester-terms { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; padding: 2px 6px 9px; }
.semester-terms button { border: 0; border-radius: 7px; background: #f4f7fa; padding: 8px 4px; color: var(--ink); font-weight: 700; }
.semester-terms button:hover, .semester-terms button.selected { background: var(--brand-soft); color: var(--brand); }
.semester-year.disabled { color: #929aa5; font-size: 13px; opacity: .65; pointer-events: none; }
.semester-year.disabled > summary { display: flex; align-items: center; justify-content: space-between; }
.semester-year.disabled small { font-size: 10px; font-weight: 600; }
.settings-group { border-top: 1px solid var(--line); margin-top: 14px; }
.settings-group > summary { padding: 14px 0; }
.settings-login { margin: 16px 0; }
.top-sync { border: 0; background: none; color: var(--brand); font: inherit; font-size: 12px; font-weight: 700; padding: 6px 8px; cursor: pointer; white-space: nowrap; }
.top-sync[hidden] { display: none; }
.search-box input:focus-visible { outline: none !important; outline-offset: 0 !important; }
.search-box:focus-within { border-color: var(--brand); outline: 2px solid #347cba; outline-offset: 1px; }
@media (max-width: 650px) {
  .mobile-nav .nav-item { font-size: 8px; padding-left: 0; padding-right: 0; }
  .mobile-nav .nav-item span:not(.count) { white-space: nowrap; }
  .top-sync { font-size: 10px; padding: 5px 4px; }
  .semester-picker { width: 100%; }
  .semester-picker > summary { width: 100%; box-sizing: border-box; }
}


/* KOMAPOKE_UI_REFINEMENT_2026_09 */
.week-scroll { overflow-x: visible; width: 100%; }
.week-table { min-width: 0 !important; width: 100%; table-layout: fixed; border-spacing: 2px; }
.week-table th { font-size: 10px; padding: 5px 0; }
.week-table th:first-child, .week-table .period-column { width: 36px; }
.week-period { padding: 3px 1px !important; vertical-align: middle; }
.week-period strong { display: block; font-size: 10px; line-height: 1; }
.week-period strong span { font-size: 7px; font-weight: 600; }
.week-period small { font-size: 7px !important; line-height: 1.25 !important; margin-top: 4px !important; letter-spacing: -.03em; }
.week-period em { display: block; margin-top: 3px; font-size: 6.5px; line-height: 1.1; color: #8b98a8; font-style: normal; font-weight: 600; }
.week-table td { height: 92px; min-width: 0; }
.week-cell { min-height: 90px; gap: 5px; padding: 6px 4px; border-radius: 7px; min-width: 0; }
.week-cell strong { font-size: 10px; line-height: 1.35; overflow-wrap: anywhere; }
.week-cell small { font-size: 8px; line-height: 1.3; overflow-wrap: anywhere; }
.week-cell.vacant-cell { font-size: 9px; padding: 4px 2px; }
.table-card { overflow: visible; }
#connection-state[hidden] { display: none !important; }
.course-duration { display: inline-flex; margin: 0 0 12px; padding: 5px 8px; border-radius: 6px; background: #eef6ff; color: #245c91; font-size: 11px; font-weight: 700; }

.coop-status { border: 1px solid #2f83c6; background: #fff; margin-bottom: 18px; }
.coop-status-title { background: #4c94c7; color: #fff; text-align: center; font-size: 13px; font-weight: 800; padding: 7px 12px; }
.coop-status-body { padding: 13px; }
.coop-status-time { margin: 0 0 11px; font-size: 13px; color: #26384b; }
.coop-store-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.coop-store-card { position: relative; min-height: 118px; padding: 12px 9px 10px; border: 1px solid #348bd0; background: #fffef0; border-radius: 3px; }
.coop-store-card.is-closed { background: #e9e9e9; color: #4e545b; }
.coop-store-card h3 { margin: 0 28px 8px 0; color: #1762a0; font-size: 12px; line-height: 1.35; }
.coop-store-card p { margin: 0; font-size: 10px; line-height: 1.45; }
.coop-store-card small { display: block; font-size: 9px; line-height: 1.45; }
.coop-card-rule { height: 1px; background: #348bd0; margin: 12px 0 8px; }
.coop-open-badge { position: absolute; top: -7px; right: -6px; width: 29px; height: 29px; border-radius: 50%; display: grid; place-items: center; background: #ff9d00; color: #fff; font-size: 6.5px; font-weight: 800; letter-spacing: -.02em; }
.coop-store-card.is-closed .coop-open-badge { background: #777; }
.comenu-panel { padding: 14px; }
.comenu-frame-wrap { width: 100%; height: min(920px, 72vh); overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.comenu-frame { width: 100%; height: 100%; border: 0; display: block; }

.room-finder { display: grid; gap: 14px; }
.room-filter-grid { display: grid; grid-template-columns: 110px 110px 110px minmax(180px, 1fr); gap: 10px; align-items: end; }
.room-filter-grid > label { display: grid; gap: 6px; min-width: 0; }
.room-filter-grid > label > span:first-child { font-size: 10px; font-weight: 800; color: var(--muted); }
.room-filter-grid select { width: 100%; min-width: 0; }
.room-filter-search .search-box { margin: 0; min-height: 40px; }
.room-stats { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; }
.room-stats > div { padding: 10px 12px; border-right: 1px solid var(--line); }
.room-stats > div:last-child { border-right: 0; }
.room-stats small { display: block; font-size: 9px; color: var(--muted); margin-bottom: 2px; }
.room-stats strong { font-size: 20px; color: var(--ink); }
.room-source-note { margin: -5px 0 0; font-size: 10px; color: var(--muted); }
.room-building-grid { display: grid; gap: 11px; }
.room-building-card { border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 12px; }
.room-building-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; margin-bottom: 9px; }
.room-building-head h2 { margin: 0; font-size: 13px; }
.room-building-head span { font-size: 9px; color: var(--muted); }
.room-chip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); gap: 7px; }
.room-chip { border: 1px solid #dce7f2; border-radius: 7px; background: #f8fbff; color: #28435e; padding: 8px; text-align: left; min-width: 0; }
.room-chip strong { display: block; font-size: 11px; overflow-wrap: anywhere; }
.room-chip small { display: block; margin-top: 3px; font-size: 8px; color: #5582a9; }

@media (max-width: 700px) {
  .week-table { border-spacing: 1px; }
  .week-table th:first-child, .week-table .period-column { width: 29px; }
  .week-period strong { font-size: 9px; }
  .week-period small { font-size: 6.3px !important; }
  .week-period em { font-size: 6px; }
  .week-table td { height: 88px; }
  .week-cell { min-height: 86px; padding: 5px 3px; }
  .week-cell strong { font-size: 9px; line-height: 1.3; }
  .week-cell small { font-size: 7px; }
  .week-cell.vacant-cell { font-size: 8px; }
  .coop-store-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .room-filter-grid { grid-template-columns: repeat(3, 1fr); }
  .room-filter-search { grid-column: 1 / -1; }
}
@media (max-width: 390px) {
  .week-table th:first-child, .week-table .period-column { width: 26px; }
  .week-cell strong { font-size: 8.5px; }
  .week-cell small { font-size: 6.8px; }
  .coop-store-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .coop-store-card { min-height: 108px; padding: 10px 7px; }
}


/* KOMAPOKE_TIMETABLE_REFERENCE_LAYOUT_2026
   Layout/proportions reference only. Existing course colors are intentionally preserved. */

/* The timetable itself owns the available width. */
.week-scroll {
  width: 100%;
  overflow-x: hidden !important;
  overscroll-behavior-x: none;
}
.week-table {
  width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 2px;
}
.week-table thead th {
  height: 36px;
  padding: 0 2px !important;
  vertical-align: middle;
  text-align: center;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}
.week-table th:first-child,
.week-table .period-column {
  width: 44px !important;
}

/* Time rail: start at top, period in the middle, end at the bottom. */
.week-period {
  height: 116px;
  padding: 0 !important;
  vertical-align: top !important;
}
.week-period-layout {
  height: 116px;
  min-height: 116px;
  padding: 5px 1px 4px;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  justify-items: center;
  align-items: center;
  line-height: 1;
}
.week-period-start,
.week-period-end {
  font-size: 8px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  letter-spacing: -0.03em;
}
.week-period-layout strong {
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  margin-top: 3px;
  font-size: 17px;
  line-height: 1;
  font-weight: 700;
}
.week-period-layout strong span {
  font-size: 7px;
  font-weight: 600;
}
.week-period-layout em {
  margin: 0 0 3px;
  font-size: 6.5px;
  line-height: 1;
  color: var(--muted);
  font-style: normal;
  font-weight: 600;
  white-space: nowrap;
}

/* Each class uses the full timetable cell. Name stays high; room stays low. */
.week-table td {
  height: 116px !important;
  min-width: 0;
  padding: 0 !important;
  vertical-align: top;
}
.week-cell {
  width: 100%;
  height: 116px;
  min-height: 116px !important;
  margin: 0;
  padding: 8px 5px 6px !important;
  display: flex;
  flex-direction: column;
  justify-content: space-between !important;
  align-items: stretch;
  gap: 5px;
  border-radius: 6px;
  text-align: center;
  overflow: hidden;
}
.week-course-name {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: normal;
  font-size: 10.5px;
  line-height: 1.34;
  font-weight: 700;
  text-align: center;
}
.week-course-room {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
  font-size: 8px;
  line-height: 1.25;
  font-weight: 500;
  text-align: center;
}
.week-cell.vacant-cell {
  height: 116px;
  min-height: 116px !important;
  justify-content: center !important;
  align-items: center;
  padding: 4px !important;
  font-size: 9px;
  text-align: center;
}

/* Preserve sensible stacking if more than one class shares one slot. */
.week-table td:has(.week-cell:nth-child(2)) .week-cell {
  height: auto;
  min-height: 56px !important;
  margin: 0 0 2px;
  padding-top: 5px !important;
  padding-bottom: 5px !important;
}
.week-table td:has(.week-cell:nth-child(2)) .week-course-name {
  -webkit-line-clamp: 2;
}
.week-table td:has(.week-cell:nth-child(2)) .week-course-room {
  -webkit-line-clamp: 1;
}

/* Compact selector positioning above the grid. */
.timetable-switcher {
  justify-content: center;
  margin: -3px 0 10px;
}
.timetable-switcher .semester-picker {
  min-width: 0;
  width: auto;
}
.timetable-switcher .semester-picker > summary {
  min-width: 128px;
  width: auto;
  padding: 8px 11px;
}

@media (max-width: 700px) {
  /* Reference layout is nearly edge-to-edge on phones. Keep the page heading padded. */
  .panel.table-card {
    width: calc(100% + 40px);
    margin-left: -20px;
    margin-right: -20px;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }
  .week-table {
    border-spacing: 2px;
  }
  .week-table thead th {
    height: 34px;
    font-size: 11px;
  }
  .week-table th:first-child,
  .week-table .period-column {
    width: 38px !important;
  }
  .week-period,
  .week-period-layout,
  .week-table td,
  .week-cell,
  .week-cell.vacant-cell {
    height: 110px !important;
    min-height: 110px !important;
  }
  .week-period-layout {
    padding: 4px 0 3px;
  }
  .week-period-start,
  .week-period-end {
    font-size: 7.4px;
  }
  .week-period-layout strong {
    font-size: 15px;
  }
  .week-period-layout strong span {
    font-size: 6px;
  }
  .week-period-layout em {
    font-size: 5.8px;
  }
  .week-cell {
    padding: 7px 3px 5px !important;
    border-radius: 5px;
  }
  .week-course-name {
    font-size: 9.2px;
    line-height: 1.28;
  }
  .week-course-room {
    font-size: 7px;
    line-height: 1.2;
  }
  .week-cell.vacant-cell {
    font-size: 7.5px;
  }
}

@media (max-width: 390px) {
  .week-table {
    border-spacing: 1.5px;
  }
  .week-table th:first-child,
  .week-table .period-column {
    width: 34px !important;
  }
  .week-table thead th {
    font-size: 10px;
  }
  .week-period-start,
  .week-period-end {
    font-size: 6.7px;
  }
  .week-period-layout strong {
    font-size: 14px;
  }
  .week-period-layout em {
    font-size: 5.3px;
  }
  .week-cell {
    padding-left: 2px !important;
    padding-right: 2px !important;
  }
  .week-course-name {
    font-size: 8.4px;
    line-height: 1.25;
  }
  .week-course-room {
    font-size: 6.5px;
    line-height: 1.15;
  }
}

/* KOMAPOKE_PRODUCTION_REFINEMENT_2026 */

/* Keep the academic selector anchored with the content on wide screens. */
.timetable-switcher {
  justify-content: flex-start !important;
}
.timetable-switcher .semester-picker,
.timetable-switcher .semester-picker > summary {
  width: auto !important;
}

/* Authentication */
.auth-shell {
  display: grid;
  gap: 22px;
}
.auth-form {
  gap: 20px;
}
.auth-section {
  display: grid;
  gap: 13px;
}
.auth-section h3,
.auth-section-heading h3 {
  margin: 0;
  font-size: 12px;
  color: #455b70;
  letter-spacing: .02em;
}
.auth-section-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}
.auth-section-heading span,
.auth-help {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}
.auth-help {
  margin: -2px 0 0;
  line-height: 1.6;
}
.auth-submit {
  width: 100%;
  min-height: 44px;
  justify-content: center !important;
}
.auth-switch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}
.auth-switch a {
  color: #245c91;
  font-weight: 700;
}

/* Official course detail */
.course-detail {
  display: grid;
  gap: 17px;
}
.course-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.course-detail-meta span {
  padding: 5px 8px;
  border-radius: 999px;
  background: #f2f6fa;
  color: #486176;
  font-size: 10px;
  font-weight: 700;
}
.course-detail-primary {
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfd;
}
.course-detail-primary p {
  margin: 3px 0;
  font-size: 12px;
  line-height: 1.55;
}
.course-detail-section {
  display: grid;
  gap: 7px;
}
.course-detail-section h3 {
  margin: 0;
  font-size: 13px;
}
.course-detail-section p {
  margin: 0;
  color: #43576b;
  font-size: 12px;
  line-height: 1.8;
}
.course-detail-updated {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

@media (min-width: 701px) {
  .timetable-switcher {
    margin-left: 0 !important;
    margin-right: auto !important;
  }
  .timetable-switcher .semester-picker > summary {
    min-width: 136px;
  }
}


/* KOMAPOKE_FLOW_REFINEMENT_20260914 */
.timetable-first-setup {
  max-width: 520px;
  margin: 28px auto 0;
  padding: 34px 28px;
  text-align: center;
}
.timetable-first-setup-icon {
  width: 46px;
  height: 46px;
  margin: 0 auto 14px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: #f1f6fb;
}
.timetable-first-setup-icon .icon { width: 21px; height: 21px; }
.timetable-first-setup h2 { margin: 0 0 8px; font-size: 18px; }
.timetable-first-setup p { margin: 0 auto 18px; max-width: 360px; color: var(--muted); line-height: 1.7; font-size: 12px; }
.timetable-first-setup .button { justify-content: center; }
.timetable-setup-form { display: grid; gap: 14px; }

.food-menu-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.food-menu-heading > label {
  flex: 1 1 auto;
  max-width: 320px;
  margin: 0;
  font-weight: 700;
}
.food-menu-heading select { margin-top: 6px; }

.room-result-count {
  margin: -3px 1px 1px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}
.room-building-card {
  padding: 0 !important;
  overflow: hidden;
}
.room-building-card > summary {
  list-style: none;
  cursor: pointer;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 12px 13px;
  min-height: 46px;
}
.room-building-card > summary::-webkit-details-marker { display: none; }
.room-building-card > summary .icon {
  width: 14px;
  height: 14px;
  transform: rotate(90deg);
  transition: transform .16s ease;
}
.room-building-card[open] > summary .icon { transform: rotate(-90deg); }
.room-building-name {
  min-width: 0;
  font-size: 13px;
  font-weight: 750;
  overflow-wrap: anywhere;
}
.room-building-count { color: var(--muted); font-size: 10px; }
.room-building-card .room-chip-grid {
  padding: 11px 12px 12px;
  border-top: 1px solid var(--line);
}
.room-chip { cursor: pointer; }

@media (max-width: 700px) {
  .food-menu-heading {
    align-items: stretch;
    flex-direction: column;
  }
  .food-menu-heading > label { max-width: none; width: 100%; }
  .food-menu-heading > .button { align-self: flex-start; }
  .timetable-first-setup { margin-top: 14px; padding: 28px 20px; }
}


/* KOMAPOKE_CLASSROOM_FLOOR_MAPS */
.building-location-item {
  padding-left: 14px;
}
.map-place-summary {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.map-place-summary p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.5;
}
.floor-map-viewer {
  width: 100%;
  max-height: min(72vh, 760px);
  overflow: auto;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.floor-map-viewer img {
  display: block;
  width: 100%;
  height: auto;
}
@media (max-width: 700px) {
  .map-place-summary {
    align-items: flex-start;
  }
  .floor-map-viewer {
    max-height: 68vh;
  }
}


/* KOMAPOKE_FLOOR_ZOOM_AND_COURSE_TYPES */
.building-focus-marker {
  background: transparent !important;
  border: 0 !important;
}
.building-focus-pin {
  position: absolute;
  left: 4px;
  top: 2px;
  width: 22px;
  height: 22px;
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 0;
  background: #e53935;
  transform: rotate(-45deg);
  box-shadow: 0 2px 5px rgb(0 0 0 / 28%);
}
.building-focus-pin::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 6px;
  left: 5px;
  top: 5px;
  border-radius: 50%;
  background: #fff;
}
.floor-map-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 10px;
}
.floor-map-toolbar .icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 20px;
}
#floor-zoom-value {
  min-width: 48px;
  text-align: center;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.floor-map-viewer {
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
}
.floor-map-viewer img {
  width: 100%;
  max-width: none;
  transform-origin: top left;
  user-select: none;
  -webkit-user-drag: none;
}
.week-cell.course-kind-required,
.schedule-cell.course-kind-required {
  background: #eaf3ff;
  color: #315f8d;
  border-color: #c9def5;
}
.week-cell.course-kind-semi-required,
.schedule-cell.course-kind-semi-required {
  background: #eaf7ef;
  color: #35684a;
  border-color: #cfe8d8;
}
.week-cell.course-kind-general,
.schedule-cell.course-kind-general {
  background: #fff7dd;
  color: #745e27;
  border-color: #f0dfaa;
}
.week-cell.course-kind-theme,
.schedule-cell.course-kind-theme {
  background: #f3effb;
  color: #60537f;
  border-color: #dfd5f2;
}
.week-cell.course-kind-foundation,
.schedule-cell.course-kind-foundation {
  background: #edf8f3;
  color: #3f6a58;
  border-color: #d4eade;
}
.week-cell.course-kind-advanced,
.schedule-cell.course-kind-advanced {
  background: #eef8f8;
  color: #406c70;
  border-color: #d4e9e9;
}


/* Per-course duration */
.week-course-duration {
  align-self: center;
  display: inline-flex;
  padding: 2px 5px;
  border-radius: 999px;
  background: rgb(255 255 255 / 62%);
  color: inherit;
  font-size: 8px;
  line-height: 1.15;
  font-weight: 700;
  white-space: nowrap;
}
@media (max-width: 430px) {
  .week-course-duration {
    padding: 1.5px 4px;
    font-size: 7px;
  }
}

.open-state.unknown {
  color: var(--muted);
  background: #f0f0f2;
}


/* Friend QR invites */
.friend-qr-grid {
  display: grid;
  grid-template-columns: minmax(190px, 0.72fr) minmax(0, 1.28fr);
  gap: 24px;
  align-items: start;
}
.invite-qr-card {
  display: grid;
  justify-items: center;
  gap: 9px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  text-align: center;
}
.invite-qr {
  display: block;
  width: min(240px, 100%);
  aspect-ratio: 1;
  background: #fff;
  border-radius: 12px;
}
.invite-qr-card strong {
  font-size: 14px;
}
.invite-qr-card p {
  margin: 0;
  max-width: 260px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}
.friend-invite-controls {
  min-width: 0;
}
.friend-invite-controls .toolbar {
  justify-content: flex-start;
}
.qr-scanner {
  display: grid;
  gap: 12px;
}
.qr-scanner-video {
  display: block;
  width: 100%;
  max-height: 62vh;
  border-radius: 16px;
  background: #0c1118;
  object-fit: cover;
}
.qr-scanner p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
@media (max-width: 720px) {
  .friend-qr-grid {
    grid-template-columns: 1fr;
  }
  .invite-qr-card {
    max-width: 330px;
    width: 100%;
    margin-inline: auto;
  }
}

/* KOMAPOKE_TIMETABLE_BUILDER */
.timetable-builder-launch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border-color: #c8daf0;
  background: #f4f8fd;
  color: #245c91;
  font-size: 12px;
  font-weight: 800;
}
.timetable-builder-launch .icon { width: 15px; height: 15px; }
.timetable-builder-launch small,
.pro-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 18px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #245c91;
  color: #fff;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .06em;
}
.timetable-builder-form { gap: 22px; }
.builder-intro {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f5f8fc;
}
.builder-intro p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.timetable-builder-form fieldset { display: grid; gap: 10px; }
.timetable-builder-form label small { color: var(--muted); font-size: 10px; font-weight: 500; }
.builder-slot-grid {
  display: grid;
  grid-template-columns: 44px repeat(5, minmax(48px, 1fr));
  gap: 5px;
  align-items: center;
  max-width: 720px;
}
.builder-slot-grid > strong {
  text-align: center;
  color: var(--muted);
  font-size: 10px;
}
.builder-slot-grid .builder-day { color: var(--ink); font-size: 12px; text-align: center; }
.builder-slot-grid .builder-period { color: var(--muted); font-size: 11px; text-align: right; padding-right: 5px; }
.builder-slot {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  display: grid !important;
  place-items: center;
  padding: 0 !important;
  cursor: pointer;
}
.builder-slot input { width: 17px !important; height: 17px; margin: 0; }
.builder-slot.fixed { background: #f0f2f5; color: #7b8490; cursor: default; font-size: 9px; }
.builder-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.builder-chip { display: inline-flex !important; cursor: pointer; }
.builder-chip input { position: absolute; opacity: 0; pointer-events: none; }
.builder-chip span {
  display: inline-flex;
  align-items: center;
  min-height: 31px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #415163;
  font-size: 11px;
  font-weight: 700;
}
.builder-chip input:checked + span { border-color: #9dbdde; background: #edf5fd; color: #245c91; }
.builder-chip input:focus-visible + span { outline: 3px solid #347cba; outline-offset: 2px; }
.builder-topic-group { display: grid; gap: 7px; padding-top: 4px; }
.builder-topic-group > strong { font-size: 11px; color: var(--muted); }
.builder-results { display: grid; gap: 14px; }
.builder-plan {
  display: grid;
  gap: 13px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.builder-plan-head { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.builder-plan-label { color: #245c91; font-size: 10px; font-weight: 900; }
.builder-plan h3 { margin: 3px 0 0; font-size: 15px; }
.builder-plan-stats { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.builder-plan-stats span { padding: 4px 7px; border-radius: 999px; background: #f2f5f8; color: #526170; font-size: 9px; font-weight: 700; }
.builder-plan-courses { display: grid; border-top: 1px solid #edf0f4; }
.builder-course {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 2px;
  border: 0;
  border-bottom: 1px solid #edf0f4;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.builder-course > span { display: grid; gap: 3px; min-width: 0; }
.builder-course strong { font-size: 12px; }
.builder-course small { color: var(--muted); font-size: 9px; line-height: 1.45; }
.builder-course .icon { flex: 0 0 auto; width: 14px; height: 14px; }
@media (max-width: 650px) {
  .timetable-builder-launch span { display: none; }
  .timetable-builder-launch { padding: 8px; }
  .builder-plan-head { display: grid; }
  .builder-plan-stats { justify-content: flex-start; }
  .builder-slot-grid { grid-template-columns: 34px repeat(5, minmax(0, 1fr)); gap: 3px; max-width: none; }
}

.timetable-builder-page {
  max-width: 980px;
}
.timetable-builder-page .timetable-builder-form {
  max-width: 900px;
}


/* KOMAPOKE_UI_POLISH_2026_09 */
.page-heading-main { min-width: 0; }
.page-title-line { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-title-line h1 { margin: 0; }
.page-title-line .semester-picker { min-width: 0; width: auto; }
.page-title-line .semester-picker > summary { min-width: 126px; width: auto; padding: 7px 10px; font-size: 12px; }
.page-title-line .semester-menu { left: 0; }
/* Manual courses also use their selected color in the Today/day view. */
.schedule-cell:not([class*="course-kind-"]).blue { background: #eef6ff; color: #355f82; border-color: #d7e8f7; }
.schedule-cell:not([class*="course-kind-"]).mint { background: #eef9f5; color: #376a58; border-color: #d8eee5; }
.schedule-cell:not([class*="course-kind-"]).peach { background: #fff7e5; color: #7b6231; border-color: #f2e4bf; }
.schedule-cell:not([class*="course-kind-"]).lavender { background: #f5f2ff; color: #5f5687; border-color: #e5ddfa; }
.schedule-cell:not([class*="course-kind-"]).pink { background: #eff6ff; color: #3f648b; border-color: #dce9f7; }
/* Explicit course colors selected by the user override academic-category colors. */
.week-cell.course-color-custom.blue, .schedule-cell.course-color-custom.blue { background: #eef6ff; color: #355f82; border-color: #d7e8f7; }
.week-cell.course-color-custom.mint, .schedule-cell.course-color-custom.mint { background: #eef9f5; color: #376a58; border-color: #d8eee5; }
.week-cell.course-color-custom.peach, .schedule-cell.course-color-custom.peach { background: #fff7e5; color: #7b6231; border-color: #f2e4bf; }
.week-cell.course-color-custom.lavender, .schedule-cell.course-color-custom.lavender { background: #f5f2ff; color: #5f5687; border-color: #e5ddfa; }
.week-cell.course-color-custom.pink, .schedule-cell.course-color-custom.pink { background: #eff6ff; color: #3f648b; border-color: #dce9f7; }
@media (max-width: 650px) {
  .page-title-line { gap: 8px; }
  .page-title-line .semester-picker { width: auto; }
  .page-title-line .semester-picker > summary { width: auto; min-width: 112px; padding: 6px 9px; }
}

/* Simple friend list: rows open the timetable; deletion has its own flow. */
.friend-list {
  border-top: 1px solid var(--line);
}
.friend-list-entry {
  width: 100%;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 12px;
  padding: 15px 2px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.friend-list-entry:last-child {
  border-bottom: 0;
}
.friend-list-entry:hover,
.friend-list-entry.selected {
  color: var(--brand);
}
.friend-list-entry .icon {
  width: 16px;
  color: var(--muted);
}
.friend-list-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 700;
}
.friend-request-row,
.friend-delete-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.friend-request-row:last-child,
.friend-delete-entry:last-child {
  border-bottom: 0;
}
.friend-request-row p {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}
.friend-delete-list {
  display: grid;
}
.button.danger {
  color: #a13b3b;
  border-color: #edcccc;
  background: #fffafa;
}
.button.danger:hover {
  background: #fff1f1;
}
@media (max-width: 650px) {
  .friend-request-row,
  .friend-delete-entry {
    gap: 10px;
  }
}



/* Dedicated friend timetable page */
.friend-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.friend-back-link .icon {
  transform: rotate(180deg);
}
.friend-timetable-card {
  margin-top: 0;
}
.friend-common-free h2 {
  margin-bottom: 8px;
}

.catalog-tabs, .catalog-pagination { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.catalog-panel { padding: 24px; }
.catalog-filters { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; }
.catalog-filters label { flex: 1; min-width: 80px; }
.catalog-filters .button { min-height: 42px; }
.catalog-results { margin-top: 24px; }
.catalog-row { display: flex; align-items: center; gap: 16px; padding: 20px 0; border-top: 1px solid var(--line); }
.catalog-course { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.catalog-course h2 { margin: 0 0 8px; font-size: 16px; }
.catalog-course h2 .text-button { font: inherit; text-align: left; line-height: 1.6; }
.catalog-course p { margin: 0 0 8px; font-size: 13px; line-height: 1.7; color: #465568; }
.catalog-course small { color: #465568; }
.bookmark-button { flex-shrink: 0; min-height: 44px; }
.bookmark-button.is-saved { color: #245c91; background: #edf4fa; border-color: #8cafce; }
button:disabled { opacity: .6; cursor: wait; }
@media (max-width: 600px) {
  .catalog-panel { padding: 16px; }
  .catalog-row { gap: 10px; align-items: flex-start; }
  .catalog-row .bookmark-button { font-size: 12px; padding: 10px 8px; }
  .mobile-nav { overflow-x: auto; }
  .mobile-nav .nav-item { flex: 1 0 44px; color: #526173; }
}
@media (max-width: 380px) {
  .panel.table-card { width: calc(100% + 30px); margin-left: -15px; margin-right: -15px; }
}
@media (max-width: 380px) {
  .mobile-brand { white-space: nowrap; font-size: 15px; gap: 5px; }
  .top-actions { gap: 2px; }
  .top-sync { font-size: 9px; padding-inline: 2px; }
}
.builder-individual-results { margin-bottom: 32px; }
.builder-individual-results > h2 { font-size: 18px; }
.builder-individual-results > h2 small { font-size: 13px; color: #465568; }
.builder-individual-results .catalog-course h3 { margin: 0 0 8px; }
.builder-individual-results .text-button { text-align: left; }
.builder-individual-results .catalog-course h3 .text-button { font-size: 15px; line-height: 1.6; }
#builder-plans, #builder-courses { scroll-margin-top: 20px; }
.manual-course-entry { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px 0; }
.manual-course-entry p, .field-help { color: #465568; font-size: 12px; line-height: 1.7; margin: 0; }
#profile-form input:disabled { background: #edf1f5; color: #465568; opacity: 1; cursor: not-allowed; }
.notification-settings fieldset { display: grid; gap: 12px; }
.notification-settings > .field-help { margin-top: 16px; }
.notification-settings .dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.help-page h2:not(:first-child) { margin-top: 32px; }
.help-page p, .help-page li { max-width: 70ch; }

/* KOMAPOKE_USERNAME_HOVER_TOOLTIP */
.username-tooltip-host { position: relative; display: block; }
.username-hover-tip {
  position: absolute;
  left: 0;
  top: calc(100% - 2px);
  z-index: 30;
  width: max-content;
  max-width: min(360px, calc(100vw - 48px));
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #172033;
  color: #fff;
  font-size: 12px;
  line-height: 1.5;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(2px);
  transition: opacity 120ms ease, transform 120ms ease, visibility 120ms ease;
}
.username-tooltip-host:has(input:hover) .username-hover-tip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
