.page-timetable-wrap {
  --pt-accent: #6366f1;
  --pt-accent-soft: rgba(99, 102, 241, 0.14);
  --pt-chip-bg: #eff2ff;
  --pt-chip-bg-weekend: #e9edff;
  margin-top: 1rem;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid #d7dce7;
  background: #ffffff;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
}

.page-timetable-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid #d7dce7;
  background: #f8fafc;
}

.page-timetable-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--pt-accent-soft);
  color: #0f172a;
}

.page-timetable-caption {
  font-size: 12px;
  color: #64748b;
}

.page-timetable-layout {
  display: flex;
  min-height: 500px;
}

.page-timetable-sidebar {
  width: 56px;
  flex-shrink: 0;
  background: #f8fafc;
  border-right: 1px solid #d7dce7;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  gap: 10px;
}

.page-timetable-sidebar button {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: background 0.15s ease, color 0.15s ease;
}

.page-timetable-sidebar button:hover {
  background: #eef2ff;
  color: #1e293b;
}

.page-timetable-sidebar button.active {
  background: var(--pt-accent-soft);
  color: #1e293b;
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.page-timetable-sidebar .spacer {
  flex: 1;
}

.page-timetable-main {
  flex: 1;
  overflow: auto;
  min-width: 0;
}

.page-timetable-grid {
  display: grid;
  grid-template-columns: 72px repeat(7, minmax(88px, 1fr));
  min-width: 780px;
}

.page-timetable-grid .head {
  padding: 14px 8px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #ffffff;
  background: #0f4f85;
  border-bottom: 1px solid #0d4473;
  position: sticky;
  top: 0;
  z-index: 2;
}

.page-timetable-grid .head.weekend {
  background: #0d4473;
}

.page-timetable-grid .time-label {
  padding: 10px 8px;
  font-size: 11px;
  color: #64748b;
  text-align: right;
  border-right: 1px solid #d7dce7;
  border-bottom: 1px solid #d7dce7;
  background: #f8fafc;
}

.page-timetable-grid .cell {
  position: relative;
  min-height: 44px;
  border-right: 1px solid #d7dce7;
  border-bottom: 1px solid #d7dce7;
  background: #ffffff;
  cursor: pointer;
  padding: 6px;
  transition: background 0.12s ease;
}

.page-timetable-grid .cell.weekend {
  background: #fbfdff;
}

.page-timetable-grid .cell:hover {
  background: #f4f7ff;
}

.page-timetable-grid .cell.weekend:hover {
  background: #f1f5ff;
}

.page-timetable-grid .cell.empty::after {
  content: "+ Add";
  position: absolute;
  inset: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #5f84b2;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.page-timetable-grid .cell.empty:hover::after {
  opacity: 1;
}

.page-timetable-grid .cell.has-event {
  background: var(--pt-chip-bg);
}

.page-timetable-grid .cell.weekend.has-event {
  background: var(--pt-chip-bg-weekend);
}

.page-timetable-grid .cell span {
  display: block;
  font-size: 11px;
  line-height: 1.3;
  color: #1f2937;
  font-weight: 500;
  word-break: break-word;
}

.page-timetable-grid .event-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  border-radius: 8px;
  padding: 4px 6px;
  border: 1px solid rgba(99, 102, 241, 0.22);
  background: rgba(255, 255, 255, 0.65);
  cursor: grab;
}

.page-timetable-grid .event-chip.dragging {
  opacity: 0.4;
  cursor: grabbing;
}

.page-timetable-grid .cell-inline-input {
  width: 100%;
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.92);
  color: #0f172a;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 7px;
  outline: none;
}

.page-timetable-grid .cell.drag-target {
  outline: 2px dashed var(--pt-accent);
  outline-offset: -3px;
}

.page-timetable-grid .pt-export-footer {
  border-bottom: none;
}

.page-timetable-grid .pt-export-brand-cell {
  grid-column: 2 / -1;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  background: #f8fafc;
  cursor: default;
  pointer-events: none;
}

.page-timetable-grid .pt-export-brand-cell::after {
  display: none;
}

.page-timetable-wrap[data-tone="dark"] .page-timetable-grid .pt-export-brand-cell {
  color: #cbd5e1;
  background: #18181f;
}

.page-timetable-hint {
  padding: 10px 14px;
  font-size: 12px;
  color: #64748b;
  border-top: 1px solid #d7dce7;
  background: #f8fafc;
}

.page-timetable-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.page-timetable-modal.open {
  display: flex;
}

.page-timetable-modal-box {
  width: 100%;
  max-width: 380px;
  background: #ffffff;
  border: 1px solid #d7dce7;
  border-radius: 14px;
  padding: 18px;
  color: #1e293b;
}

.page-timetable-modal-box label {
  display: block;
  font-size: 12px;
  margin-bottom: 6px;
  color: #64748b;
}

.page-timetable-modal-box input {
  width: 100%;
  border-radius: 8px;
  border: 1px solid #d7dce7;
  background: #f8fafc;
  color: #0f172a;
  padding: 10px 12px;
  font-size: 14px;
}

.page-timetable-modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.page-timetable-modal-actions button {
  flex: 1;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
}

.page-timetable-modal-actions .save {
  background: var(--pt-accent);
  color: #fff;
}

.page-timetable-modal-actions .clear {
  background: #e2e8f0;
  color: #1e293b;
}

.page-timetable-modal-actions .cancel {
  background: transparent;
  border: 1px solid #cbd5e1;
  color: #64748b;
}

.page-timetable-wrap[data-tone="dark"] {
  --pt-chip-bg: #2a2848;
  --pt-chip-bg-weekend: #252340;
  border-color: #2a2a35;
  background: #1e1e26;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.page-timetable-wrap[data-tone="dark"] .page-timetable-top,
.page-timetable-wrap[data-tone="dark"] .page-timetable-sidebar,
.page-timetable-wrap[data-tone="dark"] .page-timetable-hint {
  background: #18181f;
  border-color: #2a2a35;
}

.page-timetable-wrap[data-tone="dark"] .page-timetable-caption,
.page-timetable-wrap[data-tone="dark"] .page-timetable-sidebar button {
  color: #8b8b9e;
}

.page-timetable-wrap[data-tone="dark"] .page-timetable-sidebar button:hover {
  background: #2a2a35;
  color: #d4d4e0;
}

.page-timetable-wrap[data-tone="dark"] .page-timetable-grid .time-label {
  color: #7c7c8f;
  border-right-color: #2a2a35;
  border-bottom-color: #252530;
  background: #1e1e26;
}

.page-timetable-wrap[data-tone="dark"] .page-timetable-grid .cell {
  border-right-color: #252530;
  border-bottom-color: #252530;
  background: #1e1e26;
}

.page-timetable-wrap[data-tone="dark"] .page-timetable-grid .cell.weekend {
  background: #1a1a21;
}

.page-timetable-wrap[data-tone="dark"] .page-timetable-grid .cell:hover {
  background: #262632;
}

.page-timetable-wrap[data-tone="dark"] .page-timetable-grid .cell.weekend:hover {
  background: #22222c;
}

.page-timetable-wrap[data-tone="dark"] .page-timetable-grid .cell.empty::after {
  color: #7ea2cf;
}

.page-timetable-wrap[data-tone="dark"] .page-timetable-grid .cell span {
  color: #e8e8f0;
}

.page-timetable-wrap[data-tone="dark"] .page-timetable-grid .event-chip {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
}

.page-timetable-wrap[data-tone="dark"] .page-timetable-grid .cell-inline-input {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(21, 21, 30, 0.95);
  color: #e8e8f0;
}

.page-timetable-wrap[data-tone="dark"] .page-timetable-modal-box {
  background: #252530;
  border-color: #3a3a48;
  color: #e8e8f0;
}

.page-timetable-wrap[data-tone="dark"] .page-timetable-modal-box label {
  color: #a0a0b0;
}

.page-timetable-wrap[data-tone="dark"] .page-timetable-modal-box input {
  border-color: #3a3a48;
  background: #1e1e26;
  color: #ffffff;
}

.page-timetable-wrap[data-tone="dark"] .page-timetable-modal-actions .clear {
  background: #3a3a48;
  color: #e8e8f0;
}

.page-timetable-wrap[data-tone="dark"] .page-timetable-modal-actions .cancel {
  border-color: #3a3a48;
  color: #a0a0b0;
}

.pt-header-actions {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.pt-header-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: #3f5ee8;
  color: #ffffff;
  border: 2px solid #3552d7;
  border-radius: 0;
  min-height: 48px;
  padding: 10px 8px;
  font-size: 12px;
  line-height: 1;
  letter-spacing: 0.1px;
  font-weight: 700;
  cursor: pointer;
}

.pt-header-btn i {
  font-size: 14px;
}

.pt-header-btn:hover {
  background: #3552d7;
}

.pt-header-btn.danger {
  background: #f04374;
  border-color: #dc3467;
}

.pt-header-btn.danger:hover {
  background: #dc3467;
}

.pt-header-btn.info {
  background: #48b8dd;
  border-color: #33acd5;
}

.pt-header-btn.info:hover {
  background: #33acd5;
}

.pt-header-btn.outline {
  background: #ffffff;
  border-color: #4f67ea;
  color: #4d64e9;
}

.pt-header-btn.outline:hover {
  background: #f3f5ff;
}

.pt-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(15, 23, 42, 0.35);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 72px 16px 16px;
}

.pt-modal.hidden {
  display: none;
}

.pt-modal-box {
  position: relative;
  z-index: 1;
  width: min(860px, 94vw);
  background: #ffffff;
  border: 1px solid #d5dbe7;
  border-radius: 8px;
  padding: 10px 8px;
  pointer-events: auto;
}

.pt-modal-title {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  color: #111827;
}

.pt-design-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.pt-design-card {
  border: 1px solid #d8dde8;
  background: #fff;
  border-radius: 0;
  min-height: 154px;
  padding: 7px 7px 9px;
  cursor: pointer;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 8px;
}

.pt-design-card.active {
  border-color: #4f67ea;
  box-shadow: inset 0 0 0 2px #4f67ea;
}

.pt-design-card .swatch {
  border-radius: 12px;
  min-height: 94px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
}

.pt-design-card > span:last-child {
  font-size: 14px;
  line-height: 1.1;
  color: #111827;
}

.pt-design-card .swatch.classic { background: linear-gradient(135deg, #475569, #64748b); }
.pt-design-card .swatch.modern { background: linear-gradient(135deg, #516de8, #7c3aed); }
.pt-design-card .swatch.minimal { background: #eef2f7; color: #374151; }
.pt-design-card .swatch.colorful { background: linear-gradient(135deg, #06b6d4, #3b82f6); }
.pt-design-card .swatch.dark { background: linear-gradient(135deg, #111827, #0f172a); }
.pt-design-card .swatch.elegant { background: linear-gradient(135deg, #8f7b65, #b49a82); }

.pt-export-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.pt-export-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  border: 1px solid #3552d7;
  background: #4662df;
  color: #ffffff;
  min-height: 94px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.pt-export-btn i { font-size: 24px; }
.pt-export-btn:hover { background: #3b56cd; }
.pt-export-btn[data-pt-action="export-pdf"] { background: #4b13b3; border-color: #3f0fa0; }
.pt-export-btn[data-pt-action="export-pdf"]:hover { background: #3f0fa0; }

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

.pt-apply-btn,
.pt-cancel-btn {
  border: 1px solid #3552d7;
  background: #4662df;
  color: #fff;
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
}

.pt-cancel-btn {
  border-color: #cbd5e1;
  background: #ffffff;
  color: #475569;
}

.page-timetable-wrap[data-design="classic"] { --pt-accent: #5b6b88; --pt-head-bg: #475569; --pt-head-bg-weekend: #64748b; }
.page-timetable-wrap[data-design="modern"] { --pt-accent: #5a67d8; --pt-head-bg: #516de8; --pt-head-bg-weekend: #7c3aed; }
.page-timetable-wrap[data-design="minimal"] {
  --pt-accent: #64748b;
  --pt-head-bg: #e2e8f0;
  --pt-head-bg-weekend: #cbd5e1;
  box-shadow: none;
}
.page-timetable-wrap[data-design="colorful"] { --pt-accent: #0ea5e9; --pt-head-bg: #06b6d4; --pt-head-bg-weekend: #3b82f6; }
.page-timetable-wrap[data-design="dark"] { --pt-accent: #111827; --pt-head-bg: #111827; --pt-head-bg-weekend: #0f172a; }
.page-timetable-wrap[data-design="elegant"] { --pt-accent: #8f7b65; --pt-head-bg: #8f7b65; --pt-head-bg-weekend: #b49a82; }

.page-timetable-wrap[data-design] .page-timetable-grid .head {
  background: var(--pt-head-bg, #0f4f85);
  border-bottom-color: transparent;
  color: #ffffff;
}

.page-timetable-wrap[data-design="minimal"] .page-timetable-grid .head {
  color: #1f2937;
}

.page-timetable-wrap[data-design] .page-timetable-grid .head.weekend {
  background: var(--pt-head-bg-weekend, #0d4473);
}

.page-timetable-wrap[data-design="minimal"] .page-timetable-grid .head.weekend {
  color: #1f2937;
}

@media (max-width: 900px) {
  .pt-header-actions {
    grid-template-columns: 1fr;
  }
  .pt-design-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .pt-design-card {
    min-height: 138px;
  }
  .pt-design-card .swatch {
    min-height: 80px;
  }
  .pt-export-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .page-timetable-layout {
    min-height: 420px;
  }

  .page-timetable-sidebar {
    width: 48px;
  }

  .page-timetable-grid {
    grid-template-columns: 64px repeat(7, minmax(76px, 1fr));
    min-width: 700px;
  }
}
