:root {
  color-scheme: dark;
  --bg: #0d100f;
  --panel: #171d19;
  --panel-strong: #202720;
  --line: #344035;
  --text: #f3f7ef;
  --muted: #a9b6aa;
  --soft: #d8e2d5;
  --accent: #74e3a7;
  --accent-strong: #34c978;
  --blue: #8ab8ff;
  --amber: #f0b767;
  --danger: #ff806f;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.38);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(116, 227, 167, 0.08), transparent 260px),
    radial-gradient(circle at 20% 0%, rgba(138, 184, 255, 0.12), transparent 330px),
    var(--bg);
}

button,
input,
select {
  font: inherit;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

label {
  display: block;
  color: var(--soft);
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.45rem;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: #111612;
  padding: 0.75rem 0.85rem;
  outline: none;
}

input:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(116, 227, 167, 0.22);
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.login-panel {
  width: min(100%, 440px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(23, 29, 25, 0.94);
  box-shadow: var(--shadow);
  padding: 2rem;
}

.login-panel h1,
.topbar h1,
.section-heading h2,
.day-panel h2 {
  margin: 0;
  letter-spacing: 0;
}

.login-panel h1 {
  font-size: clamp(2rem, 7vw, 3.35rem);
}

.login-copy {
  color: var(--muted);
  margin: 0.85rem 0 1.6rem;
  line-height: 1.55;
}

.password-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.65rem;
}

.app {
  min-height: 100vh;
  padding: 1.25rem;
}

.topbar {
  width: min(1500px, 100%);
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.topbar h1 {
  font-size: clamp(1.8rem, 4vw, 3rem);
}

.workspace {
  width: min(1500px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(210px, 0.75fr) minmax(330px, 1.25fr) minmax(420px, 1.55fr) minmax(280px, 0.85fr);
  gap: 1rem;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(23, 29, 25, 0.96);
  box-shadow: var(--shadow);
  padding: 1rem;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.section-heading h2,
.day-panel h2 {
  font-size: 1.2rem;
}

.eyebrow {
  margin: 0 0 0.2rem;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.primary-button,
.small-button,
.ghost-button,
.danger-button,
.icon-button,
.password-row button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: #07120b;
  background: var(--accent);
  font-weight: 800;
  padding: 0.7rem 0.95rem;
}

.primary-button:hover,
.small-button:hover,
.password-row button:hover {
  background: #94efbd;
}

.small-button {
  min-height: 38px;
  padding: 0.55rem 0.75rem;
  font-size: 0.9rem;
}

.ghost-button,
.icon-button {
  color: var(--text);
  border-color: var(--line);
  background: #111612;
}

.ghost-button:hover,
.icon-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.danger-button {
  color: #280805;
  background: var(--danger);
}

.danger-button:hover {
  background: #ff9a8e;
}

.icon-button {
  width: 42px;
  padding: 0;
}

.plans-list {
  display: grid;
  gap: 0.6rem;
}

.plan-list-item {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #111612;
  color: var(--text);
  padding: 0.85rem;
  text-align: left;
}

.plan-list-item:hover,
.plan-list-item.is-active {
  border-color: var(--accent);
  background: #18251d;
}

.plan-list-item strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 0.2rem;
}

.plan-list-item span,
.empty-state,
.save-state {
  color: var(--muted);
  font-size: 0.85rem;
}

.plan-form {
  display: grid;
  gap: 1rem;
}

.exercise-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.exercise-head h3 {
  margin: 0;
  font-size: 1rem;
}

.exercise-table {
  display: grid;
  gap: 0.45rem;
}

.exercise-table-head,
.exercise-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(105px, 0.6fr) minmax(82px, 0.45fr) 44px;
  gap: 0.5rem;
  align-items: center;
}

.exercise-table-head {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0 0.2rem;
}

.exercise-row input {
  min-height: 40px;
  padding: 0.62rem 0.7rem;
}

.remove-exercise-button {
  width: 40px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--danger);
  background: #111612;
  font-size: 1.15rem;
}

.remove-exercise-button:hover {
  border-color: var(--danger);
}

.form-actions,
.day-actions,
.month-controls {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.day-form {
  display: grid;
  gap: 0.75rem;
}

.delete-form {
  margin-top: 0.75rem;
}

.form-message {
  min-height: 1.2rem;
  margin: 0;
  color: var(--amber);
  font-size: 0.9rem;
}

.calendar-panel {
  min-width: 0;
}

.weekday-row,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.45rem;
}

.weekday-row {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  margin-bottom: 0.45rem;
  text-align: center;
}

.calendar-day {
  display: block;
  position: relative;
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: #111612;
  padding: 0.65rem;
  text-align: left;
  overflow: hidden;
}

.calendar-day:hover,
.calendar-day.is-selected {
  border-color: var(--accent);
  background: #18251d;
}

.calendar-day.is-today .day-number {
  color: var(--accent);
}

.calendar-day.is-muted {
  opacity: 0.36;
}

.day-number {
  display: block;
  font-weight: 900;
}

.day-assignment {
  display: block;
  margin-top: 0.55rem;
  color: #08120b;
  background: var(--amber);
  border-radius: 999px;
  padding: 0.22rem 0.45rem;
  font-size: 0.74rem;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.day-panel {
  display: grid;
  gap: 1rem;
}

.day-details {
  display: grid;
  gap: 0.65rem;
}

.day-details h3 {
  margin: 0.35rem 0 0;
  font-size: 1rem;
}

.exercise-summary {
  border-left: 3px solid var(--accent);
  background: #111612;
  border-radius: var(--radius);
  padding: 0.7rem 0.8rem;
}

.exercise-summary strong {
  display: block;
  margin-bottom: 0.2rem;
}

.exercise-summary span,
.day-details p {
  color: var(--muted);
  line-height: 1.45;
}

.flash {
  width: min(1500px, 100%);
  margin: 0 auto 1rem;
  border: 1px solid rgba(116, 227, 167, 0.45);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(116, 227, 167, 0.12);
  padding: 0.85rem 1rem;
  font-weight: 700;
}

.flash.error {
  border-color: rgba(255, 128, 111, 0.55);
  background: rgba(255, 128, 111, 0.14);
}

.topbar form {
  margin: 0;
}

.toast {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  max-width: min(340px, calc(100vw - 2.5rem));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: #111612;
  box-shadow: var(--shadow);
  padding: 0.8rem 0.95rem;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: minmax(230px, 0.8fr) minmax(420px, 1.4fr);
  }
}

@media (max-width: 760px) {
  .app {
    padding: 0.8rem;
  }

  .topbar,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .password-row,
  .exercise-table-head,
  .exercise-row {
    grid-template-columns: 1fr;
  }

  .exercise-table-head {
    display: none;
  }

  .calendar-day {
    min-height: 70px;
    padding: 0.45rem;
  }

  .day-assignment {
    border-radius: 6px;
    white-space: normal;
  }
}
