:root {
  --bg: #f4f6f1;
  --panel: #ffffff;
  --ink: #17231d;
  --muted: #617066;
  --line: #d9e1d7;
  --green: #1f6f4a;
  --green-2: #d9f0df;
  --gold: #f5c84c;
  --red: #b33b2e;
  --blue: #2d6cdf;
  --shadow: 0 12px 30px rgba(22, 45, 31, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

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

button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: var(--green);
  color: white;
  font-weight: 700;
  padding: 10px 14px;
}

button:active {
  transform: translateY(1px);
}

main {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: 14px 14px 32px;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: max(12px, env(safe-area-inset-top)) 14px 12px;
  background: #164f38;
  color: white;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.eyebrow {
  margin: 0 0 2px;
  color: #ccebd6;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

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

h1 {
  margin-bottom: 0;
  font-size: 1.35rem;
}

h2 {
  margin-bottom: 12px;
  font-size: 1.12rem;
}

h3 {
  margin-bottom: 0;
  font-size: 1.05rem;
}

.block-badge {
  display: inline-block;
  margin: 0 4px 4px 0;
  border-radius: 999px;
  background: var(--green-2);
  color: var(--green);
  padding: 3px 7px;
  font-size: 0.85rem;
  white-space: nowrap;
}

.mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.14);
}

.mode-toggle button {
  min-height: 36px;
  padding: 6px 10px;
  background: transparent;
  color: white;
}

.mode-toggle button.active {
  background: white;
  color: var(--green);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.panel,
.task-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 16px;
  margin: 14px 0;
}

.compact {
  box-shadow: none;
}

.field-grid {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 11px 12px;
}

textarea {
  resize: vertical;
}

.hint {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.summary-strip,
.status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.summary-item,
.status-item {
  min-height: 74px;
  border-radius: 8px;
  background: white;
  border: 1px solid var(--line);
  padding: 12px;
}

.summary-item strong,
.status-item strong {
  display: block;
  font-size: 1.45rem;
}

.summary-item span,
.status-item span {
  color: var(--muted);
  font-size: 0.85rem;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  margin: 18px 0 10px;
}

.section-title h2 {
  margin: 0;
}

.section-title span {
  color: var(--muted);
  font-size: 0.85rem;
}

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

.week-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 12px;
  scroll-snap-type: x proximity;
}

.week-tabs button {
  flex: 0 0 142px;
  display: grid;
  gap: 2px;
  min-height: 54px;
  background: white;
  color: var(--green);
  border: 1px solid var(--line);
  box-shadow: none;
  scroll-snap-align: start;
  text-align: left;
}

.week-tabs button span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.week-tabs button.active {
  background: var(--green);
  color: white;
  border-color: var(--green);
}

.week-tabs button.active span {
  color: #d9f0df;
}

.grouped-task-list {
  gap: 16px;
}

.block-group {
  display: grid;
  gap: 10px;
}

.block-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #eaf3e9;
  border: 1px solid var(--line);
}

.block-heading h3 {
  margin: 0;
  color: var(--green);
}

.block-heading span {
  color: var(--muted);
  font-size: 0.82rem;
  text-align: right;
}

.weekly-task-list,
.day-group {
  display: grid;
  gap: 14px;
}

.day-heading {
  position: sticky;
  top: 66px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #eaf3e9;
  border: 1px solid var(--line);
}

.day-heading h3 {
  margin: 0;
  color: var(--green);
}

.day-heading span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.task-card {
  padding: 14px;
}

.task-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.task-date {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.83rem;
}

.status-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 5px 9px;
  background: #ecefeb;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.status-pill.done {
  background: var(--green-2);
  color: var(--green);
}

.status-pill.delayed {
  background: #fff1ca;
  color: #87620a;
}

.status-pill.skipped {
  background: #ffe0da;
  color: var(--red);
}

.task-details {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.task-details div {
  border-left: 3px solid var(--line);
  padding-left: 9px;
}

dt {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

dd {
  margin: 2px 0 0;
}

.survey-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 12px 0;
}

.photo-input {
  margin-top: 10px;
}

.photo-preview {
  margin-top: 10px;
}

.photo-preview img {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.staff-note {
  margin-top: 10px;
}

.card-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.card-actions button {
  background: #e9eee8;
  color: var(--ink);
}

.card-actions button[data-status="done"] {
  background: var(--green);
  color: white;
}

.card-actions button[data-status="delayed"] {
  background: var(--gold);
  color: #2b250b;
}

.card-actions button[data-status="skipped"],
button.danger {
  background: var(--red);
  color: white;
}

.admin-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.admin-list .photo-input,
.admin-list .card-actions,
.admin-list .staff-note {
  display: none;
}

.install-panel ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

.empty {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.65);
}

@media (min-width: 700px) {
  .field-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .summary-strip,
  .status-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .card-actions {
    grid-template-columns: repeat(4, 1fr);
  }
}
