/* 植物照護：手機專用；配色、字體沿用每日清單，主色改綠 */
:root {
  --bg: #F3F1E8;
  --card: #FFFFFF;
  --card-line: #E8E4D6;
  --inner: #FAF9F3;
  --ink: #2A2A25;
  --body: #3A3A34;
  --label: #5A5A52;
  --muted: #7C7B72;
  --faint: #B6B3A5;
  --accent: #6E9B6B;
  --accent-dk: #557E53;
  --accent-tint: #E6EFE2;
  --warn: #D98A3D;
  --warn-tint: #FBEEDC;
  --bad: #C4574B;
  --bad-tint: #F8E4E1;
  --blue-tint: #E3EEF2;
  --blue: #4C8294;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
*, *::before, *::after { touch-action: manipulation; }
html, body { margin: 0; padding: 0; background: var(--bg); }
body {
  font-family: 'Noto Sans TC', 'PingFang TC', system-ui, sans-serif;
  color: var(--ink);
  overflow-x: hidden;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
input, textarea { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
button { font-family: inherit; color: inherit; }

/* iOS 主畫面 App 頂部霧面：放一條有底色的 fixed 細條 */
.remove-blur {
  display: none; position: fixed; top: 0; left: 0; right: 0; height: 11px;
  pointer-events: none; z-index: 2147483647;
  background-color: #F3F1E8; background-clip: text; -webkit-background-clip: text;
}
@media (display-mode: standalone) { .remove-blur { display: block; } }
:root[data-standalone] .remove-blur { display: block; }

.wrap {
  max-width: 480px; margin: 0 auto;
  padding: calc(24px + env(safe-area-inset-top, 0px)) 16px calc(100px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 16px; min-width: 0;
}
.wrap > * { min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

/* 標題 */
.eyebrow { font-size: 12px; letter-spacing: .18em; color: var(--muted); font-weight: 500; }
h1 { margin: 2px 0 0; font-family: 'Fredoka', 'Noto Sans TC', sans-serif; font-size: 30px; line-height: 1.25; font-weight: 600; }
.head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.sec-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--label); letter-spacing: .06em; margin: 4px 2px 0; }
.sec-title .n { color: var(--muted); font-weight: 500; }

/* 卡片 */
.card { background: var(--card); border: 1px solid var(--card-line); border-radius: 18px; padding: 14px; }
.prow { display: flex; align-items: center; gap: 12px; }
.thumb {
  width: 56px; height: 56px; flex: none; border-radius: 14px; background: var(--accent-tint);
  display: flex; align-items: center; justify-content: center; color: var(--accent); overflow: hidden;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pinfo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pname { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.psub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tap { cursor: pointer; }
.tap:active { background: var(--inner); }

.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--inner); color: var(--label); border: 1px solid var(--card-line); white-space: nowrap; }
.badge.due { background: var(--warn-tint); color: #A8651F; border-color: #F0D9B8; }
.badge.late { background: var(--bad-tint); color: var(--bad); border-color: #EBC6C1; }
.badge.ok { background: var(--accent-tint); color: var(--accent-dk); border-color: #CFE0C9; }
.badge.in { background: var(--blue-tint); color: var(--blue); border-color: #C9DCE3; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }

/* 按鈕 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--card-line);
  background: var(--card); font-size: 14px; font-weight: 700; color: var(--label); cursor: pointer;
}
.btn:active { transform: scale(.97); }
.btn.pri { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.pri:active { background: var(--accent-dk); }
.btn.done { background: var(--accent-tint); border-color: #CFE0C9; color: var(--accent-dk); }
.btn.danger { color: var(--bad); border-color: #EBC6C1; }
.btn.danger.arm { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-row .btn { flex: 1; min-width: 0; }
.icon-btn { width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--card-line); background: var(--card); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--label); }

/* 底部分頁 */
.tabs-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 8px 16px calc(8px + env(safe-area-inset-bottom, 0px));
  background: var(--bg); border-top: 1px solid var(--card-line);
}
.tabs { max-width: 480px; margin: 0 auto; display: flex; gap: 6px; background: #E8E5D6; border-radius: 999px; padding: 4px; }
.tab { flex: 1; height: 38px; border: 0; border-radius: 999px; background: transparent; font-size: 14px; font-weight: 700; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; }
.tab.on { background: var(--card); color: var(--accent-dk); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* 表單 */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12px; font-weight: 700; color: var(--label); letter-spacing: .04em; }
.field .hint { font-size: 12px; color: var(--muted); }
input[type=text], input[type=password], input[type=number], input[type=date], textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink);
  border: 1px solid var(--card-line); border-radius: 12px; background: var(--inner); padding: 10px 12px; outline: none;
  -webkit-appearance: none; appearance: none; min-height: 44px;
}
textarea { resize: none; min-height: 88px; line-height: 1.5; }
input:focus, textarea:focus { border-color: var(--accent); background: #fff; }
.seg { display: flex; gap: 6px; }
.seg button { flex: 1; min-height: 44px; border-radius: 12px; border: 1px solid var(--card-line); background: var(--inner); font-size: 14px; font-weight: 700; color: var(--muted); cursor: pointer; padding: 6px 8px; }
.seg button.on { background: var(--accent-tint); border-color: var(--accent); color: var(--accent-dk); }
.photo-pick { display: flex; align-items: center; gap: 12px; }
.photo-prev { width: 72px; height: 72px; border-radius: 14px; background: var(--inner); border: 1px dashed var(--faint); display: flex; align-items: center; justify-content: center; color: var(--faint); overflow: hidden; flex: none; }
.photo-prev img { width: 100%; height: 100%; object-fit: cover; }

/* 詳情 */
.cover { width: 100%; aspect-ratio: 4 / 3; border-radius: 18px; background: var(--accent-tint); overflow: hidden; display: flex; align-items: center; justify-content: center; color: var(--accent); }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.kv { display: flex; flex-direction: column; gap: 10px; }
.kv .row { display: flex; flex-direction: column; gap: 2px; }
.kv .k { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .08em; }
.kv .v { font-size: 14px; color: var(--body); line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.log { display: flex; flex-direction: column; gap: 8px; }
.log-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.log-date { font-size: 12px; font-weight: 700; color: var(--muted); }
.log-text { font-size: 14px; line-height: 1.6; color: var(--body); white-space: pre-wrap; word-break: break-word; }
.log img { width: 100%; max-height: 360px; object-fit: cover; border-radius: 14px; display: block; background: var(--inner); }
.log.ai { background: var(--accent-tint); border-color: #CFE0C9; }
.empty { text-align: center; color: var(--muted); font-size: 14px; padding: 28px 12px; line-height: 1.7; }

.viewer { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.9); display: flex; align-items: center; justify-content: center; padding: 16px; }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; }

.toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 12px); background: #2A2A25; color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60; max-width: 86vw; text-align: center; }
.toast.show { opacity: .95; transform: translate(-50%, 0); }

.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: sp .8s linear infinite; display: inline-block; }
@keyframes sp { to { transform: rotate(360deg); } }

/* 登入 */
.login { min-height: 70vh; display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.login .err { color: var(--bad); font-size: 13px; min-height: 18px; }
