/* COREIDON.AI Irrigation Demo — reuses the house design tokens (navy brand, cyan accent, data-theme dark) */

:root {
    --bg-canvas: #FFFFFF;
    --bg-section: #F8F5F0;
    --bg-card: #FFFFFF;
    --bg-elevated: #FFFFFF;
    --bg-subtle: #F8F5F0;

    --text-primary: #000000;
    --text-secondary: #2B303B;
    --text-muted: #6B7280;

    --accent-primary: #091C3A;
    --accent-hover: #0D2A52;

    --accent-cyan: #0284C7;
    --accent-cyan-hover: #0369A1;
    --accent-cyan-soft: rgba(2, 132, 199, 0.12);

    --success: #16A34A;
    --warning: #D97706;
    --danger:  #DC2626;

    /* agronomy data-viz tokens */
    --water: #0284C7;
    --water-soft: rgba(2, 132, 199, 0.14);
    --et: #D97706;
    --soil: #92703A;
    --rain: #2563EB;

    --divider: #E5E7EB;
    --border-subtle: 1px solid #E5E7EB;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.08);

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --transition: 0.15s ease;
    --focus-ring: 0 0 0 3px rgba(2, 132, 199, 0.25);
    --modal-backdrop-color: rgba(9, 28, 58, 0.55);
    --sidebar-w: 232px;
}

[data-theme='dark'] {
    --bg-canvas:   #0A1220;
    --bg-section:  #121B2A;
    --bg-card:     #161F30;
    --bg-elevated: #243447;
    --bg-subtle:   #1F2A3C;

    --text-primary:   #FFFFFF;
    --text-secondary: rgba(248, 245, 240, 0.78);
    --text-muted:     rgba(248, 245, 240, 0.48);

    --accent-primary: #091C3A;
    --accent-hover:   #0F2A57;

    --accent-cyan:        #38BDF8;
    --accent-cyan-hover:  #7DD3FC;
    --accent-cyan-soft:   rgba(56, 189, 248, 0.16);

    --success: #34D399;
    --warning: #FBBF24;
    --danger:  #FB7185;

    --water: #38BDF8;
    --water-soft: rgba(56, 189, 248, 0.16);
    --et: #FBBF24;
    --soil: #C99A57;
    --rain: #60A5FA;

    --divider: #22304A;
    --border-subtle: 1px solid #22304A;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.6);

    --focus-ring: 0 0 0 3px rgba(56, 189, 248, 0.3);
    --modal-backdrop-color: rgba(0, 0, 0, 0.65);
}

html:not([data-theme]) { visibility: hidden; }

* { box-sizing: border-box; }
html { font-size: 14px; }
body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-section);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: 'Space Grotesk', 'Inter', sans-serif; margin: 0; }
button { font-family: inherit; cursor: pointer; }
canvas { max-width: 100%; }

/* ---------- Shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--bg-card);
    border-right: var(--border-subtle);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px; border-bottom: var(--border-subtle); }
.brand-mark {
    width: 38px; height: 38px; border-radius: 10px;
    display: grid; place-items: center; font-size: 18px; color: #fff;
    background: linear-gradient(135deg, var(--accent-cyan), #0EA5E9);
    box-shadow: var(--shadow-sm);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-family: 'Space Grotesk'; font-weight: 700; font-size: 16px; }
.brand-sub { font-size: 11px; color: var(--text-muted); }

.nav { display: flex; flex-direction: column; gap: 2px; padding: 12px 10px; flex: 1; }
.nav-item {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 12px; border: none; border-radius: var(--radius-md);
    background: transparent; color: var(--text-secondary);
    font-size: 13.5px; font-weight: 500; text-align: left; width: 100%;
    transition: background var(--transition), color var(--transition);
}
.nav-item i { width: 18px; text-align: center; font-size: 14px; color: var(--text-muted); }
.nav-item:hover { background: var(--bg-subtle); }
.nav-item.active { background: var(--accent-cyan-soft); color: var(--accent-cyan); }
.nav-item.active i { color: var(--accent-cyan); }

.nav-badge { margin-left: auto; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; }
.nav-item.active .nav-badge { background: var(--danger); }

.sidebar-foot { padding: 12px; border-top: var(--border-subtle); display: flex; align-items: center; gap: 8px; }
.sidebar-user { flex: 1; min-width: 0; }
.sidebar-foot .icon-btn { flex: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 24px; background: var(--bg-card);
    border-bottom: var(--border-subtle);
    position: sticky; top: 0; z-index: 20;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.company { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }

.now-weather { display: flex; align-items: center; gap: 14px; font-size: 12.5px; color: var(--text-secondary); }
.now-weather .nw { display: flex; align-items: center; gap: 5px; }
.now-weather .nw i { color: var(--text-muted); }
.now-weather strong { font-weight: 600; color: var(--text-primary); }

.icon-btn {
    width: 36px; height: 36px; border-radius: var(--radius-md);
    border: var(--border-subtle); background: var(--bg-card); color: var(--text-secondary);
    display: grid; place-items: center; font-size: 14px; font-weight: 600;
    transition: background var(--transition);
}
.icon-btn:hover { background: var(--bg-subtle); }
.icon-btn[disabled] { opacity: .4; cursor: not-allowed; }
.icon-btn[disabled]:hover { background: var(--bg-card); }
.only-mobile { display: none; }

.view { padding: 24px; max-width: 1240px; width: 100%; margin: 0 auto; }
.view.wide { max-width: 1600px; }
.crumb { font-size: 12.5px; color: var(--text-muted); margin-bottom: 6px; }
.linkbtn { background: none; border: none; color: var(--accent-cyan); font-size: 12.5px; font-weight: 600; padding: 0; cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }

/* ---------- Common ---------- */
.page-head { margin-bottom: 20px; }
.page-head h1 { font-size: 22px; }
.page-head p { margin: 6px 0 0; color: var(--text-muted); font-size: 13.5px; max-width: 720px; }

.card {
    background: var(--bg-card); border: var(--border-subtle);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px; border-bottom: var(--border-subtle); }
.card-head h3 { font-size: 14.5px; }
.card-head .sub { font-size: 12px; color: var(--text-muted); }

.grid { display: grid; gap: 16px; }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-2 { grid-template-columns: repeat(2, 1fr); }

/* KPI stat tiles */
.stat {
    background: var(--bg-card); border: var(--border-subtle);
    border-radius: var(--radius-lg); padding: 16px 18px; box-shadow: var(--shadow-sm);
}
.stat .label { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 7px; }
.stat .label i { color: var(--accent-cyan); }
.stat .value { font-family: 'Space Grotesk'; font-weight: 700; font-size: 26px; margin-top: 6px; line-height: 1; }
.stat .value small { font-size: 13px; font-weight: 500; color: var(--text-muted); }
.stat .trend { font-size: 11.5px; margin-top: 6px; color: var(--text-muted); }

/* Field cards */
.field-card {
    background: var(--bg-card); border: var(--border-subtle);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
    padding: 16px; cursor: pointer; transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
    position: relative; overflow: hidden;
}
.field-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.field-card .fc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.field-card .fc-crop { display: flex; align-items: center; gap: 10px; }
.crop-ico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-size: 15px; color: #fff; }
.field-card h3 { font-size: 15px; }
.field-card .fc-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }

.badge {
    font-size: 11px; font-weight: 600; padding: 4px 9px; border-radius: 999px;
    display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
}
.badge.b-irrigate { background: rgba(220,38,38,.12); color: var(--danger); }
.badge.b-soon { background: rgba(217,119,6,.14); color: var(--warning); }
.badge.b-preventive { background: rgba(234,88,12,.15); color: #EA580C; }
[data-theme='dark'] .badge.b-preventive { color: #FB923C; }
.badge.b-ok { background: rgba(22,163,74,.13); color: var(--success); }
.badge.b-rain { background: var(--accent-cyan-soft); color: var(--accent-cyan); }
.badge.b-neutral { background: var(--bg-subtle); color: var(--text-muted); }

/* soil moisture bar */
.moist { margin-top: 14px; }
.moist-row { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; color: var(--text-muted); margin-bottom: 5px; }
.moist-bar { position: relative; height: 10px; border-radius: 999px; background: var(--bg-subtle); overflow: hidden; }
.moist-fill { position: absolute; inset: 0 auto 0 0; border-radius: 999px; }
.moist-track { position: relative; height: 10px; border-radius: 999px; background: linear-gradient(90deg, rgba(220,38,38,.25), rgba(217,119,6,.25), rgba(22,163,74,.25)); }
/* The bar's two ends, named under the ends they describe. A bare percentage does not
   say what it is a percentage of, and this one reads as "how wet the soil is" when it
   means "how much of this stage's allowance is left". */
.moist-ends { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--text-muted); margin-top: 4px; }

.fc-stats { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; padding-top: 12px; border-top: var(--border-subtle); }
/* Wraps rather than squeezes: the harvest readout puts five of these in a row
   (canopy, target, peak, trend, verdict) and a fixed flex:1 crushed them all on
   a phone instead of dropping the last one onto a second line. */
.fc-stat { flex: 1 1 130px; }
.fc-stat .k { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; }
.fc-stat .v { font-size: 14px; font-weight: 600; margin-top: 2px; }
.fc-stat .v small { font-weight: 500; color: var(--text-muted); font-size: 11px; }

/* buttons */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 14px; border-radius: var(--radius-md); font-size: 13px; font-weight: 600;
    border: var(--border-subtle); background: var(--bg-card); color: var(--text-secondary);
    transition: background var(--transition), border-color var(--transition);
}
.btn:hover { background: var(--bg-subtle); }
.btn-primary { background: var(--accent-primary); border-color: var(--accent-primary); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
[data-theme='dark'] .btn-primary { background: #F8F5F0; color: #091C3A; border-color: #F8F5F0; }
[data-theme='dark'] .btn-primary:hover { background: #fff; }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn:focus-visible, input:focus-visible, select:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* tables */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); font-weight: 600; padding: 10px 12px; border-bottom: var(--border-subtle); white-space: nowrap; }
table.tbl td { padding: 11px 12px; border-bottom: var(--border-subtle); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tr.clickable { cursor: pointer; }
table.tbl tr.clickable:hover td { background: var(--bg-subtle); }

/* forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-group { display: flex; flex-direction: column; gap: 6px; }
.field-group.full { grid-column: 1 / -1; }
label.lbl { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
label.lbl .hint { font-weight: 400; color: var(--text-muted); }
input.inp, select.inp {
    padding: 9px 11px; border-radius: var(--radius-md);
    border: var(--border-subtle); background: var(--bg-card); color: var(--text-primary); font-size: 13px; width: 100%;
}
.help { font-size: 11px; color: var(--text-muted); line-height: 1.45; }
.help b { color: var(--text-secondary); font-weight: 600; }
.modal-intro { background: var(--bg-subtle); border: var(--border-subtle); border-radius: var(--radius-md); padding: 11px 13px; font-size: 12px; color: var(--text-secondary); margin-bottom: 16px; line-height: 1.5; }
.modal-intro i { color: var(--accent-cyan); }
input[type=color].inp { padding: 3px; height: 38px; cursor: pointer; }

/* icon picker */
.icon-picker { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; }
.icon-opt {
    aspect-ratio: 1; border: var(--border-subtle); border-radius: var(--radius-md);
    background: var(--bg-card); color: var(--text-secondary);
    display: grid; place-items: center; font-size: 15px; cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition), transform var(--transition);
}
.icon-opt:hover { background: var(--bg-subtle); transform: translateY(-1px); }
.icon-opt.active { border-color: var(--accent-cyan); color: #fff; background: var(--accent-cyan); }
.icon-label-row { display: flex; align-items: center; justify-content: space-between; }
@media (max-width: 640px) { .icon-picker { grid-template-columns: repeat(6, 1fr); } }

/* ---------- In-app dialog (replaces window.confirm / alert) ---------- */
.dialog-backdrop {
    position: fixed; inset: 0; background: var(--modal-backdrop-color);
    display: grid; place-items: center; z-index: 200; padding: 20px;
    animation: dlgFade var(--transition);
}
.dialog-backdrop[hidden] { display: none; }
.dialog {
    background: var(--bg-card); border: var(--border-subtle); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg); width: 100%; max-width: 440px; overflow: hidden;
    animation: dlgPop .18s cubic-bezier(.2, .9, .3, 1.2);
}
@keyframes dlgFade { from { opacity: 0 } to { opacity: 1 } }
@keyframes dlgPop { from { opacity: 0; transform: translateY(8px) scale(.97) } to { opacity: 1; transform: none } }
.dialog-body { display: flex; gap: 14px; padding: 22px 22px 6px; }
.dialog-body h3 { font-size: 16px; margin-bottom: 6px; }
.dialog-body p { margin: 0; font-size: 13px; color: var(--text-secondary); line-height: 1.55; }
.dialog-ico {
    width: 42px; height: 42px; border-radius: 11px; flex-shrink: 0;
    display: grid; place-items: center; font-size: 17px;
}
.dialog-ico.tone-danger { background: rgba(220,38,38,.13); color: var(--danger); }
.dialog-ico.tone-warning { background: rgba(217,119,6,.14); color: var(--warning); }
.dialog-ico.tone-success { background: rgba(22,163,74,.13); color: var(--success); }
.dialog-ico.tone-primary { background: var(--accent-cyan-soft); color: var(--accent-cyan); }
.dialog-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 18px 22px 20px; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #B91C1C; border-color: #B91C1C; }

/* ---------- Toasts ---------- */
.toast-stack {
    position: fixed; right: 20px; bottom: 20px; z-index: 300;
    display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.toast {
    display: flex; align-items: center; gap: 10px;
    background: var(--bg-card); border: var(--border-subtle); border-left: 4px solid var(--text-muted);
    border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
    padding: 12px 16px; font-size: 13px; color: var(--text-primary);
    min-width: 260px; max-width: 380px;
    opacity: 0; transform: translateY(10px);
    transition: opacity .22s ease, transform .22s ease;
    pointer-events: auto;
}
.toast.show { opacity: 1; transform: none; }
.toast.tone-success { border-left-color: var(--success); }
.toast.tone-success i { color: var(--success); }
.toast.tone-warning { border-left-color: var(--warning); }
.toast.tone-warning i { color: var(--warning); }
.toast.tone-danger { border-left-color: var(--danger); }
.toast.tone-danger i { color: var(--danger); }
.toast.tone-primary { border-left-color: var(--accent-cyan); }
.toast.tone-primary i { color: var(--accent-cyan); }
@media (max-width: 640px) { .toast-stack { left: 16px; right: 16px; bottom: 16px; } .toast { min-width: 0; max-width: none; } }

/* irrigation event form */
.event-form { display: grid; grid-template-columns: 170px 170px 1fr auto; gap: 14px; align-items: end; }
.ef-cell { display: flex; flex-direction: column; gap: 5px; }
.ef-cell label { font-size: 11px; color: var(--text-muted); font-weight: 600; }
@media (max-width: 760px) { .event-form { grid-template-columns: 1fr 1fr; } }

/* soil saturation by depth */
.sat-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.sat-cell { display: flex; flex-direction: column; gap: 4px; }
.sat-cell label { font-size: 11px; color: var(--text-muted); text-align: center; }
.sat-cell .inp { text-align: center; padding: 7px 4px; }
@media (max-width: 640px) { .sat-grid { grid-template-columns: repeat(3, 1fr); } }

/* field location map */
.field-map { height: 230px; border-radius: var(--radius-md); overflow: hidden; border: var(--border-subtle); background: var(--bg-subtle); z-index: 0; }
.field-map .leaflet-container { font-family: inherit; }
.field-pin { color: var(--danger); font-size: 24px; text-shadow: 0 1px 3px rgba(0,0,0,.4); display: grid; place-items: center; background: none; border: none; }
[data-theme='dark'] .field-map { filter: brightness(0.92); }

/* modal */
.modal-backdrop { position: fixed; inset: 0; background: var(--modal-backdrop-color); display: grid; place-items: center; z-index: 100; padding: 20px; }
.modal-backdrop[hidden] { display: none; }
.modal { background: var(--bg-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; }
.phase-tbl th, .phase-tbl td { padding: 6px 8px; }
.phase-tbl .phase-in { padding: 6px 7px; font-size: 12px; }
.phase-tbl thead tr:first-child th { border-bottom: none; }
.layer-lines { display: flex; flex-direction: column; gap: 8px; }
.layer-line { display: grid; grid-template-columns: 118px 88px 1fr 78px 206px; align-items: center; gap: 10px; font-size: 12px; }
.layer-line.inactive { opacity: .5; }
.ll-d { color: var(--text-secondary); }
.ll-bar { position: relative; height: 14px; background: var(--bg-subtle); border-radius: 999px; }
.ll-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; opacity: .9; }
.ll-v { text-align: right; font-variant-numeric: tabular-nums; }
/* The two ends of the bar, labelled AT the ends they describe: 0% is the stage's
   minimum moisture, 100% is field capacity. Reading them off a list on the left meant
   holding four numbers in your head to interpret one bar. */
.ll-lo { text-align: right; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.ll-hi { text-align: left; color: var(--text-muted); font-variant-numeric: tabular-nums; }
/* θ above the layer's saturation ceiling — impossible, so it reads as a fault, not a state */
.layer-line.over-sat .ll-bar { box-shadow: 0 0 0 1.5px var(--danger); }
@media (max-width: 640px) { .layer-line { grid-template-columns: 92px 1fr; } .ll-lo, .ll-hi { display: none; } .ll-v { grid-column: 2; text-align: left; } }

/* alerts */
.alert-list { display: flex; flex-direction: column; gap: 10px; }
.alert-row { display: flex; gap: 14px; padding: 14px 16px; background: var(--bg-card); border: var(--border-subtle); border-left: 4px solid var(--text-muted); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); transition: box-shadow var(--transition); }
.alert-row:hover { box-shadow: var(--shadow-md); }
.alert-row.sev-red { border-left-color: var(--danger); }
.alert-row.sev-orange { border-left-color: #EA580C; }
.alert-row.sev-yellow { border-left-color: var(--warning); }
.alert-row.sev-green { border-left-color: var(--success); }
.ar-ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-size: 16px; flex-shrink: 0; background: var(--bg-subtle); color: var(--text-muted); }
.sev-red .ar-ico { background: rgba(220,38,38,.14); color: var(--danger); }
.sev-orange .ar-ico { background: rgba(234,88,12,.15); color: #EA580C; }
.sev-yellow .ar-ico { background: rgba(217,119,6,.14); color: var(--warning); }
.ar-body { flex: 1; min-width: 0; }
.ar-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ar-title { font-weight: 600; font-size: 14px; }
.ar-field { font-size: 12px; color: var(--text-muted); }
.ar-detail { font-size: 12.5px; color: var(--text-secondary); margin-top: 4px; line-height: 1.5; }
.ar-action { font-size: 12.5px; color: var(--accent-cyan); margin-top: 6px; font-weight: 500; }
.ar-action i { font-size: 10px; }

.layer-rows { display: flex; flex-direction: column; gap: 7px; }
.layer-row { display: grid; grid-template-columns: 48px 1fr 132px; align-items: center; gap: 10px; font-size: 12px; }
.layer-d { color: var(--text-muted); }
.layer-bar { height: 12px; background: var(--bg-subtle); border-radius: 999px; overflow: hidden; }
.layer-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--water), #0EA5E9); border-radius: 999px; }
.layer-v { text-align: right; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: var(--border-subtle); }
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: var(--border-subtle); }

/* recommendation banner */
.reco {
    display: flex; align-items: center; gap: 16px; padding: 18px 20px;
    border-radius: var(--radius-lg); border: 1px solid transparent;
}
.reco.r-irrigate { background: rgba(220,38,38,.08); border-color: rgba(220,38,38,.25); }
.reco.r-soon { background: rgba(217,119,6,.09); border-color: rgba(217,119,6,.25); }
.reco.r-ok { background: rgba(22,163,74,.08); border-color: rgba(22,163,74,.22); }
.reco .reco-ico { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; color: #fff; flex-shrink: 0; }
.reco.r-irrigate .reco-ico { background: var(--danger); }
.reco.r-soon .reco-ico { background: var(--warning); }
.reco.r-ok .reco-ico { background: var(--success); }
.reco .reco-title { font-family: 'Space Grotesk'; font-weight: 700; font-size: 16px; }
.reco .reco-sub { font-size: 13px; color: var(--text-secondary); margin-top: 3px; }
.reco .reco-metrics { margin-left: auto; display: flex; gap: 22px; text-align: right; flex-wrap: wrap; }
.reco .rm .k { font-size: 11px; color: var(--text-muted); }
.reco .rm .v { font-family: 'Space Grotesk'; font-weight: 700; font-size: 19px; }

/* forecast day cells */
/* forecast provenance: the "serves" intro and a live/sample chip side by side */
.fc-provenance { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fc-provenance .modal-intro { flex: 1 1 260px; }
.fc-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; padding: 6px 11px; border-radius: 999px; white-space: nowrap; border: 1px solid transparent; }
.fc-chip.live { color: var(--success); background: rgba(22, 163, 74, .12); border-color: rgba(22, 163, 74, .28); }
.fc-chip.sample { color: var(--text-muted); background: var(--bg-subtle); border-color: var(--border-color, rgba(0,0,0,.1)); }
.fc-chip span[title] { text-decoration: underline dotted; cursor: help; }

.fdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
.fday { background: var(--bg-card); border: var(--border-subtle); border-radius: var(--radius-md); padding: 12px 10px; text-align: center; }
.fday .fd-name { font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; }
.fday .fd-ico { font-size: 22px; margin: 8px 0; color: var(--accent-cyan); }
.fday .fd-temp { font-size: 13px; font-weight: 600; }
.fday .fd-temp small { color: var(--text-muted); font-weight: 500; }
.fday .fd-line { font-size: 11px; color: var(--text-muted); margin-top: 5px; display: flex; align-items: center; justify-content: center; gap: 4px; }
.fday .fd-line.rain { color: var(--rain); }

/* hourly forecast strip */
.hours { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x proximity; }
.fhour {
    flex: 0 0 76px; scroll-snap-align: start;
    background: var(--bg-card); border: var(--border-subtle); border-radius: var(--radius-md);
    padding: 10px 6px; text-align: center;
}
.fhour.night { background: var(--bg-subtle); }
.fh-name { font-size: 10.5px; color: var(--text-muted); font-weight: 600; }
.fh-ico { font-size: 17px; margin: 6px 0; color: var(--accent-cyan); }
.fhour.night .fh-ico { color: var(--text-muted); }
.fh-temp { font-size: 13px; font-weight: 600; }
.fh-line { font-size: 10px; color: var(--text-muted); margin-top: 4px; display: flex; align-items: center; justify-content: center; gap: 3px; }
.fh-line.rain { color: var(--rain); }

.chart-box { position: relative; height: 300px; }
.chart-box.tall { height: 340px; }

.legend-inline { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--text-secondary); }
.legend-inline .li { display: flex; align-items: center; gap: 6px; }
.legend-inline .dot { width: 10px; height: 10px; border-radius: 3px; }

.section-title { font-size: 13px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; margin: 24px 0 12px; }

.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.muted { color: var(--text-muted); }
.progress { height: 8px; border-radius: 999px; background: var(--bg-subtle); overflow: hidden; margin-top: 8px; }
.progress > span { display: block; height: 100%; border-radius: 999px; background: var(--success); }

.info-list { list-style: none; padding: 0; margin: 0; }
.info-list li { display: flex; gap: 10px; padding: 9px 0; border-bottom: var(--border-subtle); font-size: 13px; }
.info-list li:last-child { border-bottom: none; }
.info-list li i { color: var(--accent-cyan); margin-top: 2px; }
.info-list b { font-weight: 600; }

.pill-row { display: flex; gap: 8px; flex-wrap: wrap; }
.select-field { display: inline-flex; align-items: center; gap: 8px; }

.formula { font-family: 'Space Grotesk', monospace; background: var(--bg-subtle); border: var(--border-subtle); border-radius: var(--radius-md); padding: 12px 14px; font-size: 13px; color: var(--text-secondary); overflow-x: auto; }
.formula b { color: var(--accent-cyan); }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
    .cols-4 { grid-template-columns: repeat(2, 1fr); }
    .cols-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
    .sidebar { position: fixed; z-index: 50; transform: translateX(-100%); transition: transform var(--transition); box-shadow: var(--shadow-lg); }
    .sidebar.open { transform: translateX(0); }
    .only-mobile { display: grid; }
    .now-weather { display: none; }
    .view { padding: 16px; }
}
@media (max-width: 640px) {
    .cols-4, .cols-3, .cols-2 { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .fdays { grid-template-columns: repeat(4, 1fr); }
    .reco { flex-wrap: wrap; }
    .reco .reco-metrics { margin-left: 0; width: 100%; }
}
