/*
 * GARDEN KIT — giao diện tính năng mở rộng (dùng chung Desktop + Mobile)
 * Dùng lại biến màu --ck-* của care.css (nạp trước file này).
 */
.gk-muted { color: var(--ck-muted); font-size: 13px; }
.gk-hint { font-size: 12px; color: var(--ck-muted); margin-top: 6px; line-height: 1.45; }
.gk-error { background: #FBE9EA; color: #A8323B; border-radius: 14px; padding: 12px 14px; font-size: 14px; font-weight: 600; margin: 10px 0; }
.gk-warn { background: #FBF1DF; color: #7A5418; border-radius: 14px; padding: 12px 14px; font-size: 14px; font-weight: 600; margin-bottom: 16px; line-height: 1.5; }
.gk-textarea { min-height: 70px !important; }
.ck-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* ---------- Detail section ---------- */
.gk-section { display: flex; flex-direction: column; gap: 16px; margin: 20px 0 28px; }
.gk-toolbar { display: flex; flex-wrap: wrap; gap: 8px; }
.gk-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.gk-card { display: flex; flex-direction: column; gap: 4px; }
.gk-card--chart { grid-column: 1 / -1; }
.gk-card-sub { font-size: 13px; color: var(--ck-text); margin-bottom: 6px; }
.gk-trend { font-weight: 800; }
.gk-trend--up { color: #3F6B41; }
.gk-trend--down { color: #A8323B; }

/* ---------- Health chart ---------- */
.gk-chart { position: relative; min-height: 60px; }
.gk-chart__plot { position: relative; }
.gk-chart svg { display: block; max-width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.gk-grid-line { stroke: #EFE8E2; stroke-width: 1; }
.gk-axis { font-size: 11px; fill: var(--ck-muted); font-family: inherit; }
.gk-cross { stroke: #CFC3BC; stroke-width: 1; }
.gk-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--ck-text); margin-bottom: 6px; }
.gk-legend span { display: inline-flex; align-items: center; gap: 6px; }
.gk-key { display: inline-block; flex-shrink: 0; }
.gk-key--line { width: 14px; height: 3px; border-radius: 2px; }
.gk-key--diamond { width: 8px; height: 8px; transform: rotate(45deg); border-radius: 1px; }
.gk-tip { position: absolute; top: 0; transform: translateX(-50%); background: #2E1F25; color: #FFFDFA; border-radius: 10px; padding: 8px 10px; font-size: 12px; pointer-events: none; min-width: 120px; box-shadow: 0 8px 20px -8px rgba(0,0,0,.4); z-index: 2; }
.gk-tip__date { font-weight: 800; margin-bottom: 4px; color: #EADCC6; }
.gk-tip__row { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.gk-tip__row strong { font-size: 13px; }
.gk-tip__row span { opacity: .8; }
.gk-table { margin-top: 6px; font-size: 12px; color: var(--ck-muted); }
.gk-table summary { cursor: pointer; font-weight: 700; padding: 4px 0; }
.gk-table table { border-collapse: collapse; margin-top: 6px; width: 100%; max-width: 420px; }
.gk-table th, .gk-table td { text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--ck-border); color: var(--ck-text); }

/* ---------- Family ---------- */
.gk-fam-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0; }
.gk-fam-label { font-size: 11px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; color: var(--ck-gold-dark); min-width: 80px; }
.gk-pchips { display: flex; flex-wrap: wrap; gap: 6px; }
.gk-pchip { border: 1px solid var(--ck-border); background: var(--ck-field); color: var(--ck-text); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; display: inline-flex; gap: 6px; align-items: baseline; max-width: 100%; }
.gk-pchip small { color: var(--ck-muted); font-weight: 600; }
.gk-pchip:hover { border-color: var(--ck-gold); }
.gk-pchip.is-dead { opacity: .7; }

.gk-tree { overflow-x: auto; padding: 4px 0 8px; }
.gk-tree ul { list-style: none; margin: 0; padding-left: 26px; position: relative; }
.gk-tree > ul { padding-left: 0; }
.gk-tree li { position: relative; padding: 6px 0 6px 18px; }
.gk-tree > ul > li { padding-left: 0; }
.gk-tree li li::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; border-left: 2px solid var(--ck-gold-soft); }
.gk-tree li li:last-child::before { bottom: auto; height: 28px; }
.gk-tree li li::after { content: ''; position: absolute; left: 0; top: 28px; width: 16px; border-top: 2px solid var(--ck-gold-soft); }
.gk-node { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; background: var(--ck-surface); border: 1px solid var(--ck-border); border-radius: 14px; padding: 8px 14px; font: inherit; cursor: pointer; box-shadow: var(--ck-shadow); min-width: 180px; }
.gk-node:hover { border-color: var(--ck-gold); }
.gk-node.is-current { border: 2px solid var(--ck-brand); background: var(--ck-brand-soft); }
.gk-node.is-dead { opacity: .72; }
.gk-node__name { font-weight: 800; color: var(--ck-strong); font-size: 14px; }
.gk-node__meta { font-size: 12px; color: var(--ck-muted); }

/* ---------- AI ---------- */
.gk-ai-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.gk-score { font-family: var(--ck-display); font-size: 22px; font-weight: 700; color: var(--ck-brand); }
.gk-score--big { font-size: 34px; line-height: 1.1; }
.gk-urg { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 999px; background: var(--ck-field); color: var(--ck-text); }
.gk-urg--high { background: #FBE9EA; color: #A8323B; }
.gk-urg--medium { background: #FBF1DF; color: #8A6420; }
.gk-urg--low, .gk-urg--none { background: #EEF5EC; color: #3F6B41; }
.gk-ai-summary { font-size: 14px; line-height: 1.55; color: var(--ck-text); margin: 8px 0; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.gk-diag .gk-ai-summary { -webkit-line-clamp: unset; display: block; }
.gk-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin: 10px 0; max-height: 260px; overflow-y: auto; }
.gk-thumb { border: 2px solid transparent; border-radius: 12px; padding: 0; background: var(--ck-field); cursor: pointer; overflow: hidden; font: inherit; display: flex; flex-direction: column; }
.gk-thumb img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.gk-thumb span { font-size: 11px; padding: 3px; color: var(--ck-text); font-weight: 700; }
.gk-thumb.is-on { border-color: var(--ck-brand); box-shadow: 0 0 0 3px var(--ck-brand-soft); }
[data-ai-out] { margin-top: 18px; }
.gk-ai-wait { display: flex; align-items: center; gap: 10px; padding: 16px; color: var(--ck-text); font-weight: 600; }
.gk-spinner { width: 20px; height: 20px; border: 3px solid var(--ck-gold-soft); border-top-color: var(--ck-brand); border-radius: 50%; animation: gk-spin 0.9s linear infinite; flex-shrink: 0; }
@keyframes gk-spin { to { transform: rotate(360deg); } }
.gk-diag { border-top: 1px dashed var(--ck-gold-soft); padding-top: 16px; margin-top: 16px; }
.gk-diag:first-child { border-top: none; margin-top: 0; padding-top: 0; }
.gk-diag__top { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.gk-diag__img { border: none; padding: 0; background: none; cursor: pointer; display: flex; flex-direction: column; gap: 4px; font: inherit; font-size: 12px; color: var(--ck-muted); }
.gk-diag__img img { width: 120px; height: 120px; object-fit: cover; border-radius: 14px; display: block; }
.gk-diag__score { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.gk-issues { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-direction: column; gap: 8px; }
.gk-issues li { background: var(--ck-field); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.gk-issues strong { color: var(--ck-strong); }
.gk-lk { font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; margin-right: 8px; text-transform: uppercase; letter-spacing: .4px; }
.gk-lk--high { background: #FBE9EA; color: #A8323B; }
.gk-lk--medium { background: #FBF1DF; color: #8A6420; }
.gk-lk--low { background: #EEF0F2; color: #5B6470; }
.gk-actions { list-style: decimal; padding-left: 22px; margin: 0 0 12px; font-size: 14px; line-height: 1.55; color: var(--ck-text); }
.gk-diag p { font-size: 14px; line-height: 1.55; color: var(--ck-text); }

/* ---------- Compare ---------- */
.gk-compare__pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.gk-compare__pick label { display: flex; flex-direction: column; min-width: 0; }
.gk-compare__stage { position: relative; margin: 0 auto; border-radius: 18px; overflow: hidden; background: #1F1418; user-select: none; width: 100%; aspect-ratio: 4 / 3; }
.gk-compare__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.gk-compare__clip { position: absolute; inset: 0; }
.gk-compare__handle { position: absolute; top: 0; bottom: 0; width: 3px; margin-left: -1.5px; background: #FFFDFA; box-shadow: 0 0 0 1px rgba(0,0,0,.15); pointer-events: none; }
.gk-compare__handle span { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 40px; height: 40px; border-radius: 50%; background: #FFFDFA; color: var(--ck-brand); display: flex; align-items: center; justify-content: center; font-weight: 900; box-shadow: 0 6px 16px rgba(0,0,0,.3); }
.gk-compare__tag { position: absolute; top: 12px; background: rgba(31,10,20,.72); color: #FFFDFA; font-size: 12px; font-weight: 800; padding: 4px 10px; border-radius: 999px; pointer-events: none; }
.gk-compare__tag--a { left: 12px; }
.gk-compare__tag--b { right: 12px; }
.gk-compare__range { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; -webkit-appearance: none; appearance: none; }
.gk-compare__gap { text-align: center; font-weight: 800; color: var(--ck-gold-dark); margin-top: 10px; font-size: 14px; }

/* ---------- Timelapse ---------- */
.gk-tl__canvas { width: 100%; max-height: 62vh; object-fit: contain; border-radius: 18px; background: #1F1418; display: block; }
.gk-tl__bar { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.gk-tl__scrub { flex: 1; min-width: 120px; accent-color: var(--ck-brand); }
.gk-tl__speed { width: auto !important; padding: 8px 12px !important; min-height: 40px; }

/* ---------- QR ---------- */
.gk-qr { display: flex; flex-direction: column; gap: 10px; }
.gk-label { display: flex; gap: 16px; align-items: center; border: 2px dashed var(--ck-gold); border-radius: 16px; padding: 14px; background: #fff; }
.gk-label svg { flex-shrink: 0; }
.gk-label__text { display: flex; flex-direction: column; gap: 3px; min-width: 0; font-size: 13px; color: var(--ck-muted); }
.gk-label__text strong { font-family: var(--ck-display); color: var(--ck-brand); font-size: 18px; line-height: 1.2; }
.gk-label__id { font-weight: 800; color: var(--ck-strong); font-size: 15px; }
.gk-label__brand { color: var(--ck-gold-dark); font-weight: 800; }
.gk-qr__url { font-size: 12px !important; padding: 10px 12px !important; }

/* ---------- Insights ---------- */
.gk-insights { display: flex; flex-direction: column; gap: 16px; margin-top: 24px; padding-top: 20px; border-top: 2px dashed var(--ck-gold-soft); }
.gk-insights__title { font-family: var(--ck-display); font-size: 22px; color: var(--ck-strong); margin: 0; }
.gk-bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.gk-bars li { display: grid; grid-template-columns: minmax(110px, 38%) 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.gk-bars__label { color: var(--ck-text); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gk-bars__track { height: 12px; display: block; }
.gk-bars__track i { display: block; height: 100%; background: #8E2350; border-radius: 0 4px 4px 0; }
.gk-bars__val { color: var(--ck-muted); font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.gk-best { background: var(--ck-brand-soft); color: var(--ck-brand); font-weight: 800; border-radius: 12px; padding: 10px 12px; font-size: 14px; margin-bottom: 10px; }
.gk-table-wrap { overflow-x: auto; }
.gk-sp { width: 100%; border-collapse: collapse; font-size: 13px; }
.gk-sp th { text-align: left; font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--ck-gold-dark); padding: 6px 8px; border-bottom: 1px solid var(--ck-border); }
.gk-sp td { padding: 7px 8px; border-bottom: 1px solid var(--ck-border); color: var(--ck-text); white-space: nowrap; font-variant-numeric: tabular-nums; }
.gk-sp tr.is-best td { font-weight: 800; color: var(--ck-brand); }
.gk-rate { display: inline-block; width: 48px; height: 6px; background: var(--ck-field); border-radius: 3px; margin-right: 8px; vertical-align: middle; overflow: hidden; }
.gk-rate i { display: block; height: 100%; background: #8E2350; border-radius: 0 3px 3px 0; }
.gk-check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; font-weight: 600; color: var(--ck-text); margin: 6px 0 12px; cursor: pointer; line-height: 1.4; }
.gk-check input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--ck-brand); flex-shrink: 0; }

/* Modal rộng (desktop) */
#gardenModal.gk-modal--wide .modal-card { width: min(920px, 94vw); }

@media (max-width: 600px) {
    .gk-compare__pick { grid-template-columns: 1fr; }
    .gk-label { gap: 10px; padding: 10px; }
    .gk-label svg { width: 110px; height: 110px; }
    .gk-bars li { grid-template-columns: minmax(90px, 40%) 1fr auto; }
    .gk-node { min-width: 150px; }
}

/* ---------- Garden home (màn hình mở đầu) ---------- */
.gh-host { container-type: inline-size; }
.gh { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 36px; align-items: start; color: var(--ck-text); }
.gh--compact, .gh--empty { display: flex; flex-direction: column; align-items: stretch; gap: 16px; }
.gh--compact > *, .gh--empty > * { min-width: 0; }
.gh__main { display: flex; flex-direction: column; gap: 30px; min-width: 0; }
.gh__rail { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.gh-eyebrow { font-size: 11px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--ck-gold-dark); }
.gh-hello__title { font-family: var(--ck-display); font-size: 36px; font-weight: 700; line-height: 1.15; color: var(--ck-brand); margin: 4px 0 8px; }
.gh-hello__sum { font-size: 16px; line-height: 1.55; max-width: 62ch; margin: 0; }
.gh-note { font-size: 14px; line-height: 1.5; color: var(--ck-muted); margin: 0; }
.gh-todos + .gh-note { margin-top: 10px; }

.gh-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-block: 1px solid var(--ck-gold-soft); }
.gh-stats > div { padding: 14px 18px; border-left: 1px solid var(--ck-gold-soft); min-width: 0; }
.gh-stats > div:first-child { border-left: 0; padding-left: 0; }
.gh-stats b { display: block; font-family: var(--ck-display); font-size: 26px; font-weight: 700; line-height: 1.2; color: var(--ck-strong); font-variant-numeric: tabular-nums; }
.gh-stats span { font-size: 12px; color: var(--ck-muted); }

.gh-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 12px; margin-bottom: 12px; }
.gh-h { font-family: var(--ck-display); font-size: 20px; font-weight: 700; color: var(--ck-strong); margin: 0; }
.gh-sub { font-size: 13px; color: var(--ck-muted); }

.gh-todos { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.gh-todo { display: flex; align-items: center; gap: 10px; min-width: 0; background: var(--ck-surface); border: 1px solid var(--ck-border); border-radius: 16px; padding: 8px 10px 8px 8px; }
.gh-todo__open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.gh-thumb { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; flex: none; background: var(--ck-field); }
.gh-todo__txt { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.gh-todo__txt b { max-width: 100%; font-size: 14px; font-weight: 800; color: var(--ck-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gh-done { align-items: center; min-height: 36px; padding: 6px 14px; border: 0; border-radius: 999px; background: var(--ck-brand); color: #FFFDFA; font: inherit; font-size: 13px; font-weight: 800; white-space: nowrap; cursor: pointer; transition: background .2s, transform .15s; }
.gh-done:hover { background: var(--ck-brand-2); }
.gh-done:active { transform: scale(.96); }

.gh-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 20px 16px; }
.gh-tile { display: flex; flex-direction: column; gap: 6px; min-width: 0; background: none; border: 0; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.gh-tile__pic { position: relative; display: block; aspect-ratio: 4 / 3; border-radius: 16px; overflow: hidden; background: var(--ck-field); box-shadow: var(--ck-shadow); }
.gh-tile__img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s ease; }
.gh-tile:hover .gh-tile__img { transform: scale(1.05); }
.gh-tile__name { font-size: 14px; font-weight: 800; color: var(--ck-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gh-tile:hover .gh-tile__name { color: var(--ck-brand); }
.gh-tile__meta { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 8px; min-width: 0; }
.gh-tile__id { max-width: 100%; font-size: 12px; color: var(--ck-muted); font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gh-tile.is-dead .gh-tile__img { filter: grayscale(1); opacity: .7; }
.gh-tile.is-dead .gh-tile__name { color: var(--ck-muted); }
.gh-nophoto { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--ck-gold-dark); background: var(--ck-field); font-size: 12px; font-weight: 700; }
.gh-tile__pic .gh-nophoto { position: absolute; inset: 0; }
.gh-tile:focus-visible, .gh-todo__open:focus-visible, .gh-done:focus-visible, .gh-link:focus-visible { outline: 2px solid var(--ck-brand); outline-offset: 3px; border-radius: 12px; }

.gh-box { border-top: 2px solid var(--ck-gold-soft); padding-top: 12px; min-width: 0; }
.gh-wx { display: flex; align-items: center; gap: 12px; font-size: 13px; line-height: 1.4; color: var(--ck-muted); }
.gh-wx b { font-family: var(--ck-display); font-size: 36px; font-weight: 700; line-height: 1; color: var(--ck-water); }
.gh-wx__advice { font-size: 13px; line-height: 1.5; margin: 8px 0 0; }
.gh-links { display: flex; flex-wrap: wrap; gap: 0 14px; }
.gh-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 14px; line-height: 1.4; color: var(--ck-strong); }
.gh-when { display: block; font-size: 11px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: var(--ck-muted); }
.gh-link { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.gh-link:hover { color: var(--ck-brand); text-decoration: underline; text-underline-offset: 3px; }

/* Bản điện thoại: lời chào gọn + hàng "cần tưới" cuộn ngang */
.gh--compact .gh-hello__title { font-size: 26px; margin: 2px 0 6px; }
.gh--compact .gh-hello__sum { font-size: 14px; }
.gh--compact .gh-h { font-size: 17px; }
.gh--compact .gh-head { margin-bottom: 8px; }
.gh--compact .gh-todos { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.gh--compact .gh-todos::-webkit-scrollbar { display: none; }
.gh--compact .gh-todo { flex: 0 0 min(82%, 290px); scroll-snap-align: start; }

@container (max-width: 880px) {
    .gh { grid-template-columns: minmax(0, 1fr); }
    .gh__rail { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 24px; }
}
@container (max-width: 520px) {
    .gh-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .gh-stats > div:nth-child(odd) { border-left: 0; padding-left: 0; }
    .gh-stats > div:nth-child(n + 3) { border-top: 1px solid var(--ck-gold-soft); }
    .gh-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
    .gh-tile__img, .gh-done { transition: none; }
}
