*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  font-family: "Space Grotesk", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, #3b1d78 0, #050512 45%, #020009 100%);
  color: #f5f1ff;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font-family: inherit;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2.5rem;
  border-bottom: 1px solid rgba(176, 130, 255, 0.3);
  backdrop-filter: blur(18px);
  background: linear-gradient(120deg, rgba(11, 1, 35, 0.9), rgba(10, 2, 50, 0.75));
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.65);
  position: sticky;
  top: 0;
  z-index: 20;
}

.app-title {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.app-title-accent {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0.9rem;
  background: conic-gradient(from 180deg at 50% 50%, #f97316, #e11d48, #6366f1, #a855f7, #f97316);
  box-shadow: 0 0 25px rgba(168, 85, 247, 0.85), 0 0 50px rgba(79, 70, 229, 0.7);
}

.app-title-main {
  font-size: 1.55rem;
  letter-spacing: 0.04em;
  
  font-weight: 600;
}

.app-title-sub {
  font-size: 0.85rem;
  opacity: 0.7;
}

.app-header-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.app-main {
  flex: 1;
  padding: 1.75rem 2.5rem 2.5rem;
}

.app-footer {
  padding: 0.8rem 2.5rem 1.1rem;
  border-top: 1px solid rgba(176, 130, 255, 0.3);
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-size: 0.8rem;
  color: rgba(235, 225, 255, 0.7);
  background: radial-gradient(circle at top, rgba(76, 29, 149, 0.4), rgba(5, 6, 17, 0.9));
  backdrop-filter: blur(14px);
}

.tz-toggle-form {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.1rem;
  border-radius: 999px;
  background: rgba(12, 10, 30, 0.9);
  border: 1px solid rgba(168, 85, 247, 0.65);
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.8);
}

.tz-pill {
  border: none;
  background: transparent;
  color: rgba(226, 232, 240, 0.8);
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.18s ease-out;
}

.tz-pill-active {
  background: radial-gradient(circle at top left, #a855f7, #4f46e5);
  color: #0b0616;
  font-weight: 600;
  box-shadow: 0 0 14px rgba(129, 140, 248, 0.8);
}

.tz-pill:not(.tz-pill-active):hover {
  background: rgba(31, 41, 55, 0.85);
}

.footer-logout {
  font-size: 0.8rem;
  opacity: 0.8;
  transition: opacity 0.15s ease-out;
}

.footer-logout:hover {
  opacity: 1;
}

.footer-note {
  margin-left: auto;
  opacity: 0.6;
}

.primary-button {
  border-radius: 999px;
  border: none;
  padding: 0.55rem 1.3rem;
  background: radial-gradient(circle at top left, #a855f7, #4c1d95);
  color: #fdfcff;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  box-shadow:
    0 16px 35px rgba(15, 23, 42, 0.9),
    0 0 22px rgba(147, 51, 234, 0.8);
  transition: transform 0.15s ease-out, box-shadow 0.15s ease-out, background 0.15s ease-out;
}

.primary-button:hover {
  transform: translateY(-1px);
  box-shadow:
    0 18px 40px rgba(15, 23, 42, 0.95),
    0 0 26px rgba(167, 139, 250, 0.9);
}

.primary-button.strong {
  padding-inline: 1.7rem;
}

.primary-button.subtle {
  background: linear-gradient(120deg, rgba(76, 29, 149, 0.9), rgba(30, 64, 175, 0.8));
  box-shadow:
    0 10px 26px rgba(15, 23, 42, 0.9),
    0 0 14px rgba(79, 70, 229, 0.7);
}

.ghost-button {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(15, 23, 42, 0.7);
  color: rgba(226, 232, 240, 0.9);
  padding: 0.45rem 1.05rem;
  font-size: 0.82rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  transition: all 0.15s ease-out;
}

.ghost-button:hover {
  background: rgba(30, 64, 175, 0.35);
  border-color: rgba(129, 140, 248, 0.7);
}

.ghost-button.small {
  padding: 0.25rem 0.7rem;
  font-size: 0.78rem;
}

.layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 1.75rem;
  align-items: flex-start;
}

.control-panel {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.panel-card {
  background: radial-gradient(circle at top, rgba(76, 29, 149, 0.45), rgba(12, 10, 32, 0.95));
  border-radius: 1.25rem;
  border: 1px solid rgba(186, 144, 255, 0.6);
  box-shadow:
    0 18px 40px rgba(15, 23, 42, 0.9),
    0 0 22px rgba(88, 28, 135, 0.85);
  padding: 1.2rem 1.25rem 1.4rem;
}

.panel-card.secondary {
  background: radial-gradient(circle at top, rgba(46, 16, 101, 0.7), rgba(9, 9, 18, 0.97));
  border-color: rgba(148, 163, 184, 0.6);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.95);
}

.panel-header h2 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.panel-header p {
  margin: 0;
  font-size: 0.8rem;
  opacity: 0.72;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.85rem;
}

.field-row {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.field-row .field-group {
  flex: 1;
}

.field-group label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(209, 213, 219, 0.9);
}

.field-group input[type="text"],
.field-group input[type="datetime-local"] {
  border-radius: 0.7rem;
  border: 1px solid rgba(148, 163, 184, 0.55);
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  padding: 0.45rem 0.7rem;
  font-size: 0.86rem;
  outline: none;
  transition: border-color 0.16s ease-out, box-shadow 0.16s ease-out, background 0.16s ease-out;
}

.field-group input::placeholder {
  color: rgba(148, 163, 184, 0.9);
}

.field-group input:focus {
  border-color: rgba(196, 181, 253, 0.9);
  box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.8);
  background: rgba(15, 23, 42, 0.95);
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.pill {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.55);
  background: rgba(15, 23, 42, 0.7);
  color: rgba(226, 232, 240, 0.92);
  padding: 0.25rem 0.7rem;
  font-size: 0.78rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.12s ease-out;
}

.pill::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: rgba(156, 163, 175, 0.5);
}

.pill-sleep::before {
  background: linear-gradient(135deg, #22d3ee, #4f46e5);
}

.pill-meal::before {
  background: linear-gradient(135deg, #fb7185, #ec4899);
}

.pill-study::before {
  background: linear-gradient(135deg, #a3e635, #22c55e);
}

.pill-task::before {
  background: linear-gradient(135deg, #6366f1, #a855f7);
}

.pill-social::before {
  background: linear-gradient(135deg, #facc15, #f97316);
}

.pill-soccer::before {
  background: linear-gradient(135deg, #facc15, #f97316);
}

.pill-other::before {
  background: linear-gradient(135deg, #6366f1, #a855f7);
}

.pill.active {
  border-color: rgba(196, 181, 253, 0.95);
  background: radial-gradient(circle at top left, rgba(129, 140, 248, 0.65), rgba(15, 23, 42, 0.95));
  box-shadow: 0 0 18px rgba(129, 140, 248, 0.75);
}

.shortcut-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.shortcut {
  border-radius: 999px;
  border: 1px dashed rgba(148, 163, 184, 0.7);
  background: rgba(15, 23, 42, 0.85);
  color: rgba(209, 213, 219, 0.9);
  padding: 0.25rem 0.75rem;
  font-size: 0.76rem;
  cursor: pointer;
  transition: all 0.12s ease-out;
}

.shortcut:hover {
  border-style: solid;
  border-color: rgba(196, 181, 253, 0.9);
  background: rgba(30, 64, 175, 0.8);
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.1rem;
}

.hint-list {
  margin: 0.4rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.78rem;
  color: rgba(209, 213, 219, 0.9);
}

.hint-list li + li {
  margin-top: 0.22rem;
}

.week-nav {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.week-label {
  padding: 0.25rem 0.9rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.4);
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
}

.week-label-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  opacity: 0.65;
}

.week-label-date {
  font-size: 0.86rem;
  font-weight: 500;
}

.clone-form {
  margin-left: 1.25rem;
}

.schedule-panel {
  background: radial-gradient(circle at top, rgba(15, 23, 42, 0.85), rgba(3, 7, 18, 0.97));
  border-radius: 1.4rem;
  border: 1px solid rgba(148, 163, 184, 0.7);
  box-shadow:
    0 22px 55px rgba(15, 23, 42, 0.98),
    0 0 32px rgba(15, 23, 42, 0.9);
  padding: 1.15rem 1.15rem 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}

.schedule-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.time-columns-legend {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.78rem;
  color: rgba(209, 213, 219, 0.9);
}

.legend-dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 999px;
  display: inline-block;
  margin-right: 0.25rem;
}

.legend-sleep {
  background: linear-gradient(135deg, #1d4ed8, #0ea5e9);
}

.legend-meal {
  background: linear-gradient(135deg, #f97316, #ea580c);
}

.legend-study {
  background: linear-gradient(135deg, #14b8a6, #22d3ee);
}

.legend-task {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
}

.legend-social {
  background: linear-gradient(135deg, #ec4899, #db2777);
}

.legend-soccer {
  background: linear-gradient(135deg, #22c55e, #16a34a);
}

.legend-other {
  background: linear-gradient(135deg, #6b7280, #9ca3af);
}

.schedule-grid-wrapper {
  border-radius: 1.05rem;
  border: 1px solid rgba(55, 65, 81, 0.9);
  background: radial-gradient(circle at top, rgba(24, 24, 46, 0.98), rgba(3, 7, 18, 1));
  overflow: hidden;
}

.schedule-grid {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  max-height: calc(100vh - 220px);
  overflow: auto;
}

.time-column {
  background: linear-gradient(180deg, rgba(15, 23, 42, 1), rgba(17, 24, 39, 0.98));
  border-right: 1px solid rgba(55, 65, 81, 0.9);
}

.time-column-header {
  position: sticky;
  top: 0;
  z-index: 15;
  padding: 0.65rem 0.7rem;
  font-size: 0.78rem;
  border-bottom: 1px solid rgba(55, 65, 81, 0.95);
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.98), rgba(15, 23, 42, 0.98));
  height: 4rem;
  min-height: 4rem;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.time-sub,
.time-sub-secondary {
  display: block;
  font-size: 0.7rem;
  opacity: 0.7;
}

.time-sub-secondary {
  color: rgba(147, 197, 253, 0.9);
}

.time-row {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid rgba(31, 41, 55, 0.95);
  height: 40px;
  justify-content: space-between;
}

.time-labels {
  padding: 0.25rem 0.7rem 0;
}

.time-main {
  display: block;
  font-size: 0.8rem;
}

.time-secondary {
  display: block;
  font-size: 0.7rem;
  color: rgba(147, 197, 253, 0.85);
}

.time-markers {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 0 0.7rem 0.2rem;
  gap: 0.1rem;
}

.marker {
  height: 1px;
  background: linear-gradient(90deg, rgba(55, 65, 81, 0.7), rgba(15, 23, 42, 0.4));
  opacity: 0.7;
}

.days-columns {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  position: relative;
}

.day-column {
  border-left: 1px solid rgba(31, 41, 55, 0.9);
  position: relative;
}

.day-header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 0.65rem 0.6rem;
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.98), rgba(15, 23, 42, 0.98));
  border-bottom: 1px solid rgba(55, 65, 81, 0.95);
  height: 4rem;
  min-height: 4rem;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.day-name {
  font-size: 0.8rem;
  font-weight: 600;
}

.day-date {
  font-size: 0.72rem;
  opacity: 0.7;
}

.day-grid {
  position: relative;
}

.day-hour-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: 40px;
}

.quarter-cell {
  border-left: 1px solid rgba(17, 24, 39, 1);
  border-bottom: 1px solid rgba(15, 23, 42, 0.95);
}

.quarter-cell:first-child {
  border-left-color: rgba(55, 65, 81, 0.75);
}

.tasks-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.task-block {
  position: absolute;
  left: 6%;
  right: 6%;
  border-radius: 0.7rem;
  padding: 0.22rem 0.55rem 0.3rem;
  font-size: 0.74rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  cursor: pointer;
  pointer-events: auto;
  overflow: hidden;
  box-shadow:
    0 10px 26px rgba(15, 23, 42, 0.95),
    0 0 20px rgba(129, 140, 248, 0.8);
  border: 1px solid rgba(17, 24, 39, 0.95);
}

.task-resize-handle {
  position: absolute;
  left: 18%;
  right: 18%;
  height: 6px;
  cursor: ns-resize;
  opacity: 0;
  transition: opacity 0.12s ease-out;
}

.task-resize-top {
  top: 2px;
}

.task-resize-bottom {
  bottom: 2px;
}

.task-block:hover .task-resize-handle {
  opacity: 0.9;
}

.drag-preview-block {
  background: linear-gradient(135deg, rgba(129, 140, 248, 0.18), rgba(147, 51, 234, 0.38));
  border-style: dashed;
  border-color: rgba(196, 181, 253, 0.95);
  opacity: 0.9;
  pointer-events: none;
}

.task-title {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-time {
  font-size: 0.7rem;
  opacity: 0.9;
}

.task-delete {
  position: absolute;
  top: 2px;
  right: 4px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: none;
  background: rgba(15, 23, 42, 0.9);
  color: rgba(248, 250, 252, 0.9);
  font-size: 0.7rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.12s ease-out, transform 0.12s ease-out;
}

.task-block:hover .task-delete {
  opacity: 1;
}

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

.task-sleep {
  background: linear-gradient(135deg, rgba(29, 78, 216, 0.2), rgba(14, 165, 233, 0.36));
  border-color: rgba(37, 99, 235, 0.98);
}

.task-meal {
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.2), rgba(234, 88, 12, 0.36));
  border-color: rgba(249, 115, 22, 0.98);
}

.task-study {
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.2), rgba(34, 211, 238, 0.36));
  border-color: rgba(45, 212, 191, 0.98);
}

.task-task {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.2), rgba(168, 85, 247, 0.36));
  border-color: rgba(139, 92, 246, 0.98);
}

.task-social {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.2), rgba(219, 39, 119, 0.36));
  border-color: rgba(236, 72, 153, 0.98);
}

.task-soccer {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(22, 163, 74, 0.36));
  border-color: rgba(34, 197, 94, 0.98);
}

.task-other {
  background: linear-gradient(135deg, rgba(107, 114, 128, 0.24), rgba(148, 163, 184, 0.4));
  border-color: rgba(156, 163, 175, 0.98);
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .control-panel {
    order: 2;
  }

  .schedule-panel {
    order: 1;
  }

  .app-main {
    padding-inline: 1.25rem;
  }

  .app-header {
    padding-inline: 1.25rem;
  }

  .app-footer {
    padding-inline: 1.25rem;
  }
}

@media (max-width: 780px) {
  .week-nav {
    display: none;
  }

  .clone-form {
    margin-left: 0;
  }

  .schedule-grid {
    grid-template-columns: 90px minmax(0, 1fr);
  }

  .days-columns {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
  }
}

/* --- Login page (password gate) --- */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-shell {
  position: relative;
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.login-backdrop {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top left, #3b1d78 0, #050512 45%, #020009 100%);
  z-index: 0;
}

.login-main {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
}

.login-card {
  position: relative;
  background: radial-gradient(circle at top, rgba(76, 29, 149, 0.5), rgba(12, 10, 32, 0.98));
  border-radius: 1.5rem;
  border: 1px solid rgba(186, 144, 255, 0.6);
  box-shadow:
    0 24px 56px rgba(15, 23, 42, 0.95),
    0 0 40px rgba(88, 28, 135, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  padding: 2.25rem 2rem 2.5rem;
  overflow: hidden;
}

.login-card-accent {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  width: 3rem;
  height: 3rem;
  border-radius: 1rem;
  background: conic-gradient(from 180deg at 50% 50%, #f97316, #e11d48, #6366f1, #a855f7, #f97316);
  box-shadow: 0 0 28px rgba(168, 85, 247, 0.8), 0 0 56px rgba(79, 70, 229, 0.5);
  opacity: 0.95;
}

.login-card-inner {
  position: relative;
}

.login-header {
  margin-bottom: 1.75rem;
  padding-top: 0.5rem;
}

.login-logo {
  display: block;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0.9rem;
  background: conic-gradient(from 180deg at 50% 50%, #f97316, #e11d48, #6366f1, #a855f7, #f97316);
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.7);
  margin-bottom: 1rem;
}

.login-title {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
  color: #f5f1ff;
}

.login-subtitle {
  margin: 0;
  font-size: 0.88rem;
  opacity: 0.72;
  color: rgba(235, 225, 255, 0.9);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.login-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(209, 213, 219, 0.95);
}

.login-input {
  border-radius: 0.85rem;
  border: 1px solid rgba(148, 163, 184, 0.55);
  background: rgba(15, 23, 42, 0.92);
  color: #e5e7eb;
  padding: 0.65rem 0.9rem;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.16s ease-out, box-shadow 0.16s ease-out;
}

.login-input::placeholder {
  color: rgba(148, 163, 184, 0.8);
}

.login-input:focus {
  border-color: rgba(196, 181, 253, 0.95);
  box-shadow: 0 0 0 2px rgba(129, 140, 248, 0.5);
}

.login-error {
  margin: 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  color: rgba(254, 226, 226, 0.98);
  background: rgba(185, 28, 28, 0.25);
  border: 1px solid rgba(248, 113, 113, 0.4);
  border-radius: 0.65rem;
}

.login-submit {
  margin-top: 0.25rem;
  padding: 0.65rem 1.5rem;
  font-size: 0.9rem;
  width: 100%;
}

