:root {
  --bg: #f5f7f7;
  --ink: #172d39;
  --muted: #637783;
  --line: #e0e8e9;
  --navy: #244c72;
  --mint: #dbefe5;
  --green: #27735d;
  --amber: #fff2d7;
  --purple: #eeebf7;
  --white: #fff;
  --shadow: 0 13px 35px #24445b0a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font: 15px/1.5 system-ui, -apple-system, Segoe UI, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid #e5ab37;
  outline-offset: 2px;
}

.shell {
  display: grid;
  grid-template-columns: 242px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: #163748;
  color: #fff;
  padding: 28px 17px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.brand {
  font-size: 22px;
  letter-spacing: -0.8px;
  font-weight: 780;
  padding: 2px 13px;
}

.smallcaps {
  font-size: 10px;
  letter-spacing: 1.7px;
  text-transform: uppercase;
  color: #9cbbcc;
  padding: 0 13px;
}

.navbtn {
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #bed2db;
  padding: 12px 15px;
  font-weight: 650;
  margin-bottom: 3px;
}

.navbtn:hover, .navbtn.active {
  background: #fff2;
  color: #fff;
}

.switch {
  margin-top: auto;
  padding: 10px;
  background: #ffffff17;
  border-radius: 15px;
}

.switch button {
  border: 0;
  background: #fff;
  color: #17384b;
  width: 100%;
  padding: 9px;
  border-radius: 9px;
  font-weight: 750;
}

.wrap {
  max-width: 1220px;
  margin: 0 auto;
  padding: 26px 34px 80px;
}

.statusbar {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 16px;
  font-size: 13px;
  margin-bottom: 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow);
}

.statusbar-left, .statusbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.date-input {
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid #cbdadd;
  background: var(--bg);
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
}

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

.top h1 {
  font-size: 32px;
  letter-spacing: -1.3px;
  line-height: 1.2;
  margin: 0 0 6px;
}

.top p {
  color: var(--muted);
  margin: 0;
}

.tag {
  display: inline-block;
  font-size: 11px;
  border-radius: 9px;
  padding: 4px 8px;
  font-weight: 700;
  background: #e9f0f4;
  color: #426374;
}

.tag.green {
  background: #dbefe5;
  color: #206249;
}

.tag.amber {
  background: var(--amber);
  color: #866221;
}

.tag.purple {
  background: var(--purple);
  color: #604c83;
}

.grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 18px;
}

.grid.three {
  grid-template-columns: repeat(3, 1fr);
}

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

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 19px;
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 17px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card.active-period {
  border: 2px solid #297c60;
  box-shadow: 0 14px 36px rgba(39, 115, 93, 0.12);
}

.card h2, .card h3 {
  letter-spacing: -0.45px;
  margin: 0 0 10px;
}

.card h2 {
  font-size: 20px;
}

.card h3 {
  font-size: 16px;
}

.muted {
  color: var(--muted);
}

.tiny {
  font-size: 12px;
  color: var(--muted);
}

.hero {
  background: linear-gradient(115deg, #224d67, #287663);
  color: white;
  padding: 30px;
  border-radius: 20px;
  margin-bottom: 19px;
}

.hero h1 {
  font-size: 31px;
  line-height: 1.15;
  letter-spacing: -1px;
  margin: 10px 0;
}

.hero p {
  color: #d8eee9;
  max-width: 680px;
}

.pill {
  background: #ffffff2b;
  border-radius: 100px;
  padding: 6px 11px;
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
}

.btn {
  border: 1px solid #ccd9df;
  color: var(--navy);
  background: white;
  border-radius: 11px;
  padding: 9px 14px;
  font-weight: 700;
  margin: 4px 5px 4px 0;
  transition: transform 0.08s ease, opacity 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn.primary {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

.btn.soft {
  background: #e5f2ed;
  border-color: #d0e8dd;
  color: #255f4f;
}

.btn.small {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 8px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.item {
  padding: 11px 0;
  border-bottom: 1px solid #edf1f2;
}

.item:last-child {
  border-bottom: 0;
}

.check {
  display: flex;
  align-items: center;
  gap: 11px;
  cursor: pointer;
}

.check input {
  accent-color: #297c60;
  width: 18px;
  height: 18px;
}

.timeline {
  border-left: 2px solid #d6e4e6;
  margin-left: 12px;
  padding-left: 20px;
}

.slot {
  position: relative;
  padding: 3px 0 19px;
}

.slot:before {
  content: "";
  position: absolute;
  left: -26px;
  top: 8px;
  width: 10px;
  height: 10px;
  background: #3c8a80;
  border: 3px solid white;
  border-radius: 100%;
  box-shadow: 0 0 0 1px #cddcdd;
}

.slot strong {
  display: block;
}

.slot small {
  color: var(--muted);
}

.slim {
  margin: 0 0 8px;
}

.mini {
  padding: 12px 14px;
  background: #f5f8f9;
  border-radius: 12px;
  margin: 9px 0;
}

.mini.warn {
  background: #fff4df;
}

.mini.good {
  background: #e5f4ec;
}

.sectionhead {
  font-size: 11px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--green);
  font-weight: 800;
  margin-bottom: 9px;
  display: block;
}

.seg {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin: 0 0 19px;
}

.seg button {
  border: 1px solid #d9e3e7;
  border-radius: 10px;
  padding: 8px 13px;
  background: white;
  color: var(--muted);
  font-weight: 650;
}

.seg button.sel, .seg button.primary {
  background: #244c72;
  color: white;
  border-color: #244c72;
}

.field {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbdadd;
  border-radius: 10px;
  min-height: 40px;
  background: #fff;
  color: var(--ink);
}

.field + .field {
  margin-top: 8px;
}

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

.progress {
  height: 8px;
  background: #e6eff0;
  border-radius: 10px;
  overflow: hidden;
  margin: 8px 0;
}

.progress span {
  height: 100%;
  display: block;
  background: #4f9388;
  transition: width 0.25s ease;
}

.notice {
  padding: 10px 12px;
  border-left: 3px solid #e0a843;
  background: #fff9eb;
  color: #715526;
  font-size: 13px;
  margin: 12px 0;
  border-radius: 0 8px 8px 0;
}

.hidden {
  display: none !important;
}

.footer {
  font-size: 12px;
  color: #637783;
  margin-top: 30px;
}

.focus {
  border: 1px solid #afdbcb;
  background: #eff8f3;
  border-radius: 14px;
  padding: 15px;
  margin-top: 12px;
}

.reflections {
  background: #f2effa;
  border-color: #dfd7f1;
}

.details {
  border: 1px solid #e4ecec;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
}

details summary {
  cursor: pointer;
  font-weight: 700;
}

.toast {
  position: fixed;
  right: 26px;
  bottom: 20px;
  background: #173e43;
  color: white;
  padding: 13px 20px;
  border-radius: 13px;
  box-shadow: 0 15px 35px #0003;
  max-width: 380px;
  z-index: 100;
}

.toast[hidden] {
  display: none;
}

.table-scroll {
  overflow: auto;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.master-table {
  border-collapse: separate;
  border-spacing: 0;
  min-width: 1180px;
  width: 100%;
  font-size: 12px;
}

.master-table th, .master-table td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 11px 10px;
  vertical-align: top;
  min-width: 135px;
  white-space: pre-line;
}

.master-table thead th {
  position: sticky;
  top: 0;
  background: #e6eff4;
  z-index: 2;
  min-width: 140px;
}

.master-table thead th.active-day-col {
  background: #27735d;
  color: #fff;
}

.master-table td.active-day-col {
  background: #f1faf6;
}

.master-table th:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #e6eff4;
  min-width: 155px;
  max-width: 170px;
  white-space: pre-line;
}

.master-table thead th:first-child {
  z-index: 3;
}

.master-table td {
  background: var(--white);
}

.protected-cell {
  background: #f8f5ff !important;
}

.weekday-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 8px 0 14px;
}

.weekday-picks label {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.added-activity {
  padding: 7px;
  border-radius: 7px;
  background: #ddf5e8;
  color: #155641;
  margin-top: 7px;
  font-size: 11px;
}

.evidence-preview {
  max-width: 100%;
  max-height: 160px;
  border-radius: 10px;
  border: 1px solid var(--line);
  margin-top: 8px;
  display: block;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 21, 31, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
}

.modal-card {
  background: var(--white);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 26px;
  max-width: 430px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

/* Dark Mode */
body.dark {
  --bg: #101b25;
  --ink: #e5eff5;
  --muted: #b2c1cc;
  --line: #344654;
  --navy: #83b1e7;
  --mint: #244b44;
  --green: #9de0c3;
  --amber: #4b3c27;
  --purple: #39334e;
  --white: #1c2a36;
  --shadow: 0 13px 35px #0003;
}

body.dark .sidebar {
  background: #0a151f;
}

body.dark .btn, body.dark .seg button, body.dark .field, body.dark .date-input {
  background: #253746;
  color: #e7f0f6;
  border-color: #526476;
}

body.dark .btn.primary, body.dark .seg button.primary {
  background: #85b5e9;
  color: #0e1e2b;
  border-color: #85b5e9;
}

body.dark .btn.soft, body.dark .mini.good, body.dark .focus {
  background: #23493f;
  color: #d0f7e7;
  border-color: #2f6355;
}

body.dark .mini {
  background: #263743;
}

body.dark .mini.warn, body.dark .notice {
  background: #483a25;
  color: #ffe1ad;
}

body.dark .item, body.dark .details {
  border-color: #354958;
}

body.dark .tag {
  background: #2b4b5d;
  color: #d6edf8;
}

body.dark .tag.green {
  background: #205044;
  color: #c5ffdf;
}

body.dark .tag.purple {
  background: #403855;
  color: #ddd0ff;
}

body.dark .tag.amber {
  background: #544022;
  color: #ffe0a1;
}

body.dark .master-table th {
  background: #253745;
  color: #e4f0fa;
}

body.dark .master-table thead th.active-day-col {
  background: #206249;
  color: #fff;
}

body.dark .master-table td {
  background: #192936;
  color: #deebf3;
}

body.dark .master-table td.active-day-col {
  background: #1c3532;
}

body.dark .added-activity {
  background: #1b5548;
  color: #e7fff3;
}

body.dark .protected-cell {
  background: #272c43 !important;
}

body.dark .slot:before {
  border-color: #182936;
}

body.dark .hero {
  background: linear-gradient(115deg, #193f5b, #165747);
}

@media (max-width: 800px) {
  .shell {
    display: block;
  }
  .sidebar {
    position: static;
    height: auto;
    padding: 13px;
  }
  .brand {
    font-size: 18px;
  }
  .sidebar nav {
    display: flex;
    overflow-x: auto;
  }
  .navbtn {
    white-space: nowrap;
    padding: 9px 12px;
  }
  .switch {
    margin: 0;
  }
  .wrap {
    padding: 19px 15px 70px;
  }
  .grid, .grid.three, .grid.equal, .split {
    grid-template-columns: 1fr;
  }
  .top h1 {
    font-size: 26px;
  }
  .hero {
    padding: 22px;
  }
}
