:root {
  --green: #3B6D11;
  --green-bg: #EAF3DE;
  --green-text: #27500A;
  --amber: #854F0B;
  --amber-bg: #FAEEDA;
  --amber-text: #633806;
  --red: #A32D2D;
  --red-bg: #FCEBEB;
  --red-text: #791F1F;
  --blue-bg: #E6F1FB;
  --blue-text: #0C447C;
  --gray-bg: #F1EFE8;
  --gray-text: #5F5E5A;
  --surface: #ffffff;
  --bg: #f4f4f2;
  --text: #1a1a18;
  --muted: #6b6b68;
  --border: rgba(0,0,0,0.1);
  --r: 12px;
  --r-sm: 8px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --green-bg: #162b06; --green-text: #90c850;
    --amber-bg: #2a1800; --amber-text: #e8a040;
    --red-bg: #280a0a; --red-text: #e87070;
    --blue-bg: #071828; --blue-text: #70a8e8;
    --gray-bg: #222220; --gray-text: #a0a09c;
    --surface: #1e1e1c; --bg: #111110;
    --text: #f0f0ee; --muted: #909090; --border: rgba(255,255,255,0.1);
  }
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); min-height: 100dvh; }
#app { max-width: 520px; margin: 0 auto; }

/* Header */
.app-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px; background: var(--surface); border-bottom: 0.5px solid var(--border); position: sticky; top: 0; z-index: 20; }
.header-left h1 { font-size: 19px; font-weight: 700; }
.location { font-size: 11px; color: var(--muted); }
.weather-pill { display: flex; align-items: center; gap: 5px; background: var(--bg); border: 0.5px solid var(--border); border-radius: 20px; padding: 6px 12px; font-size: 14px; font-weight: 500; }
#w-icon { font-size: 16px; }
.weather-alert { background: var(--amber-bg); color: var(--amber-text); font-size: 13px; padding: 8px 16px; display: none; line-height: 1.4; }
.weather-alert.show { display: block; }

/* Tabs */
.tab-bar { display: flex; background: var(--surface); border-bottom: 0.5px solid var(--border); position: sticky; top: 57px; z-index: 19; }
.tab { flex: 1; padding: 11px 4px; font-size: 13px; font-weight: 400; color: var(--muted); background: none; border: none; border-bottom: 2px solid transparent; cursor: pointer; font-family: inherit; transition: color .15s; }
.tab.active { color: var(--text); font-weight: 600; border-bottom-color: var(--green); }

.main-content { padding: 0; }
.tab-pane { display: none; padding: 12px 12px 2rem; }
.tab-pane.active { display: block; }

/* Stats */
.stats-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-bottom: 12px; }
.stat { background: var(--surface); border-radius: var(--r-sm); padding: 10px; text-align: center; border: 0.5px solid var(--border); }
.stat-n { font-size: 22px; font-weight: 700; }
.stat-l { font-size: 11px; color: var(--muted); margin-top: 1px; }

/* Notify banner */
.notify-banner { background: var(--green-bg); color: var(--green-text); border-radius: var(--r); padding: 12px 14px; margin-bottom: 12px; font-size: 13px; line-height: 1.5; }
.notify-banner.hidden { display: none; }
.notify-banner strong { display: block; font-size: 12px; font-weight: 600; margin-bottom: 4px; opacity: 0.75; }

/* Task cards */
.task-card { background: var(--surface); border-radius: var(--r); border: 0.5px solid var(--border); border-left: 4px solid var(--border); padding: 13px 13px 13px 11px; margin-bottom: 10px; }
.task-card.overdue { border-left-color: #E24B4A; }
.task-card.soon    { border-left-color: #EF9F27; }
.task-card.ok      { border-left-color: #639922; }
.task-card.done-card { opacity: 0.5; border-left-color: #B4B2A9; }
.task-title { font-size: 15px; font-weight: 600; margin-bottom: 6px; line-height: 1.3; }
.task-plant-tag { font-size: 11px; color: var(--muted); margin-bottom: 5px; }
.badges { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 8px; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 6px; font-weight: 500; }
.b-have    { background: var(--green-bg); color: var(--green-text); }
.b-hus     { background: var(--blue-bg);  color: var(--blue-text);  }
.b-teknik  { background: var(--amber-bg); color: var(--amber-text); }
.b-neutral { background: var(--gray-bg);  color: var(--gray-text);  }
.b-overdue { background: var(--red-bg);   color: var(--red-text);   }
.b-soon    { background: var(--amber-bg); color: var(--amber-text); }
.b-ok      { background: var(--green-bg); color: var(--green-text); }
.b-done    { background: var(--gray-bg);  color: var(--gray-text);  }
.task-note { font-size: 13px; color: var(--muted); margin-bottom: 10px; line-height: 1.5; }
.ai-tip { border-radius: var(--r-sm); padding: 10px 12px; margin-bottom: 10px; font-size: 13px; line-height: 1.5; }
.ai-tip .ai-lbl { font-size: 11px; font-weight: 600; margin-bottom: 3px; opacity: 0.7; }
.ai-tip.green   { background: var(--green-bg); color: var(--green-text); }
.ai-tip.amber   { background: var(--amber-bg); color: var(--amber-text); }
.ai-tip.red     { background: var(--red-bg);   color: var(--red-text);   }
.ai-tip.loading { background: var(--gray-bg);  color: var(--muted); }
.task-actions { display: flex; gap: 8px; }
.btn-done { flex: 1; padding: 13px; font-size: 15px; font-weight: 600; border: none; border-radius: var(--r-sm); background: var(--green); color: #EAF3DE; cursor: pointer; font-family: inherit; }
.btn-done:active { transform: scale(0.98); }
.btn-edit { padding: 13px 14px; font-size: 14px; border: 0.5px solid var(--border); border-radius: var(--r-sm); background: none; color: var(--muted); cursor: pointer; font-family: inherit; }
.btn-ai  { width: 100%; padding: 10px; font-size: 13px; border: 0.5px solid var(--border); border-radius: var(--r-sm); background: none; color: var(--muted); cursor: pointer; font-family: inherit; margin-bottom: 8px; }
.done-row { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.done-info { font-size: 13px; color: var(--muted); }
.btn-undo { font-size: 13px; color: var(--muted); background: none; border: none; cursor: pointer; text-decoration: underline; font-family: inherit; }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); font-size: 15px; }
.hint { font-size: 13px; color: var(--muted); text-align: center; padding: 1rem; }

/* Plant cards */
.plant-card { background: var(--surface); border-radius: var(--r); border: 0.5px solid var(--border); padding: 14px; margin-bottom: 10px; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.plant-icon { font-size: 28px; flex-shrink: 0; }
.plant-body { flex: 1; }
.plant-name { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.plant-type { font-size: 13px; color: var(--muted); }
.plant-note { font-size: 12px; color: var(--muted); margin-top: 4px; }
.plant-task-count { font-size: 12px; color: var(--green-text); margin-top: 4px; }
.btn-plant-remove { padding: 6px 10px; font-size: 13px; border: 0.5px solid var(--border); border-radius: var(--r-sm); background: none; color: var(--red-text); cursor: pointer; font-family: inherit; flex-shrink: 0; }

/* Add toggle */
.add-toggle { display: flex; border: 0.5px solid var(--border); border-radius: var(--r); overflow: hidden; margin-bottom: 16px; }
.toggle-btn { flex: 1; padding: 11px; font-size: 14px; font-weight: 400; color: var(--muted); background: none; border: none; cursor: pointer; font-family: inherit; }
.toggle-btn.active { background: var(--green-bg); color: var(--green-text); font-weight: 600; }

/* Season tip */
.season-tip { background: var(--blue-bg); color: var(--blue-text); border-radius: var(--r-sm); padding: 10px 14px; font-size: 13px; line-height: 1.5; margin-bottom: 14px; }

/* Forms */
.form-field { margin-bottom: 14px; }
.form-field label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.form-field input, .form-field select, .form-field textarea { width: 100%; font-size: 15px; padding: 12px 14px; border: 0.5px solid var(--border); border-radius: var(--r-sm); background: var(--surface); color: var(--text); font-family: inherit; -webkit-appearance: none; }
.form-field select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; background-color: var(--surface); padding-right: 36px; }
.form-field textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Buttons */
.btn-primary   { width: 100%; padding: 15px; font-size: 16px; font-weight: 600; border: none; border-radius: var(--r-sm); background: var(--green); color: #EAF3DE; cursor: pointer; font-family: inherit; }
.btn-primary:active { transform: scale(0.98); }
.btn-secondary { padding: 12px 16px; font-size: 14px; font-weight: 500; border: 0.5px solid var(--border); border-radius: var(--r-sm); background: none; color: var(--text); cursor: pointer; font-family: inherit; }
.btn-danger    { padding: 12px 16px; font-size: 14px; font-weight: 500; border: none; border-radius: var(--r-sm); background: var(--red-bg); color: var(--red-text); cursor: pointer; font-family: inherit; }

/* Modals */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 50; display: flex; align-items: flex-end; padding: 0; }
.modal-backdrop.hidden { display: none; }
.modal { background: var(--surface); border-radius: 20px 20px 0 0; padding: 24px 16px 32px; width: 100%; max-height: 90dvh; overflow-y: auto; }
.modal h2 { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.modal-sub { font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; }
.modal-actions .btn-primary { flex: 1; }

/* Approve list */
.approve-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 0.5px solid var(--border); }
.approve-item:last-child { border-bottom: none; }
.approve-item input[type=checkbox] { width: 20px; height: 20px; margin-top: 2px; flex-shrink: 0; accent-color: var(--green); }
.approve-item-body { flex: 1; }
.approve-item-title { font-size: 14px; font-weight: 600; }
.approve-item-meta  { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Toast */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--surface); padding: 10px 20px; border-radius: 20px; font-size: 14px; z-index: 100; transition: opacity 0.3s; white-space: nowrap; }
.toast.hidden { opacity: 0; pointer-events: none; }
.hidden { display: none !important; }
