:root {
  --bg: #EEF2F7;
  --surface: #FFFFFF;
  --surface-sunken: #F3F6FA;
  --border: #DDE4EC;
  --border-strong: #B7C3D2;
  --text: #16202C;
  --text-secondary: #5B6B7F;
  --text-muted: #8996A6;
  --accent: #2563EB;
  --accent-bg: #E7F0FE;
  --accent-text: #1D4ED8;
  --warn-bg: #FFF4E0;
  --warn-text: #B4650B;
  --ok-bg: #E5F6EC;
  --ok-text: #15803D;
  --pink-bg: #FCE8F1;
  --pink-text: #BE185D;
  --hold-bg: #F1E9FE;
  --hold-text: #6D28D9;
  --closed-bg: #E7EAEF;
  --closed-text: #4B5768;
  --shadow: 0 1px 2px rgba(16,24,40,0.04), 0 1px 3px rgba(16,24,40,0.06);
  --radius: 12px;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F172A; --surface: #182338; --surface-sunken: #1F2B42;
    --border: #2C3A52; --border-strong: #435067; --text: #ECF1F8;
    --text-secondary: #9AABC2; --text-muted: #71829A; --accent: #5B9CFA;
    --accent-bg: #1E3A66; --accent-text: #A9CBFC; --warn-bg: #3B2E15;
    --warn-text: #F0B85C; --ok-bg: #113522; --ok-text: #6FD79B;
    --pink-bg: #3B1B2A; --pink-text: #F4A9C8;
    --hold-bg: #2E2350; --hold-text: #C4A9FA;
    --closed-bg: #263041; --closed-text: #AEBACB;
    --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 1px 3px rgba(0,0,0,0.3);
  }
}
:root[data-theme="dark"] {
  --bg: #0F172A; --surface: #182338; --surface-sunken: #1F2B42;
  --border: #2C3A52; --border-strong: #435067; --text: #ECF1F8;
  --text-secondary: #9AABC2; --text-muted: #71829A; --accent: #5B9CFA;
  --accent-bg: #1E3A66; --accent-text: #A9CBFC; --warn-bg: #3B2E15;
  --warn-text: #F0B85C; --ok-bg: #113522; --ok-text: #6FD79B;
  --pink-bg: #3B1B2A; --pink-text: #F4A9C8;
  --hold-bg: #2E2350; --hold-text: #C4A9FA;
  --closed-bg: #263041; --closed-text: #AEBACB;
  --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 1px 3px rgba(0,0,0,0.3);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans Thai", Roboto, Helvetica, Arial, sans-serif; }
body { padding: 20px 16px 48px; max-width: 720px; margin: 0 auto; }
.top-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 2px; }
h1 { font-size: 15px; font-weight: 600; margin: 0 0 2px; letter-spacing: -0.01em; }
.sub { font-size: 13px; color: var(--text-secondary); margin: 0 0 18px; }
.lang-toggle { display: flex; gap: 4px; background: var(--surface-sunken); border-radius: 999px; padding: 3px; flex-shrink: 0; }
.lang-btn { appearance: none; border: none; cursor: pointer; font-family: inherit; font-size: 12px;
  padding: 5px 12px; border-radius: 999px; background: none; color: var(--text-secondary); }
.lang-btn.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,0.08); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.tab-btn { appearance: none; background: none; border: none; cursor: pointer; padding: 9px 6px; margin-right: 14px;
  font-size: 14px; color: var(--text-secondary); border-bottom: 2px solid transparent; font-family: inherit; }
.tab-btn.active { color: var(--accent-text); border-bottom-color: var(--accent); font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 8px; flex-wrap: wrap; }
.meta { font-size: 13px; color: var(--text-secondary); }
button.action { appearance: none; font-family: inherit; cursor: pointer; font-size: 13px; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 8px 14px; color: var(--text); }
button.action:hover { background: var(--surface-sunken); }
button.primary { background: var(--accent); border-color: var(--accent); color: #FFFFFF; font-weight: 600; width: 100%; box-shadow: var(--shadow); }
button.primary:hover { background: var(--accent-text); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { appearance: none; font-family: inherit; cursor: pointer; font-size: 12px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 999px; padding: 5px 13px; color: var(--text-secondary); }
.chip.active { background: var(--accent-bg); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.search-wrap { position: relative; margin-bottom: 12px; }
.search-wrap input { width: 100%; padding: 9px 12px 9px 32px; }
.search-wrap .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 13px; }
input[type="text"], input[type="number"], select { width: 100%; font-family: inherit; font-size: 14px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); }
input:disabled { color: var(--text-muted); background: var(--surface-sunken); }
label.field-label { font-size: 12px; color: var(--text-secondary); display: block; margin-bottom: 4px; }
.list { display: flex; flex-direction: column; gap: 10px; max-height: 620px; overflow-y: auto; padding-right: 2px; margin-bottom: 6px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 8px; }
.card-title { font-size: 15px; font-weight: 600; margin: 0; display: flex; align-items: center; gap: 8px; }
.badge { font-size: 11px; padding: 3px 10px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.badge.pending { background: var(--warn-bg); color: var(--warn-text); }
.badge.approved { background: var(--ok-bg); color: var(--ok-text); }
.badge.manual { background: var(--surface-sunken); color: var(--text-secondary); }
.badge.available { background: var(--ok-bg); color: var(--ok-text); }
.badge.blocked { background: var(--pink-bg); color: var(--pink-text); }
.badge.unable-ship { background: var(--warn-bg); color: var(--warn-text); }
.badge.buy-type { background: var(--accent-bg); color: var(--accent-text); }
.badge.sell-type { background: var(--pink-bg); color: var(--pink-text); }
.badge.priority-urgent { background: var(--pink-bg); color: var(--pink-text); }
.badge.priority-high { background: var(--warn-bg); color: var(--warn-text); }
.badge.priority-medium { background: var(--accent-bg); color: var(--accent-text); }
.badge.priority-low { background: var(--closed-bg); color: var(--closed-text); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.market-row { font-size: 13px; color: var(--text-secondary); margin-bottom: 10px; }
.market-row b { color: var(--text); font-weight: 600; }
.suggest-box { background: var(--surface-sunken); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; }
.suggest-label { font-size: 11px; color: var(--text-secondary); margin: 0 0 6px; }
.suggest-values { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 4px; }
.suggest-values span { font-size: 14px; font-weight: 600; }
.suggest-reason { font-size: 12px; color: var(--text-muted); margin: 0; }
.field-row { margin-bottom: 12px; }
.hint { font-size: 12px; color: var(--text-muted); margin: 0 0 10px; }
.checkline { display: flex; align-items: center; gap: 8px; }
.checkline input[type="checkbox"] { width: 16px; height: 16px; }
#no-results { display: none; text-align: center; font-size: 13px; color: var(--text-muted); padding: 16px 0; }
.table-scroll { overflow-x: auto; }
.brand-row { display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 124px; height: auto; flex-shrink: 0; object-fit: contain; display: block; }
.qr-preview-wrap { margin-top: 14px; text-align: center; }
.qr-preview-wrap p { font-size: 12px; color: var(--accent-text); margin: 0 0 8px; font-weight: 600; }
/* Printed label: white paper with black ink in every theme, because that is what the printer produces. */
.qr-label { background: #ffffff; color: #000000; width: 100%; max-width: 300px; margin: 0 auto; border: 2px solid #1f2937;
  padding: 10px 12px 12px; text-align: left; font-family: Arial, "Noto Sans Thai", Helvetica, sans-serif; box-shadow: var(--shadow); }
.qr-label .ql-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.qr-preview-wrap .qr-label img.ql-logo { width: 46%; max-width: 140px; height: auto; border: none; border-radius: 0; box-shadow: none; }
.qr-label .ql-svc { text-align: right; font-weight: 800; line-height: 1.05; }
.qr-label .ql-svc span { display: block; font-size: 18px; }
.qr-label .ql-svc b { display: block; font-size: 28px; }
.qr-label .ql-addr { font-size: 10.5px; line-height: 1.35; margin-top: 4px; }
.qr-label .ql-rule { height: 2px; background: linear-gradient(90deg, #6b21a8, #c084fc, rgba(192,132,252,0)); margin: 6px 0; }
.qr-label .ql-line { font-size: 15px; line-height: 1.4; overflow-wrap: anywhere; }
.qr-label .ql-line.small { font-size: 12.5px; }
.qr-label .ql-qr { width: 72%; margin: 6px auto 2px; }
.qr-label .ql-qr svg { display: block; width: 100%; height: auto; }
.qr-label .ql-code { text-align: center; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 10px; letter-spacing: 0.04em; margin-bottom: 6px; }
.qr-label .ql-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; font-size: 10.5px; line-height: 1.4; }
.qr-label .ql-date { text-align: right; font-size: 12px; white-space: nowrap; }
.result-panel.stale .result-row, .result-panel.stale .qr-preview-wrap { opacity: 0.45; }
.result-panel button.action:disabled { opacity: 0.5; cursor: not-allowed; }
.qr-preview-wrap img { max-width: 220px; width: 100%; border-radius: 10px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.group-toggle { display: flex; gap: 8px; margin-bottom: 16px; }
.group-btn { flex: 1; appearance: none; font-family: inherit; cursor: pointer; font-size: 13px; font-weight: 700;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 11px 6px; color: var(--text-secondary); }
.group-btn.active { background: var(--accent); border-color: var(--accent); color: #FFFFFF; }
.home-group { display: none; background: var(--surface-sunken); border: 1px solid var(--border); border-radius: 18px; padding: 16px; }
.home-group.active { display: block; }
.home-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.home-grid .home-tile { background: var(--surface); }
.home-subgroup + .home-subgroup { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.home-subgroup.sub-first { margin-top: 0; padding-top: 0; border-top: none; }
.home-sub-title { margin: 0 0 10px; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-secondary); }
.home-tile { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 26px 10px; border-radius: 18px; border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; font-family: inherit; box-shadow: var(--shadow); transition: transform 0.12s ease, box-shadow 0.12s ease; }
.home-tile:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(16,24,40,0.10); border-color: var(--accent); }
.home-tile .icon { font-size: 30px; }
.home-tile .label { font-size: 13px; font-weight: 600; color: var(--text); text-align: center; }
.home-tile-badge { display: none; position: absolute; top: 8px; right: 12px; width: 19px; height: 19px;
  border-radius: 50%; background: #E11D48; box-shadow: 0 0 0 2px var(--surface);
  align-items: center; justify-content: center; font-size: 12px; font-weight: 800; color: #fff; line-height: 1; }
.home-tile-badge.show { display: flex; }
/* A group button carries the same warning mark while any tile inside its group shows one. */
.group-btn { position: relative; }
.group-btn.has-alert::after { content: "!"; position: absolute; top: -7px; right: -5px; width: 18px; height: 18px;
  border-radius: 50%; background: #E11D48; box-shadow: 0 0 0 2px var(--bg);
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; color: #fff; line-height: 1; }
.cancel-request-card { border: 1.5px solid var(--pink-text); background: var(--pink-bg); border-radius: 12px; padding: 10px 12px; margin-top: 8px; }
.cancel-request-card p { margin: 0 0 8px; font-size: 12.5px; color: var(--pink-text); font-weight: 600; }
.back-btn { appearance: none; background: none; border: none; color: var(--accent-text); font-size: 13px;
  font-weight: 600; cursor: pointer; padding: 0; margin-bottom: 14px; display: inline-flex; align-items: center; gap: 4px; font-family: inherit; }
.svc-selector { display: flex; gap: 8px; margin-bottom: 14px; }
.svc-btn { flex: 1; appearance: none; font-family: inherit; cursor: pointer; font-size: 13px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 10px 6px; color: var(--text-secondary); }
.svc-btn.active { background: var(--accent-bg); border-color: var(--accent); color: var(--accent-text); }
.svc-panel { display: none; }
.svc-panel.active { display: block; }
.result-panel { background: var(--accent-bg); border-radius: 12px; padding: 14px; margin-top: 12px; }
.result-row { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 8px; color: var(--accent-text); }
.result-row b { font-size: 15px; }
.result-row.pay-part { padding-left: 12px; font-size: 12px; }
.result-row.pay-part b { font-size: 13px; white-space: nowrap; }
.result-row.pay-part small { display: block; font-size: 11px; opacity: 0.85; }
.result-actions { display: flex; gap: 8px; margin-top: 10px; }
.result-actions button { flex: 1; }
.rate-table-wrap { margin-bottom: 12px; }
table.rate-table { width: 100%; border-collapse: collapse; }
table.rate-table th, table.rate-table td { text-align: left; padding: 8px; font-size: 12px; border-bottom: 1px solid var(--border); }
table.rate-table th { background: var(--surface-sunken); color: var(--text-secondary); font-weight: 600; }
table.rate-table td.qty-cell input { width: 70px; padding: 5px 6px; font-size: 13px; }
.total-row { display: flex; justify-content: space-between; background: var(--surface-sunken); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; font-weight: 600; }
.tv-section { margin-bottom: 18px; }
.tv-section-title { font-size: 13px; font-weight: 600; padding: 7px 12px; border-radius: 8px 8px 0 0; margin: 0; }
.tv-section-title.inprocess { background: var(--pink-bg); color: var(--pink-text); }
.tv-section-title.queue { background: var(--warn-bg); color: var(--warn-text); }
.tv-section-title.completed { background: var(--ok-bg); color: var(--ok-text); }
.tv-section-title.hold { background: var(--hold-bg); color: var(--hold-text); }
.tv-section-title.closed { background: var(--closed-bg); color: var(--closed-text); }
table.tv-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-top: none; border-radius: 0 0 10px 10px; overflow: hidden; box-shadow: var(--shadow); }
table.tv-table th, table.tv-table td { text-align: left; padding: 8px 10px; font-size: 13px; border-bottom: 1px solid var(--border); }
table.tv-table th { color: var(--text-secondary); font-weight: 600; font-size: 11px; text-transform: none; }
table.tv-table tr:last-child td { border-bottom: none; }
.cap-note { font-size: 12px; color: var(--text-muted); margin: 6px 0 0; }
.status-card { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; box-shadow: var(--shadow); }
.status-card .who { display: flex; flex-direction: column; gap: 2px; }
.status-card .ord-id { font-weight: 700; font-size: 14px; }
.status-card .ord-cust { font-size: 12px; color: var(--text-secondary); }
.status-select { appearance: none; font-family: inherit; font-size: 12px; font-weight: 600; padding: 7px 26px 7px 10px;
  border-radius: 999px; border: 1px solid var(--border-strong); background-color: var(--surface); color: var(--text);
  background-repeat: no-repeat; background-position: right 8px center; background-size: 10px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath fill='%235B6B7F' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E"); }
.status-select.queue { background-color: var(--warn-bg); color: var(--warn-text); border-color: transparent; }
.status-select.inprocess { background-color: var(--pink-bg); color: var(--pink-text); border-color: transparent; }
.status-select.hold { background-color: var(--hold-bg); color: var(--hold-text); border-color: transparent; }
.status-select.closed { background-color: var(--closed-bg); color: var(--closed-text); border-color: transparent; }
.status-select.cancelled { background-color: var(--pink-bg); color: var(--pink-text); border-color: transparent; }
.status-select.ready_for_delivery { background-color: var(--warn-bg); color: var(--warn-text); border-color: transparent; }
.delivery-info-card { border: 1.5px solid var(--warn-text); background: var(--warn-bg); border-radius: 12px; padding: 10px 12px; margin-top: 8px; }
.delivery-info-card p { margin: 0 0 6px; font-size: 12.5px; color: var(--warn-text); }
.delivery-info-card .d-row { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; margin-bottom: 4px; }
.delivery-info-card .d-label { color: var(--text-muted); white-space: nowrap; }
.delivery-info-card input[type="text"] { margin-top: 4px; font-size: 13px; padding: 7px 8px; }
/* Milling status cards: header and selects share a row when there is room, detail panels always take a full row. */
#status-update-list .status-card { flex-wrap: wrap; align-items: flex-start; }
#status-update-list .status-card > .who { flex: 1 1 180px; min-width: 0; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
#status-update-list .status-card > .who .ord-cust { flex: 1 1 100%; }
#status-update-list .status-card > .two-col { flex: 2 1 260px; min-width: 0; margin: 0 !important; }
#status-update-list .status-card > .order-type-row, #status-update-list .status-card > .cancel-request-card,
#status-update-list .status-card > .delivery-info-card { flex: 1 1 100%; min-width: 0; margin-top: 0; }
.order-type-row { display: flex; align-items: center; gap: 8px; }
.order-type-row .field-label { margin: 0; white-space: nowrap; }
.order-type-row select { flex: 0 1 220px; min-width: 0; }
.status-select:disabled { cursor: not-allowed; opacity: 0.85; }
.cancel-request-card p.block-note { font-weight: 400; margin: 8px 0 0; }
.delivery-info-card input[type="datetime-local"] { width: 100%; margin-top: 4px; box-sizing: border-box; font-family: inherit; font-size: 13px; padding: 7px 8px; border-radius: 8px; border: 1px solid var(--border); }
.status-select.completed { background-color: var(--ok-bg); color: var(--ok-text); border-color: transparent; }
.status-select.open { background-color: var(--warn-bg); color: var(--warn-text); border-color: transparent; }
.status-select.prepared { background-color: var(--pink-bg); color: var(--pink-text); border-color: transparent; }
.status-select.unpaid { background-color: var(--hold-bg); color: var(--hold-text); border-color: transparent; }
table.price-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); }
table.price-table th, table.price-table td { text-align: left; padding: 9px 10px; font-size: 13px; border-bottom: 1px solid var(--border); }
table.price-table th { background: var(--surface-sunken); color: var(--text-secondary); font-weight: 600; font-size: 11px; }
table.price-table tr:last-child td { border-bottom: none; }
table.price-table td.buy { color: #DC2626; font-weight: 600; }
table.price-table td.sell { color: var(--ok-text); font-weight: 600; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) table.price-table td.buy { color: #F1948A; }
}
:root[data-theme="dark"] table.price-table td.buy { color: #F1948A; }
/* ===== Inventory & Service Dashboards: FusionCharts-inspired theme ===== */
#tab-inventory-dashboard, #tab-service-dashboard, #tab-trade-dashboard {
  --fc-blue: #0075C2; --fc-blue-light: #4FA8E8;
  --fc-green: #1AAF5D; --fc-green-light: #6FE3A0;
  --fc-orange: #F2854C; --fc-orange-light: #FFB37D;
  --fc-red: #E04F5F; --fc-red-light: #F58B97;
  --fc-amber: #F2A93C; --fc-amber-light: #FFCE85;
  --fc-purple: #8E6CC9; --fc-purple-light: #C2AAF0;
  --fc-teal: #00B8D9; --fc-teal-light: #6FE0F2;
  --fc-ink: #2B3A4A; --fc-sub: #6B7A8D; --fc-grid: #E3E8EF;
  background: #EEF2F7;
  border-radius: 18px; padding: 14px; margin: -2px;
}
#tab-inventory-dashboard .tv-section-title, #tab-service-dashboard .tv-section-title, #tab-trade-dashboard .tv-section-title {
  background: linear-gradient(135deg, var(--fc-blue), #005A96) !important;
  color: #FFFFFF !important;
  border: none;
  box-shadow: 0 4px 12px rgba(0,117,194,0.3);
  letter-spacing: 0.02em; font-size: 13px;
}
#tab-inventory-dashboard .back-btn, #tab-service-dashboard .back-btn, #tab-trade-dashboard .back-btn { color: var(--fc-blue); }
#tab-inventory-dashboard .card, #tab-service-dashboard .card, #tab-trade-dashboard .card {
  background: #FFFFFF !important;
  border: 1px solid var(--fc-grid) !important;
  box-shadow: 0 2px 10px rgba(43,58,74,0.08) !important;
  position: relative; overflow: hidden; border-radius: 12px !important;
  border-top: 3px solid var(--fc-blue) !important;
}
#tab-inventory-dashboard .card::before, #tab-service-dashboard .card::before, #tab-trade-dashboard .card::before { content: none; }
#tab-inventory-dashboard .card .card-title, #tab-service-dashboard .card .card-title, #tab-trade-dashboard .card .card-title {
  color: var(--fc-sub) !important; text-transform: uppercase;
  letter-spacing: 0.05em; font-size: 10.5px !important; font-weight: 700 !important; opacity: 1;
}
#tab-inventory-dashboard .lux-value, #tab-service-dashboard .lux-value, #tab-trade-dashboard .lux-value {
  font-size: 25px; font-weight: 800; margin: 8px 0 0; letter-spacing: -0.01em;
  color: var(--fc-ink);
}
#tab-inventory-dashboard .lux-value.gold, #tab-service-dashboard .lux-value.gold, #tab-trade-dashboard .lux-value.gold { color: var(--fc-blue); }
#tab-inventory-dashboard .lux-value.emerald, #tab-service-dashboard .lux-value.emerald, #tab-trade-dashboard .lux-value.emerald { color: var(--fc-green); }
#tab-inventory-dashboard .lux-value.ruby, #tab-service-dashboard .lux-value.ruby, #tab-trade-dashboard .lux-value.ruby { color: var(--fc-red); }
#tab-inventory-dashboard .lux-value.amber, #tab-service-dashboard .lux-value.amber, #tab-trade-dashboard .lux-value.amber { color: var(--fc-amber); }
#tab-inventory-dashboard .lux-value.purple, #tab-service-dashboard .lux-value.purple, #tab-trade-dashboard .lux-value.purple { color: var(--fc-purple); }
#tab-inventory-dashboard .lux-value.teal, #tab-service-dashboard .lux-value.teal, #tab-trade-dashboard .lux-value.teal { color: var(--fc-teal); }
.dash-section-label {
  font-size: 11px; font-weight: 800; color: var(--fc-sub); text-transform: uppercase;
  letter-spacing: 0.08em; margin: 0 0 2px 2px; padding-bottom: 6px;
  border-bottom: 2px solid var(--fc-grid);
}
.dash-view-panel { display: none; }
.dash-view-panel.active { display: block; }

/* ===== User Maintenance & Role Authorization ===== */
input[type="password"] { width: 100%; font-family: inherit; font-size: 14px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); }
#tab-user .status-card .who { min-width: 0; }
#tab-user .status-card .ord-id { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; overflow-wrap: anywhere; }
#tab-user .status-card .action { flex-shrink: 0; }
.role-pick-row { display: flex; gap: 8px; align-items: center; }
.role-pick-row select { flex: 1; min-width: 0; }
.role-pick-row .action { flex-shrink: 0; white-space: nowrap; }
.role-bulk-row { display: flex; gap: 6px; flex-wrap: wrap; }
.role-bulk-row .action { padding: 5px 10px; font-size: 12px; }
#tab-role button.action:disabled { opacity: 0.5; cursor: not-allowed; }
.search-wrap input[type="text"] { padding-left: 32px; }
table.perm-table { table-layout: fixed; min-width: 320px; }
table.perm-table th:not(:first-child), table.perm-table td.perm-cell { text-align: center; width: 46px; padding: 8px 2px; font-size: 11px; }
table.perm-table td.perm-name { font-size: 13px; overflow-wrap: anywhere; }
table.perm-table tr.perm-group td { background: var(--surface-sunken); color: var(--text-secondary); font-weight: 700; font-size: 11px; letter-spacing: 0.04em; }
table.perm-table tr.perm-subgroup td { color: var(--text-muted); font-weight: 700; font-size: 11px; padding-top: 10px; padding-bottom: 4px; border-bottom: none; }
table.perm-table input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
table.perm-table input[type="checkbox"]:disabled { cursor: not-allowed; }

/* ===== Sign-in and session ===== */
#login-screen { max-width: 440px; margin: 6px auto 0; display: flex; flex-direction: column; gap: 14px; }
#login-screen .card-title { margin-bottom: 4px; }
.login-error { display: none; color: var(--pink-text); background: var(--pink-bg); border-radius: 8px; padding: 8px 10px; font-size: 13px; margin: 0 0 12px; }
.login-error.show { display: block; }
.demo-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; width: 100%; appearance: none; font-family: inherit; text-align: left;
  background: none; border: none; border-top: 1px solid var(--border); padding: 9px 2px; cursor: pointer; color: var(--text); }
.demo-row:hover { background: var(--surface-sunken); }
.demo-row .demo-id { font-weight: 600; font-size: 13px; min-width: 84px; }
.demo-row .demo-meta { font-size: 12px; color: var(--text-secondary); flex: 1 1 120px; min-width: 0; }
#session-bar { display: none; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 8px 12px; margin-bottom: 14px; font-size: 13px; box-shadow: var(--shadow); }
#session-bar.show { display: flex; }
.session-who { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }
#session-bar .action { padding: 5px 12px; font-size: 12px; }
.branch-pick-card { margin-bottom: 14px; }
.branch-pick-card .cap-note { margin-top: 6px; }

/* ===== Milling order details popup ===== */
.order-detail-btn { margin-left: auto; }
#status-update-list .status-card .who .order-detail-btn { padding: 4px 10px; font-size: 12px; border-radius: 999px; }
.order-details .od-title { font-size: 16px; font-weight: 700; margin: 0 0 4px; }
.order-details .od-section { font-size: 11px; font-weight: 700; color: var(--text-secondary); letter-spacing: 0.04em; margin: 12px 0 4px;
  padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.order-details .od-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; padding: 3px 0; }
.order-details .od-label { color: var(--text-secondary); flex-shrink: 0; }
.order-details .od-row.od-part { padding-left: 12px; font-size: 12px; }
.order-details .od-row.od-part .od-label { flex: 1 1 auto; min-width: 0; }
.order-details .od-row.od-part .od-value { white-space: nowrap; flex-shrink: 0; overflow-wrap: normal; }
.order-details .od-label small { display: block; font-size: 11px; opacity: 0.85; }
.order-details .od-value { text-align: right; font-weight: 600; min-width: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.order-details .od-qr { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: 14px; }
.order-details .od-qr svg { width: 132px; height: 132px; border-radius: 6px; }
.order-details .od-qr span { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11px; color: var(--text-secondary); }

/* ===== Marketing ===== */
#tab-marketing input[type="date"] { width: 100%; min-width: 0; font-family: inherit; font-size: 14px; padding: 7px 8px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); }
#tab-marketing .checkline { font-size: 14px; cursor: pointer; }
#tab-marketing .suggest-values b { color: var(--ok-text); }

/* ===== Customer master ===== */
.cust-result-list { max-height: 220px; overflow-y: auto; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.cust-row.selected { background: var(--accent-bg); }
input[type="number"]:disabled { color: var(--text-muted); background: var(--surface-sunken); }

/* ===== Milling Production: total output ratio ===== */
#mp-yield-total-row.over { background: var(--pink-bg); color: var(--pink-text); }
#mp-yield-total { text-align: right; }
#tab-milling-production button.action:disabled { opacity: 0.5; cursor: not-allowed; }

/* ==========================================================================
   Base project additions. Everything above is the design prototype's stylesheet, unchanged
   (except its print rule). The rules below replace the prototype's inline style attributes,
   which the Content-Security-Policy of the real system does not allow, and style the few
   things the prototype did not have (links that look like buttons, notices, planned tiles).
   ========================================================================== */
[hidden] { display: none !important; }
a.lang-btn { text-decoration: none; display: inline-block; }
#session-bar form { margin: 0; }

/* links that look like the prototype's buttons */
a.action { display: inline-block; text-align: center; text-decoration: none; font-family: inherit; cursor: pointer; font-size: 13px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 8px 14px; color: var(--text); }
a.action:hover { background: var(--surface-sunken); }
a.action.primary { background: var(--accent); border-color: var(--accent); color: #FFFFFF; font-weight: 600; width: 100%; box-shadow: var(--shadow); }
a.action.primary:hover { background: var(--accent-text); }
a.back-btn { text-decoration: none; }
a.demo-row { text-decoration: none; box-sizing: border-box; }
a.chip, a.group-btn, a.home-tile, a.svc-btn { text-decoration: none; text-align: center; }
a.group-btn { display: block; }
button.action:disabled, .action[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.svc-btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* form fields the prototype did not use */
input[type="time"], input[type="search"], input[type="tel"], textarea { width: 100%; font-family: inherit; font-size: 14px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); }
select:disabled { color: var(--text-muted); background-color: var(--surface-sunken); }
fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; }

/* replacements for the prototype's inline styles */
.tv-section-title.plain { background: var(--surface-sunken); color: var(--text); }
.card.gap { margin: 14px 0; }
.mt14 { margin-top: 14px; } .mb14 { margin-bottom: 14px; } .mb0 { margin-bottom: 0; } .mt6 { margin-top: 6px; }
.desc-text { font-size: 13px; color: var(--text-secondary); line-height: 1.6; margin: 0; }
.desc-text + .rule-list { margin-top: 10px; }
.rule-list { margin: 0; padding-left: 18px; font-size: 13px; color: var(--text-secondary); line-height: 1.7; }
.card-title.sub { margin: 10px 0 4px; } .card-title.section { margin: 16px 0 10px; } .card-title.mb10 { margin-bottom: 10px; }
.cap-note.tight { margin: 0 0 8px; } .cap-note.after-row { margin: -4px 0 12px; } .cap-note.mb12 { margin-bottom: 12px; }
.row-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.row-inline.last { margin-bottom: 0; }
.row-inline .field-label { margin: 0; white-space: nowrap; }
.row-inline input { flex: 1; min-width: 140px; }
.icon-btn { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 10px; border: none; background: var(--accent); cursor: pointer;
  display: flex; align-items: center; justify-content: center; padding: 0; }
.badge.neutral { background: var(--surface-sunken); color: var(--text-secondary); }
.btn-pair { display: flex; gap: 8px; } .btn-pair > * { flex: 1; }
.btn-pair form { display: flex; margin: 0; } .btn-pair form > button { flex: 1; }
.full { width: 100%; }
.result-actions a { flex: 1; }
.result-panel[hidden] + * { margin-top: 0; }
.status-card .two-col > form { display: flex; }
.status-card .two-col > form > select { flex: 1; min-width: 0; width: 100%; }
.inline-form { display: contents; }
.status-card form { margin: 0; min-width: 0; }
.status-card .two-col.field-row { margin-top: 6px; }
.delivery-info-card label { display: block; margin-top: 6px; font-size: 12.5px; color: var(--warn-text); }
.delivery-info-card .action.primary { margin-top: 8px; }
.stale-note { margin: 0 0 8px; color: var(--warn-text); font-weight: 600; }
.home-empty { text-align: center; padding: 24px 0; }
.amount-in { color: var(--ok-text); font-weight: 600; }
.small-btn { padding: 4px 10px !important; font-size: 12px !important; }
table.tv-table.wide { margin-bottom: 6px; min-width: 520px; }
.login-error.show + .action { margin-top: 0; }

/* home: screens that are planned but not built yet */
.home-tile.planned { border-style: dashed; box-shadow: none; }
.home-tile.planned .label { color: var(--text-secondary); }
.home-tile .tile-note { font-size: 11px; color: var(--text-muted); }

/* notices (also shown in the pop-up by app.js) */
.notice { border-radius: 8px; padding: 8px 10px; font-size: 13px; margin: 0 0 12px; overflow-wrap: anywhere; }
.notice.ok { background: var(--ok-bg); color: var(--ok-text); }
.notice.error { background: var(--pink-bg); color: var(--pink-text); }
.notice.warn { background: var(--warn-bg); color: var(--warn-text); }

/* pop-up (the prototype's app-modal, written as classes) */
#app-modal-overlay { display: none; position: fixed; inset: 0; background: rgba(16,24,40,0.5); z-index: 1000; align-items: center; justify-content: center; padding: 20px; }
#app-modal-overlay.show { display: flex; }
#app-modal-box { background: var(--surface); border-radius: 14px; max-width: 400px; width: 100%; padding: 20px; box-shadow: 0 12px 32px rgba(0,0,0,0.3); max-height: 85vh; overflow-y: auto; }
#app-modal-message { font-size: 14px; color: var(--text); margin: 0 0 16px; line-height: 1.5; white-space: pre-line; }
#app-modal-message.html { white-space: normal; }
#app-modal-input { margin-bottom: 16px; }
#app-modal-actions { display: flex; gap: 8px; }
#app-modal-actions button { flex: 1; }

/* order details shown as a page (after registration) */
.order-details .od-actions { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.order-details .od-actions .cap-note { margin: 0 0 8px; }

@media print {   /* the app's pages print only the QR label; the stand-alone print pages (customer card, LINE poster) print whole.
                    Keep these selectors simple: a stronger "hidden" rule here hid the label too (update 41 fix) */
  body * { visibility: hidden; }
  .qr-label, .qr-label * { visibility: visible; }
  body.cust-card-page *, body.line-poster * { visibility: visible; }
  /* no extra blank pages: the parts of the page without the label (or receipt) take no room */
  body:not(.cust-card-page):not(.line-poster) *:not(:has(.qr-label)):not(:has(.receipt)):not(.qr-label):not(.qr-label *):not(.receipt):not(.receipt *) { display: none !important; }
  body:not(.cust-card-page):not(.line-poster) { min-height: 0 !important; height: auto !important; }
  .qr-label { position: absolute !important; top: 0 !important; left: 0 !important; box-shadow: none; }
}

/* ===== Update 4: inventory inbound pop-up, hold reason, buy/sell list ===== */
#app-modal-actions[hidden] { display: none; }
.inbound-form .field-row { margin-top: 10px; }
.inbound-form .field-row input, .inbound-form .field-row select { width: 100%; }
.inbound-form .btn-pair { margin-top: 14px; }
.inbound-form input:user-invalid { border-color: var(--pink-text); }
.hold-reason-note { margin: 8px 0 0; padding: 7px 10px; border-radius: 8px; font-size: 12px; background: var(--hold-bg); color: var(--hold-text); overflow-wrap: anywhere; }
.status-card .bs-note { margin: 6px 0 0; font-size: 12px; color: var(--text-secondary); }
.status-card .bs-amount { font-weight: 600; font-variant-numeric: tabular-nums; }
.order-details .od-link { color: inherit; }
.badge.from-milling { background: var(--hold-bg); color: var(--hold-text); }
#bs-status-update-list .status-card { flex-wrap: wrap; align-items: center; }
#bs-status-update-list .status-card > .who { flex: 1 1 200px; min-width: 0; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
#bs-status-update-list .status-card > .who .ord-cust { flex: 1 1 100%; }
#bs-status-update-list .status-card > form { flex: 0 0 auto; }
#bs-status-update-list .status-card > form > select { min-width: 150px; }
#bs-status-update-list .status-card > .bs-note { flex: 1 1 100%; margin: 0; }

/* ===== Update 5: editable order details, delivery confirmation ===== */
.od-editable .od-field { margin: 6px 0; }
.od-editable .od-field input { width: 100%; box-sizing: border-box; }
.od-editable .two-col.od-field input { width: 100%; }
.od-inline { display: flex; gap: 8px; } .od-inline input { flex: 1; min-width: 0; } .od-inline .action { flex-shrink: 0; }
.od-cust-results { margin-top: 6px; max-height: 180px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; }
.od-save-btn { width: 100%; margin-top: 10px; }
.status-card.needs-attention { border: 1.5px solid var(--warn-text); }
.delivery-info-card .d-confirmed { margin: 8px 0 4px; font-weight: 600; }
.delivery-info-card input[type="datetime-local"] { width: 100%; box-sizing: border-box; }

/* ===== Update 6: Customer Service > Buy / Sell, receipt ===== */
.bs-panel .rate-table td.num, .bs-panel .rate-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.bs-panel .rate-table td.qty-cell input { width: 90px; max-width: 100%; }
.bs-panel .btn-pair { margin-top: 10px; }
.bs-panel .rate-table { table-layout: auto; }
.bs-check-table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 13px; }
.bs-check-table th, .bs-check-table td { padding: 5px 6px; border-bottom: 1px solid var(--border); text-align: left; }
.bs-check-table .num { text-align: right; white-space: nowrap; }
.bs-check-table .short { color: var(--pink-text); }
.bs-billing-btn { padding: 4px 10px; font-size: 12px; border-radius: 999px; flex: 0 0 auto; }
.receipt { background: #fff; color: #000; border: 1px solid var(--border); border-radius: 8px; padding: 14px; font-family: Arial, sans-serif; }
.receipt .rc-logo { display: block; width: 120px; height: auto; margin: 0 auto 6px; }
.receipt .rc-brand { font-size: 18px; font-weight: 700; margin: 0; }
.receipt .rc-addr { font-size: 11px; margin: 2px 0 10px; line-height: 1.4; }
.receipt .rc-title { margin: 0 0 8px; padding: 6px 0; border-top: 1px solid #000; border-bottom: 1px solid #000; font-weight: 700; }
.receipt .rc-row { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 2px 0; }
.receipt .rc-items { font-weight: 600; font-size: 13px; margin: 10px 0 4px; }
.receipt .rc-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.receipt .rc-table th, .receipt .rc-table td { padding: 4px 3px; border-bottom: 1px solid #ccc; text-align: left; }
.receipt .rc-table .num { text-align: right; white-space: nowrap; }
.receipt .rc-table tfoot td { font-weight: 700; border-bottom: 0; }
.rc-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.rc-print-btn, .rc-line-btn { width: 100%; }
.rc-line-btn:not([disabled]) { background: #06C755; border-color: #06C755; color: #fff; }
.rc-line-status { margin: 8px 0 0; font-size: 13px; text-align: center; }
.rc-line-status.ok { color: #0a7a3a; }
.rc-line-status.bad { color: #b42318; }
@media print {
  body.print-receipt .qr-label, body.print-receipt .qr-label * { visibility: hidden; }
  body.print-receipt .receipt, body.print-receipt .receipt * { visibility: visible; }
  body.print-receipt .receipt { position: absolute; top: 0; left: 0; width: 80mm; border: 0; }
}

/* ===== Update 7: Inventory ===== */
.inv-toolbar-actions { display: flex; gap: 8px; }
.inv-search { display: flex; gap: 8px; margin-bottom: 10px; }
.inv-search input { flex: 1; min-width: 0; }
.inv-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tv-table td.num, table.tv-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tv-table td.nowrap { white-space: nowrap; }
table.tv-table td.center { text-align: center; padding: 16px; }
.inv-link { font-weight: 600; color: inherit; }
.inv-sub, .inv-kept { display: block; font-size: 11px; color: var(--text-secondary); margin-top: 2px; overflow-wrap: anywhere; }
.inv-kept { color: var(--hold-text); }
.inv-kind.in { color: var(--ok-text); font-weight: 600; }
.inv-kind.out { color: var(--pink-text); font-weight: 600; }
.inv-kind.T, .inv-kind.ST { color: var(--text-secondary); font-weight: 600; }
.inv-mini-link { font-size: 12px; }
.inv-form .field-row input, .inv-form .field-row select { width: 100%; box-sizing: border-box; }
.inv-history-filter { gap: 8px; }
.inv-kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.inv-kpi-grid .inv-kpi-wide { grid-column: 1 / -1; }
.inv-kpi-note { font-size: 12px; color: var(--fc-sub); margin: 4px 0 0; }
.inv-chart { width: 100%; max-width: 380px; display: block; margin: 8px auto 0; }
.inv-chart text { font-family: inherit; }
.inv-chart text.v { font-size: 14px; font-weight: 800; fill: var(--fc-ink); }
.inv-chart text.l { font-size: 11px; fill: var(--fc-sub); }
.inv-chart text.small { font-size: 9.5px; }
.inv-chart .mark:hover rect:last-child, .inv-donut .mark:hover path, .inv-donut .mark:hover circle { opacity: 0.8; }
.inv-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; font-size: 12px; color: var(--fc-ink); margin-top: 6px; }
.inv-legend i, .inv-pie-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.inv-donut-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.inv-donut { width: 160px; height: 160px; flex-shrink: 0; }
.inv-pie-legend { list-style: none; margin: 0; padding: 0; flex: 1 1 180px; min-width: 0; color: var(--fc-ink); font-size: 13px; }
.inv-pie-legend li { display: flex; align-items: center; gap: 6px; padding: 4px 0; border-bottom: 1px solid var(--fc-grid); }
.inv-pie-legend li span { flex: 1; min-width: 0; }
.inv-pie-legend li b { font-variant-numeric: tabular-nums; }
.inv-pie-legend li small { color: var(--fc-sub); width: 48px; text-align: right; }
.sw-in { background: var(--fc-green); } .sw-out { background: var(--fc-red); } .sw-other { background: var(--fc-sub); }
.sw-PADDY { background: var(--fc-blue); } .sw-RICE_W5 { background: var(--fc-orange); } .sw-BRAN { background: var(--fc-purple); }
.sw-BROKEN { background: var(--fc-green); } .sw-HUSK { background: var(--fc-teal); }
#inv-list-table td:first-child { min-width: 130px; } #inv-list-table .inv-sub { white-space: normal; overflow-wrap: normal; word-break: keep-all; }
#inv-list-table td:nth-child(2) { overflow-wrap: anywhere; min-width: 70px; }

/* ===== Update 8: Financial and Service screens ===== */
.market-edit { margin-top: 10px; font-size: 13px; }
.market-edit summary { cursor: pointer; color: var(--accent-text); }
.market-edit form { margin-top: 8px; }
.span2 { grid-column: 1 / -1; }
.action.full { width: 100%; }
.acct-totals { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.acct-totals .result-panel { margin: 0; }
.acct-income { background: var(--closed-bg); } .acct-expense { background: var(--pink-bg); }
.result-row.acct-block { display: block; } .result-row.acct-block b { display: block; font-size: 18px; }
#acct-net-balance { font-size: 18px; } #acct-net-balance.neg { color: var(--pink-text); } #acct-net-balance.pos { color: var(--closed-text); }
.mt10 { margin-top: 10px; }
.acct-amt.in { color: var(--closed-text); font-weight: 600; } .acct-amt.ex { color: var(--pink-text); font-weight: 600; }
.acct-delete-btn { border: none; background: none; color: var(--pink-text); cursor: pointer; font-size: 14px; padding: 4px 8px; }
.inline-form { display: inline; margin: 0; }
.kpi-link { display: block; text-decoration: none; color: inherit; }
.kpi-link:hover { box-shadow: 0 4px 14px rgba(43,58,74,0.16) !important; }
.inv-chart text.donut-total, .inv-donut text.donut-total { font-size: 18px; font-weight: 800; fill: var(--fc-ink); }
.inv-donut text.donut-sub { font-size: 9px; fill: var(--fc-sub); text-transform: uppercase; }
.inv-chart text.v.small { font-size: 10px; }
.cap-note.center { text-align: center; }
.sw-st-Q, .sw-st-0 { background: var(--fc-blue); } .sw-st-I, .sw-st-1 { background: var(--fc-teal); }
.sw-st-H, .sw-st-2 { background: var(--fc-purple); } .sw-st-F, .sw-st-3 { background: var(--fc-green); }
.sw-st-C, .sw-st-4 { background: var(--fc-sub); }
#tab-service-dashboard .inv-pie-legend li, #tab-service-dashboard .inv-legend { color: var(--fc-ink); }
#acct-form input, #acct-form select, #mk-form input[type="date"], #mk-form input[type="number"] { width: 100%; box-sizing: border-box; }
#acct-form input[type="date"], #mk-form input[type="date"] { font-family: inherit; font-size: 14px; padding: 7px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); min-height: 38px; }

/* ===== Update 9: Automation ===== */
.auto-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.auto-kpis .card { margin: 0; }
.kpi-value { font-size: 20px; font-weight: 800; margin: 6px 0 0; color: var(--text); overflow-wrap: anywhere; }
.kpi-value.small { font-size: 14px; }
.auto-chart { width: 100%; max-width: 420px; display: block; margin: 6px auto 0; }
.auto-chart .grid { stroke: var(--border); }
.auto-chart .axis { stroke: var(--text-secondary); opacity: 0.4; }
.auto-chart .bar { fill: var(--accent); }
.auto-chart .mark:hover .bar { opacity: 0.8; }
.auto-chart text { font-family: inherit; }
.auto-chart text.v { font-size: 11px; font-weight: 700; fill: var(--text); }
.auto-chart text.l { font-size: 9.5px; fill: var(--text-secondary); }
.machine-card .cap-note.tight { margin: 0; }

.action.danger { background: var(--pink-bg); color: var(--pink-text); border-color: var(--pink-text); }
.action:disabled { opacity: 0.45; cursor: not-allowed; }
.link-btn { border: none; background: none; color: var(--accent-text); cursor: pointer; padding: 0; font: inherit; text-decoration: underline; }
.setup-box summary { cursor: pointer; }
.key-box { border: 2px solid var(--warn-text); }
.key-box input.mono { width: 100%; box-sizing: border-box; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.alert-row { font-size: 13px; margin: 0; padding: 8px 0; border-bottom: 1px solid var(--border); }
.alert-row:last-of-type { border-bottom: none; }
td.advice.raise_buy { color: var(--pink-text); font-weight: 600; } td.advice.lower_buy { color: var(--warn-text); font-weight: 600; }
#ai-question { width: 100%; box-sizing: border-box; font-family: inherit; font-size: 14px; padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); }
.ai-answer { background: var(--surface-sunken); border-radius: 8px; padding: 10px 12px; margin: 8px 0; }
.ai-answer .ai-q { font-weight: 600; margin: 0 0 6px; } .ai-answer .ai-a { margin: 0; white-space: pre-wrap; font-size: 13px; }
.ai-answer small { font-weight: 400; color: var(--text-secondary); }
@media (max-width: 420px) { .auto-kpis { grid-template-columns: 1fr 1fr; } .auto-kpis > :last-child { grid-column: 1 / -1; } }
/* five menu groups: wrap onto two rows on a phone instead of scrolling sideways */
.group-toggle { flex-wrap: wrap; }
.group-btn { min-width: 0; }
@media (max-width: 560px) { .group-btn { flex: 1 1 30%; } }
.mc-list { display: flex; flex-direction: column; gap: 12px; }
.mc-manual .od-inline { flex-wrap: wrap; }
.mc-manual .od-inline select { flex: 1 1 130px; min-width: 0; }
.mc-manual .od-inline input { flex: 2 1 150px; min-width: 0; }
.auto-page .cap-note a, .auto-page .hint a { color: var(--accent-text); font-weight: 600; }

/* ===== Update 10: rice varieties ===== */
.rate-table tr.rate-group th { text-align: left; font-size: 12px; font-weight: 700; color: var(--accent-text); background: var(--surface-sunken); padding: 6px 8px; }
.sw-paddy { background: var(--fc-blue); } .sw-rice { background: var(--fc-orange); } .sw-bran { background: var(--fc-purple); }
.sw-broken { background: var(--fc-green); } .sw-husk { background: var(--fc-teal); }
#profit-table td.neg { color: var(--pink-text); }
#profit-table tr.pf-rec td { background: var(--accent-bg); }
#profit-table small.warn { color: var(--warn-text); font-weight: 600; }
.pf-line b { color: var(--warn-text); }
.mk-map-row { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 10px; }
.mk-map-row:first-of-type { border-top: none; margin-top: 0; }
.mk-map-fields { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 8px; }
.mk-map-fields input, .mk-map-fields select { width: 100%; box-sizing: border-box; min-width: 0; }
@media (max-width: 560px) { .mk-map-fields { grid-template-columns: 1fr 1fr; } .mk-map-fields > :first-child { grid-column: 1 / -1; } }
.mono-wrap { overflow-wrap: anywhere; word-break: break-all; }
#mk-upload-form { flex-wrap: wrap; }
#mk-upload-form input[type=file] { flex: 1 1 200px; min-width: 0; }
.price-table tr.price-group th { text-align: left; font-size: 13px; padding: 8px 10px 4px; color: var(--accent-text); background: transparent; }
.badge.variety-badge { background: var(--accent-bg); color: var(--accent-text); }
.mk-src-row { grid-template-columns: 1.2fr 2fr 1.4fr 1.2fr; margin-bottom: 8px; }
@media (max-width: 560px) { .mk-src-row { grid-template-columns: 1fr 1fr; } .mk-src-row > :nth-child(2) { grid-column: 1 / -1; } }
#tv-link { width: 100%; box-sizing: border-box; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }

/* order details: status timeline (update 22) */
.od-timeline { list-style: none; margin: 4px 0 8px; padding: 0 0 0 14px; border-left: 2px solid var(--border); }
.od-timeline .tl-item { position: relative; padding: 4px 0 8px 10px; font-size: 13px; display: flex; flex-direction: column; gap: 1px; }
.od-timeline .tl-item::before { content: ""; position: absolute; left: -21px; top: 8px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--text-secondary); border: 2px solid var(--surface, #fff); }
.od-timeline .tl-queue::before { background: var(--warn-text); } .od-timeline .tl-inprocess::before { background: #0075C2; }
.od-timeline .tl-hold::before { background: #B54708; } .od-timeline .tl-completed::before, .od-timeline .tl-closed::before { background: var(--ok-text); }
.od-timeline .tl-cancelled::before { background: #B42318; } .od-timeline .tl-ready_for_delivery::before { background: #7A5AF8; }
.od-timeline .tl-time { font-size: 11.5px; color: var(--text-secondary); }
.od-timeline .tl-sub { font-size: 12px; color: var(--text-secondary); }
/* Milling Analysis (update 22) */
.ma-filter-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; align-items: end; }
.ma-filter-row .ma-filter-btn .action { width: 100%; }
@media (max-width: 640px) { .ma-filter-row { grid-template-columns: 1fr 1fr; } }
#tab-mill-analysis .auto-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 640px) { #tab-mill-analysis .auto-kpis { grid-template-columns: 1fr 1fr; } }
#tab-mill-analysis .tv-table .pos { color: var(--closed-text); } #tab-mill-analysis .tv-table .neg, #tab-mill-analysis .cap-note .neg { color: var(--pink-text); }
#tab-mill-analysis .block-sub { display: block; font-size: 11px; color: var(--text-secondary); }
.ma-filter-row input, .ma-filter-row select { width: 100%; box-sizing: border-box; }
/* customer mobile with country code (update 23) */
.phone-group { display: grid; grid-template-columns: minmax(118px, 42%) 1fr; gap: 6px; }
.phone-group select, .phone-group input { width: 100%; min-width: 0; box-sizing: border-box; }
/* queue label: LINE registration QR (update 24) */
.qr-label .ql-line-reg { display: flex; align-items: center; gap: 8px; border-top: 1px dashed #999; padding: 6px 0; margin-bottom: 6px; }
.qr-label .ql-line-qr { width: 40%; flex-shrink: 0; } .qr-label .ql-line-qr svg { display: block; width: 100%; height: auto; }
.qr-label .ql-line-text { font-size: 11px; line-height: 1.35; } .qr-label .ql-line-text b { color: #06C755; font-size: 13px; }
.ln-reason { display: block; flex-basis: 100%; font-size: 12px; color: var(--pink-text); margin-top: 2px; }
/* LINE setup card and counter poster (update 24) */
.ln-check td.ok { color: var(--closed-text); } .ln-check td.bad { color: var(--pink-text); }
body.line-poster { background: #fff; }
.lp-page { max-width: 640px; margin: 24px auto; padding: 24px; text-align: center; font-family: inherit; color: #111; }
.lp-logo { width: 220px; height: auto; } .lp-page h1 { font-size: 30px; margin: 18px 0 4px; } .lp-line { color: #06C755; }
.lp-sub { color: #555; margin: 0 0 14px; font-size: 16px; }
.lp-qr { display: flex; flex-direction: column; align-items: center; gap: 6px; } .lp-qr svg { width: 300px; height: 300px; }
.lp-qr span { font-size: 12px; color: #666; word-break: break-all; }
.lp-steps { text-align: left; font-size: 18px; line-height: 1.5; margin: 18px auto; max-width: 520px; } .lp-steps li { margin-bottom: 10px; }
.lp-steps small { color: #666; font-size: 13px; }
@media print { .lp-print { display: none; } .lp-page { margin: 0 auto; } }
/* LINE Message Maintenance (update 25) */
.lm-card textarea { width: 100%; box-sizing: border-box; font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; resize: vertical; }
.lm-id { font-size: 13px; } .lm-param { font-family: ui-monospace, Menlo, monospace; font-size: 12px; background: var(--hold-bg, #f2f2f2); padding: 0 4px; border-radius: 4px; }
.lm-preview { background: #E9F9EF; color: #0b3d1e; border-radius: 12px; padding: 8px 12px; margin-top: 6px; }
.lm-preview p { margin: 2px 0 0; white-space: pre-line; font-size: 14px; } .lm-preview .field-label { color: #06C755; }
.check-row { display: flex; gap: 8px; align-items: center; font-size: 14px; }
/* Pricing Maintenance tabs and the market price history graph (update 25) */
.seg-tabs { display: flex; gap: 4px; background: var(--surface-sunken); border-radius: 12px; padding: 4px; }
.seg-tab { flex: 1; text-align: center; padding: 10px 12px; border-radius: 9px; font-weight: 600; font-size: 15px; color: var(--text-secondary);
  text-decoration: none; border: 0; background: transparent; cursor: pointer; font-family: inherit; }
.seg-tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg-tabs.small { flex: 0 0 auto; padding: 3px; } .seg-tabs.small .seg-tab { padding: 6px 10px; font-size: 13px; flex: 0 0 auto; }
#market-history { --mkh-HM: #2a78d6; --mkh-WH: #eb6834; --mkh-GL: #1baf7a; --mkh-bran: #6250d6; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) #market-history { --mkh-HM: #3987e5; --mkh-WH: #d95926; --mkh-GL: #199e70; --mkh-bran: #9085e9; } }
:root[data-theme="dark"] #market-history { --mkh-HM: #3987e5; --mkh-WH: #d95926; --mkh-GL: #199e70; --mkh-bran: #9085e9; }
#market-history .card-head { flex-wrap: wrap; gap: 8px; }
.mkh-skus { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 0; font-size: 13px; }
.mkh-sku { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--text); }
.mkh-sku.nodata { color: var(--text-muted); }
.mkh-sw { display: inline-block; width: 22px; height: 0; border-top: 3px solid var(--text-secondary); }
.mkh-sw.mkh-k-rice { border-top-style: dashed; } .mkh-sw.mkh-k-broken { border-top-style: dotted; }
.mkh-v-HM { border-color: var(--mkh-HM); } .mkh-v-WH { border-color: var(--mkh-WH); } .mkh-v-GL { border-color: var(--mkh-GL); } .mkh-v-bran { border-color: var(--mkh-bran); }
.mkh-quick { margin-left: auto; color: var(--text-muted); }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
.mkh-wrap { position: relative; }
.mkh-svg { display: block; width: 100%; height: auto; }
.mkh-grid { stroke: var(--border); stroke-width: 1; } .mkh-axis { fill: var(--text-muted); font-size: 11px; }
.mkh-end { fill: var(--text-secondary); font-size: 11px; font-weight: 600; }
.mkh-cross { stroke: var(--text-muted); stroke-width: 1; stroke-dasharray: 3 3; }
.mkh-tip { position: absolute; top: 8px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 10px; font-size: 12px; box-shadow: var(--shadow); pointer-events: none; min-width: 160px; z-index: 2; }
.mkh-tip div { display: flex; align-items: center; gap: 6px; margin-top: 3px; white-space: nowrap; }
#mkh-table .pos { color: var(--ok-text); } #mkh-table .neg { color: var(--pink-text); }
@media (max-width: 640px) { #mkh-table .mkh-src { display: none; } #mkh-table td, #mkh-table th { padding-left: 6px; padding-right: 6px; } }
/* Current Services: prices and the milling queue on one screen (update 26) */
.cs-grid { display: grid; grid-template-columns: 1fr; gap: 14px; margin-top: 14px; }
@media (min-width: 900px) { .cs-grid { grid-template-columns: 1fr 1fr; align-items: start; } }
#cust-line summary { display: inline-block; list-style: none; cursor: pointer; } #cust-line summary::-webkit-details-marker { display: none; }
.cust-line-qr { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: 6px; } .cust-line-qr svg { width: 220px; height: 220px; }
.cust-line-qr span { font-size: 11px; color: var(--text-muted); word-break: break-all; text-align: center; }
/* Administration quick jumps (update 26) */
.quick-jump { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 4px; padding: 8px 2px; margin: 10px 0;
  background: var(--bg); border-bottom: 1px solid var(--border); }
.qj-track { display: flex; gap: 6px; overflow-x: auto; flex: 1; min-width: 0; -webkit-overflow-scrolling: touch; scrollbar-width: none; scroll-behavior: smooth; }
.qj-track::-webkit-scrollbar { display: none; }
.qj-arrow { display: none; flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-size: 18px; line-height: 1; cursor: pointer; padding: 0; }
.qj-arrow:disabled { opacity: .35; cursor: default; }
.quick-jump.overflow .qj-arrow { display: inline-block; }
.quick-jump.open { align-items: flex-start; } .quick-jump.open .qj-track { flex-wrap: wrap; overflow: visible; }
.quick-jump.open .qj-prev, .quick-jump.open .qj-next { display: none; }
.quick-jump.open .qj-all { background: var(--accent); border-color: var(--accent); color: #fff; }
.qj-chip { flex: 0 0 auto; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); font-size: 13px; text-decoration: none; white-space: nowrap; }
.qj-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.qj-top { color: var(--text-secondary); }
[id^="qj-"], .card[id], .home-subgroup { scroll-margin-top: 64px; }

/* ---- Financial > Investment & Break-even (draft, update 27) ---- */
.three-col { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 520px) { .three-col { grid-template-columns: 1fr; } }
#tab-invest .neg { color: var(--pink-text); } #tab-invest .pos { color: var(--closed-text); }
#tab-invest tr.muted td { color: var(--text-muted); }
#tab-invest tr.iv-group td { background: transparent; color: var(--accent-text); font-size: 13px; padding-top: 12px; }
#tab-invest tfoot td { border-top: 2px solid var(--border); }
.iv-budget-input { max-width: 140px; text-align: right; margin-left: auto; display: block; }
#iv-budget-table select { min-width: 92px; }
.iv-used { min-width: 120px; }
.iv-bar { position: relative; height: 8px; border-radius: 4px; background: var(--surface-sunken); margin-top: 4px; }
.iv-bar-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--iv-rev); }
.iv-bar-fill.over { background: var(--pink-text); }
.iv-bar-mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text-muted); }
#tab-invest { --iv-rev: #2a78d6; --iv-cost: #eb6834; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) #tab-invest { --iv-rev: #3987e5; --iv-cost: #d95926; } }
:root[data-theme="dark"] #tab-invest { --iv-rev: #3987e5; --iv-cost: #d95926; }
.iv-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--text-secondary); margin: 6px 0; }
.iv-legend span { display: inline-flex; align-items: center; gap: 6px; }
.iv-sw { display: inline-block; width: 20px; height: 0; border-top: 2px solid; }
.iv-sw.rev { border-color: var(--iv-rev); } .iv-sw.cost { border-color: var(--iv-cost); } .iv-sw.fixed { border-color: var(--text-muted); border-top-style: dashed; }
.iv-chart-wrap { position: relative; }
#iv-be-chart svg { display: block; width: 100%; height: auto; }
.iv-line-rev { stroke: var(--iv-rev); } .iv-line-cost { stroke: var(--iv-cost); }
.iv-line-fixed { stroke: var(--text-muted); stroke-dasharray: 5 4; }
.iv-zone-profit { fill: var(--iv-rev); opacity: 0.10; } .iv-zone-loss { fill: var(--iv-cost); opacity: 0.10; }
.iv-ref { stroke: var(--text-muted); stroke-width: 1; stroke-dasharray: 2 3; }
.iv-ref-label { fill: var(--text-secondary); font-size: 11px; }
.iv-be-dot { fill: var(--surface); stroke: var(--text); stroke-width: 2; }
.iv-be-label { fill: var(--text); font-size: 12px; font-weight: 700; }
#iv-years-table tr.pf-rec td { background: var(--surface-sunken); font-weight: 700; }
#iv-budget-table .iv-budget-input { width: 120px; min-width: 120px; }
#iv-budget-table small.inv-sub { white-space: nowrap; }
.linked-open-note { font-size: 13px; color: var(--text-secondary); background: var(--surface-sunken); border-radius: 8px; padding: 6px 10px; margin: 6px 0; }
/* update 29: main milling motor ON/OFF */
.machine-card.main-motor { border: 2px solid var(--accent-text); }
.motor-onoff .action { font-size: 18px; padding: 14px 10px; }
#machine-setup tr.muted td { color: var(--text-muted); }
/* update 30: live inverter values */
.mc-live { background: var(--surface-sunken); border-radius: 12px; padding: 10px 12px; margin: 8px 0; --mc-hz: #2a78d6; --mc-amp: #eb6834; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mc-live { --mc-hz: #3987e5; --mc-amp: #d95926; } }
:root[data-theme="dark"] .mc-live { --mc-hz: #3987e5; --mc-amp: #d95926; }
.mc-live-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 480px) { .mc-live-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.mc-live-cell { display: flex; flex-direction: column; }
.mc-live-label { font-size: 12px; color: var(--text-secondary); }
.mc-live-val { font-size: 24px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.mc-live-cell small { color: var(--text-muted); font-size: 12px; }
.mc-live-fault, .mc-live-warn { color: var(--pink-text); font-size: 14px; margin: 6px 0 0; }
.mc-spark-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.mc-spark { height: 56px; color: var(--text-muted); font-size: 12px; }
.mc-spark svg { width: 100%; height: 56px; display: block; }
.mc-spark-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.mc-spark-line.hz { stroke: var(--mc-hz); } .mc-spark-line.amp { stroke: var(--mc-amp); }
.mc-spark-max { fill: var(--text-muted); font-size: 10px; }
.mc-speed .od-inline { align-items: center; }
.mc-speed-range { flex: 1 1 140px; min-width: 120px; }
.mc-speed input[type=number] { width: 90px; flex: 0 0 90px; }

/* ---- SCADA, control-room design (update 34): deep navy, circuit board, glowing tiles - same in light and dark mode ---- */
body:has(#tab-scada) { max-width: 1680px; }
.scada { --sc-ink: #e6f0ff; --sc-sub: #93b4e6; --sc-dim: #6f93cc; --sc-line: rgba(96, 165, 250, 0.35); --sc-cyan: #38bdf8;
  --sc-run: #34d399; --sc-fault: #f87171; --sc-idle: #94a3b8; --sc-maint: #fbbf24; --sc-amp: #fb923c;
  --sc-head: 'Chakra Petch', 'IBM Plex Sans Thai', system-ui, sans-serif; --sc-body: 'IBM Plex Sans Thai', system-ui, sans-serif;
  position: relative; margin-top: 12px; padding: 22px; border-radius: 22px; color: var(--sc-ink); font-family: var(--sc-body); overflow: hidden;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='320' fill='none' stroke='%231d4f9c' stroke-width='1.2' opacity='.5'%3E%3Cpath d='M0 60h70l30 30h80M320 230h-60l-30-30h-70M40 0v40l30 30v50M280 320v-40l-30-30h-60'/%3E%3Ccircle cx='180' cy='90' r='3' fill='%2338bdf8' stroke='none'/%3E%3Ccircle cx='160' cy='200' r='3' fill='%2338bdf8' stroke='none'/%3E%3Ccircle cx='70' cy='120' r='3' fill='%2338bdf8' stroke='none'/%3E%3Ccircle cx='190' cy='250' r='3' fill='%2338bdf8' stroke='none'/%3E%3C/svg%3E"),
    radial-gradient(1200px 620px at 46% 42%, #0b2350 0%, #061334 45%, #030817 100%);
  box-shadow: 0 10px 40px rgba(2, 8, 23, 0.45); }
.scada:fullscreen { border-radius: 0; padding: 28px; overflow: auto; }
.scada-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.scada-title { display: flex; align-items: center; gap: 14px; }
.scada-title > div { display: flex; flex-direction: column; }
.scada-brand { font-family: var(--sc-head); font-size: 26px; font-weight: 700; letter-spacing: 0.06em; color: #f1f7ff; }
.scada-sub { font-size: 14px; color: var(--sc-sub); }
.scada-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--sc-run); box-shadow: 0 0 0 5px rgba(52, 211, 153, 0.18), 0 0 18px var(--sc-run); flex: 0 0 auto; }
.scada-dot.lost { background: var(--sc-fault); box-shadow: 0 0 0 5px rgba(248, 113, 113, 0.2), 0 0 18px var(--sc-fault); }
.scada-top-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.scada-shift { display: inline-flex; align-items: center; gap: 8px; font-family: var(--sc-head); font-size: 14px; font-weight: 600; border-radius: 999px; padding: 6px 14px; }
.scada-shift.day { color: #fde68a; background: rgba(251, 191, 36, 0.10); border: 1px solid rgba(251, 191, 36, 0.45); }
.scada-shift.night { color: #c7d2fe; background: rgba(129, 140, 248, 0.12); border: 1px solid rgba(129, 140, 248, 0.45); }
.scada-clock { font-family: var(--sc-head); font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.scada-btn { height: 44px; padding: 0 16px; display: inline-flex; align-items: center; gap: 8px; border-radius: 12px; border: 1px solid rgba(96, 165, 250, 0.45);
  background: rgba(14, 40, 90, 0.6); color: #cfe3ff; font: 600 14px var(--sc-head); cursor: pointer; }
.scada-btn:hover { border-color: var(--sc-cyan); box-shadow: 0 0 14px rgba(56, 189, 248, 0.35); }
.scada-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; margin: 18px 0; }
@media (max-width: 1100px) { .scada-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .scada-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .scada { padding: 14px; } }
.scada-kpi { min-width: 0; padding: 12px 16px; border-radius: 14px; background: linear-gradient(180deg, rgba(23, 56, 120, 0.55), rgba(8, 22, 56, 0.75));
  border: 1px solid var(--sc-line); box-shadow: 0 0 22px rgba(56, 189, 248, 0.10); }
.scada-kpi span { display: block; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: #8fb0e0; }
.scada-kpi b { display: block; font-family: var(--sc-head); font-size: 24px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.scada-kpi b small { font-size: 14px; font-weight: 500; color: #8fb0e0; }
.scada-kpi:first-child b { color: var(--sc-run); }
.scada-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; }
@media (max-width: 1100px) { .scada-body { grid-template-columns: 1fr; } }
.scada-plant { min-width: 0; padding: 14px; border-radius: 20px; background: rgba(7, 22, 58, 0.45); border: 1px solid rgba(59, 130, 246, 0.22); }
.scada-canvas-wrap { position: relative; overflow: hidden; }
.scada-canvas-wrap.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.scada-canvas { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.sc-stage { position: absolute; text-align: center; font-family: var(--sc-head); font-size: 13px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--sc-dim); }
.sc-stage.hot { color: #7dd3fc; }
.sc-group { position: absolute; border-radius: 18px; background: rgba(56, 189, 248, 0.06); border: 1px dashed rgba(56, 189, 248, 0.45); }
.sc-plat { position: absolute; border-radius: 50%; background: radial-gradient(closest-side, rgba(56, 189, 248, 0.22), transparent); pointer-events: none; }
.sc-plat.st-run { background: radial-gradient(closest-side, rgba(52, 211, 153, 0.6), transparent); }
.sc-plat.st-fault { background: radial-gradient(closest-side, rgba(248, 113, 113, 0.55), transparent); }
.sc-plat.st-dis { opacity: 0.6; }
.sc-links { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.sc-link { fill: none; stroke: #4a6a9e; stroke-width: 2; stroke-dasharray: 6 6; stroke-linecap: round; stroke-linejoin: round; }
.sc-link.hot { stroke: var(--sc-cyan); stroke-width: 3; stroke-dasharray: none; filter: drop-shadow(0 0 6px #38bdf8); }
.sc-pulse { fill: none; stroke: #e0f7ff; stroke-width: 3; stroke-linecap: round; stroke-dasharray: 2 26; animation: sc-flow 1.1s linear infinite; }
@keyframes sc-flow { to { stroke-dashoffset: -28; } }
.sc-head.dim { fill: #4a6a9e; } .sc-head.hot { fill: var(--sc-cyan); }
.sc-node { position: absolute; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 10px; text-align: center; border-radius: 14px; cursor: pointer; font: inherit; color: #9db7de;
  background: linear-gradient(180deg, rgba(30, 64, 140, 0.45), rgba(9, 22, 54, 0.88)); border: 1.5px solid rgba(96, 165, 250, 0.55);
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.06); transition: box-shadow 0.2s, border-color 0.2s; }
.sc-node:hover, .sc-node:focus-visible { border-color: var(--sc-cyan); box-shadow: 0 0 30px rgba(56, 189, 248, 0.4); outline: none; }
.sc-node.selected { outline: 2px solid #bae6fd; outline-offset: 4px; }
.sc-node.motor, .sc-node:not(.tall):has(.sc-ico[width="28"]) { flex-direction: row; text-align: left; gap: 12px; }
.sc-txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sc-name { font-family: var(--sc-head); font-size: 15px; font-weight: 700; color: #d6e4fb; line-height: 1.2; }
.sc-state { font-size: 12px; } .sc-val { font-size: 12px; color: #b9d0f2; font-variant-numeric: tabular-nums; }
.sc-node.st-dis { border-style: dashed; border-color: rgba(125, 160, 214, 0.45); box-shadow: none; opacity: 0.72; }
.sc-node.st-dis .sc-name { color: #b7c9e6; }
.sc-node.st-run { color: var(--sc-run); border: 2px solid var(--sc-run); background: linear-gradient(180deg, rgba(16, 92, 92, 0.55), rgba(6, 30, 48, 0.92));
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.12), 0 0 32px rgba(52, 211, 153, 0.45); }
.sc-node.st-run .sc-name { color: #ecfdf5; } .sc-node.st-run .sc-state { font-weight: 600; } .sc-node.st-run .sc-val { color: #a7f3d0; }
.sc-node.st-fault { color: var(--sc-fault); border: 2px solid var(--sc-fault); box-shadow: 0 0 32px rgba(248, 113, 113, 0.5); animation: sc-blink 1s steps(2) infinite; }
.sc-node.st-maint { color: var(--sc-maint); border-color: var(--sc-maint); }
.sc-node.st-off { color: var(--sc-idle); }
@keyframes sc-blink { 50% { box-shadow: 0 0 6px rgba(248, 113, 113, 0.2); } }
.st-run .sc-fan { animation: sc-spin 0.6s linear infinite; }
@keyframes sc-spin { to { transform: rotate(360deg); } }
.sc-shift-chip { position: absolute; box-sizing: border-box; height: 22px; display: flex; align-items: center; justify-content: center; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; background: #0a1838; border: 1px solid #36507c; color: #8fb0e0; white-space: nowrap; }
.sc-shift-chip.now { background: #0c3b7a; border-color: #60a5fa; color: #dbeafe; box-shadow: 0 0 12px rgba(96, 165, 250, 0.6); }
.scada-legend { display: flex; flex-wrap: wrap; gap: 20px; font-size: 13px; color: var(--sc-sub); margin: 8px 6px 0; }
.scada-legend span { display: inline-flex; align-items: center; gap: 8px; }
.scada-legend .lg { width: 14px; height: 10px; border-radius: 3px; display: inline-block; }
.lg.run { background: var(--sc-run); box-shadow: 0 0 8px var(--sc-run); } .lg.idle { background: var(--sc-idle); }
.lg.fault { background: var(--sc-fault); box-shadow: 0 0 8px var(--sc-fault); } .lg.dis { border: 1.5px dashed #7da0d6; }
.lg.flow { width: 22px; height: 0; border-top: 3px solid var(--sc-cyan); box-shadow: 0 0 6px var(--sc-cyan); border-radius: 0; }
@media (prefers-reduced-motion: reduce) { .sc-pulse, .st-run .sc-fan, .sc-node.st-fault { animation: none; } }
/* details panel */
.scada-panel { box-sizing: border-box; padding: 20px; display: flex; flex-direction: column; gap: 14px; border-radius: 20px; min-width: 0;
  background: linear-gradient(180deg, rgba(20, 52, 112, 0.65), rgba(6, 18, 46, 0.92)); border: 1px solid rgba(96, 165, 250, 0.45); box-shadow: 0 0 40px rgba(56, 189, 248, 0.16); }
.scada-hint { color: var(--sc-sub); font-size: 14px; margin: 0; }
.sc-panel-head { display: flex; flex-direction: column; gap: 4px; }
.sc-eyebrow { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: #8fb0e0; }
.sc-panel-name { font-family: var(--sc-head); font-size: 22px; font-weight: 700; color: #f1f7ff; }
.sc-panel-sub { font-size: 13px; color: var(--sc-sub); }
.sc-info { display: flex; flex-direction: column; gap: 8px; }
.sc-info-top { display: flex; align-items: center; gap: 16px; }
.sc-info-col { display: flex; flex-direction: column; gap: 6px; font-size: 14px; min-width: 0; }
.sc-kv { color: #cfe3ff; } .sc-kv b { font-family: var(--sc-head); color: #f1f7ff; }
.sc-pill { display: inline-flex; width: fit-content; padding: 3px 12px; border-radius: 999px; font-weight: 600; font-size: 13px; text-transform: uppercase;
  background: rgba(148, 163, 184, 0.14); border: 1px solid rgba(148, 163, 184, 0.45); color: #cbd5e1; }
.sc-pill.st-run { background: rgba(52, 211, 153, 0.16); border-color: rgba(52, 211, 153, 0.55); color: #6ee7b7; }
.sc-pill.st-fault { background: rgba(248, 113, 113, 0.16); border-color: rgba(248, 113, 113, 0.6); color: #fecaca; }
.sc-pill.st-dis { border-style: dashed; color: #9db7de; }
.sc-gauge { flex: 0 0 auto; } .sc-gauge .g-bg { fill: none; stroke: #173868; stroke-width: 10; }
.sc-gauge .g-val { fill: none; stroke: var(--sc-idle); stroke-width: 10; stroke-linecap: round; }
.sc-gauge.st-run .g-val { stroke: var(--sc-run); filter: drop-shadow(0 0 6px #34d399); } .sc-gauge.st-fault .g-val { stroke: var(--sc-fault); }
.sc-gauge .g-num { font-family: var(--sc-head); font-size: 26px; font-weight: 700; fill: #ecfdf5; } .sc-gauge .g-unit { font-size: 12px; fill: #a7f3d0; }
.sc-note { color: var(--sc-sub); font-size: 13px; margin: 0; } .sc-warn { color: #fecaca; font-size: 14px; margin: 0; }
.sc-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.scada-cmd { margin: 0; display: flex; gap: 10px; align-items: center; }
.sc-btn { width: 100%; height: 52px; border-radius: 14px; font: 700 17px var(--sc-head); cursor: pointer; letter-spacing: 0.04em; }
.sc-btn.on { border: 1px solid var(--sc-run); background: rgba(52, 211, 153, 0.16); color: #a7f3d0; box-shadow: 0 0 18px rgba(52, 211, 153, 0.25); }
.sc-btn.off { border: 1px solid var(--sc-fault); background: rgba(248, 113, 113, 0.16); color: #fecaca; box-shadow: 0 0 18px rgba(248, 113, 113, 0.25); }
.sc-btn.set { width: auto; height: 44px; padding: 0 14px; font-size: 14px; border: 1px solid rgba(96, 165, 250, 0.5); background: rgba(14, 40, 90, 0.7); color: #dbeafe; white-space: nowrap; }
.sc-btn:disabled { opacity: 0.4; box-shadow: none; cursor: not-allowed; }
.sc-speed { display: flex; flex-direction: column; gap: 8px; } .sc-speed-label { font-size: 13px; color: var(--sc-sub); }
.sc-range { flex: 1; min-width: 0; accent-color: var(--sc-cyan); }
.sc-link-hw { color: #7dd3fc; font-size: 14px; font-weight: 600; } .sc-link-hw:hover { color: #bae6fd; }
/* monitors */
.scada-monitors { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 18px; }
@media (max-width: 900px) { .scada-monitors { grid-template-columns: 1fr; } }
.scada-mon { min-width: 0; padding: 12px 16px; border-radius: 16px; background: rgba(6, 20, 52, 0.85); border: 1px solid var(--sc-line); }
.scada-mon-h { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: #8fb0e0; }
.scada-trend { height: 96px; margin-top: 6px; } .sc-trend-svg { width: 100%; height: 96px; display: block; }
.t-grid { stroke: #173868; stroke-width: 1; vector-effect: non-scaling-stroke; }
.t-rated { stroke: #fbbf24; stroke-width: 1.2; stroke-dasharray: 5 5; vector-effect: non-scaling-stroke; }
.t-line { fill: none; stroke-width: 2.5; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.t-line.hz { stroke: var(--sc-cyan); filter: drop-shadow(0 0 4px #38bdf8); } .t-line.amp { stroke: var(--sc-amp); filter: drop-shadow(0 0 4px #fb923c); }
.t-last { font-size: 11px; } .t-last.hz { fill: #7dd3fc; } .t-last.amp { fill: #fdba74; } .t-empty { fill: var(--sc-dim); font-size: 13px; }
.scada-alarms { list-style: none; margin: 8px 0 0; padding: 0; font-size: 14px; display: flex; flex-direction: column; gap: 6px; }
.sc-alarm { display: flex; align-items: center; gap: 10px; color: #fecaca; }
.sc-alarm i { width: 8px; height: 8px; border-radius: 50%; background: var(--sc-fault); box-shadow: 0 0 8px var(--sc-fault); flex: 0 0 auto; }
.sc-alarm b { font-family: var(--sc-head); }
.sc-ok { color: #9db7de; }
#scada-table tr.muted td { color: var(--text-muted); }
/* ---- Customer QR card (update 33): 85 x 54 mm, like a business card ---- */
.cust-qr-row { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px; }
.cust-qr-small { width: 96px; flex: 0 0 96px; } .cust-qr-small svg { width: 100%; height: auto; display: block; }
body.cust-card-page { background: #eef2f7; max-width: none; color: #111; }
.cc-tools { display: flex; gap: 10px; justify-content: center; align-items: center; margin: 10px 0 16px; }
.cc-copies { display: flex; gap: 6px; align-items: center; } .cc-copies select { width: auto; }
.cc-sheet { display: flex; flex-wrap: wrap; gap: 6mm; justify-content: center; }
.cust-card { width: 85mm; height: 54mm; box-sizing: border-box; background: #fff; border: 0.3mm solid #c9d2de; border-radius: 3mm;
  padding: 3.5mm 4mm; display: flex; flex-direction: column; break-inside: avoid; }
.cc-head { display: flex; gap: 2.5mm; align-items: center; border-bottom: 0.3mm solid #e2e8f0; padding-bottom: 1.5mm; }
.cc-head img { height: 8mm; width: auto; } .cc-head b { font-size: 11pt; display: block; } .cc-head small { font-size: 7pt; color: #555; }
.cc-body { flex: 1; display: flex; gap: 3mm; align-items: center; }
.cc-info { flex: 1; min-width: 0; }
.cc-name { font-size: 12pt; font-weight: 700; margin: 0 0 1mm; line-height: 1.2; overflow-wrap: anywhere; }
.cc-code { font-size: 13pt; font-weight: 800; letter-spacing: 0.04em; margin: 0; font-variant-numeric: tabular-nums; }
.cc-phone { font-size: 9pt; margin: 0.5mm 0 0; color: #333; }
.cc-note { font-size: 6.5pt; color: #555; margin: 1.5mm 0 0; line-height: 1.3; }
.cc-qr { width: 30mm; flex: 0 0 30mm; } .cc-qr svg { width: 100%; height: auto; display: block; }
@media print { .cc-tools { display: none; } body.cust-card-page { background: #fff; padding: 0; margin: 0; } .cc-sheet { gap: 4mm; }
  .cust-card { break-inside: avoid; page-break-inside: avoid; -webkit-print-color-adjust: exact; print-color-adjust: exact; } @page { margin: 10mm; } }
.cc-qr > :not(svg), .cust-qr-small > :not(svg) { display: none; }
.cc-tools .action { width: auto; flex: 0 0 auto; padding-left: 28px; padding-right: 28px; }
html[lang="th"] .scada-kpi span, html[lang="th"] .sc-stage, html[lang="th"] .scada-mon-h, html[lang="th"] .sc-eyebrow,
html[lang="th"] .sc-shift-chip, html[lang="th"] .sc-pill { letter-spacing: 0.01em; text-transform: none; }
/* update 35: machine setup - SCADA fields in one row, check boxes next to their text */
.mc-scada-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; align-items: end; }
@media (max-width: 640px) { .mc-scada-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.mc-scada-grid .field-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.checkline { justify-content: flex-start; text-align: left; }
.checkline input[type="checkbox"] { flex: 0 0 auto; width: 18px; min-width: 18px; height: 18px; margin: 0; padding: 0; }
.checkline > span { flex: 1 1 auto; min-width: 0; }

/* ===== update 37: camera QR scan (qrscan.js) ===== */
.scan-btn { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--accent); background: transparent; color: var(--accent);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.scan-btn:active { background: var(--accent); color: #fff; }
.od-inline .scan-btn { height: auto; align-self: stretch; }
#qr-scan-overlay { display: none; position: fixed; inset: 0; z-index: 1200; background: rgba(3,8,23,.92); align-items: center; justify-content: center; padding: 16px; }
#qr-scan-overlay.show { display: flex; }
html.qs-open, html.qs-open body { overflow: hidden; }
.qs-box { width: 100%; max-width: 520px; display: flex; flex-direction: column; gap: 14px; align-items: stretch; }
.qs-view { position: relative; width: 100%; aspect-ratio: 1 / 1; border-radius: 18px; overflow: hidden; background: #000; border: 1.5px solid rgba(96,165,250,.45);
  box-shadow: 0 0 30px rgba(56,189,248,.25); }
.qs-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
.qs-frame { position: absolute; inset: 16%; pointer-events: none; }
.qs-frame i { position: absolute; width: 34px; height: 34px; border: 4px solid #38bdf8; filter: drop-shadow(0 0 6px #38bdf8); }
.qs-frame i:nth-child(1) { left: 0; top: 0; border-right: 0; border-bottom: 0; border-radius: 10px 0 0 0; }
.qs-frame i:nth-child(2) { right: 0; top: 0; border-left: 0; border-bottom: 0; border-radius: 0 10px 0 0; }
.qs-frame i:nth-child(3) { right: 0; bottom: 0; border-left: 0; border-top: 0; border-radius: 0 0 10px 0; }
.qs-frame i:nth-child(4) { left: 0; bottom: 0; border-right: 0; border-top: 0; border-radius: 0 0 0 10px; }
.qs-frame b { position: absolute; left: 6%; right: 6%; top: 0; height: 2px; background: #38bdf8; box-shadow: 0 0 12px #38bdf8; animation: qs-line 2s ease-in-out infinite; }
@keyframes qs-line { 50% { top: 100%; } }
#qr-scan-overlay.done .qs-frame i { border-color: #34d399; filter: drop-shadow(0 0 8px #34d399); }
#qr-scan-overlay.done .qs-frame b { display: none; }
.qs-status { margin: 0; text-align: center; color: #dbeafe; font-size: 15px; line-height: 1.5; min-height: 22px; }
.qs-status.ok { color: #6ee7b7; font-weight: 700; font-size: 20px; letter-spacing: .04em; }
.qs-status.err { color: #fecaca; }
.qs-cancel { align-self: center; min-width: 160px; }
@media (prefers-reduced-motion: reduce) { .qs-frame b { animation: none; top: 50%; } }
.field-row.has-scan { display: grid; grid-template-columns: 1fr auto; gap: 6px 8px; align-items: center; }
.field-row.has-scan > .field-label { grid-column: 1 / -1; margin-bottom: 0; }
.field-row.has-scan > input { min-width: 0; }
.field-row.has-scan > .scan-btn { height: 100%; min-height: 40px; }
/* update 39: Edit items of a take-home order */
.bs-edit-btn { margin-left: 6px; }
.bs-edit-table td.num input { width: 96px; max-width: 100%; text-align: right; }
.bs-edit-table td small { display: block; }
/* update 40: SCADA command answer (stays in full screen) */
.scada { position: relative; }
.scada-toast { position: absolute; left: 50%; top: 18px; transform: translate(-50%, -12px); z-index: 50; max-width: min(92%, 560px);
  padding: 10px 18px; border-radius: 12px; background: rgba(6,40,30,.95); border: 1.5px solid #34d399; color: #d1fae5; font-size: 14px;
  box-shadow: 0 0 22px rgba(52,211,153,.35); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; }
.scada-toast.show { opacity: 1; transform: translate(-50%, 0); }
.scada-toast.bad { background: rgba(60,10,16,.95); border-color: #f87171; color: #fecaca; box-shadow: 0 0 22px rgba(248,113,113,.4); }
/* update 43: mill selector on the SCADA */
.sc-link.off { stroke: rgba(148,163,184,.35); stroke-dasharray: 3 6; }
.sc-switch { display: grid; gap: 8px; margin: 10px 0 4px; }
.sc-switch .scada-cmd { margin: 0; }
.sc-switch .sc-btn { width: 100%; }
.sc-switch .sc-btn.chosen:disabled { opacity: 1; border-color: #34d399; color: #a7f3d0; box-shadow: 0 0 14px rgba(52,211,153,.3); }
/* update 44: milling order list sequence (Milling Maintenance) */
.queue-base { display: grid; gap: 8px; margin: 8px 0 4px; }
.qb-opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; background: var(--surface); }
.qb-opt input { flex: 0 0 auto; width: 18px; height: 18px; margin: 2px 0 0; }
.qb-opt span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.qb-opt small { color: var(--text-secondary); font-size: 12.5px; line-height: 1.4; }
.qb-opt:has(input:checked), .qb-opt.on { border-color: var(--accent); background: var(--accent-bg); }
/* update 46: Milling Order List - active / closed views */
.ml-views { display: flex; gap: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); }
.ml-view { flex: 1; text-align: center; padding: 10px 8px; font-weight: 600; color: var(--text-secondary); text-decoration: none; }
.ml-view + .ml-view { border-left: 1px solid var(--border); }
.ml-view b { display: inline-block; min-width: 24px; padding: 0 7px; margin-left: 4px; border-radius: 999px; background: var(--surface-sunken); color: var(--text); font-size: 12px; }
.ml-view.on { background: var(--accent); color: #fff; }
.ml-view.on b { background: rgba(255,255,255,.25); color: #fff; }
.chip .chip-n { opacity: .7; font-size: 11px; margin-left: 2px; }
/* update 48: server health (AI) and the home banner */
.hl-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.hl-badge-ok { background: #DCFCE7; color: #166534; } .hl-badge-warn { background: #FEF3C7; color: #92400E; } .hl-badge-crit { background: #FFE4E6; color: #BE123C; }
.hl-card.hl-warn { border: 1.5px solid #F59E0B; } .hl-card.hl-crit { border: 1.5px solid #E11D48; box-shadow: 0 0 0 3px rgba(225,29,72,.12); }
.hl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin: 10px 0; }
.hl-tile { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; background: var(--surface); }
.hl-tile .hl-k { font-size: 12px; color: var(--text-secondary); }
.hl-tile b { font-size: 20px; font-variant-numeric: tabular-nums; } .hl-tile b small { font-size: 12px; margin-left: 2px; font-weight: 600; }
.hl-tile .hl-sub { font-size: 11.5px; color: var(--text-muted); }
.hl-tile.hl-warn { border-color: #F59E0B; background: #FFFBEB; } .hl-tile.hl-crit { border-color: #E11D48; background: #FFF1F2; }
.hl-row .hl-todo { display: block; color: var(--text-secondary); margin-top: 2px; }
.hl-log-table td { font-size: 12.5px; vertical-align: top; overflow-wrap: anywhere; }
.hl-log-table tr.lv-error td, .hl-log-table tr.lv-critical td { color: #BE123C; }
.chip.hl-chip-warn { border-color: #F59E0B; color: #92400E; } .chip.hl-chip-crit { border-color: #E11D48; color: #BE123C; font-weight: 700; }
.health-banner { display: block; margin: 0 0 12px; padding: 10px 14px; border-radius: 12px; text-decoration: none; font-size: 14px; line-height: 1.45; }
.health-banner.warn { background: #FEF3C7; color: #78350F; border: 1px solid #F59E0B; }
.health-banner.crit { background: #E11D48; color: #fff; border: 1px solid #BE123C; animation: hl-pulse 2s ease-in-out infinite; }
.health-banner u { white-space: nowrap; }
@keyframes hl-pulse { 50% { box-shadow: 0 0 0 4px rgba(225,29,72,.25); } }
@media (prefers-reduced-motion: reduce) { .health-banner.crit { animation: none; } }
/* update 48: customer card - send to LINE */
.cc-tools { flex-wrap: wrap; }
.cc-line { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.cc-line .checkline { display: flex; gap: 6px; align-items: center; font-size: 14px; }
.cc-line-note { font-size: 13px; color: #555; }
.cc-line-status { text-align: center; margin: -6px 0 12px; font-size: 14px; }
.cc-line-status.ok { color: #166534; } .cc-line-status.bad { color: #BE123C; }
@media print { .cc-line-status, .cc-line-note { display: none !important; } }
.hl-log-table td:nth-child(2) { white-space: nowrap; } .hl-log-table td:first-child { white-space: nowrap; }
/* update 49: API / LINE / hardware monitoring */
.hl-mon .card-title.section { margin-top: 14px; }
.hl-api td.bad, .hl-mon .bad b { color: #BE123C; font-weight: 700; } .hl-api td.warnc, .hl-dev td.warnc { color: #B45309; font-weight: 700; }
.hl-line { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; font-size: 13px; }
.hl-pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid transparent; }
.hl-pill.ok { background: #DCFCE7; color: #166534; } .hl-pill.warn { background: #FEF3C7; color: #92400E; }
.hl-pill.crit { background: #FFE4E6; color: #BE123C; } .hl-pill.off { background: var(--surface-sunken); color: var(--text-secondary); }
.hl-kv { color: var(--text-secondary); } .hl-kv b { color: var(--text); }
/* update 50: AI > Price analysis - fixed source colours (categorical order), neutral indicators, status-coloured B / S */
#tab-ps { --ps-NABC: #2a78d6; --ps-TRMA: #eb6834; --ps-TREA: #1baf7a; --ps-APPLIED: #eda100; --ps-BUY: #e87ba4; --ps-SELL: #008300;
          --ps-good: #0ca30c; --ps-crit: #d03b3b; --ps-warn: #c98500; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) #tab-ps { --ps-NABC: #3987e5; --ps-TRMA: #d95926; --ps-TREA: #199e70; --ps-APPLIED: #c98500; --ps-BUY: #d55181; --ps-SELL: #008300; } }
:root[data-theme="dark"] #tab-ps { --ps-NABC: #3987e5; --ps-TRMA: #d95926; --ps-TREA: #199e70; --ps-APPLIED: #c98500; --ps-BUY: #d55181; --ps-SELL: #008300; }
.ps-src { stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; opacity: .75; }
.ps-src.base { stroke-width: 2.5; opacity: 1; }
.ps-dot { stroke: var(--surface); stroke-width: 1.5; } .ps-dot.last { stroke-width: 2; }
.ps-s-NABC { stroke: var(--ps-NABC); } .ps-dot.ps-s-NABC { fill: var(--ps-NABC); }
.ps-s-TRMA { stroke: var(--ps-TRMA); } .ps-dot.ps-s-TRMA { fill: var(--ps-TRMA); }
.ps-s-TREA { stroke: var(--ps-TREA); } .ps-dot.ps-s-TREA { fill: var(--ps-TREA); }
.ps-s-APPLIED { stroke: var(--ps-APPLIED); } .ps-dot.ps-s-APPLIED { fill: var(--ps-APPLIED); }
.ps-s-BUY { stroke: var(--ps-BUY); } .ps-dot.ps-s-BUY { fill: var(--ps-BUY); }
.ps-s-SELL { stroke: var(--ps-SELL); } .ps-dot.ps-s-SELL { fill: var(--ps-SELL); }
.ps-dot { stroke: var(--surface); }
.ps-c-NABC { border-color: var(--ps-NABC); } .ps-c-TRMA { border-color: var(--ps-TRMA); } .ps-c-TREA { border-color: var(--ps-TREA); }
.ps-c-APPLIED { border-color: var(--ps-APPLIED); } .ps-c-BUY { border-color: var(--ps-BUY); } .ps-c-SELL { border-color: var(--ps-SELL); }
.mkh-sw.ps-base { border-top-width: 4px; }
.ps-l-smas { stroke: var(--text-secondary); stroke-width: 1.5; stroke-dasharray: 5 3; }
.ps-l-smal { stroke: var(--text-muted); stroke-width: 1.5; stroke-dasharray: 2 3; }
.mkh-sw.ps-c-sma { border-top: 2px dashed var(--text-secondary); } .mkh-sw.ps-c-smal { border-top: 2px dotted var(--text-muted); }
.ps-band { fill: var(--text-muted); opacity: .12; stroke: none; }
.mkh-sw.ps-c-band { height: 8px; border: 0; background: var(--text-muted); opacity: .3; }
.ps-lv { stroke-width: 1.2; stroke-dasharray: 6 4; } .ps-lv-cost { stroke: var(--text-secondary); }
.ps-lv-tp { stroke: var(--ps-good); } .ps-lv-sl { stroke: var(--ps-crit); }
.ps-lv-t { fill: var(--text-secondary); font-size: 10.5px; font-weight: 600; }
.mkh-sw.ps-c-levels { border-top: 2px dashed var(--text-secondary); }
.ps-mk-b { fill: var(--ps-good); stroke: var(--surface); stroke-width: 1.5; } .ps-mk-s { fill: var(--ps-crit); stroke: var(--surface); stroke-width: 1.5; }
.ps-mk-t { fill: var(--text); font-size: 10px; font-weight: 700; }
.ps-mk-sw { font-style: normal; font-size: 10px; font-weight: 700; color: var(--text-secondary); }
.ps-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 12px 0 6px; font-size: 13px; }
.ps-pick { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; }
.ps-pick .field { min-width: 180px; flex: 1; } .ps-pick .action { flex: 0 0 auto; }
.mkh-periods { display: flex; gap: 6px; margin: 10px 0; flex-wrap: wrap; } .mkh-periods .chip.active { background: var(--text); color: var(--surface); }
.ps-hero { display: grid; grid-template-columns: minmax(170px, 230px) 1fr; gap: 12px; margin-top: 8px; }
@media (max-width: 640px) { .ps-hero { grid-template-columns: 1fr; } }
.ps-verdict { border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--border); background: var(--surface-sunken); }
.ps-verdict b { font-size: 24px; line-height: 1.2; } .ps-v-k, .ps-v-sub { font-size: 12px; color: var(--text-secondary); }
.ps-verdict.ps-strong_buy, .ps-verdict.ps-buy { border-color: var(--ps-good); } .ps-verdict.ps-strong_buy b, .ps-verdict.ps-buy b { color: #15803D; }
.ps-verdict.ps-strong_sell, .ps-verdict.ps-sell { border-color: var(--ps-crit); } .ps-verdict.ps-strong_sell b, .ps-verdict.ps-sell b { color: #BE123C; }
.ps-why { margin: 0; padding-left: 0; list-style: none; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.ps-why li b { display: inline-block; min-width: 26px; } .ps-why li.up b { color: #15803D; } .ps-why li.down b { color: #BE123C; }
.ps-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; margin-top: 12px; }
.ps-kpi { background: var(--surface-sunken); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; }
.ps-kpi span, .ps-kpi small { font-size: 11.5px; color: var(--text-secondary); } .ps-kpi b { font-size: 16px; }
.ps-pos { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 10px; }
.ps-state { margin: 10px 0 0; font-weight: 600; } .ps-st-tp .ps-state { color: #15803D; } .ps-st-sl .ps-state { color: #BE123C; }
.gain { color: #15803D; } .loss { color: #BE123C; }
.ps-sig { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--surface-sunken); color: var(--text-secondary); }
.ps-sig.ps-strong_buy, .ps-sig.ps-buy { background: #DCFCE7; color: #166534; } .ps-sig.ps-strong_sell, .ps-sig.ps-sell { background: #FFE4E6; color: #BE123C; }
.ps-sig.ps-strong_buy::before, .ps-sig.ps-buy::before { content: "\25B2 "; } .ps-sig.ps-strong_sell::before, .ps-sig.ps-sell::before { content: "\25BC "; }
.ps-sig.ps-hold::before { content: "\25CF "; }
.ps-table tr.sel td { background: var(--surface-sunken); }
.ps-actions { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-end; margin-top: 8px; }
.ps-upload { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.ps-set-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 12px; }
#ps-map select { width: 100%; min-width: 140px; }
/* update 50: AI dashboard */
body.wide { max-width: 1240px; }
.dash { --d-ok: #0ca30c; --d-warn: #e0a100; --d-crit: #d03b3b; --d-s1: #2a78d6; --d-s2: #eb6834; --d-s3: #1baf7a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .dash { --d-s1: #3987e5; --d-s2: #d95926; --d-s3: #199e70; } }
:root[data-theme="dark"] .dash { --d-s1: #3987e5; --d-s2: #d95926; --d-s3: #199e70; }
.dash-intro { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 16px; margin: 4px 2px 10px; }
.dash-intro .desc-text { margin: 0; max-width: 760px; } .dash-time { font-size: 12px; color: var(--text-muted); }
.dash-nav { margin-bottom: 14px; }
.dash-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 8px; }
@media (max-width: 1000px) { .dash-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .dash-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }
.dash-kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px;
            text-decoration: none; color: var(--text); box-shadow: var(--shadow); min-height: 104px; position: relative; overflow: hidden; transition: transform .12s, box-shadow .12s; }
.dash-kpi:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(16,24,40,.08); }
.dash-kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent); opacity: .85; }
.dash-kpi.lvl-ok::before { background: var(--d-ok); } .dash-kpi.lvl-warn::before { background: var(--d-warn); } .dash-kpi.lvl-crit::before { background: var(--d-crit); }
.dash-kpi .k { font-size: 12px; color: var(--text-secondary); font-weight: 600; } .dash-kpi b { font-size: 26px; line-height: 1.1; font-weight: 700; }
.dash-kpi b small { font-size: 13px; color: var(--text-secondary); font-weight: 600; } .dash-kpi .s { font-size: 12px; color: var(--text-muted); margin-top: auto; }
.dash-status { display: flex; align-items: center; gap: 8px; font-size: 20px !important; }
.dash-status .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--d-ok); box-shadow: 0 0 0 4px rgba(12,163,12,.15); }
.lvl-warn .dash-status .dot { background: var(--d-warn); box-shadow: 0 0 0 4px rgba(224,161,0,.18); } .lvl-crit .dash-status .dot { background: var(--d-crit); box-shadow: 0 0 0 4px rgba(208,59,59,.18); }
.dash-sigs { display: flex; gap: 10px; font-size: 18px !important; } .dash-sigs .up { color: #15803D; } .dash-sigs .down { color: #BE123C; } .dash-sigs .hold { color: var(--text-secondary); }
.dash-minibars { width: 100%; height: 26px; margin-top: auto; } .dash-minibars rect { fill: var(--accent); opacity: .75; }
.dash-sec { font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-secondary); margin: 22px 2px 10px; }
.dash-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
.dash-grid > .span2 { grid-column: span 2; }
@media (max-width: 1000px) { .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .dash-grid { grid-template-columns: 1fr; } .dash-grid > .span2 { grid-column: auto; } }
.dash-card { margin: 0; border-radius: 16px; }
.dash-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; } .dash-head .card-title { margin: 0; }
.action.small { padding: 6px 12px; font-size: 13px; min-height: 0; width: auto; text-decoration: none; }
.dash-gauges { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: center; }
.dash-gauge { display: flex; flex-direction: column; align-items: center; width: 104px; text-align: center; }
.dash-gauge svg { width: 88px; height: 88px; } .dash-gauge .track { fill: none; stroke: var(--surface-sunken); }
.dash-gauge .fill { fill: none; stroke: var(--d-ok); stroke-linecap: round; } .dash-gauge.hl-warn .fill { stroke: var(--d-warn); } .dash-gauge.hl-crit .fill { stroke: var(--d-crit); }
.dash-gauge .v { font-size: 17px; font-weight: 700; fill: var(--text); } .dash-gauge .u { font-size: 10px; fill: var(--text-secondary); }
.dash-gauge .k { font-size: 12.5px; font-weight: 600; margin-top: 2px; } .dash-gauge .s { font-size: 11px; color: var(--text-muted); }
.dash-minis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; flex: 1; min-width: 220px; }
.dash-minis.two { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 10px; } .dash-minis.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 480px) { .dash-minis.three { grid-template-columns: 1fr 1fr; } }
.dash-mini { background: var(--surface-sunken); border-radius: 12px; padding: 9px 11px; display: flex; flex-direction: column; gap: 2px; border: 1px solid transparent; }
.dash-mini span { font-size: 11.5px; color: var(--text-secondary); } .dash-mini b { font-size: 18px; } .dash-mini b.sm { font-size: 13px; } .dash-mini b small { font-size: 11px; color: var(--text-secondary); }
.dash-mini.hl-warn { border-color: var(--d-warn); } .dash-mini.hl-crit { border-color: var(--d-crit); }
.dash-mini b.up { color: #15803D; } .dash-mini b.down { color: #BE123C; }
.dash-chart-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; margin: 14px 0 4px; }
.dash-legend { font-size: 12px; color: var(--text-secondary); display: inline-flex; align-items: center; gap: 6px; }
.dash-legend .sw { display: inline-block; width: 16px; height: 0; border-top: 3px solid; margin-left: 6px; }
.dash-lines { width: 100%; height: auto; display: block; } .dash-lines .grid { stroke: var(--border); } .dash-lines .ax { fill: var(--text-muted); font-size: 10px; }
.dash-lines .ln { fill: none; stroke-width: 2; stroke-linejoin: round; }
.s-disk { stroke: var(--d-s1); border-color: var(--d-s1) !important; } .s-memory { stroke: var(--d-s2); border-color: var(--d-s2) !important; } .s-cpu { stroke: var(--d-s3); border-color: var(--d-s3) !important; }
.dash-ok { color: #15803D; font-weight: 600; margin: 10px 0 4px; }
.dash-log { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.dash-log li { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; background: var(--surface-sunken); border-radius: 10px; padding: 7px 10px; font-size: 12.5px; }
.dash-log .lvl { font-weight: 700; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: #FEF3C7; color: #92400E; align-self: start; }
.dash-log li.lv-error .lvl, .dash-log li.lv-critical .lvl { background: #FFE4E6; color: #BE123C; }
.dash-log .when { grid-column: 2; color: var(--text-muted); font-size: 11px; }
.dash-api { display: flex; flex-direction: column; gap: 12px; }
.dash-api-row .top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; } .dash-api-row .nm { font-weight: 600; }
.dash-api-row .nums { color: var(--text-secondary); font-size: 12px; } .dash-api-row .nums b { color: var(--text); font-size: 14px; }
.dash-stack { width: 100%; height: 8px; display: block; margin: 5px 0 4px; } .dash-stack .bg { fill: var(--surface-sunken); }
.dash-stack .ok { fill: var(--accent); } .dash-stack .e4 { fill: var(--d-warn); } .dash-stack .e5 { fill: var(--d-crit); }
.dash-api-row .tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--surface-sunken); color: var(--text-secondary); }
.tag.e4 { background: #FEF3C7; color: #92400E; } .tag.e5 { background: #FFE4E6; color: #BE123C; }
.dash-hourly { width: 100%; height: auto; display: block; } .dash-hourly rect { fill: var(--accent); opacity: .8; } .dash-hourly rect.err { fill: var(--d-crit); }
.dash-hourly .ax { fill: var(--text-muted); font-size: 9px; }
.dash-checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
.dash-checks li { display: flex; align-items: center; gap: 10px; } .dash-checks i { width: 10px; height: 10px; border-radius: 50%; background: var(--text-muted); flex: 0 0 auto; }
.dash-checks li.ok i { background: var(--d-ok); } .dash-checks li.warn i { background: var(--d-warn); } .dash-checks li.crit i { background: var(--d-crit); }
.dash-devs { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.dash-dev { background: var(--surface-sunken); border-radius: 12px; padding: 10px 12px; border-left: 4px solid var(--text-muted); display: flex; flex-direction: column; gap: 3px; }
.dash-dev.st-ok { border-left-color: var(--d-ok); } .dash-dev.st-warn { border-left-color: var(--d-warn); }
.dash-dev .top { display: flex; align-items: center; gap: 8px; } .dash-dev .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-muted); }
.dash-dev.st-ok .dot { background: var(--d-ok); box-shadow: 0 0 0 3px rgba(12,163,12,.18); } .dash-dev.st-warn .dot { background: var(--d-warn); }
.dash-dev .id { font-size: 11.5px; color: var(--text-muted); margin-bottom: 4px; }
.dash-dev .row { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-secondary); } .dash-dev .row b { color: var(--text); }
.dash-dev .warnc, .hl-dev td.warnc { color: #B45309; }
.dash-bigchart .auto-chart { max-width: none; }
.dash-alerts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.dash-alerts li { display: flex; gap: 10px; background: var(--surface-sunken); border-radius: 12px; padding: 9px 11px; font-size: 13px; }
.dash-alerts li .ic { color: var(--d-warn); font-size: 16px; } .dash-alerts li.serious .ic { color: var(--d-crit); } .dash-alerts li.none .ic { color: var(--d-ok); }
.dash-alerts li div { display: flex; flex-direction: column; gap: 2px; } .dash-alerts li b { font-size: 11.5px; color: var(--text-secondary); }
.dash-sig-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.dash-sig { background: var(--surface-sunken); border-radius: 14px; padding: 12px; text-decoration: none; color: var(--text); display: flex; flex-direction: column; gap: 6px;
            border: 1px solid transparent; transition: border-color .12s, transform .12s; }
.dash-sig:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.dash-sig .top { display: flex; justify-content: space-between; gap: 6px; align-items: center; } .dash-sig .nm { font-weight: 600; font-size: 13.5px; }
.dash-sig .mid { display: flex; align-items: baseline; gap: 6px; } .dash-sig .mid b { font-size: 24px; } .dash-sig .mid small { color: var(--text-secondary); font-size: 11.5px; }
.chg { margin-left: auto; font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--surface); }
.chg.up { color: #15803D; } .chg.down { color: #BE123C; }
.dash-spark { width: 100%; height: 44px; display: block; } .dash-spark .l { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.dash-spark .a { fill: var(--accent); opacity: .10; } .dash-spark .p { fill: var(--accent); }
.dash-spark.tone-up .l { stroke: #16A34A; } .dash-spark.tone-up .a, .dash-spark.tone-up .p { fill: #16A34A; }
.dash-spark.tone-down .l { stroke: #E11D48; } .dash-spark.tone-down .a, .dash-spark.tone-down .p { fill: #E11D48; }
.dash-range svg { width: 100%; height: 10px; display: block; } .dash-range .bg { fill: var(--border); } .dash-range .pt { fill: var(--text); stroke: var(--surface); stroke-width: 1.5; }
.dash-range .lbl { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--text-muted); margin-top: 2px; }
.dash-sig .foot { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-secondary); }
.dash-adv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.dash-adv { background: var(--surface-sunken); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 5px; }
.dash-adv .top { display: flex; justify-content: space-between; gap: 6px; align-items: flex-start; } .dash-adv .nm { font-weight: 600; font-size: 13px; }
.dash-adv .pill { font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--surface); color: var(--text-secondary); white-space: nowrap; }
.dash-adv.adv-raise_buy .pill { background: #DCFCE7; color: #166534; } .dash-adv.adv-lower_buy .pill { background: #FEF3C7; color: #92400E; }
.dash-adv .prices { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-secondary); } .dash-adv .prices b { color: var(--text); }
.dash-cover { width: 100%; height: 6px; display: block; } .dash-cover .bg { fill: var(--border); } .dash-cover .mid { fill: var(--accent); }
.dash-cover .low { fill: var(--d-crit); } .dash-cover .high { fill: var(--d-warn); }
.dash-adv .meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); } .dash-adv .adv { margin: 0; font-size: 12px; font-weight: 600; }
.dash-ask textarea { border-radius: 12px; }
.dash-ic { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-bg); }
.dash-ic svg { width: 18px; height: 18px; fill: none; stroke: var(--accent-text); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dash-ic.ic-server { background: var(--ok-bg); } .dash-ic.ic-server svg { stroke: var(--ok-text); }
.lvl-warn .dash-ic.ic-server, .dash-kpi.lvl-warn .dash-ic { background: var(--warn-bg); } .lvl-warn .dash-ic svg { stroke: var(--warn-text); }
.lvl-crit .dash-ic { background: #FFE4E6; } .lvl-crit .dash-ic svg { stroke: #BE123C; }
.dash-ic.ic-trend { background: var(--hold-bg); } .dash-ic.ic-trend svg { stroke: var(--hold-text); }
.dash-ic.ic-cal { background: var(--pink-bg); } .dash-ic.ic-cal svg { stroke: var(--pink-text); }
.dash-kpi .k { padding-right: 38px; }
.dash-bigchart .auto-chart { max-width: 760px; }
.dash-adv .top { flex-direction: column; gap: 3px; }
.dash-gauge .fill { stroke-width: 9; }
.dash-banner { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-radius: 18px; padding: 16px 20px; margin: 6px 0 10px;
               background: linear-gradient(120deg, #0F2547 0%, #1D4ED8 70%, #2a78d6 100%); color: #fff; box-shadow: 0 8px 24px rgba(29,78,216,.18); }
.dash-title { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: .01em; } .dash-subtitle { margin: 2px 0 0; font-size: 12.5px; opacity: .85; }
.dash-live { display: inline-flex; align-items: center; gap: 8px; background: rgba(255,255,255,.14); padding: 6px 12px; border-radius: 999px; font-weight: 700; font-size: 13px; white-space: nowrap; }
.dash-live i { width: 10px; height: 10px; border-radius: 50%; background: #4ADE80; box-shadow: 0 0 0 4px rgba(74,222,128,.25); }
.dash-live.lvl-warn i { background: #FBBF24; box-shadow: 0 0 0 4px rgba(251,191,36,.3); } .dash-live.lvl-crit i { background: #F87171; box-shadow: 0 0 0 4px rgba(248,113,113,.3); }
.dash-desc { margin: 0 2px 10px; }
.dash-live.ps-live-buy i, .dash-live.ps-live-strong_buy i { background: #4ADE80; } .dash-live.ps-live-sell i, .dash-live.ps-live-strong_sell i { background: #F87171; box-shadow: 0 0 0 4px rgba(248,113,113,.3); }
.dash-live.ps-live-hold i { background: #CBD5E1; box-shadow: 0 0 0 4px rgba(203,213,225,.3); }
#tab-ps .card { border-radius: 16px; }
.ps-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 8px 16px; }
.ps-toolbar .ps-pick { flex: 1 1 480px; } .ps-toolbar .mkh-periods { margin: 0; }
.ps-top { display: grid; grid-template-columns: minmax(220px, 280px) 120px 1fr; gap: 14px; align-items: center; margin: 14px 0 6px; }
@media (max-width: 760px) { .ps-top { grid-template-columns: 1fr 110px; } .ps-top .ps-why { grid-column: 1 / -1; } }
.ps-meter { width: 100%; height: 14px; margin: 6px 0 2px; } .ps-meter .pt { fill: var(--surface); stroke: var(--text); stroke-width: 2.5; }
.ps-rsi { width: 116px; } .ps-rsi .s { font-size: 10.5px; }
.ps-kpi.buyz { box-shadow: inset 3px 0 0 #0ca30c; } .ps-kpi.sellz { box-shadow: inset 3px 0 0 #d03b3b; }
.ps-ladder { width: 100%; height: auto; display: block; margin: 4px 0 6px; }
.ps-ladder .bg { fill: var(--surface-sunken); } .ps-ladder .red { fill: #d03b3b; opacity: .35; } .ps-ladder .green { fill: #0ca30c; opacity: .35; }
.ps-ladder .tick { stroke: var(--text-secondary); stroke-width: 1.5; } .ps-ladder .tl { fill: var(--text-secondary); font-size: 11px; }
.ps-ladder .now { fill: var(--accent); stroke: var(--surface); stroke-width: 3; } .ps-ladder .nl { fill: var(--text); font-size: 11px; font-weight: 700; }
.ps-src-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.ps-src-card { background: var(--surface-sunken); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; border: 1px solid transparent; }
.ps-src-card.base { border-color: var(--accent); } .ps-src-card.none { opacity: .6; }
.ps-src-card .top { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; } .ps-src-card b { font-size: 20px; }
.ps-src-card .foot { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-secondary); } .ps-src-card small { font-size: 10.5px; color: var(--text-muted); }
.dash-sig.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-bg); }
.ps-ladder { max-width: 1000px; } .ps-ladder .tl { font-size: 13px; } .ps-ladder .nl { font-size: 13px; }
.dash-sig-grid { align-items: start; }
@media (max-width: 480px) { .dash-gauges { gap: 8px; } .dash-gauge { width: calc(33.3% - 6px); } .dash-gauge svg { width: 72px; height: 72px; } .dash-gauge .k { font-size: 11.5px; } .dash-minis { min-width: 100%; } }
/* update 55: the milling order badge on a buying/selling card is a link back to it */
a.badge.from-milling.link { text-decoration: none; cursor: pointer; } a.badge.from-milling.link:hover { filter: brightness(.95); text-decoration: underline; }
/* update 58: Milling Analysis on the AI dashboard */
.dash-mill { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: center; }
.dash-mini small { font-size: 10.5px; color: var(--text-muted); }
/* update 60: three groups on the Milling Order List */
@media (max-width: 640px) { .ml-view { font-size: 13px; padding: 9px 4px; } .ml-view b { display: block; width: fit-content; margin: 3px auto 0; } }

/* update 63: live dashboards - the time of the last automatic update, or that the server cannot be reached */
.live-bar { display: inline-flex; align-items: center; gap: 6px; margin: 4px 0 10px; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; background: #e8f6ec; color: #17663a; }
.live-bar i { display: none; }
.live-bar.live-paused { background: #eef2f6; color: #5b6b7f; }
.live-bar.live-lost { background: #fdecec; color: #b42318; font-weight: 600; }

/* update 65: staff notices (a customer linked their LINE account) - stay until closed */
#staff-notices { position: fixed; right: 16px; bottom: 16px; z-index: 900; display: flex; flex-direction: column; gap: 10px;
  width: min(360px, calc(100vw - 32px)); }
.staff-notice { background: var(--surface, #fff); border: 1px solid var(--border, #dde4ec); border-left: 5px solid #06C755;
  border-radius: 12px; padding: 12px 14px; box-shadow: 0 8px 24px rgba(16,32,44,.18); }
.staff-notice b { display: block; margin-bottom: 4px; }
.staff-notice p { margin: 0 0 8px; font-size: 14px; }
.staff-notice .sn-actions { display: flex; gap: 8px; justify-content: flex-end; }
@media print { #staff-notices { display: none; } }

/* update 66: 3D plant */
.plant3d .scada-top-actions { flex-wrap: wrap; }
a.scada-btn { text-decoration: none; }
.p3-body { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 12px; margin-top: 12px; }
.p3-wrap { position: relative; height: 62vh; min-height: 380px; border-radius: 14px; overflow: hidden; border: 1px solid var(--sc-line); background: #0e1729; touch-action: none; }
.p3-wrap canvas { display: block; touch-action: none; cursor: grab; }
.p3-wrap.p3-nogl::after { content: attr(data-msg); position: absolute; inset: 0; display: grid; place-items: center; color: var(--sc-sub); padding: 20px; text-align: center; }
.p3-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.p3-label { position: absolute; left: 0; top: 0; pointer-events: auto; cursor: pointer; white-space: nowrap; padding: 3px 8px 4px; border-radius: 8px;
  background: rgba(8, 16, 32, 0.78); border: 1px solid rgba(96, 165, 250, 0.4); color: var(--sc-ink); font-size: 12px; line-height: 1.25; text-align: center; }
.p3-label b { display: block; font-size: 12.5px; }
.p3-label span { color: var(--sc-sub); font-size: 11px; }
.p3-label.st-R { border-color: rgba(34, 197, 94, 0.8); } .p3-label.st-R span { color: #86efac; }
.p3-label.st-F { border-color: #ef4444; } .p3-label.st-F span { color: #fca5a5; }
.p3-label.st-off, .p3-label.st-dis { opacity: 0.7; }
.p3-label.picked { box-shadow: 0 0 0 2px #38bdf8; }
.p3-panel { min-height: 200px; }
.p3-name { margin: 0; font-size: 18px; font-weight: 700; color: var(--sc-ink); }
.p3-id { margin: 2px 0 8px; color: var(--sc-dim); font-size: 12px; }
.p3-st { display: inline-block; margin: 0 0 10px; padding: 2px 10px; border-radius: 999px; font-weight: 600; background: rgba(127, 156, 196, 0.25); color: var(--sc-ink); }
.p3-st.st-R { background: rgba(34, 197, 94, 0.25); color: #86efac; } .p3-st.st-F { background: rgba(239, 68, 68, 0.25); color: #fca5a5; }
.p3-st.st-M { background: rgba(245, 158, 11, 0.25); color: #fcd34d; }
.p3-row { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px solid rgba(96, 165, 250, 0.15); font-size: 13px; color: var(--sc-sub); }
.p3-row b { color: var(--sc-ink); }
.p3-note { color: var(--sc-dim); font-size: 12px; }
.p3-open { margin-top: 12px; width: 100%; justify-content: center; }
.p3-howto { margin-left: auto; color: var(--sc-dim); }
.plant3d:fullscreen, .plant3d.p3-pseudo-full { position: fixed; inset: 0; z-index: 1000; overflow: auto; border-radius: 0; }

@media (max-width: 820px) { .p3-body { grid-template-columns: 1fr; } .p3-wrap { height: 52vh; } .p3-howto { display: none; } }
.scada-btn.on { border-color: var(--sc-cyan); background: rgba(56, 189, 248, 0.18); }
.p3-wrap, .p3-labels { -webkit-user-select: none; user-select: none; }

/* update 69: SCADA <-> AOI 3D switch; the other view inside full screen; a screen shown inside the other one */
.view-switch { display: inline-flex; border: 1px solid rgba(96, 165, 250, 0.45); border-radius: 12px; overflow: hidden; height: 44px; }
.view-switch a { display: inline-flex; align-items: center; padding: 0 16px; color: var(--sc-ink); text-decoration: none; font-weight: 600; }
.view-switch a + a { border-left: 1px solid rgba(96, 165, 250, 0.45); }
.view-switch a.on { background: rgba(56, 189, 248, 0.22); color: #fff; box-shadow: inset 0 -2px 0 var(--sc-cyan); }
.scada.vs-other > :not(.scada-top):not(.vs-frame) { display: none !important; }
.vs-frame { display: none; width: 100%; border: 0; border-radius: 12px; background: #050b16; height: calc(100vh - 120px); }
.scada.vs-other .vs-frame { display: block; }
body.embed { max-width: none; padding: 0 !important; background: #050b16; }
body.embed .top-row, body.embed #session-bar, body.embed .notice, body.embed .back-btn, body.embed .tv-section-title,
body.embed .scada > .scada-top, body.embed #scada-list-card { display: none !important; }
body.embed .scada { border-radius: 0; margin: 0; }
body.embed .scada { min-height: 100vh; box-sizing: border-box; }
html:has(body.embed) { background: #050b16; }
/* update 70: the 3D view shown inside SCADA (full screen) keeps its own buttons (reset, top view, auto-rotate) */
body.embed .plant3d > .scada-top { display: flex !important; justify-content: flex-end; margin-bottom: 4px; }
body.embed .plant3d .scada-title, body.embed .plant3d .view-switch, body.embed #p3-full { display: none !important; }

/* update 71: full screen fits the screen (no scrolling): header, KPIs, the 3D area (takes the rest), legend.
   The same for the 3D view inside SCADA and for SCADA inside the 3D view. The 3D buttons hide while SCADA is shown. */
.p3-tools { display: contents; }
.scada.vs-other .p3-tools { display: none; }
.plant3d:fullscreen, .plant3d.p3-pseudo-full, body.embed .plant3d { display: flex; flex-direction: column; gap: 10px; height: 100vh; box-sizing: border-box; overflow: hidden; }
.plant3d:-webkit-full-screen { display: flex; flex-direction: column; gap: 10px; height: 100vh; box-sizing: border-box; overflow: hidden; }
.plant3d:fullscreen > *, .plant3d.p3-pseudo-full > *, body.embed .plant3d > * { flex: none; }
.plant3d:fullscreen .p3-body, .plant3d.p3-pseudo-full .p3-body, body.embed .plant3d .p3-body { flex: 1 1 auto; min-height: 0; margin-top: 0; }
.plant3d:-webkit-full-screen .p3-body { flex: 1 1 auto; min-height: 0; margin-top: 0; }
.plant3d:fullscreen .p3-wrap, .plant3d.p3-pseudo-full .p3-wrap, body.embed .plant3d .p3-wrap { height: 100%; min-height: 0; }
.plant3d:-webkit-full-screen .p3-wrap { height: 100%; min-height: 0; }
.plant3d:fullscreen .p3-panel, .plant3d.p3-pseudo-full .p3-panel, body.embed .plant3d .p3-panel { overflow: auto; min-height: 0; }
body.embed .plant3d { min-height: 0; padding: 14px 22px; }
.scada.vs-other:fullscreen { display: flex; flex-direction: column; gap: 10px; height: 100vh; box-sizing: border-box; overflow: hidden; }
.scada.vs-other:-webkit-full-screen { display: flex; flex-direction: column; gap: 10px; height: 100vh; box-sizing: border-box; overflow: hidden; }
.scada.vs-other:fullscreen .vs-frame, .scada.vs-other.p3-pseudo-full .vs-frame { flex: 1 1 auto; height: auto; min-height: 0; }
.scada.vs-other:-webkit-full-screen .vs-frame { flex: 1 1 auto; height: auto; min-height: 0; }
.scada:-webkit-full-screen { border-radius: 0; padding: 28px; overflow: auto; }
.plant3d.p3-pseudo-full.vs-other, .plant3d.vs-other:fullscreen { padding: 22px; }

.badge.pending-maint { background: #fff1d6; color: #8a5a00; }   /* update 72 */

/* update 75: the mill's own trading on Price analysis */
.ps-trade-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.ps-trade-side { border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.ps-trade-side.buyz { border-top: 3px solid #16a34a; } .ps-trade-side.sellz { border-top: 3px solid #dc2626; }
.ps-trade-chart { width: 100%; height: auto; display: block; }
.ps-trade-chart .axis { stroke: var(--border); stroke-width: 1.5; }
.ps-trade-chart rect.buy { fill: #16a34a; } .ps-trade-chart rect.sell { fill: #dc2626; }
.ps-trade-chart .mark:hover rect { opacity: .8; }
.ps-trade-chart text.l { font-size: 12px; fill: var(--text-secondary); }
.ps-trade-chart text.lg { font-size: 13px; font-weight: 600; } .ps-trade-chart text.lg.buy { fill: #16a34a; } .ps-trade-chart text.lg.sell { fill: #dc2626; }
.ps-trade-notes { margin: 10px 0 0; padding-left: 20px; color: var(--text-secondary); display: grid; gap: 4px; }

a.brand-home { color: inherit; text-decoration: none; }   /* update 76 */
a.brand-home:hover .brand-logo, a.brand-home:focus-visible .brand-logo { box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25); }

/* update 77: AI web prices on Price analysis */
#tab-ps { --ps-AIWEB: #7c3aed; --ps-AIHIST: #a78bfa; }
.ps-s-AIWEB { stroke: var(--ps-AIWEB); } .ps-dot.ps-s-AIWEB { fill: var(--ps-AIWEB); }
.ps-s-AIHIST { stroke: var(--ps-AIHIST); stroke-dasharray: 6 4; } .ps-dot.ps-s-AIHIST { fill: var(--ps-AIHIST); }
.ps-c-AIWEB { border-color: var(--ps-AIWEB); } .ps-c-AIHIST { border-color: var(--ps-AIHIST); }
.mkh-sw.ps-c-AIHIST { border-top-style: dashed; }
.ps-warnings p { margin: 2px 0; }

/* update 78: a price typed by a super user */
.rate-cell .rate-input { width: 6.5em; text-align: right; padding: 6px 8px; }
tr.price-changed .rate-input { border-color: #d97706; background: #fff7e6; font-weight: 600; }
.bs-price-ovr { color: #b45309; }
/* update 80: Milling Analysis dashboard */
.ma-dash { --ma-HM: #2a78d6; --ma-WH: #eb6834; --ma-GL: #1baf7a; --ma-wait: #e0a100; --ma-mill: #2a78d6; --ma-other: #8b5cf6; --ma-pick: #1baf7a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ma-dash { --ma-HM: #3987e5; --ma-WH: #d95926; --ma-GL: #199e70; --ma-mill: #3987e5; --ma-pick: #199e70; } }
:root[data-theme="dark"] .ma-dash { --ma-HM: #3987e5; --ma-WH: #d95926; --ma-GL: #199e70; --ma-mill: #3987e5; --ma-pick: #199e70; }
.ma-dash .dash-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 760px) { .ma-dash .dash-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.dash-grid > .span3 { grid-column: 1 / -1; }
.ma-status-bar { width: 100%; height: 8px; display: block; margin-top: auto; } .ma-status-bar .bg { fill: var(--surface-sunken); }
.ma-dash .st-done { fill: var(--d-ok); background: var(--d-ok); } .ma-dash .st-active { fill: var(--accent); background: var(--accent); } .ma-dash .st-cancelled { fill: var(--d-crit); background: var(--d-crit); }
.ma-st-legend { margin-top: 4px !important; } .ma-st-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
.ma-ring-row { display: flex; align-items: center; gap: 10px; margin-top: 2px; }
.ma-ring { width: 58px; height: 58px; flex: 0 0 auto; } .ma-ring .track { fill: none; stroke: var(--surface-sunken); stroke-width: 8; }
.ma-ring .fill { fill: none; stroke: var(--accent); stroke-width: 8; stroke-linecap: round; } .ma-ring .v { font-size: 15px; font-weight: 700; fill: var(--text); }
.ma-dash .dash-legend i { display: inline-block; width: 12px; height: 10px; margin-left: 8px; }
.ma-dash .sw-bar { background: var(--accent); opacity: .35; border-radius: 2px; } .ma-dash .sw-line { height: 0 !important; border-top: 3px solid var(--d-s2); }
.ma-dash .sw-exp { height: 0 !important; border-top: 2px dashed var(--text-muted); }
.ma-trend, .ma-hours { width: 100%; height: auto; display: block; }
.ma-trend .grid, .ma-hours .grid { stroke: var(--border); } .ma-trend .ax, .ma-hours .ax { fill: var(--text-muted); font-size: 11px; }
.ma-trend .bar { fill: var(--accent); opacity: .35; } .ma-trend .mark:hover .bar { opacity: .6; } .hit { fill: transparent; }
.ma-trend .yl { fill: none; stroke: var(--d-s2); stroke-width: 2.5; stroke-linejoin: round; } .ma-trend .yd { fill: var(--d-s2); stroke: var(--surface); stroke-width: 1.5; }
.ma-trend .exp { stroke: var(--text-muted); stroke-width: 1.5; stroke-dasharray: 5 4; }
.ma-flow-total { font-size: 26px; font-weight: 700; margin: 2px 0 8px; }
.ma-flow-bar { width: 100%; height: 14px; display: block; border-radius: 7px; overflow: hidden; }
.ma-dash .fl-wait { fill: var(--ma-wait); background: var(--ma-wait); } .ma-dash .fl-milling { fill: var(--ma-mill); background: var(--ma-mill); }
.ma-dash .fl-other { fill: var(--ma-other); background: var(--ma-other); } .ma-dash .fl-pickup { fill: var(--ma-pick); background: var(--ma-pick); }
.ma-flow-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 7px; font-size: 13px; }
.ma-flow-list li { display: grid; grid-template-columns: 10px 1fr auto 38px; gap: 8px; align-items: center; }
.ma-flow-list i { width: 10px; height: 10px; border-radius: 3px; } .ma-flow-list small { color: var(--text-muted); text-align: right; }
.ma-var-wrap { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.ma-donut-box { flex: 0 0 140px; } .ma-donut { width: 140px; height: 140px; display: block; }
.ma-donut .track { fill: none; stroke: var(--surface-sunken); stroke-width: 20; } .ma-donut .vs { fill: none; stroke-width: 20; }
.ma-donut .v { font-size: 17px; font-weight: 700; fill: var(--text); } .ma-donut .u { font-size: 10px; fill: var(--text-secondary); }
.ma-dash .vc-HM { stroke: var(--ma-HM); background: var(--ma-HM); } .ma-dash .vc-WH { stroke: var(--ma-WH); background: var(--ma-WH); } .ma-dash .vc-GL { stroke: var(--ma-GL); background: var(--ma-GL); }
.ma-var-cards { flex: 1; min-width: 240px; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.ma-var { background: var(--surface-sunken); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 8px; border-top: 4px solid var(--border-strong); }
.ma-var.lvl-ok { border-top-color: var(--d-ok); } .ma-var.lvl-warn { border-top-color: var(--d-warn); } .ma-var.lvl-crit { border-top-color: var(--d-crit); }
.ma-var .top { display: flex; justify-content: space-between; align-items: center; } .ma-var .nm { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 7px; }
.ma-var .vdot { width: 10px; height: 10px; border-radius: 50%; } .ma-var .pill { font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--surface); color: var(--text-secondary); }
.ma-var .mid { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; } .ma-var .mid b { font-size: 24px; } .ma-var .mid small { color: var(--text-secondary); font-size: 11.5px; }
.ma-yscale svg { width: 100%; height: 10px; display: block; } .ma-yscale .bg { fill: var(--border); } .ma-yscale .yv { fill: var(--accent); } .ma-yscale .ex { fill: var(--text); }
.ma-yscale .lbl { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--text-muted); margin-top: 2px; }
.ma-tbars { display: flex; flex-direction: column; gap: 5px; }
.ma-tbars > div { display: grid; grid-template-columns: 64px 1fr auto; gap: 8px; align-items: center; font-size: 11.5px; color: var(--text-secondary); }
.ma-tbars svg { width: 100%; height: 6px; display: block; } .ma-tbars .bg { fill: var(--border); } .ma-tbars .tw { fill: var(--ma-wait); } .ma-tbars .tm { fill: var(--ma-mill); }
.ma-tbars b { color: var(--text); font-size: 12px; white-space: nowrap; }
.ma-var .foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 8px; font-size: 11.5px; color: var(--text-secondary); } .ma-var .foot b { color: var(--text); }
.ma-hours .bar { fill: var(--accent); opacity: .55; } .ma-hours .bar.peak { opacity: 1; } .ma-hours .mark:hover .bar { opacity: .85; }
.ma-cust { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ma-cust li { display: grid; grid-template-columns: minmax(140px, 1.2fr) 2fr minmax(120px, auto); gap: 12px; align-items: center; }
.ma-cust .nm { font-weight: 600; font-size: 13.5px; display: flex; flex-direction: column; } .ma-cust .nm small, .ma-cust .val small { font-weight: 400; font-size: 11px; color: var(--text-muted); }
.ma-cust svg { width: 100%; height: 10px; display: block; } .ma-cust .bg { fill: var(--surface-sunken); } .ma-cust .cb { fill: var(--accent); opacity: .8; }
.ma-cust li.lvl-warn .cb { fill: var(--d-warn); } .ma-cust li.lvl-crit .cb { fill: var(--d-crit); }
.ma-cust .val { display: flex; flex-direction: column; text-align: right; font-size: 13px; }
@media (max-width: 560px) { .ma-cust li { grid-template-columns: 1fr auto; } .ma-cust svg { grid-column: 1 / -1; grid-row: 2; } }
.ma-tables summary { cursor: pointer; font-weight: 600; color: var(--accent-text); } .ma-tables[open] summary { margin-bottom: 12px; }
.ma-cust svg, .ma-tbars svg, .ma-status-bar { border-radius: 999px; overflow: hidden; }
.dash-grid > * { min-width: 0; }
.ma-var-cards { min-width: 0; flex-basis: 240px; }
@media (max-width: 560px) { .ma-trend .ax { font-size: 20px; } .ma-hours .ax { font-size: 15px; } .ma-donut-box { margin: 0 auto; } }
#ma-trend .dash-head { flex-wrap: wrap; } #ma-trend .dash-legend { flex-wrap: wrap; }
.btn-row-inline { display: flex; flex-wrap: wrap; gap: 8px; } .btn-row-inline .action { width: auto; }
/* update 84: price billboard settings */
.bb-set-table td { vertical-align: middle; } .bb-set-table .bb-order { width: 64px; } .bb-set-table input[type="text"] { min-width: 200px; }
.bb-side { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 13px; }
.bb-set-table .center { text-align: center; }
.bb-set-table td:nth-child(3) { white-space: nowrap; }
/* update 91: price billboard settings layout */
.bb-form .bb-fs { border: 0; padding: 0; margin: 0; min-width: 0; }
.bb-sec { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.bb-sec:first-child { border-top: 0; padding-top: 4px; }
.bb-sec h3 { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 15px; font-weight: 700; color: var(--text); }
.bb-sec h3 span { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-bg); color: var(--accent-text); font-size: 13px; }
.bb-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
table.bb-set-table { width: 100%; border-collapse: collapse; table-layout: fixed; min-width: 720px; }
.bb-set-table col.c-show { width: 64px; } .bb-set-table col.c-order { width: 76px; } .bb-set-table col.c-name { width: 24%; }
.bb-set-table col.c-price { width: 110px; } .bb-set-table col.c-note { width: auto; }
.bb-set-table th { background: var(--surface-sunken); color: var(--text-secondary); font-size: 12px; font-weight: 600; text-align: left; padding: 9px 10px; }
.bb-set-table td { padding: 7px 10px; border-top: 1px solid var(--border); vertical-align: middle; font-size: 14px; }
.bb-set-table .center { text-align: center; }
.bb-set-table .bb-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bb-set-table .bb-order { width: 56px; padding: 6px 4px; text-align: center; }
.bb-set-table .bb-note-in { width: 100%; padding: 7px 10px; min-width: 0; }
.bb-set-table .bb-chk { width: 18px; height: 18px; }
.bb-pill { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.bb-pill input { position: absolute; opacity: 0; pointer-events: none; }
.bb-pill span { min-width: 74px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border-strong); color: var(--text-muted); font-variant-numeric: tabular-nums;
  text-decoration: line-through; transition: background .15s, color .15s, border-color .15s; }
.bb-pill input:checked + span { background: var(--ok-bg); color: var(--ok-text); border-color: var(--ok-text); text-decoration: none; font-weight: 600; }
.bb-pill input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.bb-grid3 { display: grid; grid-template-columns: 1.4fr 1fr 1.2fr; gap: 14px; align-items: end; }
.bb-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: center; }
@media (max-width: 720px) { .bb-grid3, .bb-grid2 { grid-template-columns: 1fr; } }
.bb-grid3 select, .bb-grid3 input[type="number"] { width: 100%; }
.bb-switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; min-height: 40px; font-size: 14px; }
.bb-switch input { position: absolute; opacity: 0; pointer-events: none; }
.bb-switch i { width: 42px; height: 24px; border-radius: 999px; background: var(--border-strong); position: relative; flex: 0 0 42px; transition: background .15s; }
.bb-switch i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.bb-switch input:checked + i { background: var(--accent); } .bb-switch input:checked + i::after { transform: translateX(18px); }
.bb-switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.bb-vol-row { display: flex; align-items: center; gap: 10px; } .bb-vol-row input { flex: 1; } .bb-vol-row b { min-width: 30px; text-align: right; font-variant-numeric: tabular-nums; }
.bb-msg { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.bb-msg label { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-sunken); color: var(--text-secondary); font-size: 12px; font-weight: 700; flex: 0 0 26px; }
.bb-msg input { flex: 1; min-width: 0; }
.bb-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.bb-actions .action { width: auto; min-width: 160px; margin: 0; }
table.bb-set-table { min-width: 600px; }
.bb-set-table col.c-show { width: 52px; } .bb-set-table col.c-order { width: 64px; } .bb-set-table col.c-name { width: 27%; } .bb-set-table col.c-price { width: 96px; }
.bb-set-table td, .bb-set-table th { padding-left: 8px; padding-right: 8px; }
.bb-pill span { min-width: 68px; padding: 4px 8px; }
.bb-vol-row b { min-width: 0; } .bb-vol-row span { margin-left: -6px; color: var(--text-secondary); }
.bb-grid3 .bb-switch span { white-space: normal; line-height: 1.25; }
.bb-form input, .bb-form select { box-sizing: border-box; max-width: 100%; }
.bb-switch { display: flex; } .bb-switch span { flex: 1; min-width: 0; }
.bb-set-table input[type="text"].bb-note-in { min-width: 0; }
/* update 93: Christmas / New Year campaign */
.cp-camps { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; } .cp-camps .chip small { opacity: .7; margin-left: 4px; }
.cp-form .cp-fs { border: 0; padding: 0; margin: 0; min-width: 0; }
.cp-grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: end; }
.cp-grid4 input { width: 100%; box-sizing: border-box; } .cp-span2 { grid-column: span 2; } .cp-span3 { grid-column: span 3; }
@media (max-width: 720px) { .cp-grid4 { grid-template-columns: 1fr 1fr; } .cp-span2, .cp-span3 { grid-column: 1 / -1; } }
.cp-types { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 16px; }
@media (max-width: 900px) { .cp-types { grid-template-columns: 1fr; } }
.cp-type { border-radius: 14px; padding: 14px; border: 1px solid var(--border); background: var(--surface-sunken); border-top: 5px solid var(--c); }
.cp-ML { --c: #dc2626; } .cp-BY { --c: #16a34a; } .cp-SL { --c: #2563eb; }
.cp-type h3 { margin: 0 0 10px; font-size: 16px; color: var(--c); }
.cp-levels { display: flex; flex-direction: column; gap: 8px; }
.cp-level { display: grid; grid-template-columns: 28px 70px auto 1fr; gap: 6px; align-items: center; }
.cp-level input { width: 100%; box-sizing: border-box; padding: 6px 8px; } .cp-level small { color: var(--text-muted); font-size: 11px; }
.cp-medal { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 800; font-size: 12px; color: #fff; }
.cp-medal.m1 { background: linear-gradient(180deg, #d6a06b, #a0643a); } .cp-medal.m2 { background: linear-gradient(180deg, #e5e7eb, #9ca3af); color: #374151; }
.cp-medal.m3 { background: linear-gradient(180deg, #fde047, #ca8a04); } .cp-medal.sm { width: 22px; height: 22px; font-size: 11px; margin-right: 2px; }
.cp-medal.off { background: var(--border); color: var(--text-muted); }
.cp-special { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.cp-special input { width: 100%; box-sizing: border-box; }
.cp-draw-box { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 12px 0; padding: 12px 14px;
  border-radius: 12px; background: linear-gradient(90deg, #fef2f2, #f0fdf4); border: 1px dashed #dc2626; }
.cp-draw-box .cp-won { margin: 4px 0 0; color: #15803d; font-weight: 700; } .cp-draw-btn { width: auto; margin: 0; text-decoration: none; }
.cp-gift { display: inline-flex; align-items: center; gap: 4px; margin: 2px 4px 2px 0; padding: 4px 10px; border-radius: 999px; font-size: 12px;
  border: 1px solid #f59e0b; background: #fffbeb; color: #92400e; cursor: pointer; font-family: inherit; }
.cp-gift.done { border-color: #16a34a; background: #f0fdf4; color: #166534; cursor: default; } .cp-gift small { opacity: .75; }
/* the lucky wheel */
.cp-stage { position: relative; overflow: hidden; border-radius: 22px; padding: 26px 16px 30px; text-align: center; color: #fff; min-height: 720px;
  background: radial-gradient(700px 400px at 50% 0%, rgba(253,224,71,.35), transparent 70%), linear-gradient(160deg, #b91c1c, #9d174d 40%, #166534 100%); }
.cp-h { margin: 0; font-size: 34px; text-shadow: 0 3px 0 rgba(0,0,0,.2); } .cp-sub { margin: 6px 0 18px; font-size: 18px; color: #fef3c7; }
.cp-wheel-box { position: relative; width: min(560px, 92vw); aspect-ratio: 1; margin: 0 auto; }
.cp-wheel { width: 100%; height: 100%; display: block; filter: drop-shadow(0 18px 30px rgba(0,0,0,.35)); }
.cp-lbl { fill: #fff; font-size: 15px; font-weight: 700; paint-order: stroke; stroke: rgba(0,0,0,.25); stroke-width: 3px; }
.cp-bulb { fill: #fde047; animation: cp-blink 1s steps(2) infinite; } .cp-bulb.alt { fill: #fff; animation-delay: .5s; }
@keyframes cp-blink { 50% { opacity: .3; } }
.cp-pointer { position: absolute; left: 50%; top: -8px; width: 0; height: 0; margin-left: -20px; z-index: 2; border-left: 20px solid transparent;
  border-right: 20px solid transparent; border-top: 44px solid #fde047; filter: drop-shadow(0 4px 4px rgba(0,0,0,.35)); }
.cp-hub { position: absolute; left: 50%; top: 50%; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; border: 6px solid #fff;
  background: radial-gradient(circle at 35% 30%, #fef08a, #f59e0b 60%, #b45309); color: #7c2d12; font-weight: 800; font-size: 17px; cursor: pointer;
  box-shadow: 0 8px 20px rgba(0,0,0,.35); font-family: inherit; }
.cp-hub:disabled { opacity: .85; cursor: default; }
.cp-note { margin: 18px auto 0; max-width: 620px; font-size: 13px; color: #fde68a; }
.cp-result { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.45); z-index: 5; }
.cp-result[hidden] { display: none; }
.cp-result-in { background: #fff; color: #1f2937; border-radius: 22px; padding: 26px 34px; min-width: 300px; box-shadow: 0 20px 60px rgba(0,0,0,.4); animation: cp-pop .5s cubic-bezier(.2,1.6,.4,1); }
@keyframes cp-pop { from { transform: scale(.6); opacity: 0; } }
.cp-result-in .l { margin: 0; font-weight: 700; color: #b91c1c; } .cp-result-in .n { margin: 6px 0 0; font-size: 34px; font-weight: 800; }
.cp-result-in .c { margin: 0; color: var(--text-muted); } .cp-result-in .g { margin: 12px 0 4px; font-size: 20px; font-weight: 700; color: #166534; }
.cp-result-in .k { margin: 0 0 14px; font-size: 13px; color: var(--text-secondary); } .cp-result-in .action { width: auto; min-width: 120px; }
.cp-confetti { position: absolute; inset: 0; pointer-events: none; z-index: 6; overflow: hidden; }
.cp-confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 2px; animation: cp-fall linear forwards; }
@keyframes cp-fall { to { transform: translate(var(--dx), 820px) rotate(var(--rot)); opacity: .8; } }
.cp-entry { display: block; text-decoration: none; color: #fff; background: linear-gradient(90deg, #b91c1c, #15803d); font-size: 16px; }
.cp-code { color: var(--text-muted); font-size: 11.5px; } .cp-table td { vertical-align: middle; }
.cp-level { grid-template-columns: 28px 64px auto minmax(0, 1fr); }
#tab-campaign, #cp-draw-page { max-width: 1180px; margin: 0 auto; }
.cp-empty { margin-top: 12px; padding: 22px; border: 2px dashed var(--border-strong); border-radius: 14px; text-align: center; color: var(--text-secondary); font-size: 15px; }
/* update 95: ranks */
.cp-min { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--text-secondary); margin-bottom: 10px; }
.cp-min span { display: inline-flex; align-items: center; gap: 4px; } .cp-min input { width: 70px; padding: 5px 8px; }
.cp-level { grid-template-columns: 28px 64px minmax(0, 1fr); } .cp-rank { font-size: 13px; font-weight: 700; color: var(--text-secondary); }
.cp-table tr.cp-top td { background: #fffbeb; } .cp-table tr.cp-out td { color: var(--text-muted); }
.cp-provisional { margin: 10px 0 0; padding: 8px 12px; border-radius: 10px; background: var(--warn-bg); color: var(--warn-text); font-size: 13px; }
.cp-medal.m1 { background: linear-gradient(180deg, #fde047, #ca8a04); color: #fff; } .cp-medal.m3 { background: linear-gradient(180deg, #d6a06b, #a0643a); }
/* update 96: coupons */
.cpn-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px 12px; align-items: end; }
.cpn-grid input { width: 100%; box-sizing: border-box; } .cpn-grid .cpn-note { grid-column: span 2; } .cpn-grid .cpn-send .action { width: 100%; margin: 0; }
@media (max-width: 720px) { .cpn-grid { grid-template-columns: 1fr; } .cpn-grid .cpn-note { grid-column: auto; } }
.cpn-acts .action.small { margin: 2px; }
tr.cpn-used td, tr.cpn-cancelled td, tr.cpn-expired td { color: var(--text-muted); }
.cpn-use { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 6px 0; } .cpn-use input[type="text"] { flex: 1; min-width: 160px; }
.cpn-use .action.small { margin: 0; }
.cpn-on { color: #15803d; font-weight: 600; }
.cpn-cust { display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: center; } .cpn-cust label { grid-column: 1 / -1; } .cpn-cust .action, .cpn-cust button { margin: 0; }
/* update 97: lucky wheel full screen */
.cp-full { position: absolute; right: 14px; top: 14px; z-index: 4; padding: 8px 16px; border-radius: 999px; border: 2px solid rgba(255,255,255,.8);
  background: rgba(0,0,0,.25); color: #fff; font: 600 14px inherit; font-family: inherit; cursor: pointer; }
.cp-full:hover { background: rgba(0,0,0,.4); } .cp-full[hidden] { display: none; }
.cp-stage.is-full, .cp-stage:fullscreen { border-radius: 0; min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 3vh 2vw; }
.cp-stage.is-full .cp-h { font-size: 5vh; } .cp-stage.is-full .cp-sub { font-size: 2.6vh; }
.cp-stage.is-full .cp-wheel-box { width: min(76vh, 92vw); }
.cp-stage.is-full .cp-hub { width: 16vh; height: 16vh; margin: -8vh 0 0 -8vh; font-size: 2.6vh; }
.cp-stage.is-full .cp-pointer { border-left-width: 3vh; border-right-width: 3vh; border-top-width: 6vh; margin-left: -3vh; top: -1.5vh; }
.cp-stage.is-full .cp-result-in .n { font-size: 6vh; } .cp-stage.is-full .cp-result-in .g { font-size: 3.4vh; }
.cp-stage.is-full .cp-confetti i { animation-name: cp-fall-full; } @keyframes cp-fall-full { to { transform: translate(var(--dx), 110vh) rotate(var(--rot)); opacity: .8; } }
.cp-history { max-width: 520px; margin: 16px auto 0; padding: 10px 16px; border-radius: 14px; background: rgba(0,0,0,.22); text-align: left; } .cp-history[hidden] { display: none; } .cp-history .h { margin: 0 0 6px; font-weight: 700; color: #fde68a; } .cp-history ol { margin: 0; padding-left: 0; list-style: none; max-height: 160px; overflow: auto; } .cp-history li { padding: 3px 0; border-bottom: 1px solid rgba(255,255,255,.15); } .cp-history li small { color: #fde68a; opacity: .8; } .cp-history li:first-child { font-weight: 700; color: #fff; }
/* update 100: gift winners */
.cp-count { font-size: 14px; color: var(--text-secondary); } .cp-count b { color: #15803d; font-size: 18px; }
.cp-win-table tr.cpw-given td { background: #f0fdf4; } .cp-win-table tr.cpw-pending td { background: #fffbeb; }
/* update 101: Songkran campaign */
.cp-entries { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } @media (max-width: 640px) { .cp-entries { grid-template-columns: 1fr; } }
.cp-entries .cp-entry { margin: 0; } .cp-entry-sk { background: linear-gradient(90deg, #0369a1, #f97316); }
.cp-th-songkran .cp-type { border-top-color: var(--c); }
.cp-stage.cp-th-songkran { background: radial-gradient(700px 400px at 50% 0%, rgba(253,186,116,.45), transparent 70%), linear-gradient(160deg, #0c4a6e, #0369a1 45%, #f97316 100%); }
.cp-th-songkran .cp-sub, .cp-th-songkran .cp-note { color: #e0f2fe; } .cp-th-songkran .cp-pointer { border-top-color: #38bdf8; }
.cp-th-songkran .cp-hub { background: radial-gradient(circle at 35% 30%, #e0f2fe, #38bdf8 60%, #0369a1); color: #fff; }
.cp-th-songkran .cp-bulb { fill: #7dd3fc; } .cp-th-songkran .cp-result-in .l { color: #0369a1; }

/* update 106: own music file */
.bb-music-file{margin-top:14px}
.bb-music-table .bb-audio{width:240px;max-width:100%;height:34px}
.bb-music-up{display:grid;grid-template-columns:200px 1fr auto;gap:12px;align-items:end;margin-top:12px}
.bb-music-up input[type="file"]{width:100%;min-width:0}
@media (max-width:700px){.bb-music-up{grid-template-columns:1fr}}

/* update 108: member form opened from LINE */
body.reg-page { margin: 0; min-height: 100vh; background: linear-gradient(180deg, #e8f7ee 0%, #f8fafc 60%); font-family: "Prompt", "IBM Plex Sans Thai", sans-serif; }
.reg-card { max-width: 460px; margin: 0 auto; padding: 22px 18px 36px; }
.reg-logo { display: block; height: 54px; margin: 0 auto 10px; }
.reg-card h1 { text-align: center; font-size: 24px; margin: 6px 0; color: #14532d; }
.reg-sub { text-align: center; color: #4b5563; margin: 0 0 14px; }
.reg-src { font-size: 11px; color: #9ca3af; }
.reg-err { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; border-radius: 10px; padding: 10px 12px; }
.reg-form { display: flex; flex-direction: column; gap: 6px; background: #fff; border-radius: 16px; padding: 16px; box-shadow: 0 6px 24px rgba(20,83,45,.08); }
.reg-form label { font-weight: 600; color: #1f2937; margin-top: 6px; }
.reg-form input:not([type="checkbox"]), .reg-form textarea { width: 100%; box-sizing: border-box; font-size: 17px; padding: 11px 12px; border: 1px solid #d1d5db; border-radius: 10px; }
.reg-int { border: 1px solid #e5e7eb; border-radius: 10px; padding: 8px 12px; margin-top: 8px; }
.reg-int legend { font-weight: 600; padding: 0 4px; }
.reg-int label { display: block; font-weight: 400; margin: 6px 0; }
.reg-form .reg-consent { font-weight: 400; font-size: 14px; color: #4b5563; display: flex; gap: 8px; align-items: flex-start; }
.reg-form .reg-btn.action.primary { margin-top: 12px; font-size: 18px; padding: 13px; background: #06c755; border-color: #06c755; color: #fff; }
.reg-done { text-align: center; background: #fff; border-radius: 16px; padding: 24px 16px; box-shadow: 0 6px 24px rgba(20,83,45,.08); }
.reg-tick { width: 64px; height: 64px; line-height: 64px; margin: 0 auto 8px; border-radius: 50%; background: #06c755; color: #fff; font-size: 36px; }
.reg-code { font-size: 20px; letter-spacing: 1px; }
.reg-hint { color: #6b7280; font-size: 14px; text-align: center; }

/* update 108: A5 member leaflet, 2 per A4 portrait (each A5 is landscape 210 x 148 mm). Original design. */
body.leaflet-page { background: #e5e7eb; font-family: "Prompt", "IBM Plex Sans Thai", sans-serif; }
.lf-bar { display: flex; gap: 12px; align-items: center; justify-content: center; padding: 12px; color: #374151; }
.lf-a4 { width: 210mm; margin: 0 auto 24px; background: #fff; box-shadow: 0 4px 24px rgba(0,0,0,.12); }
.lf-a5 { position: relative; overflow: hidden; width: 210mm; height: 146mm; box-sizing: border-box; padding: 9mm 10mm; display: grid;
  grid-template-columns: 1fr 74mm; gap: 7mm; color: #14301d;
  background: radial-gradient(70mm 70mm at 100% 0%, rgba(6,199,85,.16), transparent 70%),
              radial-gradient(80mm 60mm at 0% 100%, rgba(245,158,11,.18), transparent 70%), #fffdf6; }
.lf-a5::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4mm; background: linear-gradient(180deg, #06c755, #16a34a 60%, #f59e0b); }
.lf-brand { display: flex; align-items: center; gap: 3mm; font-weight: 700; color: #166534; }
.lf-brand img { height: 12mm; width: auto; }
.lf-a5 h1 { font-size: 13mm; line-height: 1.08; margin: 3mm 0 2mm; font-weight: 800; color: #0f2a17; }
.lf-a5 h1 em { font-style: normal; color: #ea580c; } .lf-line { color: #06c755; }
.lf-lead { margin: 0 0 3mm; font-size: 4.4mm; color: #3f5d47; }
.lf-benefits { list-style: none; padding: 0; margin: 0 0 3mm; font-size: 4mm; line-height: 1.55; }
.lf-benefits i { font-style: normal; display: inline-block; width: 7mm; }
.lf-steps { display: flex; gap: 2mm; padding: 0; margin: 0; list-style: none; counter-reset: s; font-size: 3.4mm; }
.lf-steps li { counter-increment: s; flex: 1; background: #ecfdf3; border: .3mm solid #86efac; border-radius: 2.5mm; padding: 2mm 2mm 2mm 8mm; position: relative; }
.lf-steps li::before { content: counter(s); position: absolute; left: 2mm; top: 1.8mm; width: 4.6mm; height: 4.6mm; border-radius: 50%; background: #06c755; color: #fff;
  font-weight: 700; font-size: 3.2mm; line-height: 4.6mm; text-align: center; }
.lf-right { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; z-index: 1; }
.lf-qr { background: #fff; border: 1.2mm solid #06c755; border-radius: 4mm; padding: 3mm; }
.lf-qr svg { width: 58mm; height: 58mm; display: block; } .lf-qr span { display: none; }
.lf-noqr { width: 58mm; height: 58mm; display: flex; align-items: center; justify-content: center; color: #b91c1c; }
.lf-scan { margin: 3mm 0 0; font-weight: 800; font-size: 5mm; color: #06a046; }
.lf-oa { margin: 1mm 0 0; font-size: 3.8mm; } .lf-type { margin: 1mm 0 0; font-size: 3.4mm; color: #4b5563; }
.lf-src { position: absolute; right: 5mm; bottom: 3mm; margin: 0; font-size: 2.6mm; color: #9ca3af; }
.lf-grains { position: absolute; right: -8mm; bottom: -10mm; width: 60mm; height: 40mm; opacity: .25; pointer-events: none;
  background: radial-gradient(ellipse 2mm 4mm at 20% 40%, #d97706 98%, transparent), radial-gradient(ellipse 2mm 4mm at 35% 60%, #d97706 98%, transparent),
              radial-gradient(ellipse 2mm 4mm at 50% 35%, #d97706 98%, transparent), radial-gradient(ellipse 2mm 4mm at 65% 65%, #d97706 98%, transparent),
              radial-gradient(ellipse 2mm 4mm at 80% 45%, #d97706 98%, transparent); }
.lf-cut { height: 4mm; line-height: 4mm; font-size: 3mm; color: #9ca3af; overflow: hidden; white-space: nowrap; text-align: center; }
.lf-how { margin: 8px 0 0; padding-left: 20px; color: var(--text-2, #555); }
.lf-new { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; margin-bottom: 12px; }
@media (max-width: 700px) { .lf-new { grid-template-columns: 1fr; } }
.lf-off { opacity: .55; }
.alert-warn { background: var(--warn-bg); color: var(--warn-text); }
@media print {
  @page { size: A4 portrait; margin: 0; }
  body.leaflet-page { background: #fff; }
  .lf-bar { display: none; }
  .lf-a4 { box-shadow: none; margin: 0; }
  .lf-a5, .lf-a5 * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.lf-new input { width: 100%; box-sizing: border-box; padding: 9px 10px; border: 1px solid var(--border, #d1d5db); border-radius: 8px; font: inherit; }

/* update 109: competitor analysis */
.co-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 14px; }
.co-stat { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; } .co-stat small { color: var(--text-2, #6b7280); }
.co-stat b { font-size: 26px; } .co-stat.bad b { color: #dc2626; } .co-stat.good b { color: #16a34a; }
@media (max-width: 700px) { .co-stats { grid-template-columns: repeat(2, 1fr); } }
.co-table td, .co-table th { vertical-align: top; } .co-table .co-p { font-weight: 700; font-size: 15px; }
.co-risk td:first-child { box-shadow: inset 4px 0 0 #dc2626; }
.co-gap.bad { color: #dc2626; font-weight: 600; } .co-gap.good { color: #16a34a; font-weight: 600; }
.co-side { font-size: 11px; padding: 1px 6px; border-radius: 999px; background: #e5e7eb; color: #374151; white-space: nowrap; }
.co-side.sB { background: #dcfce7; color: #166534; } .co-side.sS { background: #dbeafe; color: #1e40af; } .co-side.sF { background: #fef3c7; color: #92400e; }
.co-chart-pick { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 8px; }
.co-chart-pick select { max-width: 340px; }
.co-chart { width: 100%; } .co-svg { display: block; width: 100%; height: auto; }
.co-grid { stroke: var(--border, #e5e7eb); } .co-axis { font-size: 11px; fill: var(--text-2, #6b7280); }
.co-ours { fill: none; stroke: #16a34a; stroke-width: 3; }
.co-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; margin-top: 6px; } .co-legend span { display: inline-flex; align-items: center; gap: 6px; }
.co-lg-ours { display: inline-block; width: 18px; height: 3px; background: #16a34a; }
.co-lg-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; } .co-lg-dot.square { border-radius: 2px; } .co-lg-dot.diamond { border-radius: 1px; transform: rotate(45deg); }
.co-entry-head { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; }
.co-entry-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 14px; margin-top: 12px; }
.co-in { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.co-in input, .co-entry-foot input, .co-comp-form input { width: 100%; box-sizing: border-box; padding: 9px 10px; border: 1px solid var(--border, #d1d5db); border-radius: 8px; font: inherit; }
.co-entry-foot { display: grid; grid-template-columns: 1fr auto; gap: 12px; margin-top: 12px; }
@media (max-width: 700px) { .co-entry-head, .co-entry-grid { grid-template-columns: 1fr; } }
.co-comp-form { display: grid; grid-template-columns: 1.4fr 1.4fr .6fr 1.4fr .8fr auto; gap: 10px; align-items: end; margin-bottom: 12px; }
@media (max-width: 900px) { .co-comp-form { grid-template-columns: 1fr 1fr; } }
.co-ai-text { white-space: pre-wrap; line-height: 1.6; background: var(--surface-2, #f8fafc); border-radius: 10px; padding: 12px 14px; }

/* update 110: competitor card on the AI screen */
.co-stats-mini { margin-top: 8px; } .co-stats-mini .co-stat { background: var(--surface-2, #f8fafc); border-radius: 10px; padding: 10px 12px; } .co-stats-mini .co-stat b { font-size: 20px; }
.co-risk-list { margin: 10px 0 0; padding-left: 18px; line-height: 1.7; }

/* update 115: AI summary as formatted text */
.co-ai-text { white-space: normal; } .co-ai-text p { margin: 0 0 8px; } .co-ai-text h4 { margin: 12px 0 6px; font-size: 15px; }
.co-ai-text ul { margin: 0 0 8px; padding-left: 20px; } .co-ai-text li { margin-bottom: 4px; }

/* update 116: AI summary working in the background */
.co-ai-run { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 10px; background: var(--accent-bg, #eff6ff); color: var(--accent-text, #1d4ed8); margin-bottom: 10px; }
.co-spin { width: 18px; height: 18px; border-radius: 50%; border: 3px solid currentColor; border-right-color: transparent; animation: co-spin .9s linear infinite; }
@keyframes co-spin { to { transform: rotate(360deg); } }
.co-ai-err { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; border-radius: 10px; padding: 10px 12px; }
/* update 118: billboard settings save themselves - the status pill beside "Open price billboard" */
.bb-actions { align-items: center; }
.bb-autosave { margin-right: auto; font-size: 14px; color: var(--muted, #64748b); padding: 6px 12px; border-radius: 999px; background: var(--soft, #f1f5f9); }
.bb-autosave.wait, .bb-autosave.saving { color: #1d4ed8; background: #eff6ff; }
.bb-autosave.ok { color: #047857; background: #ecfdf5; }
.bb-autosave.err { color: #b91c1c; background: #fef2f2; }
/* update 119: TV display + price billboard in one card */
.tvb-links .tvb-link { margin-top: 10px; }
.tvb-row { display: flex; gap: 10px; align-items: center; }
.tvb-row input { flex: 1; min-width: 0; margin: 0; }
.tvb-row .action { width: auto; min-width: 96px; margin: 0; flex: none; }
.tvb-key { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.tvb-key .cap-note { margin: 0; }
.tvb-key .action { width: auto; margin: 0; }
.tvb-set { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.tvb-set-title { font-weight: 700; font-size: 17px; margin: 0 0 4px; }
/* update 122: product transformation formulas */
.fm-src-title { font-weight: 700; margin: 12px 0 6px; }
.fm-card { border: 1px solid var(--border, #e5e7eb); border-radius: 12px; padding: 14px; margin-top: 12px; }
.fm-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: flex-start; }
.fm-name { font-size: 17px; } .fm-head .badge { margin-left: 6px; }
.fm-actions { display: flex; gap: 6px; flex-wrap: wrap; } .fm-actions .action { width: auto; margin: 0; }
.fm-lines tr.fm-source td { background: rgba(22, 163, 74, .07); }
.fm-lines tfoot th { text-align: left; } .fm-lines tfoot th.num { text-align: right; }
.fm-auto { color: #2563eb; font-weight: 600; }
.fm-miss { color: #b45309; font-weight: 600; }
.fm-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 10px; }
.fm-kpis > div { background: var(--surface-2, #f8fafc); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.fm-kpis small { color: var(--text-2, #6b7280); } .fm-kpis b { font-size: 20px; } .fm-kpis b.good { color: #16a34a; } .fm-kpis b.bad { color: #dc2626; }
@media (max-width: 700px) { .fm-kpis { grid-template-columns: repeat(2, 1fr); } }
.fm-missing { margin: 10px 0 0; padding: 10px 12px; border-radius: 10px; background: #fffbeb; color: #92400e; }
.fm-steps { margin-top: 10px; } .fm-steps summary { cursor: pointer; font-weight: 600; }
.fm-steps-text { white-space: pre-line; margin: 6px 0 0; line-height: 1.6; }
.fm-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; } .fm-grid .span2 { grid-column: span 2; }
@media (max-width: 700px) { .fm-grid { grid-template-columns: repeat(2, 1fr); } }
.fm-inputs { display: flex; flex-direction: column; gap: 6px; }
.fm-in-row { display: grid; grid-template-columns: 1.3fr 1.6fr .8fr .8fr .9fr; gap: 6px; }
@media (max-width: 700px) { .fm-in-row { grid-template-columns: 1fr 1fr; } }
.fm-form textarea { width: 100%; }
#fm-list > .card-head, #fm-ai > .card-head, #fm-edit > .card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
#fm-list > .card-head .action, #fm-ai > .card-head .action, #fm-edit > .card-head .action, #fm-ai .inline-form .action { width: auto; margin: 0; }
/* update 123: product transformation formulas - dashboard look (gradient tiles, charts, heat table) */
.fmd-band { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 18px 20px; border-radius: 16px;
  background: linear-gradient(120deg, #1e3a8a, #2563eb 55%, #0ea5e9); color: #fff; box-shadow: 0 10px 24px rgba(30, 58, 138, .22); }
.fmd-band-title { font-size: 22px; font-weight: 800; margin: 0 0 4px; } .fmd-band-desc { margin: 0; font-size: 13px; opacity: .9; max-width: 640px; line-height: 1.5; }
.fmd-band-pick { background: rgba(255, 255, 255, .14); border-radius: 12px; padding: 10px 12px; min-width: 220px; }
.fmd-band-pick .field-label { color: #fff; } .fmd-band-pick .field-row { margin: 0; }
.fmd-tiles { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-top: 12px; }
@media (max-width: 1000px) { .fmd-tiles { grid-template-columns: repeat(3, 1fr); } } @media (max-width: 560px) { .fmd-tiles { grid-template-columns: repeat(2, 1fr); } }
.fmd-tile { border-radius: 14px; padding: 14px 16px; color: #fff; display: flex; flex-direction: column; gap: 4px; min-height: 92px; box-shadow: 0 8px 18px rgba(15, 23, 42, .14); overflow: hidden; }
.fmd-tile small { font-size: 12.5px; opacity: .92; } .fmd-tile b { font-size: 28px; line-height: 1.1; font-weight: 800; }
.fmd-tile i { font-style: normal; font-size: 11.5px; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fmd-tile.t1 { background: linear-gradient(135deg, #7c3aed, #4f46e5); } .fmd-tile.t2 { background: linear-gradient(135deg, #1d4ed8, #1e40af); }
.fmd-tile.t3 { background: linear-gradient(135deg, #0ea5e9, #0284c7); } .fmd-tile.t4 { background: linear-gradient(135deg, #14b8a6, #22c55e); }
.fmd-tile.t5 { background: linear-gradient(135deg, #ec4899, #ef4444); } .fmd-tile.t6 { background: linear-gradient(135deg, #a855f7, #7e22ce); }
.fmd-panels { display: grid; grid-template-columns: 1fr 1.25fr 1.25fr; gap: 12px; margin-top: 12px; }
@media (max-width: 1000px) { .fmd-panels { grid-template-columns: 1fr; } }
.fmd-panel, .fmd-card { background: var(--surface, #fff); border: 1px solid #e0e7ff; border-radius: 16px; padding: 14px 16px; box-shadow: 0 6px 16px rgba(30, 64, 175, .07); }
.fmd-title { font-weight: 800; font-size: 16px; margin: 0 0 8px; color: #0f172a; }
.fmd-chart { width: 100%; height: auto; display: block; } .fmd-grid { stroke: #e2e8f0; stroke-width: 1; } .fmd-zero { stroke: #64748b; stroke-width: 1.2; }
.fmd-ax { font: 11px sans-serif; fill: #64748b; }
.fmd-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: #475569; margin-top: 4px; } .fmd-legend span, .fmd-donut-legend li { display: flex; align-items: center; gap: 6px; }
.fmd-donut { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; } .fmd-donut svg[viewBox] { width: 170px; height: 170px; flex: 0 0 auto; }
.fmd-donut-n { font: 800 30px sans-serif; fill: #0f172a; }
.fmd-donut-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: #334155; }
.fmd-table { width: 100%; border-collapse: separate; border-spacing: 0 3px; font-size: 14px; }
.fmd-table th { text-align: left; font-size: 12.5px; color: #334155; padding: 6px 10px; border-bottom: 2px solid #e2e8f0; white-space: nowrap; }
.fmd-table th.num, .fmd-table td.num { text-align: right; } .fmd-table td { padding: 8px 10px; background: #f8fafc; }
.fmd-table td:first-child { border-radius: 8px 0 0 8px; } .fmd-table td:last-child { border-radius: 0 8px 8px 0; }
.fmd-table td.hp0 { background: #f3e8ff; } .fmd-table td.hp1 { background: #e9d5ff; } .fmd-table td.hp2 { background: #d8b4fe; } .fmd-table td.hp3 { background: #c084fc; } .fmd-table td.hp4 { background: #a855f7; color: #fff; }
.fmd-table td.hb0 { background: #e0f2fe; } .fmd-table td.hb1 { background: #bae6fd; } .fmd-table td.hb2 { background: #7dd3fc; } .fmd-table td.hb3 { background: #38bdf8; } .fmd-table td.hb4 { background: #0ea5e9; color: #fff; }
.fmd-table td.hg0 { background: #fee2e2; } .fmd-table td.hg1 { background: #fef9c3; } .fmd-table td.hg2 { background: #dcfce7; } .fmd-table td.hg3 { background: #86efac; } .fmd-table td.hg4 { background: #22c55e; color: #fff; }
.fmd-table td.ho0 { background: #ffedd5; } .fmd-table td.ho1 { background: #fed7aa; } .fmd-table td.ho2 { background: #fdba74; } .fmd-table td.ho3 { background: #fb923c; } .fmd-table td.ho4 { background: #f97316; color: #fff; }
.fmd-table td.hs0 { background: #f1f5f9; } .fmd-table td.hs1 { background: #e2e8f0; } .fmd-table td.hs2 { background: #cbd5e1; } .fmd-table td.hs3 { background: #94a3b8; color: #fff; } .fmd-table td.hs4 { background: #64748b; color: #fff; }
.fmd-table td.hc0 { background: #ccfbf1; } .fmd-table td.hc1 { background: #99f6e4; } .fmd-table td.hc2 { background: #5eead4; } .fmd-table td.hc3 { background: #2dd4bf; } .fmd-table td.hc4 { background: #14b8a6; color: #fff; }
.fmd .fm-card { border-color: #e0e7ff; border-radius: 14px; } .fmd .fm-kpis > div { background: linear-gradient(135deg, #eff6ff, #f5f3ff); }
.fmd .fm-lines thead th { background: #eef2ff; }
.fmd .fm-form, .fmd #fm-list .fm-card { max-width: none; }
@media (min-width: 1000px) { .fmd-list-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; } .fmd-list-grid .fm-card { margin-top: 0; } }
.fmd-list-grid { margin-top: 12px; }
.fmd-table a { color: #1e3a8a; text-decoration: none; } .fmd-table a:hover { text-decoration: underline; }
@media (max-width: 700px) { .fmd-table { min-width: 660px; } }
.fm-card .cap-note a { overflow-wrap: anywhere; word-break: break-all; } .fm-card { min-width: 0; }
/* update 124: quick jumps on every long page + a round "to top" button */
.to-top { position: fixed; right: 16px; bottom: 18px; z-index: 30; width: 46px; height: 46px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--accent, #2563eb); color: #fff; font-size: 22px; line-height: 1; box-shadow: 0 6px 16px rgba(15, 23, 42, .28);
  opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity .2s, transform .2s; }
.to-top.show { opacity: .92; pointer-events: auto; transform: none; }
.to-top:hover { opacity: 1; }
@media print { .to-top, .quick-jump { display: none !important; } }
.dash-card[id], .fmd-panel[id], section[id] { scroll-margin-top: 64px; }
/* update 125: motor control process flow (Hardware Control) */
.mf-wrap { overflow-x: auto; margin-top: 8px; } .mf-svg { width: 100%; min-width: 620px; height: auto; display: block; }
.mf-box rect { stroke-width: 1.5; } .mf-pw rect { fill: #fbecd9; stroke: #b7791f; } .mf-ct rect { fill: #e0f3ec; stroke: #1f8a63; } .mf-mt rect { fill: #f1eee8; stroke: #6b7280; }
.mf-t { font: 700 26px sans-serif; } .mf-s { font: 400 22px sans-serif; }
.mf-pw .mf-t { fill: #5b3407; } .mf-pw .mf-s { fill: #8a5a12; } .mf-ct .mf-t { fill: #0c4a36; } .mf-ct .mf-s { fill: #157a57; } .mf-mt .mf-t { fill: #374151; } .mf-mt .mf-s { fill: #6b7280; }
.mf-p { fill: none; stroke: #b7791f; stroke-width: 3; } .mf-c { fill: none; stroke: #1f9d6f; stroke-width: 3; stroke-dasharray: 9 8; }
.mf-i { fill: none; stroke: #6b7280; stroke-width: 3; stroke-dasharray: 3 6; }
.mf-ah-p { fill: #b7791f; } .mf-ah-c { fill: #1f9d6f; } .mf-l { font: 400 20px sans-serif; fill: #4b5563; }
.mf-steps { margin: 12px 0 0; padding-left: 22px; line-height: 1.7; font-size: 14px; }
.mf-seq-title { font-weight: 700; margin: 14px 0 0; }
.mf-steps { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; list-style-position: inside; padding-left: 0; margin-top: 8px; }
@media (max-width: 700px) { .mf-steps { grid-template-columns: 1fr; } }
.mf-steps li { background: var(--surface-2, #f8fafc); border: 1px solid var(--border, #e5e7eb); border-radius: 10px; padding: 8px 12px; line-height: 1.5; }
.mf-steps li b { margin-right: 6px; } .mf-steps li.mf-ready { background: #dcfce7; border-color: #86efac; }
.mf-fail { margin: 10px 0 0; padding: 10px 12px; border-radius: 10px; background: #ffedd5; color: #9a3412; }
/* update 126: rice quality grading */
.gr-on { color: #166534; } .gr-attach select { flex: 1; min-width: 180px; width: auto; }
.gr-thumb { width: 96px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border, #e5e7eb); display: block; }
.gr-attach-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; } .gr-attach-row select { width: auto; min-width: 160px; flex: 1; } .gr-attach-row .action { width: auto; margin: 0; }
.gr-key { border: 2px solid #f59e0b; background: #fffbeb; } .gr-key-text code { font-size: 16px; word-break: break-all; user-select: all; }
.gr-how summary { cursor: pointer; font-size: 14px; } #gr-entry .badge { margin-left: 6px; }
/* update 127: rice quality result slip (receipt format) */
.receipt .rc-photo { display: block; width: 100%; max-width: 320px; height: auto; margin: 10px auto 4px; border: 1px solid #ccc; border-radius: 4px; }
.receipt .rc-note { font-size: 11px; margin: 6px 0 0; line-height: 1.4; } .receipt .rc-table tr.rc-strong td { font-weight: 700; font-size: 14px; }
.gr-report-btn { width: auto; margin: 0; white-space: nowrap; }
.gr-variety { color: #166534; font-weight: 600; }
/* update 128: grading - the grader waits for an order's sample, a sample of another material, older results */
.gr-wait { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0; padding: 8px 12px; border-radius: 10px; background: var(--warn-bg, #fff7e6); color: var(--warn-text, #8a5a00); font-weight: 600; }
.gr-wait { width: 100%; box-sizing: border-box; } .gr-wait span { flex: 1 1 200px; min-width: 0; white-space: normal; } .gr-wait .action { width: auto; margin: 0; }
.gr-target { display: inline-block; margin: 6px 6px 0 0; } .gr-target .action { width: auto; }
.gr-diff { color: #b91c1c; font-weight: 700; display: inline-block; }
.gr-who { display: block; color: #6b7280; }
.gr-older { margin: 2px 0 6px; width: 100%; } .gr-older summary { cursor: pointer; color: #6b7280; font-size: .9em; }
.gr-steps { margin: 6px 0 8px 20px; padding: 0; color: #374151; } .gr-steps li { margin: 2px 0; }
.gr-avg { color: #166534; width: 100%; }
/* update 130: several graders in a branch */
.gr-target-pick { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; width: 100%; margin: 6px 0 0; } .gr-target-pick select { flex: 1; min-width: 200px; width: auto; }
.gr-dev-form, .gr-add { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 4px; } .gr-dev-form input[type=text], .gr-add input[type=text] { flex: 1; min-width: 160px; width: auto; }
.gr-dev-form .action, .gr-add .action { width: auto; margin: 0; } .gr-add { margin-top: 10px; } .gr-off td { opacity: .6; }
/* update 131: husk furnace + charcoal briquette line */
.cl-svg { min-width: 760px; } .cl-box rect { stroke-width: 2; } .cl-t { font: 700 19px sans-serif; fill: #1f2937; } .cl-s { font: 400 15px sans-serif; fill: #4b5563; }
.cl-h { font: 700 17px sans-serif; fill: #374151; }
.cl-plain rect { fill: #f8fafc; stroke: #94a3b8; } .cl-off rect { fill: #f1f5f9; stroke: #94a3b8; } .cl-run rect { fill: #dcfce7; stroke: #16a34a; }
.cl-held rect { fill: #fef3c7; stroke: #d97706; } .cl-fault rect { fill: #fee2e2; stroke: #dc2626; }
.cl-p { fill: none; stroke: #64748b; stroke-width: 2.5; } .cl-char { stroke-dasharray: 7 6; } .cl-i { fill: none; stroke: #0ea5e9; stroke-width: 3; stroke-dasharray: 3 5; } .cl-ah { fill: #64748b; }
.cl-legend { display: flex; gap: 6px 14px; flex-wrap: wrap; align-items: center; font-size: 13px; color: #4b5563; margin: 6px 0 0; }
.cl-dot { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 4px; border: 1.5px solid #94a3b8; background: #f1f5f9; vertical-align: -1px; }
.cl-dot.cl-run { background: #dcfce7; border-color: #16a34a; } .cl-dot.cl-held { background: #fef3c7; border-color: #d97706; } .cl-dot.cl-fault { background: #fee2e2; border-color: #dc2626; }
.cl-dot.cl-k-hot { background: #dc2626; border-color: #dc2626; } .cl-dot.cl-k-char { background: #2563eb; border-color: #2563eb; } .cl-dot.cl-k-set { background: #fff; border: 1.5px dashed #6b7280; }
.cl-groups { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 12px; } .cl-table td { vertical-align: middle; } .cl-table .action { width: auto; margin: 0; min-width: 84px; }
.cl-why { color: #b45309; } .cl-alarm { background: #fee2e2; color: #991b1b; font-weight: 700; border-radius: 10px; padding: 8px 12px; margin: 8px 0 0; }
.cl-stats { margin-top: 10px; } .cl-stats .co-stat.cl-bad b { color: #dc2626; }
.cl-chart { width: 100%; height: auto; display: block; } .cl-grid { stroke: #e5e7eb; stroke-width: 1; } .cl-axis { font: 400 11px sans-serif; fill: #6b7280; }
.cl-line-hot { fill: none; stroke: #dc2626; stroke-width: 2; } .cl-line-char { fill: none; stroke: #2563eb; stroke-width: 2; } .cl-setline { stroke: #6b7280; stroke-width: 1; stroke-dasharray: 5 4; }
.cl-set-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; } .cl-how { margin: 10px 0 0 18px; padding: 0; } .cl-ev-alarm td { color: #991b1b; font-weight: 600; }
.cl-safety { border-left: 4px solid #d97706; }
@media (max-width: 720px) { .cl-groups { grid-template-columns: 1fr; } .cl-set-grid { grid-template-columns: 1fr 1fr; } }
/* update 133: customer birthdays */
.cp-entry-bd { background: linear-gradient(90deg, #db2777, #f59e0b); }
.bd-zodiac { color: #9d174d; font-weight: 600; } .bd-consent { align-items: flex-start; margin-top: 22px; }
tr.bd-today td { background: #fdf2f8; }
/* update 134: fengshuiX Bazi API */
.bz-raw { max-height: 320px; overflow: auto; font-size: 12px; background: #f8fafc; padding: 8px; border-radius: 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.bz-fortune { color: #6b21a8; } .bz-result { margin-top: 10px; }
/* update 135: results in baht & AI exams */
.ck-table input { width: 100%; min-width: 90px; margin-bottom: 4px; } .ck-total { font-size: 14px; } .ck-warn { color: #b45309; font-weight: 600; }
.ck-save { display: flex; align-items: flex-end; } .ck-save .action { width: auto; }
.ck-hand { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin-bottom: 8px; }
.ck-price-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; } .ck-price-form select { flex: 1; min-width: 180px; width: auto; } .ck-price-form .action { width: auto; margin: 0; }
/* update 138: typed analyser result (miniLyzer) */
.gr-manual-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0 12px; }
.gr-manual-form textarea { width: 100%; font-family: inherit; }
