:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-2: #eef4f7;
  --text: #202522;
  --muted: #66706a;
  --line: #dce3de;
  --accent: #2f7d68;
  --accent-2: #d85f46;
  --blue: #3867b7;
  --gold: #c48a1b;
  --danger: #b93f46;
  --shadow: 0 16px 42px rgba(34, 43, 37, 0.1);
  font-family: Inter, "Segoe UI", Arial, "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

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

button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  min-height: 40px;
  padding: 0 14px;
}

button:hover {
  filter: brightness(0.96);
}

button.ghost {
  background: var(--surface-2);
  color: var(--text);
}

button.warn {
  background: var(--danger);
}

button.gold {
  background: var(--gold);
}

button.small {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

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

textarea {
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

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

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

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p {
  margin: 0;
}

.brand h1 {
  font-size: 19px;
}

.brand p,
.eyebrow {
  color: var(--muted);
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav button {
  justify-content: start;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.nav button.active {
  background: var(--surface-2);
  color: var(--accent);
  font-weight: 700;
}

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 247, 244, 0.92);
  padding: 18px 28px;
  backdrop-filter: blur(12px);
}

.topbar h2 {
  font-size: 26px;
}

.top-stats {
  display: flex;
  gap: 10px;
}

.top-stats div {
  min-width: 96px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 8px 12px;
}

.top-stats span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.top-stats strong {
  font-size: 20px;
}

.content {
  display: grid;
  gap: 18px;
  padding: 24px 28px 44px;
}

.grid-2,
.grid-3,
.grid-4 {
  display: grid;
  gap: 14px;
}

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

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

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

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

.panel h3 {
  margin: 0 0 12px;
}

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

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

.span-2 {
  grid-column: span 2;
}

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

.toolbar {
  justify-content: space-between;
}

.task-list,
.plain-list {
  display: grid;
  gap: 10px;
}

.task-card,
.inventory-card,
.ledger-row,
.okr-card {
  border: 1px solid var(--line);
  border-left: 6px solid var(--accent);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.task-card.done {
  opacity: 0.72;
}

.task-card h4,
.inventory-card h4,
.okr-card h4 {
  margin: 0 0 6px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  padding: 0 9px;
  font-size: 12px;
}

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

.day-cell {
  min-height: 104px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.day-cell strong {
  display: block;
  margin-bottom: 6px;
}

.mini-task {
  overflow: hidden;
  margin: 4px 0;
  border-radius: 5px;
  color: #fff;
  padding: 4px 6px;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress {
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: #e4e9e5;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.focus-timer {
  display: grid;
  place-items: center;
  min-height: 260px;
  text-align: center;
}

.timer-value {
  font-variant-numeric: tabular-nums;
  font-size: clamp(48px, 10vw, 112px);
  font-weight: 800;
}

.crop-stage {
  margin-top: 8px;
  color: var(--accent);
  font-weight: 700;
}

.notice {
  border-left: 5px solid var(--blue);
  border-radius: 8px;
  background: #eef4ff;
  padding: 12px;
}

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

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

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .nav button {
    text-align: center;
    justify-content: center;
  }

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

@media (max-width: 700px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
    padding: 16px;
  }

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

  .content {
    padding: 16px;
  }

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

  .grid-2,
  .grid-3,
  .grid-4,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }

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