:root {
  --bg-main: #fff3e0;
  --bg-page: #ffffff;
  --color-primary: #ff9800;
  --color-primary-dark: #f57c00;
  --color-messenger: #0056b3;
  --color-messenger-dark: #004494;
  --color-text: #212121;
  --color-text-muted: #757575;
  --color-border: #e0e0e0;
  --color-change-time: #ffebee;
  --color-change-room: #e3f2fd;
  --color-change-other: #e8f5e9;
  --radius: 12px;
  --shadow-1: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.08);
  --shadow-2: 0 4px 12px rgba(0, 0, 0, 0.12);
  --font: "Pretendard", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--color-text);
  background: var(--bg-main);
  line-height: 1.5;
}

body.page-main {
  background: var(--bg-main);
}

a {
  color: var(--color-primary-dark);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px;
}

.card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  padding: 24px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.15s;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--color-primary-dark);
  box-shadow: var(--shadow-2);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text);
}

.btn-text {
  background: transparent;
  color: var(--color-primary-dark);
  padding: 8px 12px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-muted);
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-family: var(--font);
  font-size: 15px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(255, 152, 0, 0.2);
}

.save-toast {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  padding: 18px 28px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.save-toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}

.alert-error {
  background: #ffebee;
  color: #c62828;
}

.alert-success {
  background: #e8f5e9;
  color: #2e7d32;
}

.alert-info {
  background: #e3f2fd;
  color: #1565c0;
}

.navbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-main);
}

.navbar .brand {
  font-size: 18px;
  font-weight: 700;
  color: #1565c0;
  background: #e3f2fd;
  padding: 6px 14px;
  border-radius: 8px;
}

.navbar .spacer {
  flex: 1;
}

.navbar .nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

body.page-main .navbar .nav-links .btn {
  background: #fff;
  border: 1px solid #fff;
  color: var(--color-text);
  padding: 0 14px;
  min-height: 36px;
  height: 36px;
  font-size: 13px;
  line-height: 1;
  border-radius: 8px;
  box-sizing: border-box;
}

body.page-main .navbar .nav-links .btn-primary {
  background: #fff;
  border: 1px solid #fff;
  color: var(--color-text);
}

body.page-main .navbar .nav-links #edit-toggle {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

body.page-main .navbar .nav-links .btn-nav-messenger {
  background: var(--color-messenger);
  border-color: var(--color-messenger);
  color: #fff;
}

body.page-main .navbar .nav-links .btn:hover,
body.page-main .navbar .nav-links .btn-primary:hover {
  background: #fafafa;
  border-color: #e8e8e8;
  box-shadow: var(--shadow-1);
}

body.page-main .navbar .nav-links #edit-toggle:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  color: #fff;
  box-shadow: var(--shadow-2);
}

body.page-main .navbar .nav-links .btn-nav-messenger:hover {
  background: var(--color-messenger-dark);
  border-color: var(--color-messenger-dark);
  color: #fff;
  box-shadow: var(--shadow-1);
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 20px;
}

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
}

.auth-card h1 {
  text-align: center;
  margin: 0 0 8px;
  font-size: 22px;
}

.auth-card .subtitle {
  text-align: center;
  color: var(--color-text-muted);
  margin-bottom: 24px;
  font-size: 14px;
}

.auth-links {
  margin-top: 16px;
  text-align: center;
  font-size: 14px;
}

.hidden {
  display: none !important;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.badge-pending { background: #fff3e0; color: #e65100; }
.badge-approved { background: #e8f5e9; color: #2e7d32; }
.badge-rejected { background: #ffebee; color: #c62828; }

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

table.data-table th,
table.data-table td {
  padding: 12px;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
}

table.data-table th {
  background: #fafafa;
  font-weight: 600;
}

.actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-bar .form-control {
  max-width: 280px;
}

.container-narrow {
  max-width: 640px;
}

.container-wide {
  max-width: 1400px;
}

.profile-card .form-control:disabled {
  background: #f5f5f5;
  color: var(--color-text-muted);
}

.profile-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.profile-loading {
  text-align: center;
  color: var(--color-text-muted);
  padding: 32px 16px;
  font-size: 14px;
}

.form-hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--color-text-muted);
}

.course-list-grid {
  display: grid;
  gap: 20px;
}

.course-card {
  background: #fff;
  border: 2px solid #d0d0d0;
  border-radius: 16px;
  padding: 22px 24px;
  margin-bottom: 0;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.course-card:hover {
  border-color: var(--color-primary);
  box-shadow: 0 8px 24px rgba(255, 152, 0, 0.12);
  transform: translateY(-1px);
}

.course-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid #ececec;
}

.course-card h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.35;
}

.course-code-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border: 1.5px solid var(--color-primary);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-primary-dark);
  white-space: nowrap;
  flex-shrink: 0;
}

.highlights {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.highlight-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border: 1.5px solid #e8e8e8;
  border-radius: 12px;
  background: #fafafa;
}

.chat-layout {
  display: flex;
  height: min(92vh, 2870px);
  border: 1px solid #bdbdbd;
  border-radius: 0;
  overflow: hidden;
  background: #fff;
}

.chat-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-messenger);
  color: #fff;
  padding: 12px 20px;
  flex-shrink: 0;
}

.chat-title-text {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.chat-close-x {
  background: none;
  border: none;
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  opacity: 0.95;
}

.chat-close-x:hover {
  opacity: 1;
}

.chat-body {
  display: flex;
  min-height: 0;
  flex: 1;
  height: min(88vh, 2380px);
  background: #fff;
}

.chat-sidebar {
  width: 280px;
  min-width: 240px;
  flex-shrink: 0;
  border-right: 1px solid #e0e0e0;
  display: flex;
  flex-direction: column;
  background: #fff;
}

.chat-sidebar-section {
  padding: 12px 18px 8px;
  font-size: 13px;
  font-weight: 700;
  color: #757575;
  background: #fafafa;
  border-top: 1px solid #e0e0e0;
  border-bottom: 1px solid #ececec;
}

.chat-thread-list {
  flex: 1;
  overflow-y: auto;
}

.chat-thread-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 14px 18px;
  border: none;
  border-bottom: 1px solid #ececec;
  background: #fff;
  cursor: pointer;
  font-family: var(--font);
}

.chat-thread-item:hover,
.chat-thread-item.active {
  background: #f5f5f5;
}

.chat-thread-item.active {
  background: #eeeeee;
  box-shadow: inset 3px 0 0 #0056b3;
}

.chat-thread-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.chat-thread-top strong {
  font-size: 15px;
  color: #212121;
}

.chat-thread-preview {
  font-size: 13px;
  color: #757575;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-thread-time {
  font-size: 11px;
  color: #9e9e9e;
  margin-top: 4px;
}

.chat-unread {
  background: #0056b3;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
}

.chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #fff;
  min-height: 0;
}

.chat-panel-full {
  width: 100%;
}

.chat-pane-header {
  padding: 12px 20px;
  background: #f5f5f5;
  border-bottom: 1px solid #e0e0e0;
  font-size: 14px;
  font-weight: 600;
  color: #424242;
  flex-shrink: 0;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #fff;
  min-height: 0;
}

.chat-empty {
  text-align: center;
  color: #757575;
  padding: 48px 16px;
  font-size: 14px;
  line-height: 1.6;
}

.chat-row {
  display: flex;
  flex-direction: column;
  max-width: min(68%, 520px);
}

.chat-row.mine {
  align-self: flex-end;
  align-items: flex-end;
}

.chat-row.theirs {
  align-self: flex-start;
  align-items: flex-start;
}

.chat-sender {
  font-size: 12px;
  font-weight: 600;
  color: #757575;
  margin-bottom: 4px;
  padding: 0 4px;
}

.chat-bubble {
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.5;
  word-break: break-word;
  border: 1px solid transparent;
}

.chat-row.mine .chat-bubble {
  background: #0056b3;
  color: #fff;
  border-bottom-right-radius: 6px;
}

.chat-row.theirs .chat-bubble {
  background: #fff;
  border-color: #e0e0e0;
  color: #212121;
  border-bottom-left-radius: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.chat-time {
  font-size: 11px;
  color: #9e9e9e;
  margin-top: 4px;
  padding: 0 4px;
}

.chat-input-bar {
  display: flex;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid #e0e0e0;
  background: #fff;
  flex-shrink: 0;
}

.chat-input-bar .form-control {
  flex: 1;
  border-color: #e0e0e0;
}

.btn-chat-send {
  background: var(--color-messenger);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 10px 24px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.btn-chat-send:hover:not(:disabled) {
  background: var(--color-messenger-dark);
}

.btn-chat-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.modal-overlay.chat-overlay {
  background: rgba(0, 0, 0, 0.45);
}

.modal-overlay .modal.modal-chat {
  border-radius: 6px;
}

@media (max-width: 900px) {
  .chat-body {
    flex-direction: column;
    height: min(88vh, 2520px);
  }

  .chat-sidebar {
    width: 100%;
    max-height: 200px;
    border-right: none;
    border-bottom: 1px solid #e0e0e0;
  }

  .modal-chat-wide {
    width: min(98vw, 100%);
  }

  .chat-row {
    max-width: 88%;
  }

  .archive-layout {
    grid-template-columns: 1fr;
  }
}

.chat-panel-page {
  min-height: 0;
}

.highlight-item .icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  color: var(--color-primary);
}

.highlight-item strong {
  display: block;
  font-size: 14px;
}

.highlight-item span {
  font-size: 12px;
  color: var(--color-text-muted);
}

.inclusions {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
  background: #fff;
}

.inclusions h4 {
  margin: 0 0 12px;
  font-size: 14px;
}

.check-item {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  font-size: 14px;
}

.check-item svg {
  color: #4caf50;
  flex-shrink: 0;
}

.detail-section {
  margin-bottom: 24px;
}

.detail-box {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
  background: #fff;
}

.detail-box .ql-editor {
  padding: 0;
}

.textbook-image {
  max-width: 100%;
  max-height: 400px;
  object-fit: contain;
  border-radius: 8px;
}

.notice-banner {
  background: #fff;
  border-left: 4px solid var(--color-primary);
  padding: 12px 16px;
  margin-bottom: 16px;
  border-radius: 0 8px 8px 0;
  box-shadow: var(--shadow-1);
}

.notice-banner h4 {
  margin: 0 0 4px;
  font-size: 14px;
}

.notice-banner p {
  margin: 0;
  font-size: 13px;
  color: var(--color-text-muted);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal {
  background: #fff;
  border-radius: var(--radius);
  padding: 24px;
  max-width: 480px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-2);
}

.modal.modal-chat {
  max-width: none;
  width: min(96vw, 1260px);
  height: min(94vh, 2440px);
  max-height: min(96vh, 2440px);
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: 6px;
  border: 1px solid #bdbdbd;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.modal.modal-chat.modal-chat-wide {
  width: min(98vw, 1680px);
  max-width: 1680px;
}

.modal h3 {
  margin: 0 0 16px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}

.course-picker-item {
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
}

.course-picker-item:hover {
  background: #fafafa;
}

.modal-wide {
  max-width: 520px;
}

.course-picker-list {
  max-height: 280px;
  overflow-y: auto;
  margin-bottom: 12px;
}

.course-picker-empty {
  color: var(--color-text-muted);
  font-size: 14px;
  padding: 8px 0;
}

.message-inbox {
  margin-bottom: 8px;
}

.message-inbox h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.message-inbox-item {
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  margin-bottom: 8px;
  background: #fff8e1;
}

.message-inbox-item.read {
  background: #fafafa;
  opacity: 0.85;
}

.message-inbox-meta {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}

.section-title {
  font-size: 18px;
  margin: 0 0 16px;
}

#editor-container {
  min-height: 200px;
  background: #fff;
}

.toolbar-top {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}

.view-date {
  font-size: 16px;
  font-weight: 600;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid var(--color-border);
}

.footer-edit {
  text-align: center;
  padding: 16px;
  font-size: 13px;
  color: var(--color-text-muted);
}

.week-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
  justify-content: center;
}

.week-tab {
  padding: 8px 16px;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.2s;
}

.week-tab.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.week-tab-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--color-text);
  background: #f5f5f5;
  border-color: #e0e0e0;
}

.week-tab-link:hover {
  background: #eeeeee;
  text-decoration: none;
}

.archive-search {
  margin-bottom: 20px;
}

.archive-search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.archive-search-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-muted);
}

.archive-month-input {
  max-width: 200px;
}

.archive-month-label {
  margin: 12px 0 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
}

.archive-layout {
  display: grid;
  grid-template-columns: minmax(280px, 340px) 1fr;
  gap: 20px;
  align-items: start;
}

.archive-side {
  padding: 18px;
}

.archive-calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.archive-calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 6px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
}

.archive-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-day {
  position: relative;
  min-height: 42px;
  border: 1px solid #ececec;
  border-radius: 8px;
  background: #fafafa;
  font-size: 13px;
  font-family: var(--font);
  cursor: default;
  color: #bdbdbd;
}

.cal-day-empty {
  border: none;
  background: transparent;
}

.cal-day.has-archive {
  background: #fff;
  color: var(--color-text);
  cursor: pointer;
  border-color: #d0d0d0;
}

.cal-day.has-archive:hover {
  border-color: var(--color-primary);
  background: #fff8ee;
}

.cal-day.selected {
  border-color: var(--color-primary);
  background: #fff3e0;
  box-shadow: inset 0 0 0 1px var(--color-primary);
}

.cal-dot {
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-primary);
  margin: 2px auto 0;
}

.archive-calendar-hint {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--color-text-muted);
}

.archive-week-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.archive-week-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  font-family: var(--font);
  text-align: left;
}

.archive-week-chip strong {
  font-size: 14px;
}

.archive-week-chip span {
  font-size: 12px;
  color: var(--color-text-muted);
}

.archive-week-chip:hover,
.archive-week-chip.active {
  border-color: var(--color-primary);
  background: #fff8ee;
}

.archive-empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--color-text-muted);
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.archive-selected-label {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
}

.archive-timetable {
  margin-top: 4px;
}

.timetable-wrap {
  overflow-x: auto;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  padding: 8px;
}

.timetable-wrap.edit-mode {
  outline: 3px solid var(--color-primary);
}

.timetable {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  min-width: 800px;
}

.timetable .col-period {
  width: 48px;
}

.timetable .col-day {
  width: calc((100% - 48px) / 7);
}

.timetable th,
.timetable td {
  border: 1px solid #bdbdbd;
  padding: 0;
  vertical-align: top;
  overflow: hidden;
}

.timetable th.th-day-header {
  background: #f5f5f5;
  height: 52px;
  min-height: 52px;
  max-height: 52px;
  padding: 4px 6px;
  font-size: 13px;
  text-align: center;
  vertical-align: middle;
  box-sizing: border-box;
}

.timetable th.th-corner {
  background: #f5f5f5;
  width: 48px;
  height: 52px;
  text-align: center;
  vertical-align: middle;
  padding: 0;
}

.period-header-label,
.period-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 44px;
  font-weight: 600;
  font-size: 13px;
}

.timetable th.th-day-base {
  vertical-align: middle;
}

.th-day-centered {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 44px;
  font-size: 15px;
  font-weight: 600;
}

.th-day-name {
  display: block;
  font-weight: 600;
  line-height: 1.3;
}

.th-date {
  display: block;
  font-size: 11px;
  font-weight: normal;
  color: var(--color-text-muted);
  line-height: 1.2;
  margin-top: 2px;
}

.th-date-placeholder {
  visibility: hidden;
}

.timetable .period-label {
  background: #fafafa;
  text-align: center;
  vertical-align: middle;
  font-weight: 600;
  font-size: 13px;
  padding: 0;
  width: 48px;
  height: 56px;
  box-sizing: border-box;
}

.tt-cell {
  min-height: 56px;
  height: 56px;
  box-sizing: border-box;
  padding: 4px 6px;
  cursor: pointer;
  background: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.tt-cell .tt-line {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tt-cell .tt-line.teacher {
  font-weight: 500;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.tt-cell.tt-cell-draggable {
  cursor: grab;
}

.tt-cell.tt-cell-draggable:active {
  cursor: grabbing;
}

.tt-cell:hover,
.tt-cell.dragging,
.tt-cell.drag-over {
  background: #ffe0b2 !important;
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
}

.tt-cell.change-time { background: var(--color-change-time); }
.tt-cell.change-room { background: var(--color-change-room); }
.tt-cell.change-other { background: var(--color-change-other); }

.teacher-link {
  color: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(0, 0, 0, 0.25);
}

.teacher-link:hover {
  color: var(--color-primary-dark);
}

.subject-code-tag {
  display: inline;
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
  background: none;
  padding: 0;
  border-radius: 0;
  margin-left: 0;
  vertical-align: baseline;
}

.course-details {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-top: 12px;
  overflow: hidden;
}

.details-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 16px;
  border: none;
  background: #fafafa;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.details-toggle:hover {
  background: #f0f0f0;
}

.details-toggle .toggle-icon {
  font-size: 12px;
  color: var(--color-text-muted);
  transition: transform 0.2s;
}

.details-toggle[aria-expanded="true"] .toggle-icon {
  transform: rotate(180deg);
}

.details-body {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--color-border);
}

.details-body.collapsed {
  display: none;
}

.tt-cell.selected {
  outline: 3px solid var(--color-primary-dark);
  outline-offset: -3px;
}

@media (max-width: 768px) {
  .navbar { flex-direction: column; align-items: stretch; }
  .navbar .spacer { display: none; }
}
