:root {
  --sage: #829783;
  --sage-dark: #536b58;
  --sage-pale: #e8eee6;
  --cream: #fbf7ee;
  --pink: #f3dce4;
  --pink-dark: #c7839b;
  --ink: #39443b;
  --muted: #7c877e;
  --white: #fff;
  --line: #e4e8df;
  --shadow: 0 8px 25px #536b5812;
}

* {
  box-sizing: border-box;
}

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

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

.sidebar {
  width: 250px;
  flex: 0 0 250px;
  background: #f5f0e7;
  border-right: 1px solid var(--line);
  padding: 23px 16px 18px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 24px;
  font-size: 25px;
  font-weight: 800;
  color: var(--sage-dark);
}

.brand img {
  width: 58px;
  height: 58px;
  object-fit: contain;
  border-radius: 16px;
}

.member-select {
  padding: 0 8px 18px;
}

.member-select label,
.entry-form label,
.time-dialog label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.member-select select,
.entry-form input,
.entry-form select,
.entry-form textarea,
.time-dialog select {
  width: 100%;
  border: 1px solid #dce3d8;
  background: white;
  border-radius: 10px;
  padding: 10px;
  color: var(--ink);
  font: inherit;
}

.navigation {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 11px;
  padding: 12px 13px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  color: #59665b;
  cursor: pointer;
  transition: .15s;
}

.nav-item:hover,
.nav-item.active {
  background: var(--sage-pale);
  color: var(--sage-dark);
}

.nav-item.active {
  box-shadow: inset 3px 0 var(--sage);
}

.sidebar-bottom {
  margin-top: auto;
}

.planning-label {
  border-top: 1px solid var(--line);
  padding: 15px 10px 10px;
  color: var(--sage-dark);
  font-weight: 800;
  font-size: 14px;
}

.profile-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: #fff;
  border-radius: 15px;
}

.profile-strip img {
  width: 55px;
  height: 55px;
  object-fit: cover;
  border-radius: 50%;
  background: var(--pink);
}

.profile-strip strong,
.profile-strip small {
  display: block;
}

.profile-strip small {
  font-size: 11px;
  color: var(--muted);
}

.main-content {
  min-width: 0;
  flex: 1;
  padding: 0 30px 35px;
}

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  position: relative;
}

.topbar-title {
  font-weight: 700;
  color: var(--sage-dark);
}

.top-actions {
  position: relative;
}

.notification-btn,
.soft-button,
.icon-button,
.primary-button,
.danger-button {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.notification-btn {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--sage-dark);
}

.count {
  display: inline-flex;
  min-width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  margin-left: 5px;
  border-radius: 50%;
  background: var(--pink);
  font-size: 11px;
}

.notification-panel {
  position: absolute;
  right: 0;
  top: 47px;
  width: 330px;
  max-height: 440px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: var(--shadow);
  z-index: 20;
  padding: 14px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 8px;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--sage-dark);
  cursor: pointer;
}

.notification-item {
  padding: 10px 8px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.notification-item small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}

.hidden {
  display: none !important;
}

.view {
  display: none;
  padding-top: 25px;
  position: relative;
}

.view.active {
  display: block;
}

.section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.section-toolbar h1 {
  font-size: 23px;
  margin: 0 0 4px;
  font-weight: 750;
  letter-spacing: -.4px;
}

.section-toolbar h2 {
  font-size: 17px;
  margin: 0;
}

.section-toolbar p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 17px;
}

/* Incoming Tasks panel */
.incoming-tasks {
  margin-bottom: 17px;
}

.incoming-tasks-list {
  display: grid;
  gap: 8px;
}

.incoming-task-row {
  display: grid;
  grid-template-columns: 105px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fffaf7;
}

.incoming-task-type {
  color: var(--sage-dark);
  font-size: 11px;
  font-weight: 800;
}

.incoming-task-details strong,
.incoming-task-details small {
  display: block;
}

.incoming-task-details strong {
  font-size: 13px;
}

.incoming-task-details small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.incoming-task-owner {
  padding: 5px 9px;
  border-radius: 8px;
  background: var(--sage-pale);
  color: var(--sage-dark);
  font-size: 12px;
  font-weight: 800;
}

.incoming-major {
  background: #fff;
}

@media (max-width: 760px) {
  .incoming-task-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .incoming-task-type {
    grid-column: 1 / -1;
  }
}

.calendar-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 15px;
}

.task-pool {
  padding: 14px;
}

.card-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-heading h2 {
  font-size: 16px;
  margin: 0;
}

.card-heading p {
  margin: 3px 0;
  color: var(--muted);
  font-size: 12px;
}

.task-pool-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.draggable-task {
  padding: 10px 11px;
  border: 1px solid #dce5da;
  border-radius: 10px;
  background: #f5f8f2;
  cursor: grab;
  font-size: 13px;
  font-weight: 650;
}

.draggable-task:active {
  cursor: grabbing;
}

.pool-tip {
  font-size: 11px;
  color: var(--muted);
  margin-top: 13px;
}

.week-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.week-controls strong {
  font-size: 13px;
  min-width: 130px;
  text-align: center;
}

.icon-button {
  background: #fff;
  border: 1px solid var(--line);
  font-size: 19px;
  padding: 5px 12px;
}

.soft-button {
  background: var(--sage-pale);
  color: var(--sage-dark);
}

.primary-button {
  background: var(--sage-dark);
  color: white;
}

.danger-button {
  background: #fae6e9;
  color: #a14d62;
}

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

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  align-items: stretch;
}

.calendar-day {
  min-height: 125px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: min-height .15s;
}

.calendar-day.today {
  border-color: var(--sage);
  box-shadow: 0 0 0 1px var(--sage);
}

.calendar-day.past {
  background: #f7f5f0;
}

.day-heading {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  gap: 3px;
}

.day-heading strong {
  font-size: 13px;
  color: var(--ink);
}

.day-dropzone {
  flex: 1;
  min-height: 72px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.day-dropzone.drag-over {
  background: #eaf1e7;
  outline: 1px dashed var(--sage);
}

.calendar-task {
  border-radius: 8px;
  background: var(--pink);
  padding: 7px 8px;
  font-size: 11px;
  line-height: 1.25;
  cursor: pointer;
  border-left: 3px solid var(--pink-dark);
  overflow-wrap: anywhere;
}

.calendar-task.owner-cyra {
  background: #e4e9f5;
  border-left-color: #8a9bc4;
}

.calendar-task.owner-lana {
  background: #e8eee1;
  border-left-color: #94a77d;
}

.calendar-task.done {
  opacity: .65;
  text-decoration: line-through;
}

.calendar-task .task-meta {
  display: block;
  font-size: 10px;
  margin-top: 4px;
  color: #667268;
}

.calendar-task .task-member {
  font-weight: 800;
}

.cycle-section {
  margin-top: 17px;
}

.section-toolbar.compact {
  margin-bottom: 12px;
}

.cycle-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.cycle-member {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px;
  background: #fffaf7;
}

.cycle-member-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
}

.cycle-member-head img {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  object-fit: cover;
}

.cycle-member-head strong {
  font-size: 13px;
}

.cycle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 0;
  border-top: 1px solid #f0eee8;
  font-size: 12px;
}

.cycle-row select {
  max-width: 110px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px;
  background: white;
  color: var(--ink);
  font-size: 11px;
}

.entry-form {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 18px;
}

.entry-form label {
  flex: 1;
  min-width: 170px;
}

.entry-form textarea {
  resize: vertical;
}

.entry-form .primary-button,
.entry-form .soft-button {
  align-self: end;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.subtle-label {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 10px;
}

.meal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}

.meal-day {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 13px;
  min-height: 150px;
}

.meal-day h3 {
  font-size: 13px;
  margin: 0;
}

.meal-day .meal-date {
  font-size: 11px;
  color: var(--muted);
  margin: 3px 0 12px;
}

.meal-day.past {
  opacity: .58;
  background: #f5e9eb;
  border-color: #e5cbd2;
}

.meal-day.past .meal-date {
  color: #bd7186;
}

.meal-day.today {
  border: 2px solid var(--sage-dark);
}

.meal-entry {
  background: var(--pink);
  padding: 8px;
  border-radius: 8px;
  font-size: 12px;
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}

.meal-entry button,
.grocery-item button,
.note-card button {
  border: 0;
  background: transparent;
  color: #9a6879;
  cursor: pointer;
  float: right;
}

.grocery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.grocery-category {
  background: white;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 14px;
  min-height: 95px;
}

.grocery-category h3 {
  font-size: 13px;
  margin: 0 0 8px;
  color: var(--sage-dark);
}

.grocery-item {
  font-size: 12px;
  padding: 6px 0;
  border-top: 1px solid #f0eee8;
}

.weekly-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 18px;
}

.weekly-controls button {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  font: inherit;
}

.weekly-controls button:hover {
  background: var(--sage-pale);
}

.nutrition-layout {
  display: grid;
  grid-template-columns: minmax(240px, .8fr) minmax(0, 1.2fr);
  gap: 14px;
}

.nutrition-layout .card h2,
.food-reference h2 {
  font-size: 16px;
  margin: 0 0 14px;
}

.nutrition-layout label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 10px 0;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.nutrition-layout select,
.nutrition-layout input {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px;
  background: white;
  color: var(--ink);
}

.nutrition-totals {
  display: flex;
  gap: 12px;
  margin: 17px 0;
}

.nutrition-totals div {
  flex: 1;
  padding: 13px;
  background: var(--sage-pale);
  border-radius: 11px;
}

.nutrition-totals span,
.nutrition-totals strong {
  display: block;
}

.nutrition-totals span {
  font-size: 11px;
  color: var(--muted);
}

.nutrition-totals strong {
  font-size: 20px;
  color: var(--sage-dark);
}

.nutrition-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nutrition-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
  font-size: 13px;
}

.nutrition-row button {
  border: 0;
  background: transparent;
  color: #a65c6d;
  cursor: pointer;
}

.food-reference {
  margin-top: 14px;
}

.food-reference table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.food-reference th,
.food-reference td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 8px;
}

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

.library-member {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 15px;
}

.library-member h2 {
  font-size: 15px;
  margin: 0 0 10px;
}

.library-task {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.library-task .actions {
  display: flex;
  gap: 5px;
}

.library-task button {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8f8f3;
  padding: 5px 7px;
  font-size: 11px;
  cursor: pointer;
  color: var(--ink);
}

.library-task button.archive {
  color: #936878;
}

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

.note-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  font-size: 13px;
}

.note-card small {
  display: block;
  color: var(--muted);
  margin-top: 7px;
}

.report-groups {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
}

.report-member {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}

.report-member-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.report-member-head img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 50%;
}

.report-member-head h2 {
  font-size: 15px;
  margin: 0;
}

.report-member-head small {
  font-size: 11px;
  color: var(--muted);
}

.report-row {
  border-top: 1px solid var(--line);
  padding: 9px 0;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.status-done {
  color: #4d7957;
  font-weight: 800;
}

.status-not-done {
  color: #a65c6d;
  font-weight: 800;
}

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

.time-dialog {
  width: min(390px, calc(100% - 30px));
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 20px;
  background: var(--cream);
  color: var(--ink);
  box-shadow: 0 20px 70px #0003;
}

.time-dialog::backdrop {
  background: #25312855;
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dialog-head h2 {
  font-size: 17px;
  margin: 0;
}

.close-button {
  border: 0;
  background: transparent;
  font-size: 25px;
  cursor: pointer;
  color: var(--muted);
}

.time-dialog p {
  font-size: 13px;
  color: var(--muted);
}

.time-dialog label {
  margin: 15px 0;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.dialog-actions .danger-button {
  margin-right: auto;
}

@media (max-width: 1100px) {
  .sidebar {
    width: 220px;
    flex-basis: 220px;
  }

  .main-content {
    padding: 0 18px 28px;
  }

  .calendar-layout {
    grid-template-columns: 190px minmax(0, 1fr);
  }

  .calendar-grid {
    gap: 5px;
  }

  .calendar-day {
    padding: 6px;
    min-height: 110px;
  }

  .meal-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

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

  .report-groups {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    padding: 12px;
  }

  .brand {
    padding-bottom: 10px;
  }

  .member-select {
    padding-bottom: 10px;
  }

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

  .nav-item {
    padding: 9px;
    font-size: 13px;
  }

  .sidebar-bottom {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
  }

  .planning-label {
    padding: 8px;
    border-top: 0;
  }

  .profile-strip {
    flex: 1;
  }

  .main-content {
    padding: 0 12px 25px;
  }

  .topbar {
    height: 55px;
  }

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

  .calendar-layout {
    grid-template-columns: 1fr;
  }

  .calendar-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .calendar-day {
    min-height: 125px;
  }

  .meal-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grocery-grid,
  .library-list,
  .notes-list,
  .nutrition-layout {
    grid-template-columns: 1fr;
  }

  .toolbar-actions {
    width: 100%;
  }

  .notification-panel {
    right: 0;
    width: min(330px, calc(100vw - 25px));
  }
}

@media print {
  body {
    background: white;
  }

  .sidebar,
  .topbar,
  .section-toolbar,
  .entry-form,
  .notification-panel,
  .week-controls,
  .weekly-controls,
  .toolbar-actions,
  .pool-tip,
  .task-pool,
  .cycle-section {
    display: none !important;
  }

  .main-content {
    padding: 0;
  }

  .view {
    display: none !important;
  }

  .view.printing {
    display: block !important;
    padding: 0;
  }

  .print-grocery-area {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .grocery-category {
    padding: 7px;
    border: 1px solid #bbb;
    min-height: 0;
    break-inside: avoid;
  }

  .grocery-category h3 {
    font-size: 10px;
    margin-bottom: 3px;
  }

  .grocery-item {
    font-size: 9px;
    padding: 3px 0;
  }

  .print-report-area {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .report-member {
    padding: 8px;
    break-inside: avoid;
  }

  .report-member-head img {
    width: 34px;
    height: 34px;
  }

  .report-member-head h2 {
    font-size: 11px;
  }

  .report-row {
    font-size: 9px;
    padding: 5px 0;
  }

  .report-member-head small {
    font-size: 8px;
  }
}