/* =====================================================================
   BaleTrace - landing page dashboard + small look & feel polish
   Brand green comes from the bottom menu bar (#2d6124).
   ===================================================================== */
:root {
    --bt-green-900: #1f4719;
    --bt-green-700: #2d6124;   /* brand */
    --bt-green-500: #4f8a3f;
    --bt-green-300: #9cc48a;
    --bt-green-100: #e8f2e3;
    --bt-surface: #ffffff;
    --bt-bg: #f4f6f3;
    --bt-border: #e1e6de;
    --bt-ink: #1d2a1a;
    --bt-ink-2: #4b5a47;
    --bt-ink-3: #7a8776;
    --bt-warn: #b25e09;
    --bt-warn-bg: #fdf1e3;
    --bt-radius: 12px;
    --bt-shadow: 0 1px 2px rgba(20, 40, 15, .06), 0 2px 8px rgba(20, 40, 15, .05);
}

/* After login the login-page image slider must not push the dashboard down.
   #WelcomeMsg only exists after login, so the login page itself is not affected. */
body:has(#WelcomeMsg) .sliderDiv { display: none !important; }

/* ---------- Landing wrapper (replaces the old video block) ---------- */
/* The landing dashboard is pinned right under the header (top is set from JS = header bottom)
   and scrolls on its own, so nothing on the old page can push it down. */
#WelcomeMsg.bt-landing {
    position: fixed;
    left: 0;
    right: 0;
    top: var(--bt-top, 130px);
    bottom: 0;
    z-index: 10;               /* above the old page background, below the menus (1001) and green bar (99999) */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    text-align: left;
    background: var(--bt-bg);
    padding: 12px 16px 130px;  /* bottom space for the fixed green menu bar */
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--bt-ink);
}

/* Dashboard page only: remove the faded QMS picture (bal.css .divbackg = img/imag3.JPG at 20% opacity) */
body:has(#WelcomeMsg) .divbackg { background-image: none !important; }

.bt-dash { max-width: 1100px; margin: 0 auto; }

.bt-dash-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap; margin: 4px 0 14px;
}
.bt-dash-title { font-size: 1.35rem; font-weight: 700; margin: 0; color: var(--bt-ink); }
.bt-dash-sub { font-size: .85rem; color: var(--bt-ink-3); margin-top: 2px; }
.bt-btn-ghost {
    border: 1px solid var(--bt-border); background: var(--bt-surface); color: var(--bt-green-700);
    border-radius: 999px; padding: 6px 14px; font-size: .85rem; font-weight: 600; cursor: pointer;
}
.bt-btn-ghost:hover { background: var(--bt-green-100); }

/* ---------- KPI tiles ---------- */
.bt-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.bt-kpi {
    background: var(--bt-surface); border: 1px solid var(--bt-border); border-radius: var(--bt-radius);
    box-shadow: var(--bt-shadow); padding: 14px 16px; min-width: 0;
}
.bt-kpi.hero { background: var(--bt-green-700); border-color: var(--bt-green-700); color: #fff; }
.bt-kpi-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--bt-ink-3); font-weight: 600; }
.bt-kpi.hero .bt-kpi-label, .bt-kpi.hero .bt-kpi-foot { color: rgba(255,255,255,.82); }
.bt-kpi-value { font-size: 1.9rem; font-weight: 700; line-height: 1.15; margin-top: 4px; font-variant-numeric: tabular-nums; }
.bt-kpi-unit { font-size: .95rem; font-weight: 600; margin-left: 3px; }
.bt-kpi-foot { font-size: .8rem; color: var(--bt-ink-2); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Cards ---------- */
.bt-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 12px; margin-bottom: 12px; }
.bt-card {
    background: var(--bt-surface); border: 1px solid var(--bt-border); border-radius: var(--bt-radius);
    box-shadow: var(--bt-shadow); padding: 14px 16px; min-width: 0;
}
.bt-card h3 { font-size: .95rem; font-weight: 700; margin: 0 0 2px; color: var(--bt-ink); }
.bt-card .bt-card-sub { font-size: .8rem; color: var(--bt-ink-3); margin-bottom: 10px; }

/* ---------- 7-day bar chart (single series, brand green) ---------- */
.bt-chart { position: relative; }
.bt-chart svg { display: block; max-width: 100%; height: auto; overflow: visible; }
.bt-chart .grid { stroke: var(--bt-border); stroke-width: 1; }
.bt-chart .axis-lbl { fill: var(--bt-ink-3); font-size: 11px; }
.bt-chart .val-lbl { fill: var(--bt-ink-2); font-size: 11px; font-weight: 600; }
.bt-chart .bar { fill: var(--bt-green-500); }
.bt-chart .bar.today { fill: var(--bt-green-700); }
.bt-chart .hit { fill: transparent; cursor: default; }
.bt-chart .hit:hover + .bar, .bt-chart .bar:hover { fill: var(--bt-green-900); }
.bt-tip {
    position: absolute; pointer-events: none; background: var(--bt-ink); color: #fff; font-size: .78rem;
    padding: 6px 9px; border-radius: 6px; white-space: nowrap; transform: translate(-50%, -110%); display: none; z-index: 5;
}

/* ---------- Quality split ---------- */
.bt-qbar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; gap: 2px; background: var(--bt-surface); margin: 6px 0 12px; }
.bt-qbar span { display: block; height: 100%; }
.bt-qlist { list-style: none; padding: 0; margin: 0; }
.bt-qlist li { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: .88rem; color: var(--bt-ink-2); border-bottom: 1px dashed var(--bt-border); }
.bt-qlist li:last-child { border-bottom: 0; }
.bt-qlist .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.bt-qlist .num { margin-left: auto; color: var(--bt-ink); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Tables ---------- */
.bt-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.bt-table th { text-align: left; font-weight: 600; color: var(--bt-ink-3); font-size: .74rem; text-transform: uppercase; letter-spacing: .03em; padding: 6px 8px; border-bottom: 1px solid var(--bt-border); }
.bt-table td { padding: 8px; border-bottom: 1px solid #f0f2ee; color: var(--bt-ink); }
.bt-table tr:last-child td { border-bottom: 0; }
.bt-table td.num, .bt-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.bt-table .muted { color: var(--bt-ink-3); }
.bt-pill { display: inline-block; background: var(--bt-green-100); color: var(--bt-green-900); border-radius: 999px; padding: 1px 8px; font-size: .78rem; font-weight: 600; }

.bt-empty { color: var(--bt-ink-3); font-size: .88rem; padding: 14px 0; text-align: center; }
.bt-alert { display: flex; gap: 8px; align-items: center; background: var(--bt-warn-bg); color: var(--bt-warn); border-radius: 10px; padding: 8px 12px; font-size: .85rem; font-weight: 600; margin-bottom: 12px; }
.bt-loading { color: var(--bt-ink-3); padding: 40px 0; text-align: center; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .bt-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .bt-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 420px) {
    #WelcomeMsg.bt-landing { padding-left: 12px; padding-right: 12px; }
    .bt-kpi-value { font-size: 1.55rem; }
    .bt-kpi-foot { white-space: normal; }
    .bt-table .hide-sm { display: none; }
}

/* ---------- Weighing scale status pill (Generate QR screens) ---------- */
.bt-scale {
    position: fixed; right: 16px; bottom: 110px; z-index: 100000;   /* just above the green menu bar */
    display: inline-flex; align-items: center; gap: 8px; max-width: calc(100vw - 32px);
    border: 1px solid var(--bt-border); background: var(--bt-surface); color: var(--bt-ink);
    border-radius: 999px; padding: 8px 14px; font: 600 .9rem "Segoe UI", Roboto, Arial, sans-serif;
    box-shadow: 0 2px 10px rgba(20, 40, 15, .15); cursor: default;
}
.bt-scale .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.bt-scale.on .dot { background: #2e9d3a; box-shadow: 0 0 0 3px rgba(46, 157, 58, .2); }
.bt-scale.off { border-color: #e9b4ad; background: #fdecea; color: #a1281b; cursor: pointer; }
.bt-scale.off .dot { background: #d93025; }
.bt-scale .wt { font-variant-numeric: tabular-nums; color: var(--bt-green-900); }
.bt-scale.moving .wt { color: var(--bt-warn); }
.bt-scale .wt:empty { display: none; }
.bt-scale .txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Light polish for existing forms & report tables ---------- */
.btn.btn-primary { border-radius: 8px; font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.form-control { border-radius: 8px; }
.form-control:focus { border-color: var(--bt-green-500); box-shadow: 0 0 0 3px rgba(79, 138, 63, .18); }
table.tbl.table-bordered { border-radius: 8px; overflow: hidden; font-size: .88rem; }
table.tbl.table-bordered thead th { position: sticky; top: 0; z-index: 1; }
