:root {
  --bg: #f4f1ea;
  --surface: #ffffff;
  --surface-2: #ece7dc;
  --text: #1f2a1f;
  --muted: #6b7366;
  --line: #ddd6c7;
  --brand: #2f6b3a;
  --brand-2: #4c8c4a;
  --brand-soft: #e3efdf;
  --warn: #b26b00;
  --warn-soft: #fbefd9;
  --danger: #b3261e;
  --danger-soft: #fbe3e1;
  --good: #2f6b3a;
  --good-soft: #e3efdf;
  --cold: #2a6fb0;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141814; --surface: #1d231d; --surface-2: #262e26; --text: #e8ece4; --muted: #9aa494;
    --line: #313a30; --brand: #7cc27a; --brand-2: #9bd497; --brand-soft: #22341f;
    --warn: #f0b04c; --warn-soft: #3a2e17; --danger: #ff8a80; --danger-soft: #3c1f1d;
    --good: #7cc27a; --good-soft: #22341f; --cold: #7ab4ea;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.45;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--brand); }
header.top {
  position: sticky; top: 0; z-index: 10; background: var(--bg);
  padding: calc(12px + env(safe-area-inset-top)) 16px 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border-bottom: 1px solid var(--line);
}
header.top h1 { font-size: 20px; margin: 0; letter-spacing: -.01em; }
header.top .sub { font-size: 13px; color: var(--muted); }
main { padding: 12px 16px 24px; max-width: 760px; margin: 0 auto; }
h2 { font-size: 17px; margin: 22px 0 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
h2 .count { font-size: 13px; color: var(--muted); font-weight: 500; }
h3 { font-size: 15px; margin: 14px 0 6px; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); padding: 14px; margin-bottom: 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

/* Navigation */
nav.bottom {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  background: var(--surface); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding-bottom: env(safe-area-inset-bottom);
}
nav.bottom a {
  text-decoration: none; color: var(--muted); font-size: 11px; text-align: center;
  padding: 8px 2px 9px; display: flex; flex-direction: column; align-items: center; gap: 2px;
}
nav.bottom a .ic { font-size: 21px; line-height: 1.1; }
nav.bottom a.active { color: var(--brand); font-weight: 600; }

/* Weather */
.wx-now { display: flex; align-items: center; gap: 14px; }
.wx-now .big { font-size: 40px; font-weight: 600; letter-spacing: -.02em; }
.wx-now .emoji { font-size: 38px; }
.wx-strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(64px, 1fr); gap: 6px; overflow-x: auto; margin-top: 12px; padding-bottom: 4px; scrollbar-width: none; }
.wx-strip::-webkit-scrollbar { display: none; }
.wx-day { text-align: center; background: var(--surface-2); border-radius: 10px; padding: 8px 4px; font-size: 13px; }
.wx-day .d { font-weight: 600; }
.wx-day .e { font-size: 20px; margin: 2px 0; }
.wx-day .mn.cold { color: var(--cold); font-weight: 600; }
.wx-day .r { color: var(--cold); font-size: 11px; min-height: 14px; }

/* Alerts */
.alert { border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; border: 1px solid transparent; }
.alert b { display: block; margin-bottom: 2px; }
.alert.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.alert.danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.alert.good { background: var(--good-soft); border-color: color-mix(in srgb, var(--good) 30%, transparent); }

/* Tasks */
.task { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); }
.task:first-child { border-top: 0; padding-top: 2px; }
.task .chk { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--brand); flex: none; display: grid; place-items: center; background: transparent; cursor: pointer; padding: 0; color: #fff; font-size: 16px; margin-top: 1px; }
.task.done .chk { background: var(--brand); }
.task.done .t-title { text-decoration: line-through; color: var(--muted); }
.task .t-title { font-weight: 600; }
.task .t-meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.task .t-detail { font-size: 14px; margin-top: 6px; color: var(--text); display: none; }
.task.open .t-detail { display: block; }
.task .t-body { flex: 1; min-width: 0; cursor: pointer; }
.chip { display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); font-weight: 500; white-space: nowrap; }
.chip.agac { background: #e6efd9; color: #3f6a1f; }
.chip.bostan { background: #f6e5d6; color: #8a4b17; }
.chip.kalici { background: #ece3f3; color: #6a3d8a; }
.chip.cim { background: #dff0e0; color: #24703a; }
.chip.sus { background: #f7e1e8; color: #9a3358; }
.chip.sistem { background: #dfe9f4; color: #2a5f94; }
.chip.p1 { background: var(--warn-soft); color: var(--warn); }
@media (prefers-color-scheme: dark) {
  .chip.agac, .chip.bostan, .chip.kalici, .chip.cim, .chip.sus, .chip.sistem { background: var(--surface-2); color: var(--text); }
}

/* Forms */
input, select, textarea, button { font: inherit; color: inherit; }
input[type=text], input[type=number], input[type=password], input[type=date], select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
}
textarea { min-height: 70px; resize: vertical; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
.btn { border: 0; border-radius: 10px; padding: 10px 16px; background: var(--brand); color: #fff; font-weight: 600; cursor: pointer; }
@media (prefers-color-scheme: dark) { .btn { color: #0f1a0f; } }
.btn.sec { background: var(--surface-2); color: var(--text); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.sm { padding: 6px 12px; font-size: 14px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.inline-add { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-add input[type=text] { flex: 1 1 100%; }
.inline-add input[type=date] { flex: 1; min-width: 0; }

/* Plants */
.plant { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); text-decoration: none; color: inherit; }
.plant:first-child { border-top: 0; padding-top: 0; }
.thumb { width: 52px; height: 52px; border-radius: 10px; background: var(--surface-2); flex: none; object-fit: cover; display: grid; place-items: center; font-size: 24px; }
.plant .p-name { font-weight: 600; }
.status-planli { opacity: .75; }
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; display: block; }
dl.info { display: grid; grid-template-columns: max-content 1fr; gap: 6px 12px; margin: 0; font-size: 14px; }
dl.info dt { color: var(--muted); }
dl.info dd { margin: 0; }

/* Calendar */
.month { margin-bottom: 8px; }
.month > summary { list-style: none; cursor: pointer; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); display: flex; justify-content: space-between; font-weight: 600; }
.month > summary::-webkit-details-marker { display: none; }
.month[open] > summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.month.current > summary { border-color: var(--brand); color: var(--brand); }
.month .m-body { background: var(--surface); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); padding: 4px 14px 10px; }
.filters { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters button { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 6px 12px; font-size: 13px; white-space: nowrap; cursor: pointer; }
.filters button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
@media (prefers-color-scheme: dark) { .filters button.on { color: #0f1a0f; } }

table.plan { width: 100%; border-collapse: collapse; font-size: 13px; }
table.plan th, table.plan td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.plan th { color: var(--muted); font-weight: 600; }
table.plan tr.cur td { background: var(--brand-soft); }
.table-wrap { overflow-x: auto; }

.login { max-width: 360px; margin: 18vh auto 0; padding: 0 16px; text-align: center; }
.login .logo { font-size: 54px; }
.empty { text-align: center; padding: 18px 8px; color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 50; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 90vw; }
.toast.show { opacity: 1; }
.back { text-decoration: none; font-size: 15px; display: inline-block; margin-bottom: 6px; }
.stat { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat > div { background: var(--surface-2); border-radius: 10px; padding: 10px; text-align: center; }
.stat b { display: block; font-size: 20px; }
.stat span { font-size: 12px; color: var(--muted); }
