:root {
  --bg: #fff6fb;
  --bg-2: #ffe7f1;
  --card: rgba(255, 255, 255, 0.76);
  --card-strong: rgba(255, 255, 255, 0.9);
  --text: #6c4d5b;
  --heading: #503643;
  --border: rgba(210, 128, 162, 0.18);
  --shadow: 0 18px 50px rgba(181, 112, 146, 0.15);
  --accent: #ef9fbe;
  --accent-strong: #e784ab;
  --accent-soft: #ffd7e7;
  --input: #fffafd;
  --link: #c45684;
  --success: #78b798;
  --danger: #dd7b92;
}

body.theme-finley {
  --bg: #f7f6ff;
  --bg-2: #ece7ff;
  --card: rgba(255, 255, 255, 0.8);
  --card-strong: rgba(255, 255, 255, 0.92);
  --text: #554f72;
  --heading: #383257;
  --border: rgba(131, 122, 197, 0.18);
  --shadow: 0 18px 50px rgba(124, 114, 185, 0.13);
  --accent: #b7a9ff;
  --accent-strong: #9d8ef2;
  --accent-soft: #e3dcff;
  --input: #fbfaff;
  --link: #6b63c7;
  --success: #76ad9d;
  --danger: #d5878f;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: Inter, system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, var(--bg-2), transparent 30%),
    linear-gradient(180deg, var(--bg), #fff);
  position: relative;
}

body.modal-open {
  overflow: hidden;
}

.bg-decor {
  position: fixed;
  border-radius: 999px;
  filter: blur(20px);
  opacity: 0.45;
  pointer-events: none;
}

.decor-1 {
  width: 220px;
  height: 220px;
  background: #ffdce8;
  top: 40px;
  left: -40px;
}

.decor-2 {
  width: 270px;
  height: 270px;
  background: #f1d8ff;
  top: 260px;
  right: -70px;
}

.decor-3 {
  width: 180px;
  height: 180px;
  background: #ffeec5;
  bottom: 70px;
  left: 12%;
}

body.theme-finley .decor-1 {
  background: #e3dcff;
}

body.theme-finley .decor-2 {
  background: #dff3ff;
}

body.theme-finley .decor-3 {
  background: #f6e7ff;
}

.site-shell {
  width: min(1220px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 28px;
  position: relative;
  z-index: 1;
}

.glass-card {
  background: var(--card);
  border: 1px solid var(--border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.hero,
.panel,
.footer {
  border-radius: 28px;
}

.hero {
  padding: 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--link);
}

h1,
h2,
h3 {
  color: var(--heading);
  margin: 0;
}

h1 {
  font-family: Quicksand, Inter, sans-serif;
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1.05;
}

.hero-copy {
  margin: 10px 0 0;
  max-width: 680px;
  font-size: 15px;
}

.hero-badge {
  white-space: nowrap;
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--card-strong);
  color: var(--heading);
  font-weight: 700;
  border: 1px solid var(--border);
}

.main-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 20px;
}

.form-panel,
.manage-panel,
.week-panel {
  padding: 22px;
}

.manage-panel {
  grid-column: 1 / 2;
}

.week-panel {
  grid-column: 2 / 3;
  grid-row: 1 / span 2;
}

.panel-header {
  margin-bottom: 16px;
}

.panel-header p {
  margin: 6px 0 0;
  font-size: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 14px;
  font-weight: 600;
}

label span,
.colour-preview-wrap span {
  color: var(--heading);
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--input);
  color: var(--heading);
  border-radius: 16px;
  padding: 13px 14px;
  outline: none;
  transition: 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent);
}

textarea {
  resize: vertical;
  min-height: 96px;
}

.full-width {
  grid-column: 1 / -1;
}

.colour-preview-wrap {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.colour-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 10px 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  color: #4f465a;
  font-weight: 700;
}

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

.btn {
  border: 0;
  border-radius: 16px;
  padding: 13px 18px;
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  color: white;
}

.btn-secondary {
  background: var(--card-strong);
  color: var(--heading);
  border: 1px solid var(--border);
}

.hidden {
  display: none !important;
}

.subject-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 72px;
}

.subject-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card-strong);
  color: var(--heading);
  font-size: 13px;
  font-weight: 700;
}

.subject-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.06);
  flex: 0 0 auto;
}

.empty-state-box {
  background: rgba(255, 255, 255, 0.35);
  border-radius: 18px;
  padding: 16px;
  border: 1px dashed var(--border);
}

.week-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.day-column {
  background: var(--card-strong);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 16px;
  min-height: 240px;
}

.day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.day-count {
  font-size: 12px;
  font-weight: 700;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--heading);
}

.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.task-card {
  border-radius: 18px;
  padding: 14px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.04);
}

.task-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: start;
}

.task-time {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(64, 52, 66, 0.7);
}

.task-subject {
  color: #403442;
  font-weight: 800;
  margin-top: 2px;
}

.task-notes {
  font-size: 13px;
  color: rgba(64, 52, 66, 0.8);
  margin-top: 8px;
  line-height: 1.45;
}

.task-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.task-actions button {
  padding: 9px 12px;
  border-radius: 12px;
  border: 0;
  background: rgba(255, 255, 255, 0.85);
  color: #443949;
  font-weight: 700;
  cursor: pointer;
}

.empty-day {
  padding: 16px;
  border-radius: 16px;
  border: 1px dashed var(--border);
  color: var(--text);
  font-size: 14px;
  background: rgba(255, 255, 255, 0.4);
}

.footer {
  margin-top: 20px;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.footer a {
  color: var(--link);
  text-decoration: none;
  font-weight: 800;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  padding: 13px 16px;
  border-radius: 14px;
  background: rgba(46, 40, 56, 0.92);
  color: white;
  pointer-events: none;
  transition: 0.2s ease;
  z-index: 60;
  max-width: calc(100% - 30px);
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.mobile-add-wrap {
  display: none;
  margin-bottom: 16px;
}

.mobile-add-btn {
  width: 100%;
}

.modal-close-btn {
  display: none;
  position: absolute;
  top: 14px;
  right: 14px;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card-strong);
  color: var(--heading);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.form-panel {
  position: relative;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(34, 25, 40, 0.28);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 39;
}

@media (max-width: 980px) {
  .main-grid {
    grid-template-columns: 1fr;
  }

  .manage-panel,
  .week-panel {
    grid-column: auto;
    grid-row: auto;
  }

  .week-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .site-shell {
    width: min(100% - 16px, 1200px);
    padding-top: 14px;
  }

  .hero,
  .form-panel,
  .manage-panel,
  .week-panel,
  .footer {
    border-radius: 22px;
    padding: 18px;
  }

  .hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .mobile-add-wrap {
    display: block;
  }

  .form-panel {
    display: none;
    position: fixed;
    left: 8px;
    right: 8px;
    top: 12px;
    bottom: 12px;
    margin: 0;
    z-index: 40;
    overflow-y: auto;
    background: var(--card-strong);
  }

  .form-panel.modal-visible {
    display: block;
  }

  .modal-close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .manage-panel {
    order: 2;
  }

  .week-panel {
    order: 1;
  }

  .footer,
  .week-header-row {
    flex-direction: column;
    align-items: flex-start;
  }
}