:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-strong: #fef9ec;
  --ink: #1e2520;
  --muted: #667065;
  --line: #dce2d8;
  --green: #1f8a5b;
  --green-soft: #e5f4ed;
  --coral: #cf614d;
  --coral-soft: #fff0ed;
  --yellow: #f2c45d;
  --blue: #3f6fa8;
  --shadow: 0 16px 48px rgba(38, 51, 43, 0.12);
  --radius: 8px;
  --header-h: 0px;
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(31, 138, 91, 0.08) 0, rgba(31, 138, 91, 0) 260px),
    var(--bg);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-header {
  padding: 24px 20px 18px;
}

.header-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 20px;
  width: min(1180px, 100%);
  margin: 0 auto;
  align-items: end;
}

.label {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.7rem, 4vw, 3rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.intro {
  max-width: 760px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
}

.week-panel,
.panel,
.task-card,
.toolbar {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.85) inset;
}

.week-panel {
  padding: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.week-panel span,
.week-panel small {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
}

.week-panel strong {
  display: block;
  margin: 4px 0 10px;
  font-size: 1.65rem;
  line-height: 1;
}

.progress-track {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8ede5;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--yellow), var(--coral));
  transition: width 180ms ease;
}

.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 18px;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto 56px;
  align-items: start;
}

.side-panel {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 14px;
}

.panel {
  padding: 16px;
  background: var(--surface);
}

.panel-title {
  display: flex;
  gap: 10px;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}

.panel-title h2 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.2;
}

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

.quota-list,
.owner-stats {
  display: grid;
  gap: 9px;
}

.quota-item,
.owner-row {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfa;
}

.quota-item strong,
.owner-row strong {
  font-size: 0.92rem;
}

.quota-item span,
.owner-row span {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.owner-meter {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8ede5;
}

.owner-meter i {
  display: block;
  height: 100%;
  background: var(--green);
}

.actions-panel {
  display: grid;
  gap: 10px;
}

.button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
}

.button-primary {
  border-color: #19754c;
  background: var(--green);
  color: #fff;
}

.button-danger {
  border-color: #efc2b9;
  background: var(--coral-soft);
  color: #a43f2d;
}

.work-area {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.toolbar {
  position: sticky;
  top: 16px;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 12px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.search-wrap {
  display: grid;
  gap: 6px;
}

.search-wrap label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.search-wrap input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fff;
}

.search-wrap input:focus-visible,
.filter:focus-visible,
.button:focus-visible,
.task-card input:focus-visible + .box {
  outline: 3px solid rgba(31, 138, 91, 0.24);
  outline-offset: 2px;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.filter {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.filter.is-active {
  border-color: #19754c;
  background: var(--green-soft);
  color: #176b47;
}

.section-list {
  display: grid;
  gap: 16px;
}

.task-section {
  display: grid;
  gap: 10px;
}

.section-heading {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 4px 2px;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.2;
}

.section-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.section-count {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: #7d5a18;
  font-size: 0.82rem;
  font-weight: 800;
}

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

.task-card {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  min-height: 118px;
  padding: 12px;
  background: var(--surface);
  transition:
    border-color 160ms ease,
    transform 160ms ease,
    opacity 160ms ease;
}

.task-card:hover {
  border-color: #b7c5b5;
  transform: translateY(-1px);
}

.task-card.is-done {
  opacity: 0.68;
}

.task-card.is-done h3,
.task-card.is-done p {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(30, 37, 32, 0.32);
}

.task-check {
  display: grid;
  place-items: start center;
  padding-top: 2px;
}

.task-check input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.box {
  position: relative;
  display: block;
  width: 25px;
  height: 25px;
  border: 2px solid #aebbae;
  border-radius: 6px;
  background: #fff;
  transition:
    background 120ms ease,
    border-color 120ms ease,
    transform 120ms ease;
}

.task-check input:checked + .box {
  border-color: var(--green);
  background: var(--green);
}

.task-check input:checked + .box::after {
  position: absolute;
  top: 3px;
  left: 7px;
  width: 7px;
  height: 13px;
  border: solid #fff;
  border-width: 0 3px 3px 0;
  content: "";
  transform: rotate(45deg);
}

.task-body {
  min-width: 0;
}

.task-topline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.task-owner,
.task-cadence {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border-radius: 6px;
  padding: 0 8px;
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1;
}

.task-owner[data-owner="human"] {
  background: var(--coral-soft);
  color: #9b3d2c;
}

.task-owner[data-owner="ai"] {
  background: var(--green-soft);
  color: #176b47;
}

.task-owner[data-owner="review"] {
  background: #edf3ff;
  color: var(--blue);
}

.task-owner[data-owner="auto"] {
  background: #fff4d6;
  color: #7d5a18;
}

.task-cadence {
  background: #f0f2ef;
  color: var(--muted);
}

.task-card h3 {
  margin: 0 0 6px;
  font-size: 0.98rem;
  line-height: 1.35;
  letter-spacing: 0;
}

.task-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.empty-state {
  padding: 22px;
  border: 1px dashed #c6cfc4;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  text-align: center;
}

.mobile-nav {
  position: fixed;
  right: 12px;
  bottom: 12px;
  left: 12px;
  z-index: 10;
  display: none;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

@media (max-width: 980px) {
  .header-inner,
  .app-shell {
    grid-template-columns: 1fr;
  }

  .side-panel {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .actions-panel {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolbar {
    top: 0;
    grid-template-columns: 1fr;
  }

  .filter-group {
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  body {
    padding-bottom: 84px;
  }

  .app-header {
    padding: 18px 14px 14px;
  }

  .app-shell {
    width: calc(100% - 24px);
    margin-bottom: 24px;
  }

  .intro {
    font-size: 0.95rem;
  }

  .week-panel {
    padding: 14px;
  }

  .side-panel {
    grid-template-columns: 1fr;
    order: 2;
  }

  .work-area {
    order: 1;
  }

  .actions-panel {
    grid-template-columns: 1fr;
  }

  .toolbar {
    padding: 10px;
  }

  .toolbar .filter-group {
    display: none;
  }

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

  .task-card {
    min-height: 0;
    grid-template-columns: 38px minmax(0, 1fr);
    padding: 13px;
  }

  .box {
    width: 29px;
    height: 29px;
  }

  .task-check input:checked + .box::after {
    top: 4px;
    left: 8px;
    width: 8px;
    height: 15px;
  }

  .mobile-nav {
    display: grid;
  }

  .mobile-nav .filter {
    min-height: 42px;
    padding: 0 6px;
    font-size: 0.82rem;
  }
}

@media (max-width: 420px) {
  h1 {
    font-size: 1.62rem;
  }

  .section-heading {
    align-items: flex-start;
  }

  .section-count {
    margin-top: 1px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
