/* Copyright (c) 2026 Bizon, LLC. All rights reserved. */
/* Bizon VPD Dashboard — shared theme */

:root {
    /* Surfaces — warm espresso → leather */
    --bg:          #14100b;
    --bg-grad-a:   #1a140d;
    --bg-grad-b:   #100c08;
    --surface:     #1d1811;
    --surface-2:   #251e15;
    --surface-3:   #2e251a;

    /* Lines */
    --border:      #382d20;
    --border-soft: #2a2118;
    --border-warm: #4a3a28;

    /* Text */
    --text:        #f4ede0;
    --text-muted:  #b3a48d;
    --text-dim:    #7d6e5a;

    /* Brand — caramel / tan / leather */
    --brand:       #c08a4f;
    --brand-light: #dcad77;
    --brand-dark:  #9a6432;
    --brand-deep:  #6e4623;

    /* Metric accents (harmonized for warm dark bg) */
    --c-canopy:    #e07a5f;  /* terracotta */
    --c-air:       #6fa8dc;  /* soft blue  */
    --c-humidity:  #8ab98a;  /* sage       */
    --c-vpd:       #e8b04b;  /* amber/gold */

    /* States */
    --danger:      #d9774f;
    --danger-bg:   #2a1812;
    --ok:          #8ab98a;

    --radius:      14px;
    --radius-sm:   9px;
    --shadow:      0 10px 30px -12px rgba(0,0,0,0.7);
    --shadow-sm:   0 4px 14px -8px rgba(0,0,0,0.6);
    --ring:        0 0 0 3px rgba(192,138,79,0.20);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    background:
        url("../img/leaves.svg") center center / cover no-repeat,
        radial-gradient(1100px 600px at 78% -8%, rgba(192,138,79,0.10), transparent 60%),
        radial-gradient(900px 500px at -5% 0%, rgba(110,70,35,0.10), transparent 55%),
        linear-gradient(180deg, var(--bg-grad-a), var(--bg-grad-b) 60%);
    background-attachment: fixed;
    color: var(--text);
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-light); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--text); }

/* ─────────────  Top bar  ───────────── */
.nav {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px clamp(16px, 4vw, 40px);
    background: rgba(16,12,8,0.72);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 13px; min-width: 0; }
.brand-mark {
    display: grid;
    place-items: center;
    width: 40px; height: 40px;
    flex: 0 0 auto;
    border-radius: 11px;
    background: linear-gradient(150deg, var(--brand-light), var(--brand-dark));
    color: #1a120a;
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: -0.04em;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.35), var(--shadow-sm);
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; border-radius: 11px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-name {
    font-weight: 700;
    font-size: 1.02rem;
    letter-spacing: -0.01em;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.brand-sub {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--brand);
    font-weight: 600;
}
.nav-right { display: flex; align-items: center; gap: 18px; }
.nav-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.pulse-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--ok);
    box-shadow: 0 0 0 0 rgba(138,185,138,0.6);
    animation: pulse 2.4s infinite;
}
@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 rgba(138,185,138,0.5); }
    70%  { box-shadow: 0 0 0 7px rgba(138,185,138,0); }
    100% { box-shadow: 0 0 0 0 rgba(138,185,138,0); }
}
.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: 9px;
    border: 1px solid var(--border-warm);
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    transition: all .15s ease;
}
.nav-link:hover { color: var(--text); border-color: var(--brand); background: var(--surface-3); }

/* ─────────────  Layout  ───────────── */
.page {
    max-width: 1080px;
    margin: 0 auto;
    padding: clamp(20px, 3vw, 36px) clamp(16px, 4vw, 40px) 64px;
}
.section-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.13em;
    color: var(--text-dim);
    margin: 0 0 14px;
}
.section-label::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--border), transparent);
}

/* ─────────────  Cards  ───────────── */
.card {
    background:
        linear-gradient(180deg, rgba(255,255,255,0.015), transparent 40%),
        var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: clamp(18px, 2.4vw, 26px);
    margin-bottom: 22px;
    box-shadow: var(--shadow);
}
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.card-title {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

/* ─────────────  Stat cards  ───────────── */
.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 26px;
}
.stat {
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.02), transparent 45%),
        var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 18px 20px;
    box-shadow: var(--shadow-sm);
    transition: transform .18s ease, border-color .18s ease;
}
.stat:hover { transform: translateY(-3px); border-color: var(--border-warm); }
.stat::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--accent, var(--brand));
}
.stat-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.stat-label {
    font-size: 0.74rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
}
.stat-icon {
    display: grid; place-items: center;
    width: 30px; height: 30px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--accent, var(--brand)) 18%, transparent);
    color: var(--accent, var(--brand));
}
.stat-icon svg { width: 16px; height: 16px; }
.stat-value {
    font-size: clamp(1.7rem, 3.4vw, 2.15rem);
    font-weight: 750;
    letter-spacing: -0.02em;
    line-height: 1;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.stat-unit { font-size: 0.92rem; font-weight: 600; color: var(--text-dim); margin-left: 3px; }
.stat-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    background: color-mix(in srgb, var(--accent, var(--brand)) 16%, transparent);
    color: var(--accent, var(--brand));
    border: 1px solid color-mix(in srgb, var(--accent, var(--brand)) 35%, transparent);
}
.stat-badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.stat-foot { margin-top: 12px; font-size: 0.74rem; color: var(--text-dim); }

/* Status tones — shared by stat badge + scale marker */
.badge-low   { background: rgba(111,168,220,0.15); color: #8fbfe6; border-color: rgba(111,168,220,0.40); }
.badge-ideal { background: rgba(138,185,138,0.15); color: #9fce9f; border-color: rgba(138,185,138,0.40); }
.badge-high  { background: rgba(224,122,95,0.15);  color: #ec9579; border-color: rgba(224,122,95,0.40); }

/* ─────────────  VPD position scale  ───────────── */
.scale-pref { font-size: 0.82rem; color: var(--text-muted); }
.scale-pref strong { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.scale { padding: 30px 4px 4px; }
.scale-track {
    position: relative;
    height: 14px;
    border-radius: 999px;
    background: linear-gradient(90deg,
        #5e86ad 0%, #6fa8dc 14%, #8ab98a 42%, #c9bd66 62%, #e8b04b 80%, #e07a5f 100%);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.45);
}
.scale-band {
    position: absolute;
    top: -5px; bottom: -5px;
    border-radius: 7px;
    background: rgba(255,255,255,0.06);
    border: 1.5px solid rgba(255,255,255,0.55);
    box-shadow: 0 0 0 1px rgba(0,0,0,0.25), 0 0 14px rgba(159,206,159,0.30);
    pointer-events: none;
}
.scale-marker {
    position: absolute;
    top: 50%;
    width: 18px; height: 18px;
    margin-left: -9px;
    border-radius: 50%;
    background: var(--text);
    border: 3px solid var(--bg);
    transform: translateY(-50%);
    box-shadow: 0 2px 8px rgba(0,0,0,0.6);
    transition: left .5s cubic-bezier(.4,0,.2,1);
}
.scale-marker.m-low   { background: #8fbfe6; }
.scale-marker.m-ideal { background: #9fce9f; }
.scale-marker.m-high  { background: #ec9579; }
.scale-bubble {
    position: absolute;
    bottom: calc(100% + 9px);
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    background: var(--surface-3);
    border: 1px solid var(--border-warm);
    color: var(--text);
    font-size: 0.76rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    padding: 4px 9px;
    border-radius: 7px;
    box-shadow: var(--shadow-sm);
}
.scale-bubble::after {
    content: "";
    position: absolute;
    top: 100%; left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--border-warm);
}
.scale-ticks {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    font-size: 0.74rem;
    color: var(--text-dim);
    font-variant-numeric: tabular-nums;
}
.scale-hint { letter-spacing: 0.02em; }
@media (max-width: 480px) { .scale-hint { display: none; } }

/* ─────────────  Controls  ───────────── */
.field-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 7px;
}
.seg {
    display: inline-flex;
    padding: 4px;
    gap: 3px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 11px;
}
.seg button {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.84rem;
    font-weight: 600;
    padding: 7px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all .15s ease;
    white-space: nowrap;
}
.seg button:hover { color: var(--text); }
.seg button.active {
    background: linear-gradient(180deg, var(--brand), var(--brand-dark));
    color: #1a120a;
    box-shadow: var(--shadow-sm);
}

select, input[type="date"], input[type="text"] {
    width: 100%;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border-warm);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font: inherit;
    font-size: 0.92rem;
    transition: border-color .15s ease, box-shadow .15s ease;
}
select:focus, input:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
input::-webkit-calendar-picker-indicator { filter: invert(0.7) sepia(1) saturate(2) hue-rotate(2deg); cursor: pointer; }

.btn {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 10px 18px;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s ease;
}
.btn-primary {
    background: linear-gradient(180deg, var(--brand), var(--brand-dark));
    color: #1a120a;
    box-shadow: var(--shadow-sm);
}
.btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-ghost {
    background: var(--surface-2);
    border-color: var(--border-warm);
    color: var(--text-muted);
}
.btn-ghost:hover { color: var(--text); border-color: var(--brand); }
.btn-danger {
    background: transparent;
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 45%, transparent);
}
.btn-danger:hover { background: var(--danger-bg); border-color: var(--danger); }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; filter: none; }

/* ─────────────  Graph  ───────────── */
#plotly-graph { height: 470px; }
.graph-empty { color: var(--text-dim); text-align: center; padding: 80px 0; }
.graph-tip {
    margin: 4px 0 0;
    text-align: center;
    font-size: 0.76rem;
    color: var(--text-dim);
}

/* ─────────────  Manage grid  ───────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.stack > * + * { margin-top: 14px; }
.danger-note { font-size: 0.85rem; color: var(--text-dim); margin: 0 0 16px; line-height: 1.55; }
.hint { font-size: 0.8rem; color: var(--text-dim); margin: -4px 0 0; line-height: 1.5; }

/* ─────────────  Table  ───────────── */
.table-scroll {
    max-height: 360px;
    overflow-y: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-soft);
}
.table-scroll::-webkit-scrollbar { width: 10px; }
.table-scroll::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 8px; border: 2px solid var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; font-variant-numeric: tabular-nums; }
thead th {
    position: sticky; top: 0;
    background: var(--surface-3);
    color: var(--text-muted);
    padding: 12px 14px;
    text-align: center;
    font-weight: 600;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}
tbody td {
    padding: 11px 16px;
    text-align: center;
    color: var(--text);
    border-bottom: 1px solid var(--border-soft);
    white-space: nowrap;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:nth-child(even) td { background: rgba(255,255,255,0.012); }
tbody tr:hover td { background: rgba(192,138,79,0.07); }
tbody td:first-child { color: var(--text-muted); }

/* ─────────────  Messages  ───────────── */
.message {
    margin-top: 18px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}
.message.success { background: rgba(138,185,138,0.10); border: 1px solid rgba(138,185,138,0.35); color: #a9d3a9; }
.message.error   { background: var(--danger-bg); border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent); color: #e8a487; }

pre.console {
    display: none;
    margin-top: 16px;
    background: #0c0906;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.82rem;
    color: var(--text-muted);
    white-space: pre-wrap;
    max-height: 220px;
    overflow-y: auto;
}

/* ─────────────  Footer  ───────────── */
.footer {
    text-align: center;
    color: var(--text-dim);
    font-size: 0.8rem;
    padding-top: 22px;
    margin-top: 8px;
    border-top: 1px solid var(--border-soft);
}
.footer strong { color: var(--text-muted); font-weight: 600; }

/* ─────────────  Overlay / spinner  ───────────── */
.overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(10,7,4,0.6);
    backdrop-filter: blur(2px);
    z-index: 9998;
}
.spinner {
    display: none;
    position: fixed; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
}
.spinner .ring {
    width: 46px; height: 46px;
    border: 3px solid rgba(192,138,79,0.25);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─────────────  Settings page  ───────────── */
.settings-head { margin-bottom: 26px; }
.settings-head h1 {
    margin: 0 0 4px;
    font-size: 1.6rem;
    font-weight: 750;
    letter-spacing: -0.02em;
}
.settings-head p { margin: 0; color: var(--text-muted); font-size: 0.92rem; }
.card h2 {
    margin: 0 0 4px;
    font-size: 1.02rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.card-desc { color: var(--text-muted); font-size: 0.88rem; margin: 0 0 20px; }

/* ─────────────  Dual-range VPD slider  ───────────── */
.range-readout {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}
.ro-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 13px;
    border-radius: 999px;
    border: 1px solid;
    font-size: 0.84rem;
    font-weight: 600;
}
.ro-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.ro-pill strong { color: var(--text); font-weight: 750; font-variant-numeric: tabular-nums; font-size: 0.95rem; }
.ro-unit { color: var(--text-dim); font-size: 0.82rem; }

.dual-range { position: relative; height: 34px; margin-top: 6px; }
.dr-rail, .dr-fill {
    position: absolute;
    top: 50%;
    height: 7px;
    transform: translateY(-50%);
    border-radius: 999px;
    pointer-events: none;
}
.dr-rail {
    left: 0; right: 0;
    background: var(--bg);
    border: 1px solid var(--border);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.4);
}
.dr-fill {
    background: linear-gradient(90deg, var(--brand-dark), var(--brand-light));
    box-shadow: 0 0 12px rgba(192,138,79,0.35);
}
.dual-range input[type="range"] {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 34px;
    margin: 0;
    padding: 0;
    background: none;
    border: none;
    -webkit-appearance: none;
    appearance: none;
    pointer-events: none;
}
.dual-range input[type="range"]:focus { outline: none; box-shadow: none; }
.dual-range input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    pointer-events: auto;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: linear-gradient(180deg, #f0d8b8, var(--brand));
    border: 3px solid var(--surface);
    box-shadow: 0 2px 7px rgba(0,0,0,0.6);
    cursor: grab;
    transition: transform .1s ease;
}
.dual-range input[type="range"]::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.12); }
.dual-range input[type="range"]::-moz-range-thumb {
    pointer-events: auto;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--brand-light);
    border: 3px solid var(--surface);
    box-shadow: 0 2px 7px rgba(0,0,0,0.6);
    cursor: grab;
}
.dual-range input[type="range"]::-moz-range-track { background: none; border: none; }
.dr-scale {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    font-size: 0.74rem;
    color: var(--text-dim);
    font-variant-numeric: tabular-nums;
}

/* ─────────────  Responsive  ───────────── */
@media (max-width: 820px) {
    .stats { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
    .stats { grid-template-columns: 1fr 1fr; gap: 12px; }
    .nav-status span.txt { display: none; }
    .brand-sub { display: none; }
}

/* ═══════════════════════════════════════════════════════════
   Bizon Ag Tools — additions (auth, hub, calculator)
   ═══════════════════════════════════════════════════════════ */

/* ─── Number inputs (extend base input styling) ─── */
input[type="number"], input[type="email"], input[type="password"] {
    width: 100%;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border-warm);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font: inherit;
    font-size: 0.92rem;
    transition: border-color .15s ease, box-shadow .15s ease;
}
input[type="number"]:focus, input[type="email"]:focus, input[type="password"]:focus {
    outline: none; border-color: var(--brand); box-shadow: var(--ring);
}
input[type="number"] { font-variant-numeric: tabular-nums; }

/* ─── Auth screen ─── */
.auth-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}
.auth-card {
    width: 100%;
    max-width: 410px;
    background: linear-gradient(180deg, rgba(255,255,255,0.015), transparent 40%), var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: clamp(26px, 4vw, 38px);
    box-shadow: var(--shadow);
}
.auth-brand { display: flex; align-items: center; gap: 13px; margin-bottom: 26px; }
.auth-brand .brand-mark { width: 46px; height: 46px; font-size: 1.2rem; }
.auth-title { margin: 0; font-size: 1.35rem; font-weight: 750; letter-spacing: -0.02em; }
.auth-sub { margin: 4px 0 0; color: var(--text-muted); font-size: 0.9rem; }
.auth-form { margin-top: 24px; }
.auth-form .field-label { margin-top: 16px; }
.auth-form .field-label:first-child { margin-top: 0; }
.auth-switch { margin-top: 20px; text-align: center; font-size: 0.88rem; color: var(--text-muted); }
.auth-switch button {
    background: none; border: none; color: var(--brand-light);
    font: inherit; font-weight: 600; cursor: pointer; padding: 0;
}
.auth-switch button:hover { color: var(--text); }
.auth-divider {
    display: flex; align-items: center; gap: 12px;
    margin: 22px 0; color: var(--text-dim); font-size: 0.78rem;
    text-transform: uppercase; letter-spacing: 0.1em;
}
.auth-divider::before, .auth-divider::after {
    content: ""; flex: 1; height: 1px; background: var(--border);
}

/* ─── Page header ─── */
.page-head { margin-bottom: 26px; }
.page-head h1 { margin: 0 0 5px; font-size: clamp(1.4rem, 3vw, 1.8rem); font-weight: 750; letter-spacing: -0.02em; }
.page-head p { margin: 0; color: var(--text-muted); font-size: 0.94rem; }

/* ─── Tools hub grid ─── */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
}
.tool-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: linear-gradient(180deg, rgba(255,255,255,0.015), transparent 40%), var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow-sm);
    transition: transform .18s ease, border-color .18s ease;
    color: var(--text);
}
.tool-card:hover { transform: translateY(-3px); border-color: var(--brand); color: var(--text); }
.tool-card.disabled { opacity: 0.5; pointer-events: none; }
.tool-ico {
    display: grid; place-items: center;
    width: 44px; height: 44px; border-radius: 11px;
    background: color-mix(in srgb, var(--brand) 18%, transparent);
    color: var(--brand-light);
}
.tool-ico svg { width: 22px; height: 22px; }
.tool-card h3 { margin: 0; font-size: 1.02rem; font-weight: 700; letter-spacing: -0.01em; }
.tool-card p { margin: 0; color: var(--text-muted); font-size: 0.86rem; line-height: 1.5; }
.tool-tag {
    align-self: flex-start; margin-top: auto;
    font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--brand); background: color-mix(in srgb, var(--brand) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--brand) 32%, transparent);
    padding: 3px 9px; border-radius: 999px;
}
.tool-tag.soon { color: var(--text-dim); background: var(--surface-2); border-color: var(--border); }

/* ─── Settings inline grid ─── */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}
.settings-grid .field-label { margin-bottom: 7px; }

/* ─── Ingredient table ─── */
.ingredient-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.ingredient-table thead th {
    position: sticky; top: 0; z-index: 2;
    background: var(--surface-3); color: var(--text-muted);
    padding: 10px 10px; text-align: center; font-weight: 600;
    font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em;
    white-space: nowrap; border-bottom: 1px solid var(--border);
}
.ingredient-table tbody td {
    padding: 7px 8px; text-align: center; border-bottom: 1px solid var(--border-soft);
    color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.ingredient-table tbody tr:hover td { background: rgba(192,138,79,0.05); }
.ingredient-table select, .ingredient-table input {
    padding: 7px 8px; font-size: 0.84rem; min-width: 70px;
}
.ingredient-table select.fert-select { min-width: 170px; text-align: left; }
.ingredient-table input.ppm-input { width: 78px; text-align: center; }
.ingredient-table td.calc-out { color: var(--text-muted); }
.ingredient-table td.row-tools { width: 34px; }
.row-del {
    display: grid; place-items: center; width: 26px; height: 26px;
    border-radius: 7px; border: 1px solid transparent;
    background: transparent; color: var(--text-dim); cursor: pointer;
    transition: all .15s ease;
}
.row-del:hover { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: var(--danger-bg); }
.table-x-scroll { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--border-soft); }
.table-x-scroll::-webkit-scrollbar { height: 10px; }
.table-x-scroll::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 8px; border: 2px solid var(--surface); }

/* ─── Totals / target match ─── */
.npk-targets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.npk-cell {
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 14px 16px;
}
.npk-cell .lbl { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); font-weight: 600; }
.npk-cell .val { font-size: 1.5rem; font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: 4px; }
.npk-cell .tgt { font-size: 0.78rem; color: var(--text-dim); margin-top: 3px; font-variant-numeric: tabular-nums; }

/* Micro results chips */
.micro-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 10px;
}
.micro-chip {
    background: var(--surface-2); border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm); padding: 10px 12px; text-align: center;
}
.micro-chip .el { font-size: 0.74rem; font-weight: 700; color: var(--brand-light); letter-spacing: 0.03em; }
.micro-chip .ppm { font-size: 1.02rem; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; margin-top: 2px; }
.micro-chip .ppm.zero { color: var(--text-dim); font-weight: 600; }
.micro-chip .u { font-size: 0.68rem; color: var(--text-dim); }

/* ─── User menu in nav ─── */
.user-chip {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 0.82rem; color: var(--text-muted);
    padding: 7px 12px; border-radius: 9px;
    border: 1px solid var(--border-soft); background: var(--surface-2);
    max-width: 200px;
}
.user-chip .uavatar {
    display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
    background: linear-gradient(150deg, var(--brand-light), var(--brand-dark));
    color: #1a120a; font-weight: 800; font-size: 0.72rem; flex: 0 0 auto;
}
.user-chip .uemail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.row-add { display:inline-flex; }
.recipe-bar { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.recipe-bar > div { flex: 1; min-width: 160px; }

@media (max-width: 600px) {
    .npk-targets { grid-template-columns: 1fr; }
    .user-chip .uemail { display: none; }
}

/* ─── System bar (calculator) ─── */
.system-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sys-pill {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 0.85rem; color: var(--text); font-weight: 600;
    padding: 7px 13px; border-radius: 999px;
    background: var(--surface-2); border: 1px solid var(--border-warm);
}
.sys-pill .sys-k {
    font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--brand); 
}

/* ─── Concentrate tank summary lines ─── */
.tank-stat {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 0; border-bottom: 1px solid var(--border-soft); font-size: 0.88rem;
}
.tank-stat:last-child { border-bottom: none; }
.tank-stat span { color: var(--text-muted); }
.tank-stat strong { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }

/* ─── Plan badges / paywall ─── */
.nav-plan { display: inline-flex; align-items: center; gap: 10px; }
.plan-badge {
    display: inline-flex; align-items: center;
    font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
    padding: 4px 9px; border-radius: 999px; border: 1px solid;
}
.plan-free  { color: var(--text-dim);    background: var(--surface-2); border-color: var(--border); }
.plan-pro   { color: var(--brand-light); background: color-mix(in srgb, var(--brand) 16%, transparent); border-color: color-mix(in srgb, var(--brand) 38%, transparent); }
.plan-admin { color: #9fce9f;            background: rgba(138,185,138,0.14); border-color: rgba(138,185,138,0.4); }
.nav-upgrade {
    display: inline-flex; align-items: center; padding: 6px 12px; border-radius: 9px;
    font-size: 0.8rem; font-weight: 700;
    color: #1a120a; background: linear-gradient(180deg, var(--brand), var(--brand-dark));
    box-shadow: var(--shadow-sm);
}
.nav-upgrade:hover { color: #1a120a; filter: brightness(1.08); }

/* Pro lock affordance on controls */
.pro-lock {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em;
    color: var(--brand-light); background: color-mix(in srgb, var(--brand) 16%, transparent);
    border: 1px solid color-mix(in srgb, var(--brand) 38%, transparent);
    padding: 2px 7px; border-radius: 999px; margin-left: 8px;
}

/* Upgrade page feature lists */
.plan-list { list-style: none; margin: 0; padding: 0; }
.plan-list li {
    position: relative; padding: 9px 0 9px 28px; font-size: 0.92rem;
    color: var(--text-muted); border-bottom: 1px solid var(--border-soft);
}
.plan-list li:last-child { border-bottom: none; }
.plan-list li::before {
    content: ""; position: absolute; left: 4px; top: 50%; transform: translateY(-50%);
    width: 14px; height: 14px; border-radius: 50%;
    background: var(--surface-3); border: 1px solid var(--border-warm);
}
.plan-list.pro li::before { background: var(--brand); border-color: var(--brand-light); }
.plan-list.pro li strong { color: var(--text); }

/* ─── Growing System hero (homepage) ─── */
.system-hero {
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--brand) 7%, transparent), transparent 55%),
        var(--surface);
    border-color: var(--border-warm);
}
.system-lead { margin: 0 0 18px; color: var(--text-muted); font-size: 0.95rem; line-height: 1.55; max-width: 760px; }
.system-flow { display: flex; align-items: stretch; gap: 14px; flex-wrap: wrap; }
.sys-step {
    position: relative; flex: 1 1 200px; min-width: 200px; margin: 0;
    background: var(--surface-2);
}
.sys-step .step-no {
    position: absolute; top: 14px; right: 14px;
    display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
    font-size: 0.74rem; font-weight: 800; color: #1a120a;
    background: linear-gradient(150deg, var(--brand-light), var(--brand-dark));
}
.flow-arrow {
    display: flex; align-items: center; justify-content: center;
    color: var(--brand); font-size: 1.5rem; font-weight: 700; flex: 0 0 auto;
}
@media (max-width: 760px) {
    .flow-arrow { display: none; }
    .sys-step { flex-basis: 100%; }
}
