/* ==========================================================================
   EGrow CaneOps — design system
   A small, self-contained stylesheet (no build step) in the EGrow theme:
   green brand header, clean white cards, sharp forms, tables and badges.
   ========================================================================== */

:root {
    --green: #20a455;
    --green-dark: #16833f;
    --green-lime: #8cc63f;      /* logo accent */
    --blue: #5b8def;            /* primary action (login button) */
    --blue-dark: #4577e0;
    --blue-link: #4a86e8;
    --ink: #333a44;
    --muted: #69748a;
    --line: #dbe2ea;
    --line-soft: #eef2f6;
    --bg: #f4f6f9;
    --panel: #ffffff;
    --shadow: 0 8px 24px rgba(15, 23, 42, .08);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, .06);
    --radius: 10px;
    --radius-sm: 7px;
    --danger: #d64545;
    --danger-bg: #fdecec;
    --warn: #b45309;
    --warn-bg: #fff7ed;
    --ok: #1e8e4e;
    --ok-bg: #e8f8ee;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--blue-link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Brand logo (E·GROW) ------------------------------------------- */
.logo {
    display: inline-flex;
    align-items: center;
    font-weight: 800;
    letter-spacing: .5px;
    font-size: 28px;
    line-height: 1;
    color: #4d4d4d;
}
.logo .dot {
    width: 9px;
    height: 9px;
    background: var(--green-lime);
    border-radius: 2px;
    margin: 0 3px 6px 3px;
    align-self: flex-end;
}
.logo--light { color: #ffffff; }

/* ==========================================================================
   LOGIN
   ========================================================================== */
.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 6vh 20px;
    /* Sky-to-field gradient. Drop a real photo at public/images/login-bg.jpg
       and it will layer on top automatically. */
    background:
        image-set(url('/images/login-bg.jpg') 1x) center / cover no-repeat,
        linear-gradient(to bottom,
            #1f7fc4 0%, #4ba0dd 32%, #a9d8f0 52%,
            #bfe08a 60%, #7cbf46 76%, #3f8a2a 100%);
    background-blend-mode: normal;
}

.auth-card {
    width: 100%;
    max-width: 470px;
    background: var(--panel);
    border-radius: var(--radius);
    box-shadow: 0 18px 50px rgba(15, 23, 42, .28);
    overflow: hidden;
}
.auth-card__head {
    background: #f6f7f8;
    border-bottom: 1px solid var(--line-soft);
    padding: 26px 34px 22px;
    text-align: center;
}
.auth-card__head .logo { font-size: 34px; }
.auth-card__subtitle {
    margin-top: 10px;
    color: var(--muted);
    font-weight: 700;
    letter-spacing: 2px;
    font-size: 13px;
}
.auth-card__body { padding: 30px 34px 34px; }

/* ==========================================================================
   FORMS
   ========================================================================== */
.field { margin-bottom: 20px; }
.field > label {
    display: block;
    font-weight: 700;
    color: #3d434c;
    margin-bottom: 8px;
}
.input,
.input-group input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 14px;
    color: var(--ink);
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
.input:focus,
.input-group input:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(32, 164, 85, .15);
}
/* Entered values read bold so they stand out from labels/placeholders. */
.input, .input-group input { font-weight: 600; color: #22302a; }
.input::placeholder { color: #aab2bd; font-weight: 400; }

.input-group { display: flex; }
.input-group input {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}
.input-group .toggle-pass {
    border: 1px solid var(--green);
    border-left: 0;
    background: var(--green);
    color: #fff;
    width: 46px;
    border-top-right-radius: var(--radius-sm);
    border-bottom-right-radius: var(--radius-sm);
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: 16px;
}
.input-group .toggle-pass:hover { background: var(--green-dark); border-color: var(--green-dark); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }

select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath fill='%2369748a' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 34px; }

fieldset[disabled] .input,
fieldset[disabled] input { background: #f5f7f9; color: var(--muted); cursor: not-allowed; }

.check {
    display: flex;
    align-items: center;
    gap: 9px;
    color: #4d545e;
    user-select: none;
    cursor: pointer;
}
.check input { width: 16px; height: 16px; accent-color: var(--green); }

/* ---------- Buttons ------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 11px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, box-shadow .15s, transform .05s;
    text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn-block { width: 100%; }
.btn-primary { background: var(--blue); color: #fff; border-radius: 24px; padding: 13px 18px; }
.btn-primary:hover { background: var(--blue-dark); text-decoration: none; }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { background: var(--green-dark); text-decoration: none; }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: #f7f9fb; text-decoration: none; }
.btn-sm { padding: 7px 12px; font-size: 13px; }

.auth-links { text-align: center; margin-top: 18px; }

/* ---------- Alerts -------------------------------------------------------- */
.alert {
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    margin-bottom: 18px;
    font-size: 13.5px;
    border: 1px solid transparent;
}
.alert-danger { background: var(--danger-bg); color: #a12b2b; border-color: #f3c6c6; }
.alert-ok { background: var(--ok-bg); color: #17703e; border-color: #bfe6cd; }

/* ==========================================================================
   APP SHELL
   ========================================================================== */
.app-header {
    height: 62px;
    background: var(--green);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 30;
}
.app-header .logo { font-size: 24px; }
.app-header__right { display: flex; align-items: center; gap: 18px; color: #fff; }
/* ---------- Friendly overview (Crop Intelligence) -------------------------- */
.eyebrow { color: var(--green-dark); font-size: 12px; font-weight: 800; letter-spacing: 2.5px; text-transform: uppercase; }
.greeting { font-size: 34px; font-weight: 800; color: #1f2a24; margin: 6px 0 4px; line-height: 1.15; }
.greeting-sub { color: var(--muted); font-size: 15px; margin: 0; }
.btn-hero { background: #14532d; color: #fff; border-radius: 12px; padding: 14px 22px; font-size: 15px; font-weight: 700; box-shadow: 0 10px 22px rgba(20,83,45,.25); }
.btn-hero:hover { background: #0f4023; text-decoration: none; }

.stat-card { display: flex; align-items: flex-start; gap: 14px; padding: 20px; border-radius: 14px; }
.stat-tile { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 19px; flex-shrink: 0; }
.tile-green { background: #e3f4e8; color: #1e8e4e; }
.tile-amber { background: #fdf0dc; color: #b45309; }
.tile-blue { background: #e3edfb; color: #2563eb; }
.tile-lime { background: #f2f8dc; color: #65800b; }
.tile-purple { background: #ede8fb; color: #6d28d9; }
.stat-label { font-size: 11.5px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: #56606c; }
.stat-value { font-size: 32px; font-weight: 800; color: #1f2a24; line-height: 1.1; margin: 2px 0; }
.stat-hint { font-size: 13px; color: var(--muted); }

.promo-dark { background: #1b4332; color: #f0fdf4; border-radius: 16px; padding: 26px 26px 24px; box-shadow: 0 18px 36px rgba(27,67,50,.28); }
.promo-dark .eyebrow { color: #9be86f; }
.promo-dark h3 { font-family: Georgia, 'Times New Roman', serif; font-size: 27px; line-height: 1.2; margin: 10px 0 12px; font-weight: 700; }
.promo-dark p { color: #cfe8d8; font-size: 14px; line-height: 1.55; margin: 0 0 18px; }
.progress-slim { height: 7px; border-radius: 99px; background: rgba(255,255,255,.22); overflow: hidden; margin-bottom: 12px; }
.progress-slim > div { height: 100%; background: #9be86f; border-radius: inherit; }

.safety-card { display: flex; gap: 14px; align-items: flex-start; padding: 20px; border-radius: 14px; }
.review-row { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line-soft); }
.review-row:last-child { border-bottom: 0; }

/* ---------- Farmer app phone preview --------------------------------------- */
.phone { width: 392px; max-width: 100%; margin: 0 auto; background: #17251c; border-radius: 46px; padding: 12px; box-shadow: 0 34px 70px rgba(15,23,42,.35); }
.phone__notch { display: flex; justify-content: space-between; align-items: center; color: #dcefe2; font-size: 12px; font-weight: 700; padding: 6px 22px 10px; }
.phone__screen { background: linear-gradient(180deg, #f6fbf5, #edf4ec); border-radius: 34px; padding: 18px 16px 24px; min-height: 660px; }
.app-pill { display: inline-flex; align-items: center; gap: 8px; background: #fff; border-radius: 999px; padding: 8px 16px 8px 8px; font-weight: 800; box-shadow: 0 4px 14px rgba(15,23,42,.08); }
.app-pill .e { width: 30px; height: 30px; border-radius: 9px; background: #14532d; color: #9be86f; display: grid; place-items: center; font-weight: 800; }
.app-chip { display: inline-flex; align-items: center; gap: 6px; border: 1.5px solid #cfe0d5; border-radius: 999px; padding: 8px 14px; font-weight: 700; font-size: 13px; color: #14532d; background: #fff; }
.progress-3 { display: flex; gap: 8px; margin: 16px 0 18px; }
.progress-3 span { height: 5px; border-radius: 99px; background: #d8e4da; flex: 1; }
.progress-3 span.on { background: linear-gradient(90deg, var(--green), #7cc95e); }
.app-serif { font-family: Georgia, 'Times New Roman', serif; font-size: 27px; line-height: 1.18; color: #14361f; margin: 6px 0 8px; font-weight: 700; }
.app-banner { display: flex; align-items: center; gap: 12px; border: 1.5px solid #bfe0c9; background: #f2faf3; border-radius: 14px; padding: 13px 14px; margin: 16px 0; color: inherit; }
.app-banner:hover { text-decoration: none; border-color: var(--green); }
.app-banner .ic { width: 42px; height: 42px; border-radius: 11px; background: #1e8e4e; color: #fff; display: grid; place-items: center; font-size: 18px; flex-shrink: 0; }
.app-card { background: #fff; border-radius: 16px; padding: 16px; box-shadow: 0 6px 18px rgba(15,23,42,.05); margin-bottom: 14px; }
.crop-select { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.crop-select a { border: 1.5px solid var(--line-soft); border-radius: 13px; padding: 12px 14px; background: #fff; color: inherit; }
.crop-select a:hover, .crop-select a.active { border-color: var(--green); text-decoration: none; }
.crop-select strong { color: #14532d; }
.lang-chip { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 16px; font-weight: 800; color: #14532d; }
.lang-chip.active { border-color: var(--green); background: var(--ok-bg); }

/* ---------- Crop Saathi interactive flow ---------------------------------- */
.phone__screen { position: relative; overflow: hidden; }
.step-eyebrow { color: var(--green-dark); font-size: 11px; font-weight: 800; letter-spacing: 2px; text-transform: uppercase; margin-top: 6px; }
.app-cta { width: 100%; text-align: center; margin-top: 16px; }

/* Photo cards (step 1) */
.photo-card { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: #fff; border: 1.5px solid transparent; border-radius: 16px; padding: 14px 16px; margin-bottom: 12px; box-shadow: 0 6px 18px rgba(15,23,42,.05); cursor: pointer; }
.photo-card.added { border-color: var(--green); }
.photo-ic { width: 42px; height: 42px; flex-shrink: 0; }
.photo-txt { flex: 1; min-width: 0; } .photo-txt strong { display: block; color: #14361f; } .photo-txt .muted { font-size: 12.5px; }
.photo-add { width: 34px; height: 34px; border-radius: 50%; background: #eef4ee; color: var(--green-dark); display: grid; place-items: center; font-size: 18px; font-weight: 800; flex-shrink: 0; }
.photo-card.added .photo-add { background: var(--green); color: #fff; }
.photo-card { cursor: pointer; }
.photo-thumb { width: 42px; height: 42px; border-radius: 11px; object-fit: cover; flex-shrink: 0; }
.review-photo.has-img { background-size: cover; background-position: center; font-size: 0; }
.app-tip { background: #fff7ed; color: #92400e; border: 1px solid #fed7aa; border-radius: 13px; padding: 12px 14px; font-size: 13px; margin: 6px 0 2px; }
.app-hint { background: #eef6ef; color: #2f6b45; border: 1px solid #cde6d3; border-radius: 13px; padding: 12px 14px; font-size: 13px; margin: 12px 0 2px; line-height: 1.5; }
.app-back { width: 40px; height: 40px; border-radius: 50%; border: none; background: #fff; color: #14532d; font-size: 24px; font-weight: 800; line-height: 1; cursor: pointer; box-shadow: 0 4px 14px rgba(15,23,42,.1); display: grid; place-items: center; padding: 0; }
.app-back:hover { background: #f2faf3; }

/* Symptom chips (step 2) */
.symptom-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.symptom-chip { background: #fff; border: 1.5px solid var(--line-soft); border-radius: 16px; padding: 22px 10px; display: flex; flex-direction: column; align-items: center; gap: 10px; cursor: pointer; box-shadow: 0 6px 18px rgba(15,23,42,.05); }
.symptom-chip strong { color: #2b3340; font-size: 14px; }
.symptom-chip .sym-ic { font-size: 20px; color: #56606c; }
.symptom-chip.on { border-color: var(--green); background: var(--ok-bg); }
.symptom-chip.on .sym-ic, .symptom-chip.on strong { color: var(--green-dark); }
.app-label { display: block; font-weight: 800; font-size: 13px; color: #14361f; margin: 4px 0 6px; }
.app-input { width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: 13px 14px; font-size: 15px; font-weight: 700; color: #2b3340; background: #fff; margin-bottom: 14px; }
.voice-chip { display: flex; justify-content: space-between; align-items: center; border: 1.5px dashed #bfe0c9; border-radius: 12px; padding: 13px 14px; color: var(--green-dark); font-weight: 700; font-size: 13.5px; }

/* Review (step 3) */
.review-photo { height: 150px; display: grid; place-items: center; font-size: 46px; background: linear-gradient(135deg, #dff2e2, #bfe0c9); }
.app-row { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-top: 1px solid var(--line-soft); }
.app-row strong { color: #14361f; }
.app-consent { display: flex; gap: 10px; align-items: flex-start; margin: 16px 2px; cursor: pointer; }
.app-consent input { width: 18px; height: 18px; margin-top: 2px; flex-shrink: 0; }
.app-safety { display: flex; gap: 10px; align-items: flex-start; background: #eef6ef; border-radius: 13px; padding: 13px 14px; font-size: 13.5px; color: #3d434c; }
.safety-tick { width: 24px; height: 24px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; font-size: 13px; flex-shrink: 0; }

/* Result */
.result-check { width: 92px; height: 92px; border-radius: 50%; background: #d7efdd; color: var(--green-dark); display: grid; place-items: center; font-size: 40px; margin: 26px auto 14px; }
.advice-badge { display: inline-block; background: #eef4ee; color: var(--green-dark); font-weight: 800; font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase; padding: 6px 12px; border-radius: 999px; }
.do-list { margin: 4px 0 0; padding-left: 18px; } .do-list li { margin-bottom: 6px; line-height: 1.45; }

/* Call-to-action toast */
.app-toast { position: absolute; left: 16px; right: 16px; bottom: 18px; background: #14361f; color: #fff; border-radius: 14px; padding: 15px 18px; font-weight: 700; font-size: 14px; text-align: center; box-shadow: 0 18px 40px rgba(15,23,42,.35); opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .25s, transform .25s; }
.app-toast.show { opacity: 1; transform: translateY(0); }

/* ---------- Crop chips (library) ------------------------------------------- */
.crop-chip {
    display: inline-flex; align-items: center; gap: 7px;
    background: #f2f5f3; border: 1.5px solid transparent; border-radius: 999px;
    padding: 9px 16px; font-weight: 700; font-size: 13.5px; color: #2b3a31;
}
.crop-chip:hover { background: #e9efeb; text-decoration: none; }
.crop-chip.active { border-color: var(--green); background: #fff; color: var(--green-dark); }
.chip-count {
    background: #e3e9e5; color: #56606c; border-radius: 999px;
    font-size: 11.5px; font-weight: 800; padding: 2px 8px;
}
.crop-chip.active .chip-count { background: var(--ok-bg); color: var(--green-dark); }

/* ---------- Diagnosis form (friendly) -------------------------------------- */
.dropzone {
    display: block; border: 2px dashed #c9ddd0; border-radius: 14px;
    background: #fbfdfb; padding: 46px 20px; text-align: center; cursor: pointer;
    transition: border-color .15s, background .15s;
}
.dropzone:hover { border-color: var(--green); background: #f4fbf6; }
.dropzone strong { display: block; font-size: 17px; color: #1f2a24; margin-bottom: 6px; }
.dropzone .hint { color: var(--muted); font-size: 13.5px; }
.dropzone .choose { color: var(--green-dark); font-weight: 800; margin-top: 10px; display: inline-block; }
.dropzone.has-file { border-style: solid; border-color: var(--green); background: #f0fdf4; }
.dropzone img { max-height: 180px; border-radius: 10px; margin-top: 10px; }
.fineprint { color: var(--muted); font-size: 12.5px; text-align: center; line-height: 1.5; }
.section-title { font-size: 18px; font-weight: 800; color: #1f2a24; margin: 0 0 14px; }

/* ---------- Module side rail ----------------------------------------------- */
.layout { display: flex; align-items: flex-start; }
.side-rail {
    width: 222px; flex-shrink: 0; background: #fff;
    border-right: 1px solid var(--line-soft);
    position: sticky; top: 62px; height: calc(100vh - 62px);
    padding: 16px 10px; display: flex; flex-direction: column;
}
.side-rail__label { font-size: 11px; font-weight: 800; letter-spacing: 1.6px; text-transform: uppercase; color: var(--muted); padding: 0 12px 10px; }
.side-item {
    display: flex; align-items: center; gap: 11px;
    padding: 11px 12px; border-radius: 10px; margin-bottom: 4px;
    color: #3d434c; font-weight: 700; font-size: 14px;
}
.side-item .ic { font-size: 17px; width: 22px; text-align: center; }
.side-item:hover { background: #f4f8fb; text-decoration: none; }
.side-item.active { background: var(--ok-bg); color: var(--green-dark); box-shadow: inset 3px 0 0 var(--green); }
.side-rail__foot { margin-top: auto; padding: 12px; font-size: 12px; color: var(--muted); line-height: 1.45; }
.layout-main { flex: 1; min-width: 0; }

@media (max-width: 1100px) {
    .side-rail { width: 64px; padding: 16px 8px; }
    .side-rail .tx, .side-rail__label { display: none; }
    .side-item { justify-content: center; padding: 12px 0; }
    .side-item .ic { width: auto; }
}

/* ---------- Phone layout: prevent horizontal overflow --------------------- */
@media (max-width: 640px) {
    body { overflow-x: hidden; }
    .app-header { padding: 0 14px; }
    .app-header .logo { font-size: 20px; }
    .app-header__right { gap: 10px; }
    .app-header__right > .mill-badge { display: none; }   /* hide org badge on phones */
    .user-menu span:not(.avatar) { display: none; }        /* keep avatar, drop long name */
    .app-main { padding: 18px 14px 46px; }
    .page-title { font-size: 19px; }
    /* Stack multi-column grids (incl. inline grid-template-columns) on phones. */
    .grid { grid-template-columns: 1fr !important; }
}

/* ---------- Module switcher ------------------------------------------------ */
.module-menu { position: relative; }
.module-menu summary {
    list-style: none; cursor: pointer; user-select: none;
    background: rgba(255,255,255,.16); color: #fff;
    padding: 7px 14px; border-radius: 20px; font-size: 13px; font-weight: 700;
    white-space: nowrap;
}
.module-menu summary::-webkit-details-marker { display: none; }
.module-menu[open] summary { background: rgba(255,255,255,.28); }
.module-menu__list {
    position: absolute; top: calc(100% + 8px); left: 0; z-index: 50;
    background: #fff; border: 1px solid var(--line); border-radius: 10px;
    box-shadow: 0 12px 32px rgba(15,23,42,.18); min-width: 210px; padding: 6px;
}
.module-menu__list a {
    display: block; padding: 10px 12px; border-radius: 7px;
    color: var(--ink); font-weight: 600; font-size: 13.5px;
}
.module-menu__list a:hover { background: #f4f8fb; text-decoration: none; }
.module-menu__list a.active { background: var(--ok-bg); color: var(--green-dark); }

.mill-badge {
    background: rgba(255, 255, 255, .18);
    color: #fff;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}
.user-menu { display: flex; align-items: center; gap: 10px; }
.avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: rgba(255,255,255,.22); color: #fff;
    display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.logout-btn {
    background: rgba(255,255,255,.16); border: 0; color: #fff;
    padding: 7px 14px; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 13px;
}
.logout-btn:hover { background: rgba(255,255,255,.28); }

/* ---------- Horizontal nav ------------------------------------------------ */
.app-nav {
    background: #fff;
    border-bottom: 1px solid var(--line);
    padding: 0 16px;
    display: flex;
    gap: 2px;
    overflow-x: auto;
    position: sticky;
    top: 62px;
    z-index: 20;
}
.app-nav a {
    color: var(--muted);
    padding: 14px 16px;
    font-weight: 600;
    font-size: 13.5px;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
}
.app-nav a:hover { color: var(--ink); text-decoration: none; }
.app-nav a.active { color: var(--green-dark); border-bottom-color: var(--green); }

/* ---------- Page container ------------------------------------------------ */
.app-main { max-width: 1240px; margin: 0 auto; padding: 26px 24px 60px; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.page-title { font-size: 22px; font-weight: 800; color: #2b3340; margin: 0; }
.page-sub { color: var(--muted); margin: 4px 0 0; }

/* ---------- Cards & metrics ----------------------------------------------- */
.grid { display: grid; gap: 18px; }
.grid-metrics { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.card {
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.card__body { padding: 20px 22px; }
.card__head {
    padding: 16px 22px;
    border-bottom: 1px solid var(--line-soft);
    font-weight: 700;
    color: #2b3340;
    display: flex; align-items: center; justify-content: space-between;
}
.metric { position: relative; }
.metric .metric__label { color: var(--muted); font-size: 13px; font-weight: 600; }
.metric .metric__value { font-size: 30px; font-weight: 800; color: #222b36; margin-top: 6px; }
.metric .metric__hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
.metric__bar { height: 4px; border-radius: 4px 4px 0 0; position: absolute; top: 0; left: 0; right: 0; }
.bar-green { background: var(--green); }
.bar-blue { background: var(--blue); }
.bar-lime { background: var(--green-lime); }
.bar-amber { background: #eab308; }

/* ---------- Tables -------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th, table.data td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
table.data th { color: var(--muted); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; background: #fafbfc; }
table.data tbody tr:hover { background: #f8fafc; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Badges & bars ------------------------------------------------- */
.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-danger { background: var(--danger-bg); color: #a12b2b; }
.badge-muted { background: #eef1f5; color: var(--muted); }

/* Stage color chips for the crop-stage legend / stacked bars */
.chip { display: inline-flex; align-items: center; gap: 6px; margin-right: 14px; font-size: 12.5px; color: var(--muted); }
.chip i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.stage-PLANT { background: #2e7d32; }
.stage-R1 { background: #43a047; }
.stage-R2 { background: #66bb6a; }
.stage-R3 { background: #9ccc65; }
.stage-R4 { background: #d4b106; }

/* Horizontal capacity bar (day-wise plan) */
.capbar { background: #eef2f6; border-radius: 5px; height: 16px; position: relative; overflow: hidden; min-width: 120px; }
.capbar__fill { height: 100%; display: flex; }
.capbar__seg { height: 100%; }
.capbar__cap { position: absolute; top: -2px; bottom: -2px; width: 2px; background: #d64545; }

/* ---------- Monthly calendar ---------------------------------------------- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cal-head { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; padding: 4px 0; }
.cal-cell { border: 1px solid var(--line-soft); border-radius: 8px; padding: 8px; min-height: 96px; background: #fff; display: flex; flex-direction: column; gap: 5px; }
.cal-cell.over { border-color: #f0b4b4; background: #fff6f6; }
.cal-cell.closed { background: #f2f4f7; color: var(--muted); }
.cal-cell.empty { border: 0; background: transparent; }
.cal-day { font-weight: 700; font-size: 12px; display: flex; justify-content: space-between; align-items: center; color: #475569; }
.cal-qtl { font-size: 16px; font-weight: 800; color: #222b36; }
.cal-bar { background: #eef2f6; border-radius: 4px; height: 9px; position: relative; overflow: hidden; margin-top: auto; }
.cal-bar__fill { display: flex; height: 100%; }
.cal-bar__fill > div { height: 100%; }
.cal-cap { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--danger); }

/* ---------- Delivery ticket ----------------------------------------------- */
.ticket { max-width: 720px; margin: 0 auto; }
.ticket__stub { border: 2px dashed var(--line); border-radius: 12px; padding: 0; overflow: hidden; background: #fff; }
.ticket__band { background: var(--green); color: #fff; padding: 16px 22px; display: flex; align-items: center; justify-content: space-between; }
.ticket__rows { display: grid; grid-template-columns: 1fr 1fr; }
.ticket__rows > div { padding: 12px 22px; border-bottom: 1px solid var(--line-soft); }
.ticket__rows > div:nth-child(odd) { border-right: 1px solid var(--line-soft); }
.ticket__net { background: #eefcf3; text-align: center; padding: 20px; }
.ticket__net .v { font-size: 34px; font-weight: 800; color: var(--green-dark); }
@media print {
    .app-header, .app-nav, .no-print, .page-head .btn { display: none !important; }
    body { background: #fff; }
    .app-main { padding: 0; }
    .ticket__stub { border-color: #999; }
}

.settle-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.settle-row:last-of-type { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: #f4f8fb; }

.muted { color: var(--muted); }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
.flex { display: flex; align-items: center; gap: 10px; }
.spacer { flex: 1; }
