:root {
  --sand: #f3ebe0;
  --sand-deep: #e8dccb;
  --teal: #0c3d3a;
  --teal-mid: #145a55;
  --teal-soft: #1f7a72;
  --ink: #102826;
  --muted: #5a6f6c;
  --accent: #0f6e68;
  --accent-ink: #f3ebe0;
  --warn: #b45309;
  --warn-bg: rgba(180, 83, 9, 0.12);
  --danger: #9f1239;
  --danger-bg: rgba(159, 18, 57, 0.1);
  --ok: #0f766e;
  --line: rgba(16, 40, 38, 0.12);
  --panel: rgba(255, 252, 247, 0.72);
  --font: "Nunito", system-ui, sans-serif;
  --display: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--sand);
  line-height: 1.5;
}
.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 70% 55% at 85% 0%, rgba(20, 90, 85, 0.28), transparent 55%),
    radial-gradient(ellipse 45% 40% at 5% 90%, rgba(232, 220, 203, 0.9), transparent 50%),
    linear-gradient(168deg, var(--sand) 0%, #e6ddd0 42%, #d5ebe7 100%);
}
.atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      -12deg,
      transparent,
      transparent 28px,
      rgba(12, 61, 58, 0.025) 28px,
      rgba(12, 61, 58, 0.025) 29px
    );
  pointer-events: none;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: rgba(243, 235, 224, 0.65);
  backdrop-filter: blur(8px);
}
.brand {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--teal);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.top nav { display: flex; gap: 0.75rem; align-items: center; }
.top nav a:not(.btn) {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  text-decoration: none;
  font: inherit;
  font-weight: 700;
  padding: 0.65rem 1.1rem;
  border-radius: 999px;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn.buy {
  background: var(--teal);
  color: var(--accent-ink);
  box-shadow: 0 8px 20px rgba(12, 61, 58, 0.18);
}
.btn.ghost {
  background: transparent;
  color: var(--teal);
  border: 1.5px solid rgba(12, 61, 58, 0.28);
}
.btn.soft {
  background: var(--sand-deep);
  color: var(--teal);
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.hero {
  min-height: calc(100vh - 4rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3rem 1.5rem 4rem;
  max-width: 42rem;
  position: relative;
}
.hero::before {
  content: "";
  position: absolute;
  right: -8vw;
  top: 18%;
  width: min(48vw, 28rem);
  height: min(48vw, 28rem);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 35%, rgba(31, 122, 114, 0.45), transparent 55%),
    radial-gradient(circle at 70% 70%, rgba(12, 61, 58, 0.55), transparent 60%);
  filter: blur(2px);
  z-index: -1;
  animation: drift 14s ease-in-out infinite alternate;
}
@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(-3%, 4%) scale(1.05); }
}
.brand-hero {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.6rem, 9vw, 4.4rem);
  letter-spacing: -0.04em;
  margin: 0 0 1rem;
  line-height: 0.95;
  color: var(--teal);
  animation: rise 0.7s ease both;
}
.hero h1 {
  font-family: var(--font);
  font-size: clamp(1.2rem, 3vw, 1.55rem);
  font-weight: 700;
  margin: 0 0 0.75rem;
  max-width: 24ch;
  color: var(--ink);
  animation: rise 0.7s ease 0.08s both;
}
.lede {
  color: var(--muted);
  margin: 0 0 1.75rem;
  max-width: 38ch;
  font-size: 1.05rem;
  animation: rise 0.7s ease 0.16s both;
}
.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  animation: rise 0.7s ease 0.24s both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.strip {
  padding: 2.5rem 1.5rem 3rem;
  border-top: 1px solid var(--line);
  max-width: 42rem;
}
.strip h2 {
  font-family: var(--display);
  margin: 0 0 1rem;
  color: var(--teal);
  font-size: 1.5rem;
}
.strip ul { margin: 0; padding-left: 1.1rem; color: var(--muted); }
.strip li { margin-bottom: 0.45rem; }

.foot {
  padding: 1.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}
.foot a { color: var(--accent); font-weight: 700; }

.app-body { background: var(--sand); }
.app-body .workspace {
  max-width: 58rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  display: grid;
  gap: 1.25rem;
}
@media (min-width: 900px) {
  .app-body .workspace {
    grid-template-columns: 1.05fr 0.95fr;
    align-items: start;
  }
  .plan-col { grid-column: 2; grid-row: 1 / span 4; position: sticky; top: 1rem; }
}

.status {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0;
  font-weight: 600;
  grid-column: 1 / -1;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.1rem 1.15rem 1.2rem;
  backdrop-filter: blur(6px);
}
.panel h2 {
  font-family: var(--display);
  font-size: 1.25rem;
  margin: 0 0 0.85rem;
  color: var(--teal);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}
.panel-head h2 { margin: 0; }

label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.01em;
}
input, select, textarea {
  font: inherit;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  border: 1.5px solid rgba(12, 61, 58, 0.16);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(15, 110, 104, 0.35);
  border-color: var(--teal-soft);
}

.form-grid {
  display: grid;
  gap: 0.7rem;
  grid-template-columns: 1fr 1fr;
}
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 520px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
}

.hours-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.45rem;
}
.hours-grid label { font-size: 0.72rem; text-align: center; }
.hours-grid input { padding: 0.5rem 0.25rem; text-align: center; }
@media (max-width: 640px) {
  .hours-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.assignment-list {
  list-style: none;
  margin: 0.85rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.assignment-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem 0.75rem;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
}
.assignment-item strong {
  font-family: var(--display);
  font-weight: 600;
  color: var(--teal);
}
.assignment-meta {
  grid-column: 1 / -1;
  font-size: 0.82rem;
  color: var(--muted);
}
.assignment-item .remove {
  align-self: start;
  font-size: 0.78rem;
  padding: 0.35rem 0.7rem;
}

.warnings {
  margin: 0 0 0.85rem;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  background: var(--warn-bg);
  border: 1px solid rgba(180, 83, 9, 0.25);
  color: #7c2d12;
  font-size: 0.9rem;
}
.warnings strong { display: block; margin-bottom: 0.35rem; }
.warnings ul { margin: 0; padding-left: 1.1rem; }
.warnings.danger {
  background: var(--danger-bg);
  border-color: rgba(159, 18, 57, 0.25);
  color: var(--danger);
}
.ok-banner {
  margin: 0 0 0.85rem;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  background: rgba(15, 118, 110, 0.1);
  border: 1px solid rgba(15, 118, 110, 0.22);
  color: var(--ok);
  font-size: 0.9rem;
  font-weight: 700;
}

.plan-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: min(62vh, 34rem);
  overflow: auto;
}
.day-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
  background: rgba(255, 255, 255, 0.55);
}
.day-block header {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
  font-weight: 800;
  color: var(--teal);
  font-size: 0.92rem;
}
.day-block header span {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.8rem;
}
.day-block ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
.day-block li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.88rem;
  padding: 0.25rem 0;
  border-top: 1px dashed rgba(12, 61, 58, 0.1);
}
.day-block li:first-child { border-top: none; }
.pri {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  background: rgba(12, 61, 58, 0.1);
  color: var(--teal);
  margin-left: 0.35rem;
}
.pri.high { background: rgba(159, 18, 57, 0.12); color: var(--danger); }
.pri.med { background: rgba(180, 83, 9, 0.14); color: #9a3412; }
.empty-plan {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.9rem;
}

.print-only { display: none; }

dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--sand);
  color: var(--ink);
  padding: 1.25rem;
  max-width: 22rem;
}
dialog::backdrop { background: rgba(12, 61, 58, 0.45); }
dialog h2 {
  font-family: var(--display);
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  color: var(--teal);
}
dialog p { color: var(--muted); font-size: 0.9rem; }
.err { color: var(--danger); font-size: 0.85rem; font-weight: 700; }

@media print {
  .atmosphere, .top, .actions, .panel:not(.plan-col), .status { display: none !important; }
  body { background: white; }
  .app-body .workspace {
    display: block;
    max-width: none;
    padding: 0;
  }
  .plan-col {
    position: static;
    border: none;
    background: none;
    padding: 0;
  }
  .plan-list { max-height: none; overflow: visible; }
  .print-only { display: block; margin-bottom: 1rem; }
  .day-block { break-inside: avoid; }
}

@media (max-width: 560px) {
  .top { flex-wrap: wrap; gap: 0.75rem; }
}
