/* Styles for the sections that joined FarmerFriend (Water, Drying), the combined Today and Settings.
   Built on the same Kolam tokens and FarmerFriend aliases as styles.css; status colours use Kolam's
   text-safe --success / --warning / --danger / --info on their -soft tints (WCAG AA in light, dark and contrast). */

/* ---------- Shared ---------- */
.subnav { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 16px 0 20px; padding: 4px; border-radius: var(--radius-pill); background: var(--surface-2); width: max-content; max-width: 100%; }
.subnav::-webkit-scrollbar { display: none; }
.subnav a { flex: none; padding: 8px 16px; border-radius: var(--radius-pill); font-weight: 700; font-size: 14px; color: var(--ink-2); white-space: nowrap; min-height: 40px; display: inline-flex; align-items: center; }
.subnav a:hover { color: var(--ink); }
.subnav a.on { background: var(--surface); color: var(--primary-text); box-shadow: var(--shadow-1); }
.lang-ta .subnav a { font-size: 13.5px; padding: 8px 13px; }
.sample-note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-md); background: var(--info-soft); color: var(--ink); font-size: 14px; margin: 0 0 18px; }
.sample-note svg { color: var(--info); margin-top: 2px; }
.fine { font-size: 13px; margin-top: 18px; max-width: 75ch; }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.btn svg { width: 18px; height: 18px; }
.btn-ghost { background: transparent; color: var(--primary-text); }
.btn-ghost:hover { background: var(--primary-soft); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.link.danger, .btn.danger { color: var(--danger); }
button.link { background: none; border: 0; padding: 0; cursor: pointer; }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.list-head { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; }
.list-head .search { flex: 1; min-width: 220px; margin: 0; }
.title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.title-row .page-title { margin: 0; }
.grow { flex: 1; min-width: 0; }
.empty-card { padding: 24px; display: grid; gap: 12px; justify-items: start; }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: var(--radius-pill); background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.badge.ok, .badge.good { background: var(--success-soft); color: var(--success); }
.badge.warn, .badge.fair { background: var(--warning-soft); color: var(--warning); }
.badge.danger, .badge.poor { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.none { background: var(--surface-2); color: var(--ink-2); }
.meter { display: block; height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; min-width: 60px; flex: 1; }
.meter i { display: block; height: 100%; border-radius: 4px; background: var(--primary); }
.meter.ok i { background: var(--success); } .meter.warn i { background: var(--warning); } .meter.danger i { background: var(--danger); }
.meter.water i { background: var(--secondary); } .meter.inc i { background: var(--success); } .meter.exp i { background: var(--accent); }
.facts .fact .sub { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.facts.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 16px; }
@media (max-width: 420px) { .facts.compact .fact b { font-size: 15px; } .facts.compact .fact { padding: 10px; } }
.bad { color: var(--danger) !important; } .good { color: var(--success); } .warn { color: var(--warning); }
.note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-md); background: var(--surface-2); font-size: 14.5px; margin: 14px 0 0; }
.note svg { margin-top: 2px; }
.note.ok { background: var(--success-soft); } .note.ok svg { color: var(--success); }
.note.warn { background: var(--warning-soft); } .note.warn svg { color: var(--warning); }
.note.bad { background: var(--danger-soft); } .note.bad svg { color: var(--danger); }
.note.info { background: var(--info-soft); } .note.info svg { color: var(--info); }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14.5px; }
.kv:first-of-type { border-top: 0; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; margin-top: 16px; }
@media (max-width: 960px) { .cols { grid-template-columns: 1fr; } }
.cols > .section { margin-top: 0; }
.panel { padding: 18px; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.panel-head h2 { font-size: 19px; }
.panel-head p { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.tile { width: 34px; height: 34px; border-radius: var(--radius-sm); display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-text); flex: none; }
.tile svg { width: 18px; height: 18px; }
.tile.ok { background: var(--success-soft); color: var(--success); }
.tile.inc { background: var(--success-soft); color: var(--success); } .tile.exp { background: var(--accent-soft); color: var(--accent-text); }

/* Rows: a list inside a card */
.rows { list-style: none; margin: 0; padding: 0; }
.card.rows { padding: 4px 0; }
.rows > li { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); }
.rows > li:first-child { border-top: 0; }
.rows.bare > li { padding: 10px 0; }
.rows > li > a, .rows > li > button { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 0; color: inherit; }
.rows > li > a > div, .rows > li > button > div { flex: 1; min-width: 0; }
.rows b { display: block; font-weight: 700; }
.rows small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }
.rows p { font-size: 14px; margin-top: 4px; }
.rows .meta { color: var(--muted); font-size: 13px; white-space: nowrap; }
.rows .num { font-family: var(--font-mono); font-weight: 700; min-width: 48px; text-align: right; }
.rows .end { text-align: right; display: grid; justify-items: end; gap: 4px; }
.rows > li > a > svg:last-child { color: var(--muted); }
.rows .empty { color: var(--muted); }

/* Tasks: the Needs attention list */
.tasks { list-style: none; margin: 0; padding: 0; }
.task { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.task:first-child { border-top: 0; }
.task > div { flex: 1; min-width: 0; display: grid; gap: 5px; }
.task b { font-weight: 700; font-size: 15px; }
.task > div > span { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.task small { color: var(--muted); font-size: 13px; }
.task.danger .tile { background: var(--danger-soft); color: var(--danger); }
.task.warn .tile { background: var(--warning-soft); color: var(--warning); }
.task.info .tile { background: var(--info-soft); color: var(--info); }
.task.ok .tile { background: var(--success-soft); color: var(--success); }
@media (max-width: 600px) { .task { flex-wrap: wrap; } .task > .btn { margin-left: 46px; } }
.sec-tag { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.lang-ta .sec-tag { text-transform: none; letter-spacing: 0; font-size: 12px; }

/* ---------- Today ---------- */
.home-search + .fade-in .page-title { margin-top: 6px; }
.hero .attn { padding: 18px; }
.glance { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
@media (max-width: 860px) { .glance { grid-template-columns: 1fr; } }
.glance-card { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.glance-card > div { flex: 1; min-width: 0; display: grid; gap: 2px; }
.glance-card b { font-size: 15.5px; }
.glance-card small { color: var(--muted); font-size: 13px; }
.glance-card > svg:last-child { color: var(--muted); }
.glance-card .org-icon { background: var(--primary-soft); color: var(--primary-text); }
.glance-card.drying .org-icon { background: var(--warning-soft); color: var(--warning); }
.glance-card.crops .org-icon { background: var(--success-soft); color: var(--success); }
.farm-manager-link { margin: 24px 0 0; font-size: 14px; color: var(--muted); }
.season-card.slim { min-height: 0; margin-top: 28px; padding: 24px; }
.season-card.slim h2 { font-size: clamp(24px, 3.4vw, 32px); font-weight: 900; margin: 0 0 8px; max-width: 22ch; }
.season-card.slim .actions { padding-top: 16px; }

/* ---------- Water ---------- */
.wcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
@media (max-width: 600px) { .wcards { grid-template-columns: 1fr; } }
.wcard { display: flex; gap: 16px; padding: 16px; border-left: 4px solid var(--line); }
.wcard.crit { border-left-color: var(--danger); } .wcard.warn { border-left-color: var(--warning); } .wcard.info { border-left-color: var(--info); } .wcard.good { border-left-color: var(--success); }
.wcard-body { flex: 1; min-width: 0; display: grid; gap: 6px; align-content: start; }
.wcard h3 { font-size: 19px; } .wcard h3 a:hover { color: var(--primary-text); }
.wcard .amount { font-size: 14.5px; } .wcard .detail, p.detail { color: var(--ink-2); font-size: 14px; }
p.detail { margin-top: 12px; }
.gauge { position: relative; width: 44px; height: 116px; border-radius: 12px; background: var(--surface-2); overflow: hidden; flex: none; border: 1px solid var(--line); }
.gauge .fill { position: absolute; left: 0; right: 0; bottom: 0; background: color-mix(in srgb, var(--secondary) 55%, transparent); }
.gauge .line { position: absolute; left: 0; right: 0; border-top: 2px dashed var(--danger); }
.gauge span { position: absolute; inset: auto 0 6px; text-align: center; font: 700 12px var(--font-mono); color: var(--ink); }
.gauge.empty { opacity: .5; }
.wpill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--radius-pill); font-weight: 700; font-size: 13px; width: max-content; max-width: 100%; }
.wpill svg { width: 15px; height: 15px; }
.wpill.crit { background: var(--danger-soft); color: var(--danger); } .wpill.warn { background: var(--warning-soft); color: var(--warning); }
.wpill.info { background: var(--info-soft); color: var(--info); } .wpill.good { background: var(--success-soft); color: var(--success); } .wpill.muted { background: var(--surface-2); color: var(--ink-2); }
.wstrip { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(84px, 1fr)); gap: 8px; overflow-x: auto; }
.wstrip li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 10px 6px; display: grid; justify-items: center; gap: 3px; font-size: 13px; }
.wstrip li.is-today { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.wstrip .d { font-weight: 700; } .wstrip .t { font-weight: 700; font-size: 15px; }
.wstrip .r { color: var(--secondary-text); font-weight: 700; } .wstrip .r.big { color: var(--danger); }
.wstrip .e { color: var(--muted); font-size: 12px; }
.rain-alert { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--info-soft); border-color: transparent; margin-bottom: 8px; }
.rain-alert > svg:first-child { color: var(--info); width: 28px; height: 28px; }
.rain-alert div { flex: 1; display: grid; gap: 3px; } .rain-alert span { font-size: 14px; color: var(--ink-2); }
.running { display: flex; align-items: center; gap: 16px; padding: 16px; margin-bottom: 16px; background: var(--secondary-soft); border-color: transparent; position: relative; overflow: hidden; }
.running > div:nth-child(2) { flex: 1; } .running h2 { font-size: 20px; margin: 2px 0; }
.running .mono { font-family: var(--font-mono); font-size: 14px; }
.running .bar { height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--secondary) 25%, transparent); margin-top: 8px; overflow: hidden; }
.running .bar span { display: block; height: 100%; background: var(--secondary); }
.ripple { width: 14px; height: 14px; border-radius: 50%; background: var(--secondary); flex: none; animation: rip 1.6s infinite; }
@keyframes rip { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--secondary) 50%, transparent); } 100% { box-shadow: 0 0 0 14px transparent; } }
@media (prefers-reduced-motion: reduce) { .ripple { animation: none; } }
.chart-card { padding: 16px; }
.chart-card h2 { font-size: 19px; margin-bottom: 8px; }
.soil-chart { position: relative; margin: 0; }
.soil-chart svg { width: 100%; height: auto; display: block; stroke-width: 1; }
.soil-chart .grid, .curve .grid { stroke: var(--line); }
.soil-chart .ax, .curve .ax { fill: var(--muted); font: 11px var(--font-sans); stroke: none; }
.soil-chart .zone { fill: color-mix(in srgb, var(--danger) 9%, transparent); stroke: none; }
.soil-chart .thr { fill: none; stroke: var(--danger); stroke-width: 1.5; stroke-dasharray: 5 4; }
.soil-chart .now { stroke: var(--ink-2); stroke-dasharray: 2 3; }
.soil-chart .ln { fill: none; stroke: var(--secondary); stroke-width: 2.6; }
.soil-chart .ln.fut { stroke-dasharray: 6 5; opacity: .8; }
.soil-chart .zone-label { fill: var(--danger); }
.soil-chart .dot { fill: var(--secondary); stroke: var(--surface); stroke-width: 2; } .soil-chart .cross { stroke: var(--line-strong); }
.soil-chart .b-rain { fill: color-mix(in srgb, var(--secondary) 55%, transparent); stroke: none; } .soil-chart .b-water { fill: var(--primary); stroke: none; }
.soil-chart .tip { position: absolute; background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; font-size: 12.5px; display: grid; gap: 2px; pointer-events: none; box-shadow: var(--shadow-2); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 14px; height: 4px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.k-ln { background: var(--secondary); } .k-thr { background: var(--danger); } .k-rain { background: color-mix(in srgb, var(--secondary) 55%, transparent); height: 10px !important; } .k-water { background: var(--primary); height: 10px !important; }
.k-moist { background: var(--secondary); } .k-safe { background: var(--success); } .k-target { background: var(--accent); } .k-low { background: var(--danger); }
.k-inc { background: var(--success); height: 10px !important; } .k-exp { background: var(--accent); height: 10px !important; }
.callout { padding: 20px; margin-top: 20px; }
.callout.rain { background: var(--info-soft); border-color: transparent; }
.callout h2 { font-size: 21px; margin-bottom: 8px; } .callout h3 { font-size: 17px; margin: 16px 0 6px; }
.callout details summary { cursor: pointer; font-weight: 700; color: var(--primary-text); margin-top: 10px; }
.rain-days { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.rain-days span { display: block; color: var(--ink-2); font-size: 13.5px; }
.inline-field { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; font-weight: 700; font-size: 14px; }
.inline-field input { width: 100px; height: 40px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 0 10px; background: var(--surface); color: var(--ink); font: inherit; }
.big-number { font-size: 15px; margin-top: 12px; max-width: 70ch; }
.group-title { font-size: 17px; margin: 18px 0 10px; }
.methods { display: grid; gap: 10px; }
.method { padding: 0; }
.method summary { padding: 14px 16px; cursor: pointer; display: grid; gap: 3px; list-style: none; }
.method summary::-webkit-details-marker { display: none; }
.method summary span { font-weight: 700; } .method summary small { color: var(--muted); font-size: 13px; }
.method[open] summary { border-bottom: 1px solid var(--line); }
.method > :not(summary) { margin: 12px 16px; }
.method .care { font-size: 14px; color: var(--ink-2); }
.uses { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.uses .card { padding: 16px; } .uses h3 { font-size: 16px; margin-bottom: 4px; } .uses p { font-size: 14px; color: var(--ink-2); }
.pit { margin: 12px 16px 16px; max-width: 460px; }
.pit svg { width: 100%; height: auto; stroke-width: 1; }
.p-soil { fill: color-mix(in srgb, var(--accent) 12%, var(--surface)); stroke: none; } .p-soil2 { fill: color-mix(in srgb, var(--accent) 22%, var(--surface)); }
.p-sand { fill: color-mix(in srgb, var(--warning) 28%, var(--surface)); stroke: none; } .p-gravel { fill: color-mix(in srgb, var(--ink-2) 30%, var(--surface)); stroke: none; }
.p-boulder { fill: color-mix(in srgb, var(--ink) 62%, var(--surface)); stroke: none; } .p-casing { fill: var(--ink-2); stroke: none; }
.p-water circle { fill: var(--secondary); stroke: none; } .p-outline { stroke: var(--ink); } .p-flow { stroke: var(--secondary); fill: none; } .p-arrow { fill: var(--secondary); stroke: none; }
.svg-label { font: 700 11px var(--font-sans); fill: var(--ink); stroke: none; } .svg-label.on-dark { fill: var(--surface); }
.daybars { padding: 16px; margin: 0; }
.db-row { display: grid; grid-template-columns: repeat(30, 1fr); gap: 3px; height: 120px; align-items: end; }
.db { height: 100%; display: flex; align-items: flex-end; } .db span { display: block; width: 100%; background: var(--secondary); border-radius: 3px 3px 0 0; min-height: 1px; }
.daybars figcaption { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.tank { display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin-bottom: 8px; flex-wrap: wrap; }
.tank > div:first-child { min-width: 200px; }

/* ---------- Drying ---------- */
.dhero { border-radius: var(--radius-xl); padding: 22px; color: var(--on-sidebar); background: linear-gradient(160deg, color-mix(in srgb, var(--warning) 45%, var(--sidebar)), color-mix(in srgb, var(--warning) 14%, var(--sidebar))); }
.dhero.cloudy { background: linear-gradient(160deg, color-mix(in srgb, var(--ink-2) 40%, var(--sidebar)), var(--sidebar)); }
.dhero.rainy { background: linear-gradient(160deg, color-mix(in srgb, var(--secondary) 45%, var(--sidebar)), var(--sidebar)); }
.dhero.night { background: linear-gradient(160deg, color-mix(in srgb, var(--primary) 30%, var(--sidebar)), var(--sidebar)); }
.dhero-top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.dhero-top > svg { width: 52px; height: 52px; stroke-width: 1.4; }
.dtemp { font: 900 44px/1 var(--font-display); }
.dcond { display: grid; flex: 1; min-width: 160px; } .dcond small { color: color-mix(in srgb, var(--on-sidebar) 85%, transparent); }
.dhero .badge { background: color-mix(in srgb, var(--on-sidebar) 16%, transparent); color: var(--on-sidebar); }
.dstats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.dstats div { background: color-mix(in srgb, var(--on-sidebar) 10%, transparent); border-radius: var(--radius-md); padding: 10px 12px; display: grid; }
.dstats span { font-size: 12.5px; color: color-mix(in srgb, var(--on-sidebar) 85%, transparent); } .dstats b { font-size: 20px; }
.dstats b.hot { text-decoration: underline wavy; }
.dtip { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; font-size: 14.5px; }
.ddays { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(76px, 1fr); gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.dday { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 10px 6px; display: grid; justify-items: center; gap: 3px; font-size: 13px; }
.dday.today { border-color: var(--warning); box-shadow: inset 0 0 0 1px var(--warning); }
.dday .d { font-weight: 700; } .dday .t { font-weight: 700; font-size: 15px; } .dday .s { display: flex; align-items: center; gap: 4px; color: var(--ink-2); font-size: 12px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.good { background: var(--success); } .dot.fair { background: var(--warning); } .dot.poor { background: var(--danger); }
.note-card h3 { margin-top: 2px; }
a.note-card:hover { border-color: var(--primary); }
.mcard { overflow: hidden; display: flex; flex-direction: column; }
.mcard:hover { border-color: var(--primary); }
.mph { aspect-ratio: 4 / 3; background: var(--surface-2); overflow: hidden; }
.mph img { width: 100%; height: 100%; object-fit: cover; }
.mcard .mb { padding: 12px 14px 14px; display: grid; gap: 4px; justify-items: start; }
.mcard h3 { font-size: 16.5px; } .mcard .ta { color: var(--muted); font-size: 13px; }
.rail > .mcard { width: 200px; }
.filter-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 12px 0 16px; font-weight: 700; font-size: 14px; }
.curve { width: 100%; height: auto; display: block; stroke-width: 1; }
.curve .area { fill: color-mix(in srgb, var(--secondary) 16%, transparent); stroke: none; }
.curve .ln { fill: none; stroke: var(--secondary); stroke-width: 3; }
.curve .c-safe { stroke: var(--success); stroke-width: 1.5; } .curve .c-safe-t { fill: var(--success); font: 700 11px var(--font-sans); stroke: none; }
.curve .c-low { stroke: var(--danger); stroke-width: 1.5; } .curve .c-low-t { fill: var(--danger); font: 700 11px var(--font-sans); stroke: none; }
.curve .c-target { stroke: var(--accent-text); stroke-width: 1.5; } .curve .c-target-t { fill: var(--accent-text); font: 700 11px var(--font-sans); stroke: none; }
.curve .c-safe-dot { fill: var(--success); stroke: var(--surface); stroke-width: 2.5; } .curve .c-target-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2.5; }
.plan-card { padding: 16px; } .plan-card h2 { font-size: 19px; margin: 4px 0 8px; }
.mini-stack > .card { padding: 16px; }
.therm { margin: 10px 0; }
.tbar { position: relative; height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--info-soft), var(--warning-soft), var(--danger-soft)); }
.tbar i { position: absolute; top: 0; bottom: 0; background: var(--success); border-radius: 6px; opacity: .85; }
.tbar u { position: absolute; top: -4px; bottom: -4px; width: 3px; background: var(--ink); border-radius: 2px; }
.tscale { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 4px; }
.dform { padding: 18px; display: grid; gap: 14px; align-content: start; }
.picked { display: flex; gap: 12px; align-items: flex-end; }
.picked img { width: 72px; height: 72px; border-radius: var(--radius-md); object-fit: cover; background: var(--surface-2); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.calc-grid .card { padding: 14px; display: grid; gap: 2px; }
.calc-grid small { color: var(--muted); font-size: 13px; } .calc-grid b { font-size: 22px; } .calc-grid em { font-style: normal; color: var(--ink-2); font-size: 13px; }
.massbar { display: flex; height: 26px; border-radius: var(--radius-sm); overflow: hidden; font-size: 12px; font-weight: 700; }
.massbar .w { background: var(--secondary-soft); color: var(--secondary-text); display: flex; align-items: center; padding: 0 8px; white-space: nowrap; overflow: hidden; }
.massbar .dr { background: var(--warning-soft); color: var(--warning); display: flex; align-items: center; padding: 0 8px; white-space: nowrap; overflow: hidden; }
.house-art { padding: 16px; max-width: 420px; margin: 0 0 16px; }
.house-art svg { width: 100%; height: auto; stroke-width: 2; }
.h-sun { fill: var(--warning); stroke: none; } .h-sheet { fill: color-mix(in srgb, var(--secondary) 12%, var(--surface)); stroke: var(--secondary); stroke-width: 3; }
.h-floor { fill: var(--ink); stroke: none; } .h-tray rect { fill: var(--warning-soft); stroke: var(--warning); } .h-chilli circle { fill: var(--danger); stroke: none; } .h-leaf ellipse { fill: var(--success); stroke: none; }
.table-wrap { overflow-x: auto; }
.trouble th { text-align: left; font-size: 13px; color: var(--muted); padding: 12px 14px; }
.trouble td { vertical-align: top; }

.chip svg { width: 15px; height: 15px; vertical-align: -3px; margin-right: 4px; }

/* ---------- Settings ---------- */
.settings { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
@media (max-width: 600px) { .settings { grid-template-columns: 1fr; } }
.set-row { display: flex; align-items: center; gap: 12px; }
.set-row svg { color: var(--primary-text); }
.set-row small { display: block; color: var(--muted); font-weight: 400; font-size: 13px; }
.settings-btn { flex: none; color: var(--ink-2); }
.settings-btn.on { background: var(--primary-soft); color: var(--primary-text); border-color: transparent; }

/* ---------- Form sheet ---------- */
.form-sheet { width: min(560px, calc(100vw - 24px)); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; margin-top: 12px; }
.form-grid .field:has(textarea), .form-grid .choices { grid-column: 1 / -1; }
@media (max-width: 520px) { .form-grid { grid-template-columns: 1fr; } }
.field > span { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.field select, .field textarea, .dform input, .dform select { width: 100%; min-height: 44px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 8px 12px; background: var(--surface); color: var(--ink); font: inherit; }
.field textarea { resize: vertical; }
.field small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.choices { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.choices legend { font-weight: 700; font-size: 14px; margin-bottom: 6px; padding: 0; }
.choices label { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-md); cursor: pointer; }
.choices label:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.choices input { grid-row: span 2; width: 18px; height: 18px; accent-color: var(--primary); }
.choices span { color: var(--muted); font-size: 13px; }
.sheet-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.form-sheet .link.danger { margin-top: 14px; }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 60;
  background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: var(--radius-md); display: flex; gap: 16px; align-items: center; font-size: 14.5px; box-shadow: var(--shadow-3); transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast .link { color: var(--bg); text-decoration: underline; }
@media (min-width: 861px) { .toast { bottom: 24px; } }

/* ---------- Tamil: longer words need room ---------- */
.lang-ta .tabs a span { white-space: nowrap; }
@media (max-width: 860px) { .lang-ta .tabs a { font-size: 11px; letter-spacing: 0; padding: 6px 2px; } }
@media (max-width: 380px) { .lang-ta .tabs a { font-size: 10.5px; } }

/* ---------- Android app (Material 3) ---------- */
html.k-android .settings-btn { display: none; }
html.k-android .subnav { background: transparent; padding: 0; gap: 8px; border-radius: 0; }
html.k-android .subnav a { height: 32px; min-height: 32px; padding: 0 16px; border-radius: var(--md-sys-shape-corner-small); box-shadow: inset 0 0 0 1px var(--md-sys-color-outline); color: var(--md-sys-color-on-surface-variant); font: var(--md-sys-typescale-label-large); }
html.k-android .subnav a.on { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); box-shadow: none; }
html.k-android .badge { border-radius: var(--md-sys-shape-corner-small); }
html.k-android .wcard, html.k-android .task .tile { border-radius: var(--md-sys-shape-corner-medium); }
html.k-android .form-sheet { border-radius: var(--md-sys-shape-corner-extra-large); background: var(--md-sys-color-surface-container-high); border: 0; }
html.k-android .field select, html.k-android .field textarea, html.k-android .dform input, html.k-android .dform select, html.k-android .inline-field input { min-height: 56px; border-radius: var(--md-sys-shape-corner-extra-small); border-color: var(--md-sys-color-outline); background: transparent; }
html.k-android .toast { display: none; }

/* ---------- iOS app (Apple HIG) ---------- */
html.k-ios .settings-btn { display: none; }
html.k-ios .subnav { background: var(--ios-fill3); padding: 2px; }
html.k-ios .subnav a { min-height: 32px; padding: 0 14px; font: 500 13px/32px var(--ios-font); color: var(--ios-label); }
html.k-ios .subnav a.on { background: var(--ios-elevated, #fff); color: var(--ios-label); font-weight: 600; box-shadow: 0 3px 8px rgba(0,0,0,.12), 0 1px 1px rgba(0,0,0,.04); }
html.k-ios .badge, html.k-ios .wpill { font-family: var(--ios-font); }
html.k-ios .dtemp { font-family: var(--ios-font-display); }
html.k-ios .form-sheet { border-radius: 14px; border: 0; background: var(--ios-grouped2); }
html.k-ios .field select, html.k-ios .field textarea, html.k-ios .dform input, html.k-ios .dform select { border-radius: 10px; border: 0; background: var(--ios-fill3); }
html.k-ios .rows > li { border-top-color: var(--ios-separator, var(--line)); }
html.k-ios .toast { border-radius: 14px; }
html.k-android body.lang-ta .md-nav-label { font-size: 11.5px; letter-spacing: 0; text-overflow: clip; overflow: visible; }
@media (max-width: 360px) { html.k-android body.lang-ta .md-nav-label { font-size: 10.5px; } }
.task, .wcard, .glance-card { color: var(--ink); }
@media (max-width: 600px) {
  .task { flex-wrap: wrap; }
  .task > div { flex: 1 1 calc(100% - 46px); }
  .task > .btn { margin-left: 46px; }
}
@media (max-width: 420px) { .topbar .brand-name { display: none; } .settings-btn { width: 40px; height: 40px; } }
.wcards { grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); }
.wcards > *, .cols > *, .glance > *, .settings > *, .calc-grid > * { min-width: 0; }
.wcard-body .amount, .wcard-body .detail { overflow-wrap: anywhere; }
.org-layout > *, .mini-stack > * { min-width: 0; }
@media (max-width: 420px) {
  .rows.bare > li { flex-wrap: wrap; }
  .rows.bare > li:has(> .btn) > .grow { flex: 1 1 calc(100% - 58px); }
  .rows.bare > li:has(> .btn) > .tile ~ .grow + * { margin-left: 46px; }
}
.panel-head, .section-head { flex-wrap: wrap; }
.panel-head > div, .section-head > div { min-width: 0; flex: 1 1 200px; }

/* ---------- Left sidebar (web, wide screens) ----------
   The header turns into a sidebar on wide screens; phones keep the bottom tab bar and the
   Android / iOS apps keep their native bars (html.k-android / html.k-ios). */
.lang-btn[hidden] { display: none !important; }
.side-sub, .side-label { display: none; }
.side-foot { display: contents; }
.profile-btn { display: inline-flex; align-items: center; gap: 10px; flex: none; color: var(--ink); border-radius: var(--radius-pill); }
.profile-btn .avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 15px;
  background: var(--primary-soft); color: var(--primary-text); border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent); }
.profile-btn.on .avatar { background: var(--primary); color: #fff; }
.profile-btn .side-label b { display: block; font-weight: 700; font-size: 14px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-btn .side-label small { display: block; color: var(--muted); font-size: 12px; }
@media (max-width: 860px) { .place-btn { margin-left: auto; } }
html.k-android .profile-btn, html.k-ios .profile-btn { display: none; }

@media (min-width: 861px) {
  html:not(.k-android):not(.k-ios) { --side-w: 264px; }
  html:not(.k-android):not(.k-ios) body { padding-left: var(--side-w); }
  html:not(.k-android):not(.k-ios) .topbar {
    position: fixed; top: 0; bottom: 0; left: 0; width: var(--side-w); z-index: 25;
    flex-direction: column; align-items: stretch; gap: 0; overflow-y: auto; overscroll-behavior: contain;
    padding: calc(20px + env(safe-area-inset-top)) 14px 16px;
    background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none;
    border-bottom: 0; border-right: 1px solid var(--line);
  }
  html:not(.k-android):not(.k-ios) .topbar .brand { padding: 2px 8px 22px; }
  html:not(.k-android):not(.k-ios) .topbar .brand-name { display: inline; }
  html:not(.k-android):not(.k-ios) .tabs { flex-direction: column; margin: 0; gap: 2px; flex: 1; }
  html:not(.k-android):not(.k-ios) .tabs > a { padding: 10px 12px; border-radius: var(--radius-md); font-size: 15px; gap: 12px; }
  html:not(.k-android):not(.k-ios) .tabs > a svg { width: 22px; height: 22px; }
  html:not(.k-android):not(.k-ios) .lang-ta .tabs > a, .lang-ta html:not(.k-android):not(.k-ios) .tabs > a { font-size: 14px; }
  html:not(.k-android):not(.k-ios) .tabs > a.on + .side-sub { display: flex; }
  html:not(.k-android):not(.k-ios) .side-sub { flex-direction: column; gap: 1px; margin: 4px 0 10px 23px; padding-left: 12px; border-left: 2px solid var(--line); }
  html:not(.k-android):not(.k-ios) .side-sub a { padding: 7px 10px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; color: var(--ink-2); line-height: 1.3; }
  html:not(.k-android):not(.k-ios) .side-sub a:hover { background: var(--surface-2); color: var(--ink); }
  html:not(.k-android):not(.k-ios) .side-sub a.on { background: var(--primary-soft); color: var(--primary-text); font-weight: 700; }
  html:not(.k-android):not(.k-ios) .side-foot { display: flex; flex-direction: column; gap: 6px; padding-top: 14px; margin-top: 14px; border-top: 1px solid var(--line); }
  html:not(.k-android):not(.k-ios) .side-label { display: block; min-width: 0; }
  html:not(.k-android):not(.k-ios) .side-foot .profile-btn { padding: 8px 10px; border-radius: var(--radius-md); }
  html:not(.k-android):not(.k-ios) .side-foot .profile-btn:hover, html:not(.k-android):not(.k-ios) .side-foot .profile-btn.on { background: var(--surface-2); }
  html:not(.k-android):not(.k-ios) .side-foot .place-btn { margin: 0; max-width: none; width: 100%; border-radius: var(--radius-md); padding: 9px 12px; }
  html:not(.k-android):not(.k-ios) .side-foot .settings-btn { width: 100%; height: auto; justify-content: flex-start; gap: 12px; padding: 9px 12px; border-radius: var(--radius-md); font-weight: 700; font-size: 14px; color: var(--ink-2); }
  html:not(.k-android):not(.k-ios) .side-foot .settings-btn .side-label { display: inline; }
  /* The sidebar already lists each section's pages, so the row of links under the title is not needed. */
  html:not(.k-android):not(.k-ios) main .subnav { display: none; }
}
/* Narrow desktops and tablets: an icon rail with short labels */
@media (min-width: 861px) and (max-width: 1180px) {
  html:not(.k-android):not(.k-ios) { --side-w: 92px; }
  html:not(.k-android):not(.k-ios) .topbar { padding-left: 8px; padding-right: 8px; align-items: center; }
  html:not(.k-android):not(.k-ios) .topbar .brand { padding: 2px 0 18px; }
  html:not(.k-android):not(.k-ios) .topbar .brand-name, html:not(.k-android):not(.k-ios) .side-label { display: none !important; }
  html:not(.k-android):not(.k-ios) .tabs { width: 100%; }
  html:not(.k-android):not(.k-ios) .tabs > a { flex-direction: column; gap: 4px; padding: 10px 4px; font-size: 12px; text-align: center; }
  html:not(.k-android):not(.k-ios) .tabs > a.on + .side-sub { display: none; }
  html:not(.k-android):not(.k-ios) .side-foot { align-items: center; width: 100%; }
  html:not(.k-android):not(.k-ios) .side-foot .place-btn { width: 48px; height: 48px; padding: 0; justify-content: center; }
  html:not(.k-android):not(.k-ios) .side-foot .place-btn span { display: none; }
  html:not(.k-android):not(.k-ios) .side-foot .settings-btn { width: 48px; height: 48px; justify-content: center; padding: 0; }
  html:not(.k-android):not(.k-ios) .side-foot .profile-btn { padding: 4px; }
  html:not(.k-android):not(.k-ios) main .subnav { display: flex; }
}

/* ---------- Profile ---------- */
.profile-card { display: flex; gap: 20px; align-items: center; padding: 22px; }
.profile-card .avatar-lg { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 30px; flex: none;
  background: var(--primary-soft); color: var(--primary-text); border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent); }
.profile-card h2 { font-size: 24px; }
.guest-pill { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; padding: 3px 10px; border-radius: var(--radius-pill); background: var(--surface-2); color: var(--ink-2); font-size: 13px; font-weight: 700; }
.guest-pill svg { width: 14px; height: 14px; }
.profile-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 700px) { .profile-form { grid-template-columns: 1fr; } .profile-card { flex-direction: column; align-items: flex-start; } }
.profile-form .field input { padding: 12px 14px; border-radius: var(--radius-md); border: 1px solid var(--line); background: var(--bg); font: inherit; color: var(--ink); width: 100%; }
.signin-soon { display: flex; gap: 12px; align-items: flex-start; }
.signin-soon .btn[disabled] { opacity: .55; cursor: not-allowed; }
@media (min-width: 1181px) {
  html:not(.k-android):not(.k-ios) .side-foot .settings-btn { display: flex; flex-direction: row; align-items: center; border: 0; background: none; }
  html:not(.k-android):not(.k-ios) .side-foot .settings-btn:hover, html:not(.k-android):not(.k-ios) .side-foot .settings-btn.on { background: var(--surface-2); color: var(--ink); }
  html:not(.k-android):not(.k-ios) .side-foot .settings-btn svg { width: 20px; height: 20px; }
  html:not(.k-android):not(.k-ios) .side-foot .place-btn { border: 0; background: none; color: var(--ink-2); gap: 12px; }
  html:not(.k-android):not(.k-ios) .side-foot .place-btn:hover { background: var(--surface-2); color: var(--ink); }
  html:not(.k-android):not(.k-ios) .side-foot .place-btn svg { width: 20px; height: 20px; }
}
.profile-wrap { display: grid; gap: 16px; max-width: 880px; }
.profile-wrap .panel { padding: 22px; }
/* Phones: place, profile and settings sit together on the right of the header */
@media (max-width: 860px) {
  .side-foot .place-btn { order: 1; margin-left: auto; }
  .side-foot .profile-btn { order: 2; }
  .side-foot .settings-btn { order: 3; }
}
