:root {
  color-scheme: light;
  --bg: #eef2f6;
  --surface: rgba(255, 255, 255, 0.96);
  --surface-soft: rgba(247, 250, 253, 0.94);
  --surface-muted: #edf2f8;
  --ink: #162338;
  --muted: #5c6a7e;
  --line: #d5deea;
  --line-strong: #bfd0e0;
  --brand: #114d89;
  --brand-strong: #0c3863;
  --accent: #cf642c;
  --accent-soft: #fff2ea;
  --success: #246644;
  --danger: #a13f28;
  --shadow: 0 18px 38px rgba(16, 34, 54, 0.08);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --font-ui: "Poppins", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-ui);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(17, 77, 137, 0.08), transparent 26%),
    radial-gradient(circle at top right, rgba(207, 100, 44, 0.08), transparent 20%),
    linear-gradient(180deg, #eef2f6 0%, #f6f8fb 100%);
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes soft-drift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }

  to {
    transform: translate3d(-18px, 14px, 0) scale(1.08);
  }
}

@keyframes pulse-sheen {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1220px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 18px 0 36px;
}

.hero,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hero-top,
.hero-body,
.panel-header,
.section-head,
.results-header,
.group-header,
.group-actions,
.slot-topline {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.hero-top,
.section-head,
.results-header,
.group-header {
  align-items: flex-start;
}

.brand-lockup h1,
.panel h2,
.section-head h2,
.group-title,
.slot-subject,
.faculty-card-title {
  margin: 0;
  font-family: var(--font-ui);
}

.brand-kicker,
.section-kicker,
.faculty-card-kicker {
  margin: 0 0 10px;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero-copy,
.panel-copy,
.section-copy,
.group-note,
.slot-room,
.slot-dates,
.calendar-hint,
.admin-muted {
  color: var(--muted);
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 22px;
  border-radius: var(--radius-xl);
  animation: fade-up 540ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -80px -90px auto;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(17, 77, 137, 0.15), rgba(17, 77, 137, 0));
  pointer-events: none;
  animation: soft-drift 7.5s ease-in-out infinite alternate;
}

.brand-lockup h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.05;
  max-width: 14ch;
}

.hero-body {
  margin-top: 18px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.hero-copy {
  margin: 0;
  max-width: 56ch;
}

.meta-row,
.course-tabs,
.day-tabs,
.faculty-card-meta,
.slot-notes,
.catalog-source-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.group-count,
.slot-chip,
.slot-series,
.note-badge,
.catalog-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.82rem;
}

.group-count,
.slot-chip,
.slot-series {
  color: var(--brand-strong);
  background: #edf4fb;
}

.topbar-actions,
.results-tools {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-button,
.secondary-button,
.calendar-button,
.course-tab,
.back-button {
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease,
    transform 180ms ease,
    box-shadow 180ms ease;
}

.primary-button,
.secondary-button,
.calendar-button,
.back-button {
  min-height: 48px;
  padding: 0 16px;
  font-weight: 600;
}

.primary-button {
  color: #ffffff;
  background: var(--brand);
}

.secondary-button,
.back-button {
  color: var(--brand-strong);
  background: var(--surface-soft);
  border-color: var(--line);
}

.calendar-button {
  color: #ffffff;
  background: var(--accent);
}

.calendar-button:disabled {
  cursor: not-allowed;
  color: var(--muted);
  background: var(--surface-muted);
}

.app-main {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.global-banner {
  margin-top: 16px;
}

.panel {
  padding: 20px;
  border-radius: var(--radius-lg);
  animation: fade-up 580ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.section-head {
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.section-head h2 {
  font-size: clamp(1.4rem, 3vw, 1.9rem);
}

.section-copy,
.panel-copy,
.group-note,
.slot-room,
.slot-dates,
.admin-muted {
  margin: 6px 0 0;
  line-height: 1.55;
}

.faculty-grid {
  display: grid;
  gap: 16px;
}

.faculty-card {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 14px;
  padding: 22px;
  min-height: 240px;
  border-radius: 24px;
  border: 0;
  color: #ffffff;
  text-align: left;
  background: linear-gradient(145deg, #102742 0%, #1d416a 100%);
  box-shadow: 0 18px 32px rgba(16, 34, 54, 0.14);
  transform-origin: center;
  transition: transform 220ms ease, box-shadow 220ms ease, filter 220ms ease;
  animation: fade-up 620ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.faculty-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.18), transparent 28%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.06), transparent 55%);
  pointer-events: none;
  transition: transform 260ms ease, opacity 260ms ease;
}

.faculty-card > * {
  position: relative;
  z-index: 1;
}

.faculty-card:nth-child(1) {
  animation-delay: 90ms;
}

.faculty-card:nth-child(2) {
  animation-delay: 170ms;
}

.faculty-card:nth-child(3) {
  animation-delay: 250ms;
}

.faculty-card:nth-child(4) {
  animation-delay: 330ms;
}

.faculty-card--perniagaan {
  background: linear-gradient(145deg, #241910 0%, #523725 100%);
}

.faculty-card--custom {
  background: linear-gradient(145deg, #28313d 0%, #455161 100%);
}

.faculty-card-kicker {
  margin-bottom: 2px;
  color: rgba(255, 255, 255, 0.78);
}

.faculty-card-title {
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  line-height: 1.15;
  max-width: 14ch;
}

.faculty-card-copy {
  margin: 0;
  max-width: 40ch;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.86);
}

.faculty-card-meta span,
.faculty-card-action {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-size: 0.82rem;
  backdrop-filter: blur(8px);
}

.faculty-card-action {
  justify-self: start;
  font-weight: 600;
}

.faculty-card.is-empty {
  min-height: 160px;
  background: var(--surface-soft);
  color: var(--ink);
  border: 1px dashed var(--line-strong);
}

.faculty-card.is-empty h3,
.admin-card h3,
.catalog-block h4 {
  margin: 0;
}

.admin-grid {
  display: grid;
  gap: 16px;
}

.admin-card {
  padding: 18px;
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.admin-card form {
  display: grid;
  gap: 12px;
}

.admin-card h3 {
  margin-bottom: 12px;
}

.catalog-block + .catalog-block {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.detail-section {
  display: grid;
  gap: 16px;
}

.faculty-banner {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.detail-section > .panel,
.main-grid > .panel,
.schedule-root > * {
  animation: fade-up 520ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.main-grid > .panel:nth-child(1) {
  animation-delay: 70ms;
}

.main-grid > .panel:nth-child(2) {
  animation-delay: 120ms;
}

.main-grid > .panel:nth-child(3) {
  animation-delay: 170ms;
}

.main-grid > .panel:nth-child(4) {
  animation-delay: 220ms;
}

.back-button {
  align-self: flex-start;
}

.main-grid {
  display: grid;
  gap: 16px;
}

.field-grid,
.calendar-grid {
  display: grid;
  gap: 14px;
}

.field-row {
  display: grid;
  gap: 8px;
}

.field-row label {
  color: var(--brand-strong);
  font-size: 0.86rem;
  font-weight: 700;
}

.field-row input,
.field-row select,
.field-row textarea {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface-soft);
  color: var(--ink);
}

.field-row textarea {
  min-height: 120px;
  resize: vertical;
}

.meta-row {
  margin-top: 18px;
}

.meta-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 500;
  transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.meta-link-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
}

.meta-link-icon svg {
  width: 16px;
  height: 16px;
}

.course-panel .panel-header,
.calendar-panel .panel-header {
  margin-bottom: 14px;
}

.course-tabs {
  overflow-x: auto;
  flex-wrap: nowrap;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.course-tabs::-webkit-scrollbar,
.day-tabs::-webkit-scrollbar {
  display: none;
}

.course-tab {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 14px;
  color: var(--brand-strong);
  background: var(--surface-soft);
  border-color: var(--line);
  font-weight: 600;
}

.course-tab.is-active {
  color: #ffffff;
  background: var(--brand);
  border-color: var(--brand);
}

.view-toggle {
  display: inline-flex;
  padding: 4px;
  border-radius: 14px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.view-toggle-button,
.day-tab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
}

.view-toggle-button {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 10px;
}

.view-toggle-button.is-active {
  background: var(--surface);
  color: var(--brand-strong);
  border-color: var(--line);
}

.day-tabs {
  margin-bottom: 14px;
  overflow-x: auto;
  flex-wrap: nowrap;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.day-tab {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--surface-soft);
  border-color: var(--line);
}

.day-tab.is-active {
  color: #ffffff;
  background: var(--brand);
  border-color: var(--brand);
}

.calendar-hint {
  margin: 0;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  line-height: 1.6;
}

.status-banner {
  margin-bottom: 14px;
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  color: var(--brand-strong);
  transition: background-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.status-banner[data-state="loading"] {
  background-image: linear-gradient(
    110deg,
    rgba(255, 255, 255, 0) 20%,
    rgba(255, 255, 255, 0.52) 40%,
    rgba(255, 255, 255, 0) 60%
  );
  background-size: 220% 100%;
  animation: pulse-sheen 2.6s linear infinite;
}

.status-banner[data-state="error"] {
  color: var(--danger);
  background: #fcefe9;
}

.status-banner[data-state="success"] {
  color: var(--success);
  background: #edf8f0;
}

.status-banner[data-state="empty"] {
  color: var(--muted);
  background: var(--surface-soft);
}

.schedule-root {
  display: grid;
  gap: 14px;
}

.group-card,
.timeline-group {
  padding: 18px;
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.results-header,
.group-actions {
  flex-wrap: wrap;
}

.group-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.group-note {
  font-size: 0.93rem;
}

.group-note[hidden] {
  display: none;
}

.slot-grid {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.slot-card {
  padding: 15px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid var(--line);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.slot-series {
  color: var(--muted);
  background: var(--surface-muted);
}

.slot-subject {
  margin-top: 12px;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
}

.slot-dates {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 0.88rem;
}

.slot-notes {
  margin-top: 12px;
}

.note-badge {
  color: var(--ink);
  background: var(--surface-muted);
}

.note-badge.is-shared {
  color: var(--accent);
  background: var(--accent-soft);
}

.timeline-board {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.timeline-axis {
  position: relative;
}

.timeline-axis-label {
  position: absolute;
  right: 0;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.timeline-grid {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  background: linear-gradient(180deg, #fbfcfd 0%, #f4f7fa 100%);
  border: 1px solid var(--line);
}

.timeline-hour-line {
  position: absolute;
  inset-inline: 0;
  height: 1px;
  background: var(--line);
}

.timeline-event {
  position: absolute;
  left: 10px;
  right: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(17, 77, 137, 0.92);
  color: #ffffff;
  overflow: hidden;
  box-shadow: 0 10px 18px rgba(17, 77, 137, 0.18);
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
  animation: fade-up 420ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.timeline-event.is-shared {
  background: rgba(207, 100, 44, 0.92);
  box-shadow: 0 10px 18px rgba(207, 100, 44, 0.16);
}

.timeline-event-title,
.timeline-event-time,
.timeline-event-room,
.timeline-event-note {
  display: block;
}

.timeline-event-title {
  font-size: 0.92rem;
  line-height: 1.3;
}

.timeline-event-time,
.timeline-event-room,
.timeline-event-note {
  margin-top: 4px;
  font-size: 0.8rem;
  line-height: 1.25;
  color: rgba(255, 255, 255, 0.92);
}

.primary-button:hover,
.secondary-button:hover,
.calendar-button:hover,
.course-tab:hover,
.view-toggle-button:hover,
.day-tab:hover,
.back-button:hover,
.faculty-card:hover,
.meta-link:hover {
  transform: translateY(-2px);
}

.primary-button:hover,
.secondary-button:hover,
.calendar-button:hover,
.back-button:hover {
  box-shadow: 0 10px 20px rgba(16, 34, 54, 0.1);
}

.faculty-card:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow: 0 24px 42px rgba(16, 34, 54, 0.2);
  filter: saturate(1.06);
}

.faculty-card:hover::before {
  opacity: 0.92;
  transform: scale(1.05);
}

.group-card:hover,
.timeline-group:hover,
.slot-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 26px rgba(16, 34, 54, 0.08);
  border-color: rgba(17, 77, 137, 0.18);
}

.timeline-event:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 24px rgba(17, 77, 137, 0.22);
}

.timeline-event.is-shared:hover {
  box-shadow: 0 14px 24px rgba(207, 100, 44, 0.22);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@media (min-width: 760px) {
  .faculty-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .admin-overview {
    grid-column: 1 / -1;
  }
}

@media (min-width: 920px) {
  .hero-top {
    align-items: center;
  }

  .main-grid {
    grid-template-columns: 320px minmax(0, 1fr);
    align-items: start;
  }

  .controls-panel {
    grid-column: 1;
    grid-row: 1 / span 3;
    position: sticky;
    top: 16px;
  }

  .course-panel,
  .calendar-panel,
  .results-panel {
    grid-column: 2;
  }

  .calendar-grid {
    grid-template-columns: 280px minmax(0, 1fr);
    align-items: end;
  }

  .slot-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1180px) {
  .slot-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
