:root {
  --bg: #f6ecdc;
  --paper: #fff6e8;
  --surface: #fff2dd;
  --surface-strong: #fffaf1;
  --text: #3a2d23;
  --muted: #806f5e;
  --line: #ead7bd;
  --primary: #0f6a72;
  --primary-dark: #07515c;
  --orange: #e97722;
  --orange-dark: #b94c17;
  --olive: #727b39;
  --olive-dark: #566024;
  --success: #5f7f3a;
  --warning: #c96e1e;
  --danger: #c6512b;
  --shadow: 0 16px 34px rgba(88, 56, 25, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background:
    repeating-linear-gradient(0deg, rgba(122, 91, 55, 0.025) 0, rgba(122, 91, 55, 0.025) 1px, transparent 1px, transparent 18px),
    linear-gradient(180deg, #fff7e9 0%, var(--bg) 42%, #f2e4d0 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

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

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

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

.sidebar {
  background: #fff0d7;
  border-right: 1px solid var(--line);
  padding: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  align-items: center;
  display: flex;
  gap: 12px;
}

.brand-mark {
  align-items: center;
  background: linear-gradient(135deg, var(--primary), #24818a);
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(15, 106, 114, 0.22);
  color: #fff;
  display: inline-flex;
  font-weight: 800;
  height: 42px;
  justify-content: center;
  width: 42px;
}

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

.brand small {
  display: block;
  font-size: 0.8rem;
}

.nav-list {
  display: grid;
  margin-top: 32px;
}

.nav-module {
  display: grid;
  gap: 10px;
}

.nav-module-title {
  color: var(--orange-dark);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  padding: 0 14px;
  text-transform: uppercase;
}

.nav-module-links {
  display: grid;
  gap: 8px;
}

.nav-list a,
.mobile-nav a {
  border-radius: 8px;
  color: var(--muted);
  font-weight: 700;
  padding: 12px 14px;
}

.nav-list a.active,
.nav-list a:hover,
.mobile-nav a.active {
  background: #dcebe4;
  color: var(--primary-dark);
}

.logout-form {
  bottom: 24px;
  left: 24px;
  position: absolute;
  right: 24px;
}

.logout-form button {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  padding: 10px 12px;
  width: 100%;
}

.main-content {
  padding: 32px;
  position: relative;
}

.page-header {
  align-items: flex-start;
  background:
    linear-gradient(90deg, rgba(255, 246, 232, 0.98), rgba(229, 239, 224, 0.82)),
    var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin-bottom: 24px;
  overflow: hidden;
  padding: 22px;
  position: relative;
}

.page-header::after {
  background: var(--orange);
  content: "";
  height: 100%;
  opacity: 0.9;
  position: absolute;
  right: 0;
  top: 0;
  width: 8px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  color: var(--primary-dark);
  font-size: 2.6rem;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 8px;
}

h2 {
  color: #33261d;
  font-size: 1.2rem;
  font-weight: 900;
}

h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.eyebrow {
  color: var(--orange-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.button {
  align-items: center;
  background: #fff7e9;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
}

.button.primary {
  background: var(--orange);
  border-color: var(--orange);
  box-shadow: 0 10px 20px rgba(201, 110, 30, 0.18);
  color: #fff;
}

.button.success {
  background: var(--olive);
  border-color: var(--olive);
  color: #fff;
}

.button.quiet {
  background: #e7ecd8;
  color: var(--primary-dark);
}

.header-actions,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.summary-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  margin-bottom: 24px;
}

.summary-card,
.task-card,
.mini-card,
.list-card,
.timeline-card,
.form-panel,
.empty-state,
.login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.summary-card {
  border-top: 5px solid var(--orange);
  color: inherit;
  display: grid;
  gap: 4px;
  padding: 18px;
  position: relative;
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

a.summary-card:hover,
a.summary-card:focus-visible {
  box-shadow: 0 12px 28px rgba(47, 31, 20, 0.12);
  transform: translateY(-1px);
}

.summary-card.warning {
  border-top-color: var(--danger);
}

.summary-card.calm {
  border-top-color: var(--olive);
}

.summary-card.info {
  border-top-color: var(--primary);
}

.summary-card strong {
  color: var(--orange-dark);
  font-size: 2.2rem;
  font-weight: 900;
}

.summary-card.warning strong,
.danger strong {
  color: var(--danger);
}

.summary-card.calm strong {
  color: var(--olive);
}

.summary-card.info strong {
  color: var(--primary-dark);
}

.content-section {
  margin-top: 28px;
}

.section-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-heading a {
  color: var(--primary-dark);
  font-weight: 800;
}

.stack {
  display: grid;
  gap: 12px;
}

.task-card {
  border-left: 6px solid var(--orange);
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(170px, 1.4fr) minmax(130px, 0.9fr) minmax(150px, 1fr) minmax(150px, 1fr);
  padding: 16px;
}

.task-card.late {
  border-color: #dfaa86;
  border-left-color: var(--danger);
}

.task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  grid-column: 1 / -1;
  justify-content: flex-end;
  min-width: 0;
}

.task-actions form {
  display: block;
}

.task-cell {
  align-content: start;
  display: grid;
  gap: 6px;
  min-width: 0;
}

.task-cell strong {
  color: var(--text);
  overflow-wrap: anywhere;
}

.task-label {
  color: var(--orange-dark);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.inline-people {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.inline-people span {
  background: #e7ecd8;
  border-radius: 999px;
  color: var(--olive-dark);
  font-size: 0.86rem;
  font-weight: 800;
  padding: 5px 9px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chips span,
.chips a {
  background: #e7ecd8;
  border-radius: 999px;
  color: var(--olive-dark);
  font-size: 0.86rem;
  font-weight: 800;
  padding: 6px 10px;
}

.mini-card {
  border-left: 5px solid var(--primary);
  display: grid;
  gap: 4px;
  padding: 14px;
}

.mini-card.danger {
  border-left-color: var(--danger);
}

.mini-card.done {
  border-color: #b7c78a;
  border-left-color: var(--olive);
}

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

.list-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.list-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  justify-content: space-between;
  padding: 18px;
}

.card-actions,
.compact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.card-actions form,
.compact-actions form {
  display: contents;
}

.danger-button {
  background: #fff1e7;
  border-color: #e7b08a;
  color: var(--orange-dark);
}

.list-card.is-paused {
  background: #fff7ea;
  border-style: dashed;
}

.task-list-panel {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.task-list-heading {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 12px;
}

.task-list-heading h2 {
  font-size: 1.05rem;
  margin: 0;
}

.task-list-heading span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.task-list-rows {
  display: grid;
  gap: 1px;
}

.task-list-row {
  align-items: center;
  background: #fffdf8;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(190px, 1.45fr) minmax(92px, 0.45fr) minmax(150px, 1fr) auto;
  min-height: 62px;
  padding: 10px 8px;
}

.task-list-row:last-child {
  border-bottom: 0;
}

.task-list-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.task-list-main strong {
  color: var(--text);
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.task-list-main span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.task-list-status {
  min-width: 0;
}

.task-list-people {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.task-list-people span {
  background: #eef1f3;
  border-radius: 999px;
  color: #59656c;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.1;
  padding: 7px 11px;
}

.task-list-actions {
  display: flex;
  gap: 8px;
  justify-content: end;
  min-width: 0;
}

.task-list-actions form {
  display: contents;
}

.task-list-actions .button {
  min-height: 38px;
  padding: 8px 12px;
}

.routine-groups {
  display: grid;
  gap: 14px;
}

.routine-group {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: visible;
}

.routine-group h3 {
  align-items: center;
  background: #f8f2e8;
  border-bottom: 1px solid var(--line);
  display: flex;
  font-size: 1rem;
  justify-content: space-between;
  margin: 0;
  padding: 12px 14px;
}

.routine-group h3 span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 900;
}

.routine-group-rows {
  display: grid;
  gap: 1px;
}

.routine-row {
  align-items: center;
  background: #fffdf8;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 14px;
  grid-template-columns: 116px minmax(170px, 1fr) minmax(170px, 0.8fr) minmax(92px, 0.35fr) auto;
  min-height: 76px;
  padding: 10px;
}

.routine-row:last-child {
  border-bottom: 0;
}

.routine-date-tile {
  align-items: center;
  background: #edf5f1;
  border: 1px solid #d6e4de;
  border-radius: 8px;
  color: var(--teal);
  display: grid;
  justify-items: center;
  min-height: 66px;
  padding: 8px;
  text-align: center;
}

.routine-date-tile strong {
  font-size: 0.96rem;
  line-height: 1;
  white-space: nowrap;
}

.routine-date-tile span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
}

.routine-date-tile small {
  color: var(--orange-dark);
  font-size: 0.7rem;
  font-weight: 900;
}

.routine-title strong {
  color: var(--text);
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.routine-people {
  display: grid;
  gap: 5px;
}

.field-label {
  color: var(--muted);
  display: none;
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.routine-people > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.routine-people span:not(.field-label) {
  background: #eef1f3;
  border-radius: 999px;
  color: #59656c;
  font-size: 0.9rem;
  font-weight: 800;
  padding: 5px 8px;
}

.routine-status {
  justify-self: start;
}

.action-menu {
  justify-self: end;
  position: relative;
}

.action-menu summary {
  background: #fffdf8;
  border: 1px solid #d8e1df;
  border-radius: 6px;
  color: var(--teal);
  cursor: pointer;
  font-weight: 900;
  list-style: none;
  min-height: 36px;
  padding: 9px 12px;
}

.action-menu summary::-webkit-details-marker {
  display: none;
}

.action-menu-list {
  background: #fffdf8;
  border: 1px solid #e1d7ca;
  border-radius: 8px;
  box-shadow: 0 16px 34px rgba(72, 50, 24, 0.14);
  display: grid;
  gap: 6px;
  min-width: 132px;
  padding: 8px;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 5;
}

.action-menu-list form {
  display: contents;
}

.action-menu-item {
  background: #fffdf8;
  border: 1px solid #d8e1df;
  border-radius: 6px;
  color: var(--teal);
  cursor: pointer;
  display: block;
  font: inherit;
  font-weight: 900;
  line-height: 1;
  min-height: 34px;
  padding: 9px 10px;
  text-align: center;
  width: 100%;
}

.action-menu-item.danger {
  border-color: #ead0c6;
  color: var(--orange-dark);
}

.archived-routine-row > div:first-child {
  display: grid;
  gap: 4px;
}

.archived-routine-row > div:first-child span {
  color: var(--muted);
  font-weight: 800;
}

.status-row {
  display: flex;
  margin-bottom: 10px;
}

.status-pill {
  display: inline-flex;
  justify-self: start;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 900;
  padding: 5px 10px;
}

.status-pill.active {
  background: #e7ecd8;
  color: var(--olive-dark);
}

.status-pill.paused {
  background: #f3dcc4;
  color: var(--orange-dark);
}

.status-pill.one-time {
  background: #eef1f3;
  color: #59656c;
}

.compact-list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.compact-row {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 14px 16px;
}

.compact-row:last-child {
  border-bottom: 0;
}

.compact-row strong {
  font-size: 1rem;
}

.timeline {
  display: grid;
  gap: 16px;
}

.timeline-item {
  display: grid;
  gap: 14px;
  grid-template-columns: 120px minmax(0, 1fr);
}

.timeline-date {
  color: var(--muted);
  font-weight: 800;
  padding-top: 16px;
}

.timeline-card {
  border-left: 5px solid var(--orange);
  padding: 18px;
}

.notice {
  color: var(--orange-dark);
  font-weight: 800;
}

.form-panel {
  max-width: 860px;
  padding: 20px;
}

.form-grid,
.form-stack {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 7px;
  font-weight: 800;
}

input,
select,
textarea {
  background: #fffaf1;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  min-height: 42px;
  padding: 10px 12px;
  width: 100%;
}

textarea {
  resize: vertical;
}

ul {
  margin: 0;
  padding-left: 20px;
}

input[type="checkbox"],
input[type="radio"] {
  min-height: auto;
  width: auto;
}

.checkbox-row {
  align-items: center;
  display: flex;
  gap: 10px;
}

.choice-field {
  border: 0;
  display: grid;
  gap: 8px;
  margin: 0;
  min-width: 0;
  padding: 0;
}

.choice-title {
  font-weight: 800;
}

.choice-field-inline {
  align-items: center;
  grid-template-columns: 110px minmax(0, 1fr);
}

.choice-options {
  min-width: 0;
}

.choice-options > div {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.choice-options > div > div {
  margin: 0;
}

.choice-options label {
  align-items: center;
  background: #fffaf1;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  gap: 8px;
  min-height: 38px;
  padding: 8px 12px;
}

.choice-options input[type="checkbox"],
.choice-options input[type="radio"] {
  margin: 0;
}

.choice-field small {
  grid-column: 2;
}

.error {
  color: var(--danger);
}

.messages {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.message {
  background: #e7ecd8;
  border: 1px solid #cbd9a2;
  border-radius: 8px;
  padding: 12px 14px;
}

.message.error {
  background: #fff0df;
  border-color: #e7a579;
}

.empty-state {
  color: var(--muted);
  padding: 20px;
}

.mobile-nav {
  display: none;
}

.login-body {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-card {
  max-width: 420px;
  padding: 28px;
  width: 100%;
}

.login-brand {
  margin-bottom: 24px;
}

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

  .sidebar {
    display: none;
  }

  .main-content {
    padding: 22px 16px 92px;
  }

  .page-header,
  .task-card,
  .two-columns,
  .timeline-item {
    display: grid;
    grid-template-columns: 1fr;
  }

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

  .task-actions {
    justify-content: stretch;
    min-width: 0;
  }

  .task-actions form {
    width: 100%;
  }

  .task-actions .button {
    width: 100%;
  }

  .card-actions,
  .compact-actions,
  .compact-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .task-list-panel {
    padding: 14px;
  }

  .task-list-heading,
  .task-list-row {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .task-list-row {
    padding: 12px 8px;
  }

  .task-list-actions {
    justify-content: start;
  }

  .routine-row {
    align-items: center;
    grid-template-columns: 108px minmax(0, 1fr);
    padding: 10px;
  }

  .routine-people,
  .routine-status,
  .action-menu {
    grid-column: 2;
    justify-self: start;
  }

  .field-label {
    display: inline;
  }

  .action-menu-list {
    left: 0;
    right: auto;
  }

  .choice-field-inline {
    grid-template-columns: 1fr;
  }

  .choice-field small {
    grid-column: auto;
  }

  .mobile-nav {
    background: #fff0d7;
    border-top: 1px solid var(--line);
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    left: 0;
    padding: 8px;
    position: fixed;
    right: 0;
    z-index: 10;
  }

  .mobile-nav a {
    font-size: 0.82rem;
    padding: 9px 6px;
    text-align: center;
  }

  h1 {
    font-size: 2rem;
  }
}
