@import url("icons-outline.css");   /* outline icons (Tabler) in place of filled Font Awesome */
/* ============================================================================
   AgriStack — Global stylesheet
   Design system per specification §66. Material-inspired: generous spacing,
   soft layered elevation, tonal states, outlined fields, pill navigation.
   Brand tokens (§66) are preserved; only spacing/elevation/derived tokens are
   refined. Every component class the app already uses is kept.
   ========================================================================== */

:root {
    /* ---- Brand tokens (§66 — do not change) ---- */
    --primary:    #377dff;
    --text:       #172033;
    --muted:      #6b7280;
    --border:     #e5e7eb;
    --surface:    #ffffff;
    --background: #f5f6f8;
    --radius:     14px;

    /* ---- Primary ramp / tones ---- */
    --primary-700: #2258c8;
    --primary-600: #2f6ae0;
    --primary-500: #377dff;
    --primary-100: #dce8ff;
    --primary-050: #eef4ff;
    --on-primary:  #ffffff;

    /* ---- Semantic ---- */
    --success: #16a34a;  --success-bg: #e7f6ee;
    --danger:  #dc2626;  --danger-bg:  #fdecec;
    --warning: #d97706;  --warning-bg: #fdf1e3;
    --info:    #0ea5e9;  --info-bg:    #e6f6fe;

    /* ---- Neutral surface tones ---- */
    --surface-1: #ffffff;
    --surface-2: #fafbfc;
    --surface-3: #f2f4f7;
    --hover:     rgba(23, 32, 51, .045);   /* state-layer overlay */
    --line:      #eef1f5;                    /* hairline inside cards */

    /* ---- Radii ---- */
    --radius-xs: 8px;
    --radius-sm: 10px;
    --radius-lg: 18px;
    --radius-pill: 999px;

    /* ---- Material elevation (layered, soft) ---- */
    --elev-0: none;
    --elev-1: 0 1px 2px rgba(23,32,51,.06), 0 1px 3px rgba(23,32,51,.05);
    --elev-2: 0 2px 6px rgba(23,32,51,.06), 0 4px 12px rgba(23,32,51,.06);
    --elev-3: 0 8px 24px rgba(23,32,51,.10), 0 2px 8px rgba(23,32,51,.06);
    /* legacy aliases kept for any inline references */
    --shadow-xs: var(--elev-1);
    --shadow-sm: var(--elev-1);
    --shadow-md: var(--elev-3);

    --focus-ring: 0 0 0 3px rgba(55, 125, 255, .20);

    --sidebar-w: 272px;
    --topbar-h:  66px;

    --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

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

body {
    margin: 0;
    font-family: var(--font-sans);
    background: var(--background);
    color: var(--text);
    font-size: 14px;
    line-height: 1.55;
    letter-spacing: .002em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

h1, h2, h3, h4, h5 { letter-spacing: -.012em; }

::selection { background: var(--primary-100); }

/* Refined scrollbars */
* { scrollbar-width: thin; scrollbar-color: #d3d9e3 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d8dee8; border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #c4ccd9; background-clip: content-box; }

/* =============================================================== Shell === */

.app-shell { display: flex; min-height: 100vh; align-items: stretch; }

.app-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ============================================================= Sidebar === */

.app-sidebar {
    width: var(--sidebar-w);
    --bs-offcanvas-width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 0;
}

@media (min-width: 992px) {
    .app-sidebar {
        flex: 0 0 var(--sidebar-w);
        position: sticky;
        top: 0;
        height: 100vh;
    }
}

.sidebar-brand {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
    flex: 0 0 auto;
}
.brand-link { display: flex; align-items: center; gap: 11px; color: var(--text); font-weight: 700; font-size: 16px; letter-spacing: -.02em; }
.brand-link:hover { color: var(--text); }
.brand-mark {
    width: 36px; height: 36px; border-radius: 10px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    color: #fff; font-size: 16px; box-shadow: var(--elev-1);
}

.sidebar-nav {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 14px 14px 18px;
}

.nav-group-label {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #9aa2b1;
    padding: 18px 14px 8px;
}
.sidebar-nav > .nav-group-label:first-child, .sidebar-nav > .nav-link + .nav-group .nav-group-label { padding-top: 14px; }

/* MD3-style pill navigation items */
.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 10px 14px;
    margin: 2px 0;
    border-radius: var(--radius-pill);
    color: #454e5e;
    font-weight: 500;
    font-size: 13.5px;
    position: relative;
    transition: background-color .16s ease, color .16s ease;
}
.sidebar-nav .nav-link i {
    width: 20px; text-align: center; font-size: 15px;
    color: #9aa2b1; transition: color .16s ease;
}
.sidebar-nav .nav-link:hover { background: var(--surface-3); color: var(--text); }
.sidebar-nav .nav-link:hover i { color: #5b6472; }
.sidebar-nav .nav-link.active { background: var(--primary-050); color: var(--primary-700); font-weight: 600; }
.sidebar-nav .nav-link.active i { color: var(--primary); }
.sidebar-nav .nav-link:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.sidebar-footer { padding: 14px 20px 20px; border-top: 1px solid var(--border); flex: 0 0 auto; }
.badge-module {
    display: inline-block; font-size: 11px; font-weight: 600; color: var(--muted);
    background: var(--surface-3); border: 1px solid var(--border);
    padding: 5px 12px; border-radius: var(--radius-pill);
}

/* ============================================================== Topbar === */

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 22px;
    background: rgba(255, 255, 255, .82);
    backdrop-filter: saturate(180%) blur(10px);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--border);
}

.btn-icon {
    width: 42px; height: 42px; padding: 0;
    display: inline-grid; place-items: center;
    border: 0; border-radius: var(--radius-pill);
    color: #566072; background: transparent;
    transition: background-color .15s ease, color .15s ease;
}
.btn-icon:hover { background: var(--surface-3); color: var(--text); }
.btn-icon:active { background: var(--primary-050); }

/* Topbar search — filled, pill, elevates on focus */
.topbar-search {
    position: relative;
    flex: 1 1 auto;
    max-width: 540px;
}
.topbar-search i {
    position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
    color: #9aa2b1; font-size: 14px; pointer-events: none; transition: color .15s ease;
}
.topbar-search .form-control {
    height: 44px;
    padding-left: 42px;
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
    background: var(--surface-3);
    font-size: 13.5px;
    transition: background-color .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.topbar-search .form-control::placeholder { color: #98a1b0; }
.topbar-search .form-control:focus {
    background: #fff;
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}
.topbar-search .form-control:focus + i,
.topbar-search:focus-within i { color: var(--primary); }

.topbar-actions .notif-badge {
    position: absolute; top: 3px; right: 3px;
    min-width: 18px; height: 18px; padding: 0 5px;
    background: var(--danger); color: #fff;
    font-size: 10px; font-weight: 700; line-height: 18px;
    border-radius: var(--radius-pill); text-align: center;
    box-shadow: 0 0 0 2px #fff;
}

.user-menu-btn {
    display: flex; align-items: center; gap: 9px;
    padding: 5px 10px 5px 6px; border-radius: var(--radius-pill);
    border: 0; background: transparent; color: var(--text);
    transition: background-color .15s ease;
}
.user-menu-btn:hover { background: var(--surface-3); }
.user-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    display: inline-grid; place-items: center; overflow: hidden;
    background: var(--primary-050); color: var(--primary); font-size: 13px; font-weight: 600;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-name { font-size: 13.5px; font-weight: 600; }

/* Notification dropdown */
.notif-menu { width: 356px; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--elev-3); overflow: hidden; }
.notif-menu-head { padding: 14px 18px; font-weight: 600; border-bottom: 1px solid var(--line); }
.notif-menu-body { max-height: 360px; overflow-y: auto; }
.notif-item { display: block; padding: 12px 18px; border-bottom: 1px solid var(--line); color: var(--text); transition: background-color .12s ease; }
.notif-item:hover { background: var(--surface-2); color: var(--text); }
.notif-item.unread { background: var(--primary-050); }
.notif-title { display: block; font-weight: 600; font-size: 13px; }
.notif-text { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.notif-time { display: block; font-size: 11.5px; color: #9aa2b1; margin-top: 3px; }
.notif-empty { text-align: center; padding: 30px 16px; color: var(--muted); }
.notif-empty i { font-size: 24px; color: #c8ced9; }
.notif-empty p { margin: 8px 0 0; font-size: 13px; }
.notif-menu-foot { padding: 12px 16px; text-align: center; border-top: 1px solid var(--line); }
.notif-menu-foot a { font-size: 13px; font-weight: 600; }

/* ============================================================= Content === */

.app-content { flex: 1 1 auto; padding: 28px; }
.content-container { max-width: 1360px; margin: 0 auto; }

.app-breadcrumb { margin-bottom: 10px; }
.app-breadcrumb .breadcrumb { font-size: 12.5px; margin: 0; }
.app-breadcrumb .breadcrumb-item + .breadcrumb-item::before { content: "›"; color: #b8c0cd; padding: 0 2px; }
.app-breadcrumb .breadcrumb-item.active { color: var(--muted); }

.page-header { margin-bottom: 24px; }
.page-title { font-size: 24px; font-weight: 700; margin: 0; letter-spacing: -.02em; }
.page-description { color: var(--muted); margin: 5px 0 0; font-size: 14px; }

/* Demo banner */
.demo-banner {
    display: flex; gap: 12px; align-items: flex-start;
    background: var(--primary-050); border: 1px solid var(--primary-100);
    border-radius: var(--radius); padding: 15px 18px; margin-bottom: 22px;
    font-size: 13.5px; color: #3a4557;
}
.demo-banner i { color: var(--primary); margin-top: 2px; }
.demo-banner strong { color: var(--text); }

/* ============================================================== Panels === */

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--elev-1);
    margin-bottom: 22px;
    overflow: hidden;
    transition: box-shadow .18s ease;
}
.panel.h-100 { margin-bottom: 0; }
.panel-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 16px 22px; border-bottom: 1px solid var(--line);
}
.panel-title { font-size: 15.5px; font-weight: 600; margin: 0; letter-spacing: -.01em; }
.panel-body { padding: 22px; }

.badge-demo {
    font-size: 11px; font-weight: 600; color: var(--warning);
    background: var(--warning-bg); padding: 4px 10px; border-radius: var(--radius-pill);
}

/* ================================================================ KPIs === */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 22px;
}
.kpi-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--elev-1); padding: 18px 20px; display: flex; gap: 16px; align-items: center;
    color: var(--text);
    transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}
a.kpi-card:hover { box-shadow: var(--elev-2); transform: translateY(-2px); border-color: #d7deea; color: var(--text); }
.kpi-icon {
    width: 48px; height: 48px; border-radius: 14px; flex: 0 0 auto;
    display: grid; place-items: center; font-size: 18px;
    background: var(--primary-050); color: var(--primary);
}
.kpi-label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.kpi-value { font-size: 26px; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
.kpi-hint { font-size: 11px; color: #9aa2b1; margin-top: 2px; }

/* ====================================================== Quick actions === */

.quick-actions { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
.quick-action {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
    padding: 20px 12px; border: 1px solid var(--border); border-radius: var(--radius);
    color: #414b5a; background: #fff; text-align: center; font-size: 12.5px; font-weight: 600;
    transition: border-color .16s ease, box-shadow .16s ease, color .16s ease, transform .16s ease;
}
.quick-action i { font-size: 20px; color: var(--primary); }
.quick-action:hover { border-color: transparent; box-shadow: var(--elev-2); color: var(--text); transform: translateY(-2px); }

/* ============================================== Forms, fields & search === */

.form-label { font-size: 13px; font-weight: 600; color: #3a4557; margin-bottom: 6px; }
.form-text { font-size: 12px; color: var(--muted); }

.form-control,
.form-select {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 13px;
    font-size: 13.5px;
    color: var(--text);
    background-color: #fff;
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.form-control::placeholder { color: #9aa1af; }
.form-control:hover:not(:focus),
.form-select:hover:not(:focus) { border-color: #cfd6e2; }
.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
    background-color: #fff;
}
.form-control-sm, .form-select-sm { padding: 7px 11px; font-size: 13px; border-radius: var(--radius-sm); }
.form-control-lg { padding: 12px 16px; font-size: 15px; }
textarea.form-control { line-height: 1.5; }
.form-check-input:focus { border-color: var(--primary); box-shadow: var(--focus-ring); }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }

/* Input groups (search rows across listings) — unified, rounded */
.input-group { border-radius: var(--radius-sm); }
.input-group > .form-control,
.input-group > .form-select { box-shadow: none; }
.input-group .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.input-group > .form-control:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .input-group-text {
    background: var(--surface-3); border-color: var(--border); color: var(--muted); font-size: 13px;
}
.input-group:focus-within { box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }
.input-group:focus-within > .form-control { box-shadow: none; border-color: var(--primary); }
.input-group:focus-within .btn-outline-secondary { border-color: var(--primary); color: var(--primary); }

/* A search input using type=search gets a subtle filled look */
.form-control[type="search"] { background-color: var(--surface-2); }
.form-control[type="search"]:focus { background-color: #fff; }

.invalid-feedback { font-size: 12px; }
.form-control.is-invalid, .form-select.is-invalid { border-color: var(--danger); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 3px rgba(220,38,38,.16); }

/* =============================================================== Tables === */

.table { margin-bottom: 0; }
table.dataTable { border-collapse: collapse !important; }
.table > :not(caption) > * > * { padding: 13px 14px; }
.table thead th {
    font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
    color: #8a93a3; font-weight: 700; border-bottom: 1px solid var(--border);
    background: transparent; white-space: nowrap;
}
.table tbody td { border-bottom: 1px solid var(--line); vertical-align: middle; color: #2b3444; }
.table tbody tr:last-child td { border-bottom: 0; }
.table-hover tbody tr { transition: background-color .12s ease; }
.table-hover tbody tr:hover td { background: var(--surface-2); }
.table code { background: var(--surface-3); padding: 2px 7px; border-radius: 6px; font-size: 12px; color: #3a4557; }

.status-pill {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11.5px; font-weight: 600;
    padding: 4px 11px; border-radius: var(--radius-pill); line-height: 1.3;
}
.status-ok   { color: var(--success); background: var(--success-bg); }
.status-warn { color: var(--warning); background: var(--warning-bg); }
.status-off  { color: var(--danger);  background: var(--danger-bg); }

/* DataTables controls */
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 8px 12px; font-size: 13px; background: #fff;
}
.dataTables_wrapper .dataTables_filter input:focus,
.dataTables_wrapper .dataTables_length select:focus {
    outline: none; border-color: var(--primary); box-shadow: var(--focus-ring);
}
.dataTables_wrapper .dataTables_info { color: var(--muted); font-size: 12.5px; padding-top: 14px; }
.dataTables_wrapper .dataTables_paginate { padding-top: 10px; }
.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: var(--radius-sm) !important; font-size: 13px; border: 0 !important; margin: 0 2px; color: var(--muted) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--surface-3) !important; color: var(--text) !important; border: 0 !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--primary) !important; color: #fff !important; box-shadow: var(--elev-1);
}

/* Bootstrap pagination (partials/pagination.php) */
.pagination { --bs-pagination-color: var(--muted); --bs-pagination-hover-color: var(--text);
    --bs-pagination-hover-bg: var(--surface-3); --bs-pagination-border-color: var(--border);
    --bs-pagination-active-bg: var(--primary); --bs-pagination-active-border-color: var(--primary);
    --bs-pagination-border-radius: var(--radius-sm); --bs-pagination-focus-box-shadow: var(--focus-ring); gap: 4px; }
.page-link { border-radius: var(--radius-sm); }

/* ========================================================= Activity feed === */

.activity-feed { list-style: none; margin: 0; padding: 0; }
.activity-feed li { display: flex; gap: 13px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.activity-feed li:last-child { border-bottom: 0; }
.activity-feed .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); margin-top: 6px; flex: 0 0 auto; box-shadow: 0 0 0 3px var(--primary-050); }
.act-text { display: block; font-size: 13px; }
.act-time { display: block; font-size: 11.5px; color: #9aa2b1; margin-top: 3px; }

/* ========================================================== Empty states === */

.empty-state { text-align: center; padding: 44px 16px; color: var(--muted); }
.empty-state i { font-size: 34px; color: #ccd3df; }
.empty-state p { margin: 14px 0 4px; font-weight: 600; color: var(--text); font-size: 14.5px; }
.empty-state span { font-size: 12.5px; color: var(--muted); display: block; max-width: 380px; margin: 0 auto; }

/* =================================================== Notifications (page) === */

.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-list li { border-bottom: 1px solid var(--line); }
.notif-list li:last-child { border-bottom: 0; }
.notif-list li a { display: flex; align-items: flex-start; gap: 14px; padding: 15px 10px; color: var(--text); transition: background-color .12s ease; }
.notif-list li a:hover { background: var(--surface-2); }
.notif-list li.unread a { background: var(--primary-050); }
.notif-list-icon { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-050); color: var(--primary); flex: 0 0 auto; }
.notif-list-main { flex: 1 1 auto; min-width: 0; }
.notif-list-title { display: block; font-weight: 600; font-size: 13.5px; }
.notif-list-text { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.notif-list-time { font-size: 11.5px; color: #9aa2b1; white-space: nowrap; }

/* =============================================================== Toasts === */

.app-toast {
    min-width: 300px; max-width: 380px;
    border: 1px solid var(--border); border-left-width: 4px;
    border-radius: var(--radius-sm); background: #fff; box-shadow: var(--elev-3);
}
.app-toast .toast-line { display: flex; align-items: flex-start; gap: 11px; padding: 13px 16px; }
.app-toast .toast-ico { font-size: 16px; margin-top: 1px; }
.app-toast .toast-msg { font-size: 13.5px; color: var(--text); flex: 1 1 auto; }
.app-toast.t-success { border-left-color: var(--success); } .app-toast.t-success .toast-ico { color: var(--success); }
.app-toast.t-error   { border-left-color: var(--danger); }  .app-toast.t-error .toast-ico { color: var(--danger); }
.app-toast.t-info    { border-left-color: var(--info); }    .app-toast.t-info .toast-ico { color: var(--info); }
.app-toast.t-warning { border-left-color: var(--warning); } .app-toast.t-warning .toast-ico { color: var(--warning); }

/* ============================================================== Buttons === */

.btn {
    font-size: 13.5px; font-weight: 600; border-radius: var(--radius-sm);
    padding: 9px 18px; letter-spacing: .005em;
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease, color .15s ease, transform .05s ease;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { box-shadow: var(--focus-ring); }
.btn-sm { padding: 6px 13px; font-size: 12.5px; border-radius: var(--radius-xs); }
.btn-lg { padding: 12px 24px; font-size: 15px; }

.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); box-shadow: var(--elev-1); }
.btn-primary:hover { background: var(--primary-600); border-color: var(--primary-600); color: #fff; box-shadow: var(--elev-2); }
.btn-primary:active, .btn-primary:focus { background: var(--primary-700); border-color: var(--primary-700); color: #fff; }

.btn-outline-secondary { color: #4b5563; border-color: var(--border); background: #fff; }
.btn-outline-secondary:hover { background: var(--surface-3); color: var(--text); border-color: #d3dae5; }
.btn-outline-primary { color: var(--primary); border-color: var(--primary-100); background: var(--primary-050); }
.btn-outline-primary:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-success { background: var(--success); border-color: var(--success); }
.btn-success:hover { background: #138a3f; border-color: #138a3f; }
.btn-outline-danger { color: var(--danger); border-color: #f3c9c9; }
.btn-outline-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-outline-warning { color: var(--warning); border-color: #f3ddba; }
.btn-outline-warning:hover { background: var(--warning); border-color: var(--warning); color: #fff; }

/* Dropdown menus */
.dropdown-menu { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--elev-3); padding: 6px; font-size: 13.5px; }
.dropdown-item { border-radius: var(--radius-xs); padding: 8px 12px; }
.dropdown-item:hover, .dropdown-item:focus { background: var(--surface-3); color: var(--text); }
.dropdown-item.active, .dropdown-item:active { background: var(--primary); color: #fff; }
.dropdown-divider { border-color: var(--line); }

/* =============================================================== Cards === */

.card { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--elev-1); }

/* Generic Bootstrap alerts, softened */
.alert { border-radius: var(--radius); border: 1px solid transparent; font-size: 13.5px; padding: 13px 16px; }
.alert-success { background: var(--success-bg); border-color: #cdecd9; color: #14683a; }
.alert-danger  { background: var(--danger-bg);  border-color: #f4cccc; color: #a12020; }
.alert-warning { background: var(--warning-bg); border-color: #f2dcbb; color: #8a5410; }
.alert-info    { background: var(--info-bg);    border-color: #c8ebfb; color: #0b6a92; }

/* ============================================================== Modals === */

.modal-content { border: 0; border-radius: var(--radius-lg); box-shadow: var(--elev-3); }
.modal-header, .modal-footer { border-color: var(--line); padding: 16px 20px; }
.modal-body { padding: 20px; }
.modal-title { font-size: 16.5px; font-weight: 700; }

/* ============================================================ Utilities === */

.text-muted { color: var(--muted) !important; }
hr { border-color: var(--line); opacity: 1; }
dl.row dt { font-weight: 600; color: #3a4557; }
dl.row dd { color: #2b3444; }
.badge.text-bg-light { background: var(--surface-3) !important; color: #4b5563 !important; border-color: var(--border) !important; font-weight: 600; }

/* ========================================================== Responsive === */

@media (max-width: 1199px) {
    .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .quick-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
    .app-content { padding: 18px; }
    .page-title { font-size: 21px; }
    .panel-body { padding: 18px; }
}
@media (max-width: 575px) {
    .app-content { padding: 14px; }
    .kpi-grid { grid-template-columns: 1fr; }
    .quick-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .topbar-search { max-width: none; }
    .user-name { display: none; }
}

/* Accessibility: respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

/* ============================== Animal icon system (shared everywhere) === */
.animal-icon { display: inline-block; vertical-align: middle; color: #7a8794; }
.animal-icon.gender-female  { color: #d6336c; }
.animal-icon.gender-male    { color: #1c7ed6; }
.animal-icon.gender-unknown { color: #7a8794; }
.animal-avatar { display: inline-flex; align-items: center; justify-content: center; background: var(--surface-3); border-radius: 12px; overflow: hidden; flex: 0 0 auto; }
.animal-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ============================================ Top bar: search results ==== */
.topbar-actions { margin-left: auto; flex: 0 0 auto; }
.topbar-search-results {
    position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 1050;
    max-height: 70vh; overflow: auto; padding: 6px;
    background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--elev-3);
}
.topbar-search-results .sr-group { padding: 8px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: .03em; color: var(--muted); }
.topbar-search-results .sr-group i { position: static; transform: none; margin-right: 6px; font-size: 11px; }
.topbar-search-results a { display: block; padding: 7px 10px; border-radius: 9px; color: var(--text); text-decoration: none; font-size: 13.5px; }
.topbar-search-results a small { color: var(--muted); margin-left: 6px; }
.topbar-search-results a:hover, .topbar-search-results a.is-active { background: var(--primary-050); }
.topbar-search-results .sr-empty, .topbar-search-results .sr-all { padding: 9px 10px; font-size: 13px; color: var(--muted); }
.topbar-search-results .sr-all { border-top: 1px solid var(--line); margin-top: 4px; }

/* ================================================== Photos on records ==== */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.gallery-item { position: relative; margin: 0; border-radius: 12px; overflow: hidden; background: var(--surface-3); aspect-ratio: 4 / 3; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s ease; }
.gallery-item a:hover img { transform: scale(1.03); }
.gallery-item.is-cover { box-shadow: 0 0 0 2px var(--primary); }
.gallery-cover-badge { position: absolute; left: 6px; top: 6px; font-size: 10.5px; font-weight: 700; background: var(--primary); color: #fff; padding: 2px 7px; border-radius: 6px; }
.gallery-actions { position: absolute; right: 6px; bottom: 6px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s ease; }
.gallery-item:hover .gallery-actions, .gallery-item:focus-within .gallery-actions { opacity: 1; }
.gallery-actions .btn { padding: 2px 7px; }
.gallery-files li { padding: 6px 0; border-top: 1px solid var(--line); }
.gallery-modal { background: #0f1420; border: 0; position: relative; padding: 10px; }
.gallery-modal img { max-width: 100%; max-height: 78vh; margin: 0 auto; display: block; border-radius: 8px; }
.gallery-modal .btn-close { position: absolute; right: 14px; top: 14px; z-index: 2; }
.gallery-modal-nav { display: flex; justify-content: center; align-items: center; gap: 14px; padding: 10px 0 2px; color: #cfd6e4; font-size: 13px; }
@media (hover: none) { .gallery-actions { opacity: 1; } }

/* thumbnails in lists and cards */
.rec-thumb { width: 38px; height: 38px; border-radius: 10px; object-fit: cover; background: var(--surface-3); flex: 0 0 38px; }
.rec-thumb-ph { width: 38px; height: 38px; border-radius: 10px; display: inline-grid; place-items: center; background: var(--primary-050); color: var(--primary); flex: 0 0 38px; }

/* ================================================== Farm business ======== */
.biz-hero { display: flex; gap: 18px; align-items: center; }
.biz-logo { width: 72px; height: 72px; border-radius: 18px; object-fit: cover; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 26px; font-weight: 700; flex: 0 0 72px; }
.farm-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.farm-card { border: 1px solid var(--border); border-radius: 16px; overflow: hidden; background: #fff; display: flex; flex-direction: column; color: inherit; text-decoration: none; transition: box-shadow .15s ease, transform .15s ease; }
.farm-card:hover { box-shadow: var(--elev-3); transform: translateY(-2px); color: inherit; }
.farm-card-img { aspect-ratio: 16 / 9; background: linear-gradient(135deg, #e3eefc, #eaf6ec); display: grid; place-items: center; color: var(--primary); font-size: 30px; }
.farm-card-img img { width: 100%; height: 100%; object-fit: cover; }
.farm-card-body { padding: 14px 16px 16px; }
.farm-card-body h3 { font-size: 16px; font-weight: 700; margin: 0 0 2px; }
.farm-card-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.people-list { list-style: none; margin: 0; padding: 0; }
.people-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.people-list li:first-child { border-top: 0; }
.person-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--primary-050); color: var(--primary); display: grid; place-items: center; font-weight: 700; flex: 0 0 40px; font-size: 14px; }
.role-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--surface-3); color: #4b5563; }
.role-chip.is-owner { background: #fff1d6; color: #8a5a00; }
.role-chip.is-manager { background: var(--primary-050); color: var(--primary); }
.role-chip.is-leader { background: #e2f5ea; color: #1f7a4b; }
.role-chip.is-worker { background: #f1eefc; color: #5b45b0; }
.farm-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 2px 9px; border-radius: 8px; background: var(--surface-3); color: #3a4557; margin: 2px 4px 2px 0; }
.loc-map-link { font-size: 12.5px; }

/* ---- List toolbars (filters, search, export, add) ------------------------------------------- */
/* the small select kept its text under the arrow: give the arrow its own room */
.form-select-sm { padding-right: 30px; background-position: right 10px center; background-size: 12px 9px; }
.panel-head { flex-wrap: wrap; row-gap: 12px; }
.panel-head > .panel-title { flex: 0 0 auto; white-space: nowrap; }
.panel-head > .d-flex:last-child { flex: 1 1 auto; justify-content: flex-end; flex-wrap: wrap; align-items: center; row-gap: 8px; }
.panel-head form[role=search] { flex: 1 1 auto; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 8px !important; min-width: 0; }
.panel-head form[role=search] .form-select-sm { width: auto; max-width: 210px; min-width: 120px; flex: 0 1 auto; text-overflow: ellipsis; }
.panel-head form[role=search] .input-group { flex: 0 1 230px; width: 230px; max-width: 100% !important; flex-wrap: nowrap; }
.panel-head form[role=search] .input-group .form-control { min-width: 0; }
/* one height for every control in the bar */
.panel-head .form-select-sm,
.panel-head .input-group-sm > .form-control,
.panel-head .input-group-sm > .btn,
.panel-head > .d-flex > .btn-sm,
.panel-head > .d-flex > form > .btn-sm { height: 36px; line-height: 1.2; padding-top: 0; padding-bottom: 0; display: inline-flex; align-items: center; }
.panel-head .input-group-sm > .btn { justify-content: center; width: 38px; }
.panel-head > .d-flex > .btn-sm { white-space: nowrap; flex: 0 0 auto; }
@media (max-width: 767.98px) {
    .panel-head { padding: 14px 16px; }
    .panel-head > .d-flex:last-child { justify-content: flex-start; }
    .panel-head form[role=search] { flex: 1 1 100%; justify-content: flex-start; }
    .panel-head form[role=search] .form-select-sm { flex: 1 1 140px; max-width: none; }
    .panel-head form[role=search] .input-group { flex: 1 1 100%; width: auto; }
}

/* ---- One-click switches in lists (status, priority) ------------------------------------------ */
.quick-form { display: inline; margin: 0; }
.quick-switch {
    appearance: none; -webkit-appearance: none; border: 1px solid transparent; cursor: pointer;
    padding: 3px 24px 3px 10px; font: inherit; font-size: 12px; font-weight: 600; line-height: 1.5;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23667085' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat; background-position: right 8px center; background-size: 9px 9px;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.quick-switch:not([class*="status-"]) { background-color: #f1f3f5; color: #344054; }
.quick-switch:hover { border-color: rgba(16, 24, 40, .18); }
.quick-switch:focus { outline: none; box-shadow: var(--focus-ring); }

/* ---- Due for watering strip ------------------------------------------------------------------- */
.due-strip { border-left: 4px solid var(--primary); }
.due-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.due-item { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; padding: 14px 22px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); }
.due-item .due-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 4px; }
.due-item .due-actions form { margin: 0; }
@media (max-width: 575.98px) { .due-list { grid-template-columns: 1fr; } .due-item { padding: 12px 16px; border-right: 0; } }

/* ---- Earnings & Risk ---------------------------------------------------------------------------- */
.earn-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.earn-kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius, 14px); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.earn-kpi span { font-size: 12.5px; color: #667085; }
.earn-kpi strong { font-size: 22px; font-weight: 700; letter-spacing: -.01em; color: #101828; }
.earn-kpi small { font-size: 12px; color: #98a2b3; }
.earn-kpi.is-profit strong { color: #1f9d55; }
.earn-kpi.is-loss strong { color: #d64545; }
.earn-riskbar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; gap: 2px; margin: 8px 0 4px; background: #f2f4f7; }
.earn-riskbar i { display: block; }
.lv-high { background: #d64545; } .lv-medium { background: #d99a06; } .lv-low { background: #1f9d55; }
.txt-high { color: #b42318; } .txt-medium { color: #a15c07; }
.earn-chart { position: relative; width: 100%; }
.earn-meter { flex: 1 1 auto; max-width: 140px; height: 6px; background: #f2f4f7; border-radius: 3px; overflow: hidden; }
.earn-meter i { display: block; height: 100%; border-radius: 3px; }
.earn-factor { line-height: 1.45; }
.earn-factor .fx-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.earn-ico { width: 34px; height: 34px; border-radius: 50%; background: #f2f4f7; display: inline-flex; flex: 0 0 34px; padding: 4px; }
.earn-ico svg { width: 100%; height: 100%; }
.earn-table td { vertical-align: top; padding-top: 14px; padding-bottom: 14px; }
@media print { .earn-chart { break-inside: avoid; } }

/* ---- Sidebar: hide on desktop, collapsible groups ---------------------------------------------- */
@media (min-width: 992px) {
    .app-sidebar { transition: margin-left .22s ease, visibility .22s; }
    .sb-closed .app-sidebar { margin-left: calc(-1 * var(--sidebar-w)); visibility: hidden; }
}
#sidebarToggle { margin-right: 4px; }
.nav-group-toggle {
    display: flex; align-items: center; justify-content: space-between; width: 100%;
    background: none; border: 0; text-align: left; cursor: pointer; border-radius: 8px;
}
.nav-group-toggle:hover { color: #667085; background: rgba(16, 24, 40, .03); }
.nav-group-toggle:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.nav-group-toggle i { font-size: 9px; transition: transform .2s ease; opacity: .7; }
.nav-group.is-closed .nav-group-toggle i { transform: rotate(-90deg); }
.nav-group.is-closed .nav-group-items { display: none; }
@media (prefers-reduced-motion: reduce) { .app-sidebar, .nav-group-toggle i { transition: none; } }

/* ---- Earnings & Risk: owner view ---------------------------------------------------------------- */
.own-tabs { display: inline-flex; background: #f2f4f7; border-radius: 12px; padding: 4px; gap: 4px; }
.own-tabs a { padding: 8px 16px; border-radius: 9px; font-weight: 600; font-size: 14px; color: #475467; text-decoration: none; }
.own-tabs a span { font-weight: 500; color: #98a2b3; margin-left: 4px; }
.own-tabs a.is-on { background: #fff; color: #101828; box-shadow: 0 1px 2px rgba(16, 24, 40, .08); }
.own-summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 22px 24px; }
.own-sentence { font-size: 18px; line-height: 1.6; color: #344054; max-width: 62ch; }
.own-sentence b { color: #101828; white-space: nowrap; }
.own-sentence b.pos, .own-nums b.pos { color: #1f7a45; }
.own-sentence b.neg, .own-nums b.neg { color: #c0392b; }
.own-counts { display: flex; gap: 10px; }
.own-count { min-width: 104px; border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; align-items: flex-start; }
.own-count b { font-size: 26px; line-height: 1.1; color: #101828; }
.own-count span:last-child { font-size: 12.5px; color: #475467; font-weight: 600; }
.own-dot { font-size: 14px; }
.lv-bg-high { background: #fdecec; } .lv-bg-medium { background: #fdf4e3; } .lv-bg-low { background: #e8f6ee; }
.own-todo { list-style: none; margin: 0; padding: 0; }
.own-todo li { display: grid; grid-template-columns: minmax(170px, 220px) minmax(0, 1fr) 150px; gap: 16px; align-items: center; padding: 14px 22px; border-top: 1px solid var(--line); }
.own-todo li:first-child { border-top: 0; }
.own-todo-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.own-problem { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 3px 0; }
.own-problem form { margin: 0; }
.own-todo-money { text-align: right; }
.own-h2 { font-size: 16px; font-weight: 600; margin: 0 0 12px; }
.own-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.own-card { background: #fff; border: 1px solid var(--line); border-left: 4px solid #d0d5dd; border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.own-card header { display: flex; align-items: flex-start; gap: 10px; }
.own-card .min-w-0 { min-width: 0; }
.lv-edge-high { border-left-color: #d64545; } .lv-edge-medium { border-left-color: #d99a06; } .lv-edge-low { border-left-color: #1f9d55; }
.own-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; background: #f9fafb; border-radius: 10px; padding: 10px 12px; }
.own-nums span { display: block; font-size: 11.5px; color: #667085; }
.own-nums b { font-size: 14px; color: #101828; }
.own-why { margin: 0; padding-left: 18px; color: #475467; }
.own-why li { margin: 2px 0; }
.own-ok { color: #1f7a45; }
.own-card footer { margin-top: auto; border-top: 1px dashed var(--line); padding-top: 8px; }
.own-how { margin: 18px 0 6px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; }
.own-how summary { cursor: pointer; font-weight: 600; color: #344054; }
.own-how p { margin: 10px 0 0; max-width: 90ch; }
@media (max-width: 991.98px) {
    .own-summary { grid-template-columns: 1fr; }
    .own-todo li { grid-template-columns: 1fr; gap: 8px; }
    .own-todo-money { text-align: left; }
}
@media (max-width: 575.98px) { .own-counts { flex-wrap: wrap; } .own-count { min-width: 0; flex: 1 1 30%; } .own-sentence { font-size: 16px; } }
.own-card .status-pill, .own-todo-money .status-pill { white-space: nowrap; flex: 0 0 auto; }

/* ---- Expenses ------------------------------------------------------------------------------------ */
.exp-strip { display: grid; grid-template-columns: repeat(3, minmax(150px, 200px)) minmax(0, 1fr); gap: 12px; }
.exp-tile { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.exp-tile span { display: block; font-size: 12.5px; color: #667085; }
.exp-tile b { font-size: 20px; color: #101828; }
.exp-tile.is-due b { color: #c0392b; }
.exp-bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; gap: 2px; background: #f2f4f7; margin: 8px 0 6px; }
.exp-bar i { display: block; min-width: 3px; }
.exp-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: #475467; }
.exp-legend i, .exp-dot { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; vertical-align: 0; }
.exp-legend b { color: #101828; font-weight: 600; }
.exp-legend em { font-style: normal; color: #98a2b3; }
.exp-head { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 20px; align-items: start; }
.exp-total span { display: block; font-size: 12.5px; color: #667085; }
.exp-total b { display: block; font-size: 24px; color: #101828; line-height: 1.2; }
.exp-total small { color: #667085; }
@media (max-width: 991.98px) { .exp-strip { grid-template-columns: repeat(3, 1fr); } .exp-strip .exp-tile-wide { grid-column: 1 / -1; } .exp-head { grid-template-columns: 1fr; } }
@media (max-width: 575.98px) { .exp-strip { grid-template-columns: 1fr 1fr; } }
.exp-sold { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); } .exp-sold span { display: block; font-size: 12.5px; color: #667085; } .exp-sold b { display: block; font-size: 18px; color: #1f7a45; } .exp-sold small { font-weight: 600; }

/* ---- Cash book & supplier credit ---------------------------------------------------------------- */
.cb-accounts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.cb-acc { display: flex; flex-direction: column; gap: 2px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; color: inherit; text-decoration: none; transition: border-color .15s ease, box-shadow .15s ease; }
.cb-acc:hover { border-color: #b2c7f5; color: inherit; }
.cb-acc.is-on { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(55, 125, 255, .12); }
.cb-acc span { font-size: 13px; color: #475467; font-weight: 600; }
.cb-acc b { font-size: 20px; color: #101828; }
.cb-acc small { color: #98a2b3; font-size: 12px; }
.cb-all { background: #f5f8ff; }
.cb-sum { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border-bottom: 1px solid var(--line); }
.cb-sum > div { background: #fff; padding: 12px 22px; }
.cb-sum span { display: block; font-size: 12px; color: #667085; }
.cb-sum b { font-size: 17px; color: #101828; }
.cb-sum .pos b { color: #1f7a45; } .cb-sum .neg b { color: #c0392b; }
.cb-sum-card { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.pay-list { display: flex; flex-direction: column; gap: 10px; }
.pay-item { margin: 0; }
.pay-item summary { list-style: none; display: grid; grid-template-columns: minmax(0, 1fr) auto 150px 20px; gap: 14px; align-items: center; padding: 14px 22px; cursor: pointer; }
.pay-item summary::-webkit-details-marker { display: none; }
.pay-who b { display: block; font-size: 15px; }
.pay-owed { text-align: right; font-size: 17px; color: #c0392b; }
.pay-caret { color: #98a2b3; transition: transform .2s ease; }
.pay-item[open] .pay-caret { transform: rotate(180deg); }
.pay-body { padding: 0 22px 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.pay-form { display: grid; grid-template-columns: 140px 150px minmax(140px, 1fr) minmax(140px, 1fr) auto; gap: 10px; background: #f9fafb; border-radius: 10px; padding: 12px; }
@media (max-width: 767.98px) { .cb-sum { grid-template-columns: 1fr 1fr; } .pay-form { grid-template-columns: 1fr 1fr; } .pay-item summary { grid-template-columns: 1fr auto; } .pay-owed { grid-column: 1 / -1; text-align: left; } .pay-caret { display: none; } }

/* ---- Payroll ----------------------------------------------------------------------------------- */
.pr-table td { vertical-align: top; padding-top: 12px; }
.pr-table .pr-done td { opacity: .6; }
.pr-table input.form-control-sm { min-width: 100px; }
.pr-foot { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.pr-foot > div { min-width: 150px; }

/* ---- Season profit & loss ----------------------------------------------------------------------- */
.sp-table td, .sp-table th { white-space: nowrap; }
.sp-table .sp-total { background: #f9fafb; font-weight: 600; }
.sp-table .sp-head td { background: #f2f4f7; font-size: 11.5px; font-weight: 700; color: #475467; padding-top: 8px; }
.sp-table .sp-sub td { font-weight: 600; border-top: 1px solid #d0d5dd; }
.sp-table .sp-profit td { font-weight: 700; font-size: 15px; border-top: 2px solid #98a2b3; }
.sp-delta { font-size: 11.5px; font-weight: 700; margin-left: 4px; }
.sp-delta.up { color: #1f7a45; } .sp-delta.down { color: #c0392b; }
.own-count b { font-size: 20px; }
.exit-box summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.exit-box summary::-webkit-details-marker { display: none; }
.exit-box[open] summary .fa-chevron-down { transform: rotate(180deg); }

/* ---- Crop plan ---------------------------------------------------------------------------------- */
.cp-table td { vertical-align: top; padding-top: 12px; padding-bottom: 12px; }
.cp-chip { display: inline-flex; flex-direction: column; margin: 0 6px 6px 0; padding: 5px 10px; border-radius: 10px; font-size: 12.5px; text-decoration: none; line-height: 1.25; border: 1px solid transparent; }
.cp-chip small { font-size: 11px; opacity: .75; }
.cp-past { background: #f2f4f7; color: #475467; }
.cp-now { background: #e8f6ee; color: #1f7a45; border-color: #bfe5cd; }
.cp-next { background: #eef4ff; color: #2f5fc4; border-color: #c7d7fe; border-style: dashed; }

/* ---- Weather ------------------------------------------------------------------------------------ */
.wx-farms { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.wx-days { display: grid; grid-template-columns: repeat(7, minmax(44px, 1fr)); gap: 6px; }
.wx-day { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 10px; background: #f9fafb; text-align: center; }
.wx-day small { font-size: 11px; color: #667085; white-space: nowrap; }
.wx-day i { font-size: 18px; color: #e48a2e; margin: 2px 0; }
.wx-day.is-rain { background: #eef4ff; } .wx-day.is-rain i { color: #2f6fde; }
.wx-day b { font-size: 14px; color: #101828; line-height: 1; }
.wx-day span { font-size: 11.5px; color: #98a2b3; }
.wx-day em { font-style: normal; font-size: 11px; color: #2f6fde; }

/* ---- Weather ------------------------------------------------------------------------------------ */
.wx-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.wx-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; margin-bottom: 8px; }
.wx-now { font-size: 13px; color: #475467; }
.wx-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.wx-day { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 2px; border-radius: 10px; background: #f9fafb; font-size: 12px; }
.wx-day.is-today { background: #eef4ff; }
.wx-day span { color: #667085; font-weight: 600; }
.wx-day i { font-style: normal; font-size: 20px; line-height: 1.3; }
.wx-day b { font-size: 13px; color: #101828; }
.wx-day small { color: #98a2b3; }
.wx-day em { font-style: normal; font-size: 11px; color: #98a2b3; }
.wx-day em.wet { color: #1d6fd6; font-weight: 600; }
.wx-warn { list-style: none; padding: 0; margin: 8px 0 0; font-size: 12.5px; }
.wx-warn li { padding: 5px 8px; border-radius: 8px; margin-top: 4px; }
.wx-rain { background: #eaf2ff; color: #1d4f9c; } .wx-frost { background: #eef7fb; color: #0b6b8f; }
.wx-heat { background: #fdecec; color: #a12a2a; } .wx-wind { background: #f4f1fb; color: #5b3fa8; }

/* ---------- Satellite Map ---------- */
.fm-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 12px; }
.fm-bar select { min-width: 190px; }
.fm-seg { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.fm-seg .btn { border: 1px solid var(--border); background: #fff; color: var(--text); border-radius: 999px; padding: 3px 12px; }
.fm-seg .btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.fm-counts { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.fm-chip { border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 3px 12px 3px 9px; font-size: .85rem; display: inline-flex; align-items: center; gap: 6px; }
.fm-chip::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.fm-chip b { color: var(--text); }
.fm-chip.fmlv-high { color: #dc2626; } .fm-chip.fmlv-medium { color: #d97706; } .fm-chip.fmlv-ok { color: #16a34a; }
.fm-chip.active { box-shadow: 0 0 0 2px currentColor inset; }
.fm-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 14px; align-items: stretch; }
.fm-map-box { position: relative; border-radius: 14px; overflow: hidden; border: 1px solid var(--border); background: #1f2a1f; }
#fmMap { height: calc(100vh - 230px); min-height: 460px; }
#fmMap.is-editing { cursor: crosshair; }
.fm-side { height: calc(100vh - 230px); min-height: 460px; overflow-y: auto; margin: 0; }
@media (max-width: 991.98px) { .fm-wrap { grid-template-columns: 1fr; } #fmMap { height: 62vh; min-height: 340px; } .fm-side { height: auto; max-height: none; } .fm-counts { margin-left: 0; } }
.fm-list-head { font-size: .78rem; font-weight: 600; color: var(--text-muted, #6b7280); padding: 12px 14px 6px; position: sticky; top: 0; background: #fff; z-index: 1; border-bottom: 1px solid var(--border); }
.fm-row { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--border); background: #fff; padding: 10px 14px; }
.fm-row:hover, .fm-row.is-sel { background: var(--surface-3, #f3f4f6); }
.fm-row:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.fm-row > i { margin-top: 4px; }
.fm-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.15); }
.fm-row-main { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.fm-row-sub { font-size: .8rem; color: var(--text-muted, #6b7280); }
.fm-row-adv { font-size: .82rem; line-height: 1.35; margin-top: 2px; }
.fm-row-adv.fmlv-high { color: #b91c1c; } .fm-row-adv.fmlv-medium { color: #b45309; } .fm-row-adv.fmlv-info { color: #1d4ed8; } .fm-row-adv.fmlv-ok { color: #15803d; }
#fmDetail { padding: 14px 16px 18px; }
.fm-det-head { position: relative; padding-right: 26px; margin-bottom: 6px; }
.fm-det-head .btn-close { position: absolute; right: 0; top: 2px; }
.fm-det-head h3 { font-size: 1.2rem; margin: 4px 0 2px; }
.fm-crop { margin-top: 6px; font-size: .9rem; } .fm-crop i { color: #16a34a; }
.fm-badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; color: #fff; }
.fm-badge.fmlv-high { background: #dc2626; } .fm-badge.fmlv-medium { background: #d97706; } .fm-badge.fmlv-info { background: #2563eb; } .fm-badge.fmlv-ok { background: #16a34a; }
#fmDetail h4 { font-size: .82rem; font-weight: 600; color: var(--text-muted, #6b7280); margin: 16px 0 6px; }
.fm-adv { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.fm-adv li { display: flex; gap: 10px; padding: 8px 10px; border-radius: 10px; font-size: .88rem; line-height: 1.4; border-left: 4px solid; }
.fm-adv li i { margin-top: 3px; width: 16px; text-align: center; }
.fm-adv .fmlv-high { background: #fef2f2; border-color: #dc2626; } .fm-adv .fmlv-high i { color: #dc2626; }
.fm-adv .fmlv-medium { background: #fffbeb; border-color: #f59e0b; } .fm-adv .fmlv-medium i { color: #d97706; }
.fm-adv .fmlv-info { background: #eff6ff; border-color: #3b82f6; } .fm-adv .fmlv-info i { color: #2563eb; }
.fm-adv .fmlv-ok { background: #f0fdf4; border-color: #16a34a; } .fm-adv .fmlv-ok i { color: #16a34a; }
.fm-now { font-size: .9rem; } .fm-now-ic { font-size: 1.3rem; vertical-align: -3px; margin-right: 4px; }
.fm-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 8px; }
.fm-days > div { display: flex; flex-direction: column; align-items: center; background: var(--surface-3, #f3f4f6); border-radius: 8px; padding: 5px 2px; font-size: .74rem; line-height: 1.25; }
.fm-days span { color: var(--text-muted, #6b7280); } .fm-days i { font-style: normal; font-size: 1.05rem; } .fm-days b { font-size: .82rem; } .fm-days small { color: var(--text-muted, #6b7280); }
.fm-days em { font-style: normal; color: var(--text-muted, #6b7280); } .fm-days em.wet { color: #1d4ed8; font-weight: 600; }
.fm-facts { list-style: none; padding: 0; margin: 0; font-size: .88rem; display: grid; gap: 5px; }
.fm-facts i { width: 18px; color: #2563eb; margin-right: 4px; } .fm-facts .fm-dot { margin-right: 6px; vertical-align: -1px; }
.fm-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.fm-edit { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border); }
.fm-editbar { position: absolute; left: 50%; transform: translateX(-50%); top: 12px; z-index: 1000; background: #fff; border-radius: 12px; box-shadow: 0 6px 24px rgba(0,0,0,.25); padding: 8px 12px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: .88rem; max-width: calc(100% - 24px); }
.fm-editbar[hidden] { display: none; }
.fm-legend { background: rgba(255,255,255,.94); border-radius: 10px; padding: 8px 10px; font-size: .76rem; line-height: 1.5; box-shadow: 0 2px 10px rgba(0,0,0,.2); }
.fm-legend b { display: block; margin-bottom: 2px; } .fm-legend span { display: flex; align-items: center; gap: 6px; }
.fm-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.leaflet-tooltip.fm-label { background: transparent; border: 0; box-shadow: none; color: #fff; font-weight: 600; font-size: 12px; text-align: center; line-height: 1.15; text-shadow: 0 1px 3px #000, 0 0 2px #000; padding: 0; }
.leaflet-tooltip.fm-label::before { display: none; }
.leaflet-tooltip.fm-label small { font-weight: 500; font-size: 11px; }
.leaflet-tooltip.fm-label.is-dim { opacity: .45 !important; }
.leaflet-tooltip.fm-farm-label { background: rgba(17,24,39,.8); color: #fff; border: 0; font-weight: 600; border-radius: 6px; }
.leaflet-tooltip.fm-farm-label::before { border-top-color: rgba(17,24,39,.8); }
.fm-locate { width: 34px; height: 34px; display: grid !important; place-items: center; background: #fff; color: #333; font-size: 15px; }
.fm-toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #111827; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 2000; font-size: .9rem; box-shadow: 0 6px 20px rgba(0,0,0,.3); transition: opacity .4s; }
.fm-toast.out { opacity: 0; }

.fm-zoom-low .leaflet-tooltip.fm-label { display: none; }
.fm-zoom-high .leaflet-tooltip.fm-farm-label { display: none; }
@media (max-width: 575.98px) { .fm-legend { font-size: .7rem; padding: 6px 8px; } }

/* ---------- Farm Map tabs (Satellite / Layout / Live 3D) ---------- */
.fmap-tabs { display: inline-flex; gap: 4px; padding: 4px; background: #fff; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 14px; flex-wrap: wrap; position: relative; z-index: 5; }
.fmap-tab { display: inline-flex; align-items: center; gap: 8px; padding: 7px 16px; border-radius: 9px; color: var(--text); text-decoration: none; font-weight: 500; font-size: .92rem; }
.fmap-tab i { color: var(--text-muted, #6b7280); }
.fmap-tab:hover { background: var(--surface-3, #f3f4f6); color: var(--text); }
.fmap-tab.is-on { background: var(--primary); color: #fff; }
.fmap-tab.is-on i { color: #fff; }
.fmap-tab:focus-visible { outline: none; box-shadow: var(--focus-ring); }


/* ==========================================================================
   Modern layout (v3) — after the reference: slim floating icon rail in
   white pill groups (opens with labels on hover), floating top bar pills,
   big headline, flat white bento cards, stat cards with the icon top-right
   and one brand-colour hero card, dark "selected" pills.
   Shape and layout only — colours come from the tokens above.
   ========================================================================== */
:root {
    --rail-w: 76px;
    --shell-gap: 14px;
    --card-r: 24px;
    --tile-r: 18px;
    --flat: 0 1px 2px rgba(23, 32, 51, .035);
    --lift: 0 10px 30px rgba(23, 32, 51, .10), 0 2px 6px rgba(23, 32, 51, .05);
    --ink: var(--text);
}
body { background: var(--background); }

/* ---------- Icon rail (desktop) ---------- */
@media (min-width: 992px) {
    .app-shell { display: block; }
    .app-sidebar {
        position: fixed !important;
        left: var(--shell-gap); top: var(--shell-gap); bottom: var(--shell-gap);
        width: var(--rail-w); height: auto !important;
        background: transparent; border: 0; box-shadow: none;
        z-index: 1035; overflow: visible;
        transition: width .2s ease, transform .22s ease, visibility .22s;
    }
    .app-main { margin-left: calc(var(--rail-w) + var(--shell-gap) * 2); min-height: 100vh; transition: margin-left .22s ease; }
    .sb-closed .app-sidebar { margin-left: 0; transform: translateX(calc(-1 * (var(--rail-w) + var(--shell-gap) * 2))); }
    .sb-closed .app-main { margin-left: var(--shell-gap); }

    .sidebar-brand { height: auto; padding: 0 0 12px; border: 0; justify-content: flex-start; }
    .brand-link { gap: 12px; }
    .brand-mark { width: var(--rail-w); height: var(--rail-w); border-radius: 50%; font-size: 22px; box-shadow: var(--flat); flex: 0 0 auto; }
    .brand-text { display: none; font-size: 17px; white-space: nowrap; }

    .sidebar-nav {
        display: flex; flex-direction: column; gap: 12px;
        padding: 0 0 4px; overflow-y: auto; overflow-x: hidden;
        scrollbar-width: none;
    }
    .sidebar-nav::-webkit-scrollbar { display: none; }

    /* every group is its own white pill, like the reference */
    .sidebar-nav > .nav-link,
    .sidebar-nav .nav-group {
        background: var(--surface); border-radius: 38px; box-shadow: var(--flat);
        padding: 8px; margin: 0; flex: 0 0 auto;
    }
    .sidebar-nav .nav-group-items { display: flex; flex-direction: column; gap: 4px; }
    .sidebar-nav .nav-group-toggle { display: none; }
    .app-sidebar:not(:hover):not(:focus-within) .nav-group.is-closed .nav-group-items { display: flex; }

    .sidebar-nav .nav-link {
        width: 60px; height: 60px; padding: 0; margin: 0 auto;
        justify-content: center; gap: 0; border-radius: 50%;
        white-space: nowrap; overflow: hidden;
    }
    .sidebar-nav .nav-group .nav-link { width: 44px; height: 44px; }
    .sidebar-nav > .nav-link { width: var(--rail-w); height: var(--rail-w); padding: 0; }
    .sidebar-nav .nav-link i { font-size: 16px; width: 20px; color: #6b7280; }
    .sidebar-nav .nav-link span { display: none; }
    .sidebar-nav .nav-link:hover { background: var(--surface-3); }
    .sidebar-nav .nav-link.active { background: var(--ink); color: #fff; box-shadow: none; }
    .sidebar-nav .nav-link.active i { color: #fff; }
    .sidebar-footer { display: none; }

    /* hover or keyboard focus opens the rail with labels, over the page */
    .app-sidebar:hover, .app-sidebar:focus-within { width: 264px; }
    .app-sidebar:hover .brand-text, .app-sidebar:focus-within .brand-text { display: inline; }
    .app-sidebar:hover .sidebar-nav > .nav-link, .app-sidebar:focus-within .sidebar-nav > .nav-link,
    .app-sidebar:hover .sidebar-nav .nav-group, .app-sidebar:focus-within .sidebar-nav .nav-group { border-radius: 24px; box-shadow: var(--lift); }
    .app-sidebar:hover .sidebar-nav .nav-link, .app-sidebar:focus-within .sidebar-nav .nav-link {
        width: 100%; height: 42px; padding: 0 14px; margin: 0; justify-content: flex-start; gap: 12px; border-radius: 14px;
    }
    .app-sidebar:hover .sidebar-nav > .nav-link, .app-sidebar:focus-within .sidebar-nav > .nav-link { height: 56px; padding: 0 22px; }
    .app-sidebar:hover .sidebar-nav .nav-link span, .app-sidebar:focus-within .sidebar-nav .nav-link span { display: inline; }
    .app-sidebar:hover .sidebar-nav .nav-group-toggle, .app-sidebar:focus-within .sidebar-nav .nav-group-toggle { display: flex; padding: 8px 12px 6px; }
    .app-sidebar:hover .sidebar-footer, .app-sidebar:focus-within .sidebar-footer { display: block; padding: 4px 0 0; border: 0; }
    .badge-module { border: 0; background: var(--surface); }
}

/* ---------- Top bar: floating pills ---------- */
.app-topbar {
    background: transparent; border: 0;
    backdrop-filter: none; -webkit-backdrop-filter: none;
    height: auto; padding: var(--shell-gap) 26px 6px 0; gap: 12px;
    position: relative;
}
.app-topbar .btn-icon { width: 46px; height: 46px; background: var(--surface); box-shadow: var(--flat); }
.app-topbar .btn-icon:hover { background: var(--surface-3); }
.topbar-search { max-width: 460px; }
.topbar-search .form-control { height: 48px; background: var(--surface); border-color: transparent; box-shadow: var(--flat); }
.topbar-actions { gap: 10px !important; }
.topbar-actions > .notif-dd {
    background: var(--surface); border-radius: 999px; padding: 3px; box-shadow: var(--flat);
}
.topbar-actions > .notif-dd .btn-icon { box-shadow: none; width: 42px; height: 42px; }
.user-menu-btn { background: var(--surface); box-shadow: var(--flat); height: 52px; padding: 6px 16px 6px 6px; gap: 10px; }
.user-menu-btn:hover { background: var(--surface); box-shadow: var(--lift); }
.user-avatar { width: 40px; height: 40px; }
.user-name { font-size: 14px; }

/* ---------- Content and headline ---------- */
.app-content { padding: 12px 26px 32px 0; }
.content-container { max-width: 1480px; }
.app-breadcrumb { display: none; }
.page-header { margin: 12px 0 26px; }
.page-title { font-size: 40px; font-weight: 600; letter-spacing: -.035em; line-height: 1.1; }
.page-description { font-size: 15px; margin-top: 8px; }

/* ---------- Flat white bento cards ---------- */
.panel, .card { border: 0 !important; border-radius: var(--card-r); box-shadow: var(--flat); }
.panel { margin-bottom: 16px; }
.panel-head { border-bottom: 0; padding: 22px 24px 4px; }
.panel-title { font-size: 18px; font-weight: 600; letter-spacing: -.02em; }
.panel-body { padding: 16px 24px 24px; }
.card-header { background: transparent; border-bottom: 0; padding: 22px 24px 4px; }
.card-body { padding: 16px 24px 24px; }
.demo-banner, .alert { border: 0; border-radius: var(--tile-r); }
.row.g-3, .row.g-4 { --bs-gutter-x: 16px; --bs-gutter-y: 16px; }

/* ---------- Stat cards: label top-left, icon top-right, big number ---------- */
.kpi-grid { gap: 16px; margin-bottom: 16px; }
.kpi-card {
    position: relative; flex-direction: column; align-items: flex-start; gap: 0;
    min-height: 142px; padding: 20px 22px;
    border: 0; border-radius: var(--card-r); box-shadow: var(--flat); overflow: hidden;
}
a.kpi-card:hover { box-shadow: var(--lift); transform: translateY(-2px); }
.kpi-icon {
    position: absolute; top: 16px; right: 16px;
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--surface-3); color: var(--ink); font-size: 15px;
}
.kpi-label { font-size: 14px; font-weight: 500; color: var(--muted); padding-right: 48px; }
.kpi-value { font-size: 34px; font-weight: 600; letter-spacing: -.035em; margin-top: 22px; line-height: 1.05; }
.kpi-hint { margin-top: 10px; }
/* the first stat is the hero card in the brand colour */
.kpi-grid > .kpi-card:first-child {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    color: var(--on-primary);
}
.kpi-grid > .kpi-card:first-child::after {
    content: ""; position: absolute; right: -40px; bottom: -60px; width: 200px; height: 200px; border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,.22), rgba(255,255,255,0) 70%); pointer-events: none;
}
.kpi-grid > .kpi-card:first-child .kpi-label { color: rgba(255,255,255,.85); }
.kpi-grid > .kpi-card:first-child .kpi-icon { background: rgba(255,255,255,.2); color: #fff; }
.kpi-grid > .kpi-card:first-child .kpi-hint { color: rgba(255,255,255,.75); }
.quick-action { border: 0; border-radius: var(--tile-r); box-shadow: var(--flat); }
.quick-action:hover { box-shadow: var(--lift); }
.exp-tile, .cb-sum > div { border-radius: var(--tile-r) !important; }

/* ---------- Tables: rounded grey header band, light rows ---------- */
.table thead th {
    background: var(--surface-3); border-bottom: 0;
    text-transform: none; letter-spacing: 0;
    font-size: 13px; font-weight: 500; color: var(--muted);
    padding-top: 12px !important; padding-bottom: 12px !important;
}
.table thead th:first-child { border-radius: 14px 0 0 14px; }
.table thead th:last-child { border-radius: 0 14px 14px 0; }
.table tbody td { border-bottom: 1px solid var(--line); }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: var(--surface-2); --bs-table-hover-bg: var(--surface-2); }
.panel .table-responsive, .card .table-responsive { padding: 0 16px 8px; }
.status-pill { padding: 5px 12px; }

/* ---------- Buttons, inputs, dropdowns ---------- */
.btn { border-radius: 999px; }
.btn-primary { box-shadow: none; }
.btn-outline-secondary, .btn-light { background: var(--surface-3); border-color: transparent; }
.btn-outline-secondary:hover, .btn-light:hover { background: #e8ecf1; border-color: transparent; }
.table .btn-sm, .table .btn-outline-secondary, .table .btn-outline-danger, .table .btn-outline-primary {
    width: 34px; height: 34px; padding: 0; display: inline-grid; place-items: center; border-radius: 50%;
}
.form-control, .form-select { border-radius: 14px; }
.form-control-sm, .form-select-sm { border-radius: 12px; }
.input-group > .form-control:first-child { border-radius: 999px 0 0 999px; }
.input-group .btn { border-radius: 0 999px 999px 0; }
.input-group:focus-within { border-radius: 999px; }
.dropdown-menu { border: 0; border-radius: 18px; box-shadow: var(--lift); padding: 6px; }
.dropdown-item { border-radius: 12px; }
.notif-menu { border-radius: 20px; }
.modal-content { border: 0; border-radius: var(--card-r); box-shadow: var(--lift); }
.pagination .page-link { border: 0; border-radius: 999px !important; margin: 0 2px; }

/* ---------- Tabs and filters: white track, dark selected pill ---------- */
.nav-pills, .own-tabs, .fmap-tabs {
    display: inline-flex; flex-wrap: wrap; gap: 4px !important;
    background: var(--surface); padding: 5px; border: 0; border-radius: 999px; box-shadow: var(--flat);
}
.nav-pills .nav-link, .own-tabs a, .fmap-tab { border-radius: 999px; padding: 8px 18px; font-weight: 500; color: var(--ink); }
.nav-pills .nav-link:hover, .own-tabs a:hover, .fmap-tab:hover { background: var(--surface-3); color: var(--ink); }
.nav-pills .nav-link.active, .own-tabs a.is-on, .fmap-tab.is-on { background: var(--ink); color: #fff; box-shadow: none; }
.nav-pills .nav-link.active .badge, .own-tabs a.is-on span, .fmap-tab.is-on i { color: #fff; }
.nav-pills .nav-link.active .badge { background: rgba(255,255,255,.2) !important; }
.fm-seg .btn { border-color: transparent; background: var(--surface); box-shadow: var(--flat); }
.fm-seg .btn.active { background: var(--ink); color: #fff; }
.fm-chip { border-color: transparent; box-shadow: var(--flat); }
.fm-map-box, .fm-side { border: 0; border-radius: var(--card-r); box-shadow: var(--flat); }

/* ---------- Phones and tablets: the usual slide-out menu, tighter spacing ---------- */
@media (max-width: 991.98px) {
    .app-topbar { padding: 12px 14px 4px; }
    .app-content { padding: 6px 14px 24px; }
    .page-title { font-size: 30px; }
    .panel-head { padding: 18px 18px 4px; }
    .panel-body { padding: 14px 18px 18px; }
    .panel .table-responsive, .card .table-responsive { padding: 0 8px 4px; }
}
@media (min-width: 992px) {
    .brand-mark { width: 60px; height: 60px; font-size: 19px; margin-left: 8px; }
    .sidebar-nav > .nav-link { width: 60px; height: 60px; margin-left: 8px; }
    .app-sidebar:hover .sidebar-nav > .nav-link, .app-sidebar:focus-within .sidebar-nav > .nav-link { margin-left: 0; }
}
.nav-pills .nav-link.active .badge { color: #fff !important; }
@media (min-width: 992px) {
    .app-sidebar:hover, .app-sidebar:focus-within {
        background: var(--background); border-radius: 30px; box-shadow: var(--lift);
        padding: 0 10px 10px; margin: -0px; left: calc(var(--shell-gap) - 10px); width: 284px;
    }
    .app-sidebar:hover .brand-mark, .app-sidebar:focus-within .brand-mark { margin-left: 0; }
    .app-sidebar:hover .sidebar-brand, .app-sidebar:focus-within .sidebar-brand { padding-top: 0; }
}
@media (max-width: 991.98px) {
    .nav-pills, .own-tabs, .fmap-tabs { flex-wrap: nowrap; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
    .nav-pills::-webkit-scrollbar, .own-tabs::-webkit-scrollbar, .fmap-tabs::-webkit-scrollbar { display: none; }
    .nav-pills .nav-link, .own-tabs a, .fmap-tab { white-space: nowrap; }
}
@media (min-width: 992px) {
    .app-sidebar:hover, .app-sidebar:focus-within { background-image: linear-gradient(var(--background), var(--background)); }
}
@media (max-width: 991.98px) {
    .nav-pills, .own-tabs, .fmap-tabs { flex-wrap: nowrap !important; }
}

/* Toasts: the container ignores clicks (Bootstrap), the toast itself must take them so × works */
.app-toast { pointer-events: auto; }
#toastContainer { top: 72px !important; z-index: 1095; }
.app-toast { border-radius: 16px; border-top: 0; border-right: 0; border-bottom: 0; box-shadow: var(--lift, var(--elev-3)); }
.app-toast .btn-close { flex: 0 0 auto; opacity: .55; }
.app-toast .btn-close:hover { opacity: 1; }

/* Show / hide password (eye button added by app.js to every password box) */
.pw-wrap { position: relative; }
.pw-wrap > .form-control { padding-right: 46px; }
.pw-eye {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%); z-index: 3;
    width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; color: #8a93a3;
    display: grid; place-items: center; cursor: pointer;
}
.pw-eye:hover { background: var(--surface-3); color: var(--text); }
.pw-eye:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* ==========================================================================
   Modern layout (v3) — page-by-page pass: every module's own blocks get the
   same flat white bento look, and the rail has no drop shadows.
   ========================================================================== */

/* Rail: no shadows on the pills; one soft shadow only on the opened menu */
@media (min-width: 992px) {
    .sidebar-nav > .nav-link, .sidebar-nav .nav-group, .brand-mark { box-shadow: none !important; }
    .app-sidebar:hover .sidebar-nav > .nav-link, .app-sidebar:focus-within .sidebar-nav > .nav-link,
    .app-sidebar:hover .sidebar-nav .nav-group, .app-sidebar:focus-within .sidebar-nav .nav-group { box-shadow: none !important; }
    .app-sidebar:hover, .app-sidebar:focus-within { box-shadow: 0 20px 50px rgba(23, 32, 51, .14); }
    .sidebar-nav .nav-link:not(.active):hover { background: var(--surface-3); }
}

/* Secondary buttons: white pills on the grey page, grey pills inside white cards */
.btn-outline-secondary, .btn-light { background: var(--surface); color: var(--text); }
.btn-outline-secondary:hover, .btn-light:hover { background: var(--surface); color: var(--primary); box-shadow: var(--flat); }
.panel .btn-outline-secondary, .card .btn-outline-secondary, .modal .btn-outline-secondary, .dropdown-menu .btn-outline-secondary,
.panel .btn-light, .card .btn-light { background: var(--surface-3); }
.panel .btn-outline-secondary:hover, .card .btn-outline-secondary:hover { background: #e8ecf1; color: var(--text); box-shadow: none; }
.btn-sm { padding: 6px 14px; font-weight: 500; }
.btn-outline-primary { border-color: transparent; }
.btn-outline-danger, .btn-outline-warning { background: var(--surface); }
.table .btn-link, .table .btn-sm { white-space: nowrap; }
.page-actions .btn, .content-container > .d-flex .btn { height: 38px; display: inline-flex; align-items: center; }

/* Card titles: the leading icon sits in a small round chip */
.panel-title > i:first-child, .panel-head > h2 > i:first-child, .panel-head > h3 > i:first-child {
    width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center;
    background: var(--surface-3); font-size: 13px; margin-right: 10px !important; vertical-align: -1px;
}

/* Summary strips and figure tiles (expenses, cash book, payroll, supplier credit, earnings, milk) */
.exp-strip, .cb-sum, .cb-accounts, .earn-kpis { gap: 14px; }
.exp-tile, .cb-acc, .earn-kpi, .cb-sum > div {
    background: var(--surface); border: 0 !important; border-radius: var(--card-r) !important;
    box-shadow: var(--flat); padding: 18px 20px;
}
.exp-tile span, .cb-acc span, .earn-kpi span, .cb-sum span { font-size: 13px; font-weight: 500; color: var(--muted); }
.exp-tile b, .cb-acc b, .earn-kpi strong, .cb-sum b { display: block; font-size: 24px; font-weight: 600; letter-spacing: -.03em; margin-top: 6px; }
.cb-sum { background: transparent; border: 0; }
.cb-sum-card { border: 0; border-radius: 0; overflow: visible; }
.panel > .cb-sum { padding: 0 16px 14px; }
.panel > .cb-sum > div { background: var(--surface-2); box-shadow: none; }
.cb-acc.is-on { box-shadow: 0 0 0 2px var(--ink); }
.cb-acc:hover { box-shadow: var(--lift); }

/* Owner pages (Earnings & Risk, Season P&L) */
.own-summary { border: 0; border-radius: var(--card-r); box-shadow: var(--flat); padding: 26px 28px; }
.own-card { border: 0; border-left: 4px solid #d0d5dd; border-radius: var(--tile-r); box-shadow: var(--flat); }
.own-how { border: 0; border-radius: var(--tile-r); }

/* Farms, business, people */
.farm-card { border: 0; border-radius: var(--card-r); box-shadow: var(--flat); }
.farm-card:hover { box-shadow: var(--lift); }
.farm-cards .farm-card-img { border-radius: 18px; margin: 8px 8px 0; }
.biz-logo { border-radius: 50%; }
.people-list li { border-top-color: var(--line); padding: 12px 0; }
.role-chip { padding: 3px 10px; }

/* Watering-due strip and crop plan chips */
.due-strip { border-left: 0; }
.due-strip .panel-head .panel-title { color: var(--text); }
.due-list { gap: 10px; padding: 0 16px 16px; }
.due-item { border: 0; border-radius: var(--tile-r); background: var(--surface-2); padding: 14px 16px; }
.cp-chip { border-radius: 12px; }

/* Supplier credit rows */
.pay-list { gap: 12px; }
.pay-item.panel { margin: 0; }
.pay-body { border-top: 0; }
.pay-form { border-radius: var(--tile-r); }

/* Season profit & loss table */
.sp-table .sp-head td { background: var(--surface-3); }
.sp-table .sp-head td:first-child { border-radius: 12px 0 0 12px; } .sp-table .sp-head td:last-child { border-radius: 0 12px 12px 0; }
.sp-table .sp-sub td { border-top-color: var(--border); }

/* Weather */
.wx-day { border-radius: 14px; background: var(--surface-2); }
.wx-warn li { border-radius: 12px; }

/* Notifications page: rounded rows with space between */
.notif-list { display: flex; flex-direction: column; gap: 6px; }
.notif-list li { border-bottom: 0 !important; }
.notif-list li a { border-radius: var(--tile-r); padding: 14px 16px; }
.notif-list li.unread a { background: var(--primary-050); }
.notif-list-icon { background: var(--surface); }
.notif-list li:not(.unread) .notif-list-icon { background: var(--surface-3); }

/* Empty states */
.empty-state i { width: 64px; height: 64px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--surface-3); font-size: 24px; color: #9aa2b1; }

/* Gallery / photos */
.gallery-item { border-radius: var(--tile-r); }
.rec-thumb, .rec-thumb-ph { border-radius: 12px; }

/* Forms: section labels and helper rows */
.form-section-title, .panel-body h6.text-uppercase, .panel-body .text-uppercase.small {
    text-transform: none !important; letter-spacing: 0 !important; font-size: 15px !important; font-weight: 600 !important; color: var(--text) !important;
}
.form-check-input { border-radius: 6px; }
.form-switch .form-check-input { border-radius: 999px; }
hr { border-color: var(--line); opacity: 1; }

/* Modules page cards */
.modules-grid .card, .module-card { border: 0; border-radius: var(--card-r); box-shadow: var(--flat); }
.chip { border-radius: 999px; }

/* Badges */
.badge { border-radius: 999px; font-weight: 600; padding: .4em .7em; }

/* Farm Map layout editor frame */
.farm-editor { border: 0 !important; border-radius: var(--card-r) !important; box-shadow: var(--flat) !important; overflow: hidden; }
.fe-toolbar { border-bottom-color: var(--line) !important; padding: 12px 14px !important; }
.fe-btn { border-radius: 999px !important; }
.fe-palette { background: var(--surface) !important; border-right-color: var(--line) !important; }
.fe-panel { border-left-color: var(--line) !important; }
.fe-stage { background: var(--surface-2) !important; }

/* Leaflet controls on the satellite map */
.leaflet-bar { border: 0 !important; border-radius: 14px !important; overflow: hidden; box-shadow: var(--flat) !important; }
.fm-legend { border-radius: 16px; }
.mod-grid .mod-card { border: 0 !important; border-radius: var(--card-r) !important; box-shadow: var(--flat) !important; padding: 20px !important; }
.mod-grid .mod-card.is-on { box-shadow: inset 0 0 0 1px #b7e4c7, var(--flat) !important; }
.mod-grid .mod-card .mod-icon { border-radius: 50% !important; }
.mod-group-title { text-transform: none !important; letter-spacing: 0 !important; font-size: 16px !important; font-weight: 600 !important; color: var(--text) !important; }

/* History import */
.imp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 16px; }
@media (max-width: 575.98px) { .imp-grid { grid-template-columns: 1fr; } }
.imp-card { margin: 0; }
.imp-step { width: 32px; height: 32px; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center; background: var(--ink, var(--text)); color: #fff; font-weight: 600; font-size: 13px; }
.imp-title { font-size: 16px; font-weight: 600; margin: 4px 0 4px; }
.imp-cols { display: flex; flex-wrap: wrap; gap: 4px; }
.imp-cols span { font-size: 11.5px; background: var(--surface-3); border-radius: 999px; padding: 2px 9px; color: var(--muted); }
.imp-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.imp-form .form-control { flex: 1 1 180px; width: auto; }
.fm-route-opts { display: inline-flex; gap: 6px; }
.fm-route-opts .form-select { width: auto; }
.fm-route-opts .form-control { width: 190px; }
.tw-pin span { width: 100%; height: 100%; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 13px; border: 2px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.35); }
/* Carbon */
.cb-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) 60px; gap: 12px; align-items: center; margin: 10px 0; font-size: 14px; }
.cb-row b { text-align: right; }
.cb-bar { height: 14px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.cb-bar span { display: block; height: 100%; border-radius: 999px; }
.cb-bar .is-good { background: #16a34a; } .cb-bar .is-good2 { background: #f59e0b; } .cb-bar .is-bad { background: #dc2626; }
.cb-practices { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.cb-practices li { display: flex; gap: 10px; align-items: flex-start; }
.cb-practices li i { margin-top: 3px; } .cb-practices .is-yes i { color: #16a34a; } .cb-practices .is-no i { color: #9ca3af; } .cb-practices .is-ask i { color: #f59e0b; }
.cb-practices b { display: block; font-size: 14px; font-weight: 600; } .cb-practices small { color: var(--muted); }
/* Devices */
.dv-kinds li { display: flex; gap: 12px; align-items: flex-start; padding: 6px 0; }
.dv-kinds li i { width: 20px; margin-top: 3px; color: var(--muted); text-align: center; }
.dv-kinds li b { display: block; font-weight: 600; }
.dv-code { background: var(--surface-3); border-radius: 12px; padding: 12px 14px; font-size: 12px; white-space: pre-wrap; word-break: break-all; margin-bottom: 10px; }
.dv-now { font-size: 18px; font-weight: 600; margin-bottom: 16px; }
.dv-dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; }
.dv-dl dt { color: var(--muted); font-weight: 500; } .dv-dl dd { margin: 0; word-break: break-word; }
.dv-chart { display: flex; align-items: flex-end; gap: 3px; height: 200px; }
.dv-chart span { flex: 1 1 0; min-width: 2px; background: #2563eb; border-radius: 4px 4px 0 0; }
.dv-chart span:hover { background: var(--text); }
.dv-kind-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.dv-kind-opt { position: relative; cursor: pointer; margin: 0; }
.dv-kind-opt input { position: absolute; opacity: 0; }
.dv-kind-opt span { display: flex; flex-direction: column; gap: 2px; height: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.dv-kind-opt span i { color: var(--muted); margin-bottom: 4px; } .dv-kind-opt small { color: var(--muted); font-size: 12px; }
.dv-kind-opt input:checked + span { border-color: var(--text); box-shadow: 0 0 0 1px var(--text); }
.dv-kind-opt input:focus-visible + span { outline: 2px solid var(--text); outline-offset: 2px; }

/* ==========================================================================
   Large screens and a smoother menu (v3.1)
   ========================================================================== */

/* ---------- Extra-large screens: use the width instead of a centred column ---------- */
@media (min-width: 1600px) {
    .content-container { max-width: none; margin: 0; }
    .app-content { padding-right: 32px; }
    .app-topbar { padding-right: 32px; }
}
@media (min-width: 1920px) {
    :root { --shell-gap: 18px; }
    .app-content { padding: 14px 40px 40px 8px; }
    .app-topbar { padding-right: 40px; padding-left: 8px; }
    .topbar-search { max-width: 560px; }
    .page-header { margin: 16px 0 30px; }
    .row.g-3 { --bs-gutter-x: 1.25rem; --bs-gutter-y: 1.25rem; }
    .mod-grid { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)) !important; gap: 18px !important; }
    .farm-cards, .own-cards { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
    .wx-farms, .wx-grid { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
    .fm-wrap #fmMap { height: 74vh; }
}
@media (min-width: 2400px) {
    .app-content { padding-right: 56px; padding-left: 16px; }
    .app-topbar { padding-right: 56px; padding-left: 16px; }
    body { font-size: 15px; }
}
/* long text keeps a readable line length however wide the page gets */
.page-header p, .page-description, .panel-body > p { max-width: 110ch; }

/* ---------- Smooth menu open / close ----------
   Labels are always in the layout and fade in, sizes and paddings animate, and a short
   pause before opening / closing stops the menu flickering when the mouse passes over it. */
@media (min-width: 992px) {
    .app-sidebar {
        --sb-ease: cubic-bezier(.32, .72, 0, 1);
        --sb-t: .34s;
        --sb-wait: .14s;            /* pause before closing */
        transition: width var(--sb-t) var(--sb-ease) var(--sb-wait), transform .3s var(--sb-ease), visibility .3s;
        will-change: width;
    }
    .app-sidebar:hover, .app-sidebar:focus-within { --sb-wait: .06s; }   /* pause before opening */

    .sidebar-nav > .nav-link, .sidebar-nav .nav-group {
        transition: border-radius var(--sb-t) var(--sb-ease) var(--sb-wait), box-shadow var(--sb-t) var(--sb-ease) var(--sb-wait);
    }

    /* links: fixed left-aligned layout in both states, so only sizes change */
    .sidebar-nav .nav-link {
        justify-content: flex-start;
        transition: width var(--sb-t) var(--sb-ease) var(--sb-wait), height var(--sb-t) var(--sb-ease) var(--sb-wait),
                    padding var(--sb-t) var(--sb-ease) var(--sb-wait), margin var(--sb-t) var(--sb-ease) var(--sb-wait),
                    border-radius var(--sb-t) var(--sb-ease) var(--sb-wait), gap var(--sb-t) var(--sb-ease) var(--sb-wait),
                    background-color .15s ease, color .15s ease;
    }
    .sidebar-nav .nav-group .nav-link { margin: 0 0 0 8px; padding: 0 0 0 12px; }
    .sidebar-nav > .nav-link { margin: 0; padding: 0 0 0 28px; }
    .sidebar-nav .nav-link i { flex: 0 0 20px; text-align: center; }

    .sidebar-nav .nav-link span,
    .app-sidebar .brand-text {
        display: inline !important; opacity: 0; transform: translateX(-6px);
        transition: opacity .16s ease, transform .2s var(--sb-ease);
        pointer-events: none;
    }
    .app-sidebar:hover .sidebar-nav .nav-link span, .app-sidebar:focus-within .sidebar-nav .nav-link span,
    .app-sidebar:hover .brand-text, .app-sidebar:focus-within .brand-text {
        opacity: 1; transform: none; pointer-events: auto;
        transition: opacity .22s ease calc(var(--sb-wait) + .1s), transform .28s var(--sb-ease) calc(var(--sb-wait) + .08s);
    }
    .brand-link { overflow: hidden; }

    /* group headings slide open instead of popping in */
    .sidebar-nav .nav-group-toggle {
        display: flex !important; max-height: 0; padding: 0 12px !important; opacity: 0; overflow: hidden; pointer-events: none;
        transition: max-height var(--sb-t) var(--sb-ease) var(--sb-wait), padding var(--sb-t) var(--sb-ease) var(--sb-wait), opacity .15s ease;
    }
    .app-sidebar:hover .sidebar-nav .nav-group-toggle, .app-sidebar:focus-within .sidebar-nav .nav-group-toggle {
        max-height: 40px; padding: 8px 12px 6px !important; opacity: 1; pointer-events: auto;
        transition: max-height var(--sb-t) var(--sb-ease) var(--sb-wait), padding var(--sb-t) var(--sb-ease) var(--sb-wait), opacity .2s ease calc(var(--sb-wait) + .1s);
    }

    /* open state, same sizes as before */
    .app-sidebar:hover .sidebar-nav .nav-link, .app-sidebar:focus-within .sidebar-nav .nav-link { margin: 0; padding: 0 14px; }
    .app-sidebar:hover .sidebar-nav > .nav-link, .app-sidebar:focus-within .sidebar-nav > .nav-link { padding: 0 22px; }
}
@media (min-width: 992px) and (prefers-reduced-motion: reduce) {
    .app-sidebar, .app-sidebar *, .app-sidebar *::before { transition-duration: 0s !important; transition-delay: 0s !important; }
}
/* Cameras */
.cam-cols { display: inline-flex; background: var(--surface); border-radius: 999px; padding: 3px; box-shadow: var(--flat); }
.cam-cols .btn { border: 0; border-radius: 999px; min-width: 34px; color: var(--muted); }
.cam-cols .btn.active { background: var(--ink); color: #fff; }
.cam-wall { display: grid; grid-template-columns: repeat(var(--cam-cols, 3), minmax(0, 1fr)); gap: 14px; }
.cam-tile { position: relative; display: block; background: #12161d; border-radius: var(--tile-r, 18px); overflow: hidden; aspect-ratio: 16 / 9; color: #fff; box-shadow: var(--flat); isolation: isolate; }
.cam-link { position: absolute; inset: 0; z-index: 2; border-radius: inherit; }
.cam-link:focus-visible { outline: 3px solid #fff; outline-offset: -3px; }
.cam-media, .cam-img { position: absolute; inset: 0; width: 100%; height: 100%; }
.cam-img { object-fit: cover; border: 0; display: block; background: #12161d; }
.cam-main .cam-img, .cam-tile:fullscreen .cam-img { object-fit: contain; }
.cam-tile:fullscreen { border-radius: 0; aspect-ratio: auto; }
.cam-loading, .cam-nosignal { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 10px; align-items: center; justify-content: center; color: #9aa3b2; font-size: 14px; text-align: center; padding: 16px; }
.cam-nosignal i { font-size: 28px; }
.cam-bar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; display: flex; align-items: center; gap: 10px; padding: 26px 12px 10px; background: linear-gradient(to top, rgba(0,0,0,.72), rgba(0,0,0,0)); pointer-events: none; }
.cam-name { font-weight: 600; font-size: 14px; line-height: 1.2; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; }
.cam-name small { display: block; font-weight: 400; font-size: 12px; opacity: .8; overflow: hidden; text-overflow: ellipsis; }
.cam-dot { width: 9px; height: 9px; border-radius: 50%; background: #9ca3af; flex: 0 0 auto; box-shadow: 0 0 0 3px rgba(255,255,255,.15); }
.cam-dot.is-live { background: #22c55e; } .cam-dot.is-down { background: #ef4444; } .cam-dot.is-unknown { background: #f59e0b; }
.cam-tile.is-down .cam-dot { background: #ef4444; }
.cam-lock { opacity: .8; font-size: 12px; }
.cam-btn { pointer-events: auto; border: 0; width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.16); color: #fff; display: inline-flex; align-items: center; justify-content: center; transition: background .15s; }
.cam-btn:hover, .cam-btn:focus-visible { background: rgba(255,255,255,.32); outline: none; }
.cam-tile:hover .cam-img { filter: brightness(1.04); }
.cam-main { aspect-ratio: 16 / 9; }
.cam-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.cam-mini .cam-bar { padding: 18px 10px 8px; } .cam-mini .cam-name { font-size: 13px; }
.cam-pick-map { height: 260px; border-radius: 14px; overflow: hidden; }
.cam-examples li { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 10px; padding: 3px 0; }
.cam-examples code { word-break: break-all; }
.cam-test-img { display: block; max-width: 320px; margin-top: 10px; border-radius: 10px; }
.fm-cam-thumb { display: block; width: 220px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; margin: 6px 0; background: #12161d; }
@media (max-width: 991.98px) { .cam-wall { grid-template-columns: repeat(min(var(--cam-cols, 2), 2), minmax(0, 1fr)); } }
@media (max-width: 575.98px) { .cam-wall { grid-template-columns: 1fr; } .cam-examples li { grid-template-columns: 1fr; gap: 0; } }
@media (min-width: 1920px) { .cam-wall { gap: 18px; } }
img.cam-img:not([src]) { visibility: hidden; }
.cam-video { opacity: 0; transition: opacity .4s ease; z-index: 1; }
.cam-video.is-on { opacity: 1; }
.cam-note { flex: 0 0 auto; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: rgba(255,255,255,.18); pointer-events: auto; cursor: help; }
.cam-ezk { position: absolute; inset: 0; z-index: 1; opacity: 0; transition: opacity .4s ease; overflow: hidden; background: #12161d; }
.cam-ezk.is-on { opacity: 1; }
.cam-ezk > *, .cam-ezk canvas, .cam-ezk video { max-width: 100%; }
.fm-follow-chip { background: var(--surface); border-radius: 999px; box-shadow: var(--lift); padding: 6px 8px 6px 14px; font-size: 13px; display: flex; align-items: center; }
.fm-follow-chip .btn { border-radius: 999px; }

/* ---------- Responsive fixes (v3.2) ---------- */
/* stat strips with 3 or 4 tiles: fewer columns on smaller screens */
.exp-strip.exp-strip-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.exp-strip.exp-strip-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
/* (!important also overrides the column count older page versions set inline) */
@media (max-width: 991.98px) { .exp-strip.exp-strip-4, .exp-strip[style*="repeat(4"] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; } }
@media (max-width: 575.98px) {
    .exp-strip.exp-strip-4, .exp-strip.exp-strip-3, .exp-strip[style*="repeat("] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    .exp-strip .exp-tile b { font-size: 1.35rem; word-break: normal; }
}
@media (max-width: 380px) { .exp-strip.exp-strip-3, .exp-strip[style*="repeat(3"] { grid-template-columns: 1fr !important; } }
/* wide tables scroll sideways on phones instead of squeezing their columns */
@media (max-width: 767.98px) {
    .panel > .table-responsive > .table, .panel .table-responsive > .table { min-width: 620px; }
    .panel .table-responsive { -webkit-overflow-scrolling: touch; }
}
/* first column of list tables keeps a readable width */
.panel .table td:first-child a.fw-semibold { display: inline-block; min-width: 150px; }
/* page action rows wrap neatly */
.d-flex.flex-wrap.gap-2 > form { margin: 0; }
/* Farm Map: crop line under field names only when zoomed in enough to read */
@media (max-width: 575.98px) { .fm-farm-label small, .fm-field-label small { display: none; } }
.status-pill { white-space: nowrap; }

/* ---------- Pills that hold long text (v3.3) ----------
   A full pill radius only suits one short line; chips that can wrap get a soft rectangle. */
.chip, .mod-card .chip { border-radius: 10px !important; display: inline-block; line-height: 1.45; padding: 3px 10px !important; max-width: 100%; }
.imp-cols span { border-radius: 8px; }
.mod-card .badge { padding: 4px 10px; font-size: 11px; line-height: 1.2; font-weight: 600; letter-spacing: .01em; }
.badge { white-space: nowrap; }
.role-chip, .fm-chip, .fm-badge, .cam-note { white-space: nowrap; }
/* buttons keep their label on one line (rows of buttons wrap instead) */
.btn { white-space: nowrap; }
.btn > i, .btn > .fa-solid, .btn > .fa-regular { margin-right: .35em; }
.btn > i.me-1, .btn > i.me-2 { margin-right: .35em !important; }
/* outline icons sit a touch larger so their thin lines read like the old filled ones */
.fa-solid::before, .fa-regular::before { display: inline-block; }
.sidebar-nav .nav-link i, .stat-icon i, .panel-title > i { font-size: 1.08em; }

/* ---------- Icon size and centring (v3.4) ----------
   Outline glyphs have more air inside their box than the old filled ones, so they are drawn
   about 20% larger; the menu icons get a fixed 24 px box centred in the round buttons. */
.fa-solid::before, .fa-regular::before, .fa-brands.fa-youtube::before { font-size: 1.2em; line-height: 1; vertical-align: -0.06em; }
@media (min-width: 992px) {
    .sidebar-nav .nav-link i { font-size: 17px !important; flex: 0 0 24px !important; width: 24px !important; text-align: center; }
    .sidebar-nav .nav-group .nav-link { padding-left: 10px; }
    .sidebar-nav > .nav-link { padding-left: 18px; }   /* (60 px button - 24 px icon) / 2 */
    .app-sidebar:hover .sidebar-nav .nav-link, .app-sidebar:focus-within .sidebar-nav .nav-link { padding: 0 12px; }
    .app-sidebar:hover .sidebar-nav > .nav-link, .app-sidebar:focus-within .sidebar-nav > .nav-link { padding: 0 18px; }
}
.brand-mark i { font-size: 22px; }
.brand-mark i::before { font-size: 1.15em; }
.app-topbar .btn-icon i, .user-avatar i { font-size: 17px; }
.stat-card .stat-icon i, .kpi-icon i { font-size: 18px; }
.panel-title > i { font-size: 1em; }
.btn-sm > i::before { font-size: 1.15em; }
.status-pill i::before, .badge i::before, .chip i::before { font-size: 1.05em; }

/* v3.5 — grouped choice buttons inside tables (attendance Present / Half day / Absent / Leave)
   keep their text size instead of turning into round icon buttons. */
.table .btn-group > .btn {
    width: auto; height: auto; padding: 5px 14px; display: inline-flex; align-items: center; justify-content: center;
    background: var(--surface); border-color: var(--border); font-weight: 600;
}
.table .btn-group > .btn-check:checked + .btn-outline-success { background: var(--success); border-color: var(--success); color: #fff; }
.table .btn-group > .btn-check:checked + .btn-outline-warning { background: var(--warning); border-color: var(--warning); color: #fff; }
.table .btn-group > .btn-check:checked + .btn-outline-danger  { background: var(--danger);  border-color: var(--danger);  color: #fff; }
.table .btn-group > .btn-check:focus-visible + .btn { box-shadow: var(--focus-ring); z-index: 2; }

/* v3.5 — topbar bell sized and centred; search box icon and rounded left end */
.app-topbar .btn-icon i { font-size: 21px !important; line-height: 1; display: block; }
.app-topbar .btn-icon i::before { font-size: 1em; vertical-align: 0; }
.input-group > .input-group-text:first-child { border-radius: 999px 0 0 999px; padding-left: 16px; padding-right: 12px; }
.input-group .input-group-text i { font-size: 18px; }
.input-group > .input-group-text:first-child + .form-control { border-radius: 0; }
.input-group > .form-control:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.btn-icon > i { margin: 0 !important; }
.btn.btn-icon { padding: 0 !important; }

/* v3.6 — softer corners everywhere: no pill shapes */
.btn.btn-icon { padding: 0 !important; }
.btn, .btn-sm, .btn-lg, .form-control, .form-select, .status-pill, .badge, .chip, .user-menu-btn,
.topbar-search .form-control, .topbar-actions > .notif-dd, .pagination .page-link,
.input-group:focus-within, .nav-pills .nav-link, .cam-cols, .cam-cols .btn { border-radius: 10px !important; }
.btn-sm, .form-control-sm, .form-select-sm, .badge, .status-pill, .chip { border-radius: 8px !important; }
.btn-icon, .app-topbar .btn-icon { border-radius: 10px !important; }
.input-group > :first-child { border-top-right-radius: 0 !important; border-bottom-right-radius: 0 !important; border-top-left-radius: 10px !important; border-bottom-left-radius: 10px !important; }
.input-group > :last-child { border-top-left-radius: 0 !important; border-bottom-left-radius: 0 !important; border-top-right-radius: 10px !important; border-bottom-right-radius: 10px !important; }
.input-group > :not(:first-child):not(:last-child) { border-radius: 0 !important; }
.btn-group > .btn { border-radius: 0 !important; }
.btn-group > .btn:first-child, .btn-group > .btn-check:first-child + .btn { border-top-left-radius: 10px !important; border-bottom-left-radius: 10px !important; }
.btn-group > .btn:last-child { border-top-right-radius: 10px !important; border-bottom-right-radius: 10px !important; }
.table .btn-sm, .table .btn-outline-secondary, .table .btn-outline-danger, .table .btn-outline-primary { border-radius: 8px !important; }
.table .btn-group > .btn { border-radius: 0 !important; }
.table .btn-group > .btn-check:first-child + .btn { border-radius: 8px 0 0 8px !important; }
.table .btn-group > .btn:last-child { border-radius: 0 8px 8px 0 !important; }
.brand-mark, .sidebar-nav > .nav-link { border-radius: 14px !important; }
.sidebar-nav .nav-group, .sidebar-nav .nav-group .nav-link { border-radius: 14px !important; }
/* v3.7 — centre icons in flex icon buttons; line Dashboard button up with the logo and menu rail */
.btn-icon { justify-content: center !important; align-items: center !important; }
@media (min-width: 992px) { .sidebar-nav > .nav-link { margin-left: 8px; } }
.user-avatar, .user-avatar img, .stat-card .stat-icon, .kpi-icon, .panel-head .btn-icon, .notif-list-icon, .topbar-actions .btn-icon { border-radius: 10px !important; }
.notif-badge { border-radius: 6px !important; }
[class$="-icon"]:not(.cam-dot), [class*="-icon "] { border-radius: 10px !important; }
/* Dashboard carbon credits widget */
.carbon-widget { margin-bottom: 1rem; }
.cw-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.cw-grid > div { background: var(--surface-3); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cw-grid span { font-size: 12px; color: var(--text-muted, #6b7280); }
.cw-grid b { font-size: 18px; white-space: nowrap; }
.cw-grid small { font-size: 11.5px; color: var(--text-muted, #6b7280); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cw-bar { display: flex; height: 8px; border-radius: 6px; overflow: hidden; margin-top: 14px; gap: 2px; background: var(--surface-3); }
.carbon-widget { margin-bottom: 0; }
@media (max-width: 575px) { .cw-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Ask FarmOS ---------- */
.ask-wrap { max-width: 1200px; }
.ask-tools { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 12px; }
.ask-panel { display: flex; flex-direction: column; height: calc(100vh - 260px); min-height: 460px; overflow: hidden; }
.ask-log { flex: 1 1 auto; overflow-y: auto; padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.ask-hello { margin: auto; text-align: center; max-width: 620px; padding: 20px 0; }
.ask-hello-icon { width: 52px; height: 52px; border-radius: 14px; background: var(--primary-050); color: var(--primary); display: inline-grid; place-items: center; font-size: 22px; margin-bottom: 12px; }
.ask-hello h2 { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.ask-hello p { color: var(--text-muted, #6b7280); margin-bottom: 18px; }
.ask-suggest { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.ask-chip { border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 8px 12px; font-size: 13px; color: var(--text); cursor: pointer; transition: background-color .15s, border-color .15s; }
.ask-chip:hover, .ask-chip:focus-visible { background: var(--primary-050); border-color: var(--primary); }
.ask-msg { display: flex; flex-direction: column; max-width: 88%; }
.ask-msg.is-user { align-self: flex-end; align-items: flex-end; }
.ask-msg.is-bot { align-self: flex-start; }
.ask-bubble { padding: 10px 14px; border-radius: 12px; line-height: 1.55; font-size: 14.5px; overflow-wrap: anywhere; }
.ask-msg.is-user .ask-bubble { background: var(--primary); color: #fff; white-space: pre-wrap; }
.ask-msg.is-bot .ask-bubble { background: var(--surface-3); color: var(--text); }
.ask-msg.is-error .ask-bubble { background: var(--danger-bg); color: var(--danger); }
.ask-bubble p { margin: 0 0 8px; } .ask-bubble p:last-child, .ask-bubble ul:last-child, .ask-bubble ol:last-child { margin-bottom: 0; }
.ask-bubble ul, .ask-bubble ol { margin: 0 0 8px; padding-left: 20px; }
.ask-bubble h3 { font-size: 15px; font-weight: 700; margin: 6px 0; }
.ask-bubble code { background: rgba(0,0,0,.06); padding: 1px 5px; border-radius: 5px; font-size: .92em; }
.ask-table { overflow-x: auto; margin: 6px 0 10px; }
.ask-table table { border-collapse: collapse; font-size: 13.5px; min-width: 100%; background: var(--surface); border-radius: 8px; overflow: hidden; }
.ask-table th, .ask-table td { padding: 6px 10px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.ask-table th { font-weight: 600; background: var(--surface-2, #f8fafc); }
.ask-meta { font-size: 11.5px; color: var(--text-muted, #6b7280); margin-top: 4px; padding: 0 4px; }
.ask-typing { display: inline-flex; gap: 4px; vertical-align: middle; }
.ask-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted, #9ca3af); animation: askDot 1.2s infinite ease-in-out; }
.ask-typing i:nth-child(2) { animation-delay: .15s; } .ask-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes askDot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .ask-typing i { animation: none; opacity: .7; } }
.ask-form { display: flex; gap: 10px; align-items: flex-end; padding: 12px 14px; border-top: 1px solid var(--border); background: var(--surface); }
.ask-form textarea { flex: 1 1 auto; resize: none; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 14.5px; line-height: 1.45; max-height: 180px; background: var(--surface); color: var(--text); }
.ask-form textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus-ring); }
.ask-form .btn { height: 44px; width: 48px; padding: 0; display: inline-grid; place-items: center; }
.ask-foot { font-size: 11.5px; color: var(--text-muted, #6b7280); text-align: center; padding: 0 14px 10px; background: var(--surface); }
@media (max-width: 575px) { .ask-panel { height: calc(100vh - 200px); } .ask-log { padding: 14px; } .ask-msg { max-width: 96%; } }
/* Ask FarmOS: shared box, top bar button and right-side drawer */
.ask-box { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.ask-panel > .ask-box { height: 100%; }
.ask-chip { display: inline-flex; align-items: center; gap: 8px; text-align: left; }
.ask-chip i { color: var(--primary); font-size: 14px; flex: 0 0 auto; }
.ask-top-btn { height: 46px; padding: 0 16px !important; display: inline-flex; align-items: center; gap: 8px; background: var(--surface); color: var(--primary); font-weight: 600; box-shadow: var(--flat); border: 0; }
.ask-top-btn:hover, .ask-top-btn:focus-visible { background: var(--primary-050); color: var(--primary); }
.ask-top-btn i { font-size: 18px; }
.ask-drawer { width: 440px !important; max-width: 100vw; border-left: 0 !important; box-shadow: -12px 0 40px rgba(15, 23, 42, .12); }
.ask-drawer .offcanvas-header { border-bottom: 1px solid var(--border); padding: 12px 14px 12px 18px; }
.ask-drawer .offcanvas-title { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.ask-drawer .offcanvas-title i { color: var(--primary); }
.ask-drawer .btn-icon { width: 36px; height: 36px; }
.ask-drawer .ask-log { padding: 16px; }
.ask-drawer .ask-hello { margin: 0 auto auto; padding-top: 8px; }
.ask-drawer .ask-hello h2 { font-size: 17px; }
.ask-drawer .ask-suggest { flex-direction: column; align-items: stretch; }
.ask-drawer .ask-chip { width: 100%; }
.ask-drawer .ask-msg { max-width: 94%; }
@media (max-width: 575px) { .ask-drawer { width: 100vw !important; } }
.ask-drawer .offcanvas-header { justify-content: space-between; }
/* Ask FarmOS: floating chat bubble window (replaces the side drawer) */
.ask-pop {
    position: fixed; top: 78px; right: 18px; z-index: 1060;
    width: 400px; height: min(640px, calc(100vh - 100px)); max-width: calc(100vw - 24px);
    display: flex; flex-direction: column; overflow: hidden;
    background: var(--surface); border-radius: 18px; border: 1px solid var(--border);
    box-shadow: 0 24px 60px rgba(15, 23, 42, .22), 0 4px 14px rgba(15, 23, 42, .08);
    opacity: 0; transform: translateY(-8px) scale(.96); transform-origin: top right;
    transition: opacity .18s ease, transform .18s ease;
}
.ask-pop.is-open { opacity: 1; transform: none; }
.ask-pop::before { content: ""; position: absolute; top: -7px; right: 210px; width: 14px; height: 14px; background: var(--surface); border-left: 1px solid var(--border); border-top: 1px solid var(--border); transform: rotate(45deg); display: none; }
.ask-pop-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 10px 10px 16px; background: var(--primary); color: #fff; }
.ask-pop-title { font-size: 15px; font-weight: 700; margin: 0; display: flex; align-items: center; gap: 10px; color: #fff; }
.ask-pop-head .btn-icon { width: 34px; height: 34px; color: #fff; background: transparent; box-shadow: none; }
.ask-pop-head .btn-icon:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.ask-pop-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.ask-pop .ask-log { padding: 14px; }
.ask-pop .ask-hello { margin: 0 auto auto; padding-top: 4px; }
.ask-pop .ask-hello-icon { width: 44px; height: 44px; font-size: 19px; margin-bottom: 8px; }
.ask-pop .ask-hello h2 { font-size: 16px; }
.ask-pop .ask-hello p { font-size: 13px; margin-bottom: 12px; }
.ask-pop .ask-suggest { flex-direction: column; align-items: stretch; gap: 6px; }
.ask-pop .ask-chip { width: 100%; padding: 7px 10px; font-size: 12.5px; }
.ask-pop .ask-msg { max-width: 92%; }
.ask-pop .ask-bubble { font-size: 13.5px; }
.ask-pop .ask-form { padding: 10px; }
.ask-pop .ask-form .btn { height: 40px; width: 44px; }
.ask-pop .ask-foot { font-size: 10.5px; padding-bottom: 8px; }
.ask-top-btn.is-active { background: var(--primary); color: #fff; }
@media (prefers-reduced-motion: reduce) { .ask-pop { transition: none; } }
@media (max-width: 575px) { .ask-pop { top: 70px; right: 8px; left: 8px; width: auto; height: calc(100vh - 82px); } }
/* Ask FarmOS: standard bottom-right chat widget with a round launcher */
.ask-pop { top: auto; bottom: 96px; right: 24px; height: min(620px, calc(100vh - 130px)); transform-origin: bottom right; transform: translateY(12px) scale(.96); }
.ask-pop.is-open { transform: none; }
.ask-launcher {
    position: fixed; right: 24px; bottom: 24px; z-index: 1061;
    width: 58px; height: 58px; border-radius: 50%; border: 0;
    background: var(--primary); color: #fff; display: grid; place-items: center;
    box-shadow: 0 10px 28px rgba(37, 99, 235, .35), 0 2px 6px rgba(15, 23, 42, .15);
    transition: transform .15s ease, background-color .15s ease;
}
.ask-launcher:hover { transform: scale(1.06); }
.ask-launcher:focus-visible { outline: 3px solid var(--primary-050); outline-offset: 3px; }
.ask-launcher i { font-size: 24px; }
.ask-launcher .ask-l-close { display: none; }
.ask-launcher.is-active .ask-l-open { display: none; }
.ask-launcher.is-active .ask-l-close { display: inline-block; }
@media (prefers-reduced-motion: reduce) { .ask-launcher { transition: none; } }
@media (max-width: 575px) {
    .ask-pop { top: auto; left: 8px; right: 8px; bottom: 84px; height: calc(100vh - 160px); }
    .ask-launcher { right: 16px; bottom: 16px; width: 54px; height: 54px; }
}
/* Dashboard: AI suggestions */
.ai-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.ai-item { display: flex; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--surface-3); border-left: 4px solid var(--border); min-width: 0; }
.ai-item.is-high { border-left-color: var(--danger); }
.ai-item.is-medium { border-left-color: var(--warning); }
.ai-item.is-low { border-left-color: var(--success); }
.ai-ic { flex: 0 0 34px; height: 34px; border-radius: 10px; background: var(--surface); display: grid; place-items: center; color: var(--primary); font-size: 16px; }
.ai-txt { min-width: 0; }
.ai-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.ai-top b { font-size: 14px; line-height: 1.3; }
.ai-pri { font-size: 11px; font-weight: 600; white-space: nowrap; color: var(--text-muted, #6b7280); }
.ai-item.is-high .ai-pri { color: var(--danger); }
.ai-item.is-medium .ai-pri { color: var(--warning); }
.ai-item.is-low .ai-pri { color: var(--success); }
.ai-txt p { font-size: 13px; color: var(--text-muted, #4b5563); margin: 4px 0 2px; line-height: 1.45; }
.ai-list > p { grid-column: 1 / -1; }
@media (max-width: 1199px) { .ai-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 767px) { .ai-list { grid-template-columns: 1fr; } }

/* ---------- Crop Health (satellite) ---------- */
.ch-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ch-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
.ch-map-panel { overflow: hidden; padding: 0; }
.ch-map { height: 560px; background: #1f2937; }
.ch-map-field { height: 480px; }
.ch-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding: 10px 14px; font-size: 12px; color: var(--text-muted, #6b7280); border-top: 1px solid var(--border); }
.ch-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.ch-toggle { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.ch-list { display: flex; flex-direction: column; gap: 10px; max-height: 620px; overflow-y: auto; padding-right: 2px; }
.ch-card { display: block; background: var(--surface); border-radius: 14px; padding: 12px 14px; color: var(--text); text-decoration: none; border: 1px solid transparent; transition: border-color .15s; }
.ch-card:hover, .ch-card:focus-visible { border-color: var(--primary); color: var(--text); }
.ch-card.is-stress { border-color: rgba(220, 38, 38, .35); }
.ch-card-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.ch-name { min-width: 0; display: flex; flex-direction: column; }
.ch-name b { font-size: 14px; } .ch-name small { color: var(--text-muted, #6b7280); font-size: 12px; }
.ch-val { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.ch-val b { font-size: 20px; line-height: 1; }
.ch-band { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--surface-3); white-space: nowrap; }
.ch-band.is-poor { background: #fef3c7; color: #92400e; } .ch-band.is-avg { background: #fef9c3; color: #854d0e; }
.ch-band.is-good { background: #ecfccb; color: #3f6212; } .ch-band.is-exc { background: #dcfce7; color: #166534; }
.ch-spark { width: 100%; height: 30px; margin-top: 6px; display: block; }
.ch-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; margin-top: 4px; color: var(--text-muted, #6b7280); }
.ch-warn { margin-top: 8px; font-size: 12px; color: var(--danger); background: var(--danger-bg); border-radius: 8px; padding: 6px 8px; }
.ch-tools { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.ch-chips, .ch-dates { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: thin; padding-bottom: 2px; }
.ch-chip, .ch-date { border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 5px 10px; font-size: 12.5px; white-space: nowrap; color: var(--text); cursor: pointer; }
.ch-chip.active, .ch-date.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.ch-date.is-cloudy { color: var(--text-muted, #94a3b8); }
.ch-date.is-cloudy.active { color: #fff; }
.ch-chart { height: 280px; position: relative; }
.ch-soil-row { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.ch-soil-row span { font-size: 12.5px; color: var(--text-muted, #6b7280); width: 110px; }
.ch-soil-row b { font-size: 15px; } .ch-soil-row small { margin-left: auto; font-size: 12px; color: var(--text-muted, #6b7280); }
.ch-meter { position: relative; height: 8px; border-radius: 6px; margin: 2px 0 14px; background: linear-gradient(90deg, #dc2626, #f59e0b 30%, #16a34a 50%, #2563eb 75%, #7c3aed); }
.ch-meter i { position: absolute; top: -4px; width: 4px; height: 16px; border-radius: 2px; background: var(--text); transform: translateX(-2px); }
.ch-texture { display: flex; height: 10px; border-radius: 6px; overflow: hidden; gap: 2px; margin-top: 4px; }
.ch-texture-key { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-muted, #6b7280); margin-top: 4px; }
.ch-li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.ch-li:last-child { border-bottom: 0; }
.ch-li small { flex-basis: 100%; color: var(--text-muted, #6b7280); font-size: 12px; }
.ch-advice-body { background: var(--surface-3); }
@media (max-width: 1199px) { .ch-layout { grid-template-columns: 1fr; } .ch-list { max-height: none; } .ch-map { height: 440px; } }
@media (max-width: 575px) { .ch-strip { grid-template-columns: 1fr 1fr; } .ch-map, .ch-map-field { height: 340px; } }
/* Farms: on / off switch per farm */
.farm-card-box { display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius-lg, 16px); overflow: hidden; }
.farm-card-box > .farm-card { flex: 1 1 auto; border-radius: 0; box-shadow: none; }
.farm-card-box.is-off > .farm-card { opacity: .55; filter: grayscale(.8); cursor: default; }
.farm-switch { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--border); margin: 0; }
.farm-toggle { position: relative; width: 44px; height: 24px; border-radius: 999px !important; border: 0; background: #cbd5e1; padding: 0; cursor: pointer; transition: background-color .15s; flex: 0 0 auto; }
.farm-toggle i { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, .25); transition: transform .15s; }
.farm-toggle.is-on { background: var(--success, #16a34a); }
.farm-toggle.is-on i { transform: translateX(20px); }
.farm-toggle:focus-visible { outline: 3px solid var(--primary-050); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .farm-toggle, .farm-toggle i { transition: none; } }
/* Cameras: move / zoom pad and HD switch */
.cam-pad { display: grid; grid-template-columns: repeat(3, 52px); grid-template-rows: repeat(3, 52px); gap: 6px; justify-content: center; margin: 6px 0 10px; touch-action: none; user-select: none; }
.cam-pad-btn { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 12px !important; display: grid; place-items: center; font-size: 18px; cursor: pointer; transition: background-color .12s, color .12s; touch-action: none; user-select: none; -webkit-user-select: none; }
.cam-pad-btn:hover { background: var(--primary-050); color: var(--primary); }
.cam-pad-btn.is-on, .cam-pad-btn:active { background: var(--primary); color: #fff; border-color: var(--primary); }
.cam-pad-btn:focus-visible { outline: 3px solid var(--primary-050); outline-offset: 2px; }
.cam-pad-mid { display: grid; place-items: center; color: var(--text-muted, #94a3b8); font-size: 18px; }
.cam-zoom { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 13px; color: var(--text-muted, #6b7280); }
.cam-zoom .cam-pad-btn { width: 52px; height: 40px; }
.cam-q { display: inline-flex; background: var(--surface-3); border-radius: 10px; padding: 3px; gap: 2px; margin: 0; }
.cam-q button { border: 0; background: transparent; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 8px !important; color: var(--text-muted, #6b7280); }
.cam-q button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(15, 23, 42, .12); }
@media (prefers-reduced-motion: reduce) { .cam-pad-btn { transition: none; } }
