:root {
    --primary: #145f96;
    --primary-dark: #0b4169;
    --primary-soft: #e7f1f7;
    --brand-red: #d62832;
    --success: #16845b;
    --success-soft: #e6f5ef;
    --cyan: #0b7f91;
    --cyan-soft: #e3f4f7;
    --amber: #b66a06;
    --amber-soft: #fff3df;
    --danger: #bf3d46;
    --danger-soft: #fdecee;
    --ink: #202a33;
    --muted: #64717d;
    --line: #dce3e9;
    --surface: #ffffff;
    --canvas: #f5f7f9;
    --sidebar: #172229;
    --sidebar-muted: #9dafbb;
}

* {
    letter-spacing: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    color: var(--ink);
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 14px;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-dark);
}

.btn {
    border-radius: 5px;
    font-weight: 600;
    min-height: 38px;
}

.btn-sm {
    min-height: 32px;
}

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 3px 8px rgba(23, 105, 170, 0.18);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-outline-primary {
    border-color: var(--primary);
    color: var(--primary);
}

.card {
    border: 1px solid var(--line);
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(27, 42, 54, 0.06);
    margin-bottom: 0;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.app-topbar {
    border-bottom: 2px solid var(--brand-red);
    box-shadow: 0 2px 8px rgba(24, 48, 65, 0.08);
    min-height: 58px;
    padding: 0 18px;
}

.icon-button {
    background: transparent;
    border: 0;
    border-radius: 5px;
    color: #45525d;
    height: 38px;
    width: 38px;
}

.icon-button:hover {
    background: #edf2f6;
}

.navbar-context {
    color: #485762;
    font-weight: 600;
    margin-left: 8px;
}

.system-status,
.current-date,
.user-label {
    align-items: center;
    color: #52606b;
    display: flex;
    font-size: 13px;
    white-space: nowrap;
}

.status-dot {
    background: #24a870;
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(36, 168, 112, 0.14);
    display: inline-block;
    height: 8px;
    margin-right: 8px;
    width: 8px;
    animation: livePulse 1.8s ease-in-out infinite;
}

.main-sidebar {
    background: var(--sidebar);
}

.brand-link {
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.09) !important;
    display: flex;
    height: 58px;
    padding: 7px 10px;
}

.brand-logo-shell {
    align-items: center;
    background: #ffffff;
    border-radius: 5px;
    display: inline-flex;
    flex: 0 0 76px;
    height: 39px;
    justify-content: center;
    overflow: hidden;
    padding: 4px;
}

.brand-logo-shell img,
.plant-top-logo img,
.login-official-logo img,
.mobile-official-logo img {
    display: block;
    height: 100%;
    max-width: 100%;
    object-fit: contain;
    width: 100%;
}

.brand-mark,
.login-brand-mark,
.mobile-brand-mark {
    align-items: center;
    background: #ffffff;
    border-radius: 6px;
    color: var(--primary);
    display: inline-flex;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.brand-mark::after,
.login-brand-mark::after,
.mobile-brand-mark::after,
.plant-top-mark::after {
    background: #4fb6ec;
    content: "";
    height: 2px;
    left: 5px;
    position: absolute;
    right: 5px;
    top: 5px;
    animation: brandScan 2.4s ease-in-out infinite;
}

.brand-mark {
    flex: 0 0 36px;
    font-size: 19px;
    height: 36px;
}

.brand-text {
    color: #ffffff;
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    margin-left: 9px;
    overflow: hidden;
}

.brand-text strong {
    font-size: 12px;
    font-weight: 700;
}

.brand-text small {
    color: var(--sidebar-muted);
    font-size: 9px;
    margin-top: 3px;
    text-transform: uppercase;
}

.sidebar {
    padding: 0 10px;
}

.plant-network-summary {
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    color: #ffffff;
    display: flex;
    gap: 10px;
    margin: 0 4px;
    min-height: 75px;
    padding: 14px 5px;
}

.network-icon {
    align-items: center;
    background: rgba(255, 255, 255, 0.09);
    border-radius: 5px;
    color: #74b9e8;
    display: inline-flex;
    flex: 0 0 34px;
    height: 34px;
    justify-content: center;
}

.plant-network-summary span:last-child {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.plant-network-summary strong {
    font-size: 13px;
}

.plant-network-summary small {
    color: var(--sidebar-muted);
    font-size: 11px;
}

.nav-sidebar .nav-header {
    color: #728795;
    font-size: 10px;
    font-weight: 700;
    padding: 13px 10px 6px;
}

.nav-sidebar .nav-link {
    border-radius: 5px;
    color: #c6d0d7;
    margin-bottom: 3px;
    min-height: 42px;
    padding: 10px 12px;
}

.nav-sidebar .nav-link:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #ffffff;
}

.nav-sidebar .nav-link.active {
    background: var(--primary) !important;
    border-left: 3px solid var(--brand-red);
    box-shadow: none !important;
    color: #ffffff;
}

.nav-sidebar .nav-icon {
    font-size: 14px !important;
    margin-right: 8px !important;
}

.content-wrapper {
    background: var(--canvas);
}

.content-header {
    padding: 22px 8px 16px;
}

.page-heading {
    align-items: flex-end;
    display: flex;
    gap: 24px;
    justify-content: space-between;
}

.page-heading > div:first-child {
    border-left: 3px solid var(--brand-red);
    padding-left: 12px;
}

.page-heading h1 {
    color: var(--ink);
    font-size: 24px;
    font-weight: 700;
    line-height: 1.25;
    margin: 2px 0 4px;
}

.page-heading p,
.section-heading p,
.card-header p,
.report-panel-heading p,
.settings-section-heading p {
    color: var(--muted);
    margin: 0;
}

.section-kicker {
    color: var(--primary) !important;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.page-date-chip,
.report-date {
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 5px;
    color: #485762;
    display: inline-flex;
    font-weight: 600;
    gap: 9px;
    min-height: 38px;
    padding: 8px 12px;
    white-space: nowrap;
}

.breadcrumb-line {
    align-items: center;
    color: var(--muted);
    display: flex;
    font-size: 12px;
    gap: 9px;
    margin-bottom: 5px;
}

.breadcrumb-line i {
    font-size: 8px;
}

.metric-card {
    align-items: center;
    display: flex;
    flex-direction: row;
    min-height: 118px;
    overflow: hidden;
    padding: 18px;
    position: relative;
    animation: panelEnter 0.38s ease backwards;
}

.metric-grid > div:nth-child(2) .metric-card { animation-delay: 0.04s; }
.metric-grid > div:nth-child(3) .metric-card { animation-delay: 0.08s; }
.metric-grid > div:nth-child(4) .metric-card { animation-delay: 0.12s; }

.metric-card:hover {
    box-shadow: 0 7px 18px rgba(31, 61, 82, 0.12);
    transform: translateY(-2px);
}

.metric-card::before {
    bottom: 0;
    content: "";
    left: 0;
    position: absolute;
    top: 0;
    width: 4px;
}

.metric-blue::before { background: var(--primary); }
.metric-green::before { background: var(--success); }
.metric-cyan::before { background: var(--cyan); }
.metric-amber::before { background: var(--amber); }

.metric-icon {
    align-items: center;
    border-radius: 6px;
    display: inline-flex;
    flex: 0 0 48px;
    font-size: 20px;
    height: 48px;
    justify-content: center;
    margin-right: 14px;
}

.metric-blue .metric-icon { background: var(--primary-soft); color: var(--primary); }
.metric-green .metric-icon { background: var(--success-soft); color: var(--success); }
.metric-cyan .metric-icon { background: var(--cyan-soft); color: var(--cyan); }
.metric-amber .metric-icon { background: var(--amber-soft); color: var(--amber); }

.metric-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.metric-content span {
    color: #56636e;
    font-size: 12px;
    font-weight: 600;
}

.metric-content strong {
    color: var(--ink);
    font-size: 27px;
    line-height: 1.2;
    margin: 2px 0;
}

.metric-content strong.metric-time {
    font-size: 19px;
    white-space: nowrap;
}

.metric-content small {
    color: #89949d;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.page-section {
    margin-top: 25px;
    scroll-margin-top: 70px;
}

.section-heading {
    align-items: flex-end;
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
}

.section-heading h2,
.data-card .card-header h2,
.report-panel-heading h2,
.settings-section-heading h2 {
    font-size: 17px;
    font-weight: 700;
    margin: 0 0 3px;
}

.section-count {
    background: var(--success-soft);
    border-radius: 20px;
    color: var(--success);
    font-size: 11px;
    font-weight: 700;
    padding: 5px 10px;
}

.plant-card {
    border-top: 3px solid var(--primary);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    animation: panelEnter 0.4s ease backwards;
}

.plant-grid > div:nth-child(4n + 2) .plant-card { border-top-color: var(--success); }
.plant-grid > div:nth-child(4n + 3) .plant-card { border-top-color: var(--cyan); }
.plant-grid > div:nth-child(4n + 4) .plant-card { border-top-color: var(--amber); }

.plant-card:hover {
    border-color: #a9c7de;
    box-shadow: 0 4px 12px rgba(27, 61, 87, 0.09);
    transform: translateY(-2px);
}

.plant-card .card-body {
    padding: 15px 16px 11px;
}

.plant-card .card-footer {
    background: #ffffff;
    border-top: 1px solid #edf0f2;
    padding: 10px 16px 14px;
}

.plant-card-header {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.plant-code,
.table-plant-code {
    background: var(--primary-soft);
    border-radius: 4px;
    color: var(--primary-dark);
    font-size: 10px;
    font-weight: 800;
    padding: 4px 7px;
}

.plant-online {
    align-items: center;
    color: var(--success);
    display: flex;
    font-size: 10px;
    font-weight: 700;
}

.plant-online .status-dot {
    box-shadow: none;
    height: 6px;
    margin-right: 5px;
    width: 6px;
}

.plant-card h3 {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
    margin: 0 0 13px;
    min-height: 38px;
}

.plant-scan-total {
    align-items: baseline;
    display: flex;
    gap: 7px;
    margin-bottom: 14px;
}

.plant-scan-total strong {
    font-size: 23px;
    line-height: 1;
}

.plant-scan-total span {
    color: var(--muted);
    font-size: 11px;
}

.plant-quality-row {
    align-items: center;
    color: var(--muted);
    display: flex;
    font-size: 10px;
    justify-content: space-between;
    margin-bottom: 5px;
}

.plant-quality-row strong {
    color: var(--success);
    font-size: 11px;
}

.quality-track {
    background: #e8edf0;
    border-radius: 20px;
    height: 5px;
    margin-bottom: 12px;
    overflow: hidden;
}

.quality-track span {
    background: var(--success);
    border-radius: 20px;
    display: block;
    height: 100%;
    transition: width 0.7s ease;
    width: 0;
}

.quality-track span.is-visible {
    box-shadow: 0 0 6px rgba(22, 132, 91, 0.25);
}

.operations-ribbon {
    background: #1d2b34;
    border-left: 4px solid var(--brand-red);
    border-radius: 6px;
    color: #ffffff;
    display: grid;
    gap: 0;
    grid-template-columns: 1.35fr repeat(3, 1fr);
    margin-top: 14px;
    min-height: 72px;
    overflow: hidden;
    box-shadow: 0 6px 16px rgba(20, 38, 50, 0.14);
}

.operations-ribbon-lead,
.operations-ribbon-item {
    align-items: center;
    display: flex;
    gap: 11px;
    min-width: 0;
    padding: 12px 16px;
}

.operations-ribbon-item {
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.operations-ribbon-lead > span:last-child,
.operations-ribbon-item > span:last-child {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.operations-ribbon small {
    color: #9eb2bf;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
}

.operations-ribbon strong {
    font-size: 13px;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.operations-ribbon-lead small {
    color: #65c6f2;
}

.scanner-frame,
.operations-ribbon-icon {
    align-items: center;
    border-radius: 5px;
    display: inline-flex;
    flex: 0 0 38px;
    height: 38px;
    justify-content: center;
    position: relative;
}

.scanner-frame {
    background: #ffffff;
    color: var(--primary);
    font-size: 18px;
    overflow: hidden;
}

.scanner-beam {
    background: var(--brand-red);
    height: 2px;
    left: 4px;
    position: absolute;
    right: 4px;
    top: 5px;
    animation: ribbonScan 1.9s ease-in-out infinite;
}

.ribbon-green { background: rgba(50, 193, 135, 0.16); color: #5de0a8; }
.ribbon-cyan { background: rgba(56, 181, 204, 0.16); color: #69d3e5; }
.ribbon-amber { background: rgba(221, 159, 66, 0.16); color: #f1bb67; }

.plant-timings {
    display: grid;
    gap: 8px;
    grid-template-columns: 1fr 1fr;
    margin: 0;
}

.plant-timings div {
    background: #f7f9fa;
    border-radius: 4px;
    padding: 8px;
}

.plant-timings dt {
    color: #86919a;
    font-size: 9px;
    font-weight: 600;
    margin-bottom: 2px;
    text-transform: uppercase;
}

.plant-timings dd {
    font-size: 12px;
    font-weight: 700;
    margin: 0;
}

.data-card .card-header,
.chart-card .card-header {
    align-items: center;
    background: #ffffff;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    padding: 15px 18px;
}

.table-heading-icon {
    color: #9aa7b0;
    font-size: 19px;
}

.data-card .card-body {
    padding: 14px 18px 17px;
}

.table {
    color: #34414b;
    margin-bottom: 0;
}

.table > :not(caption) > * > * {
    border-bottom-color: #e7ebee;
    padding: 11px 10px;
    vertical-align: middle;
}

.table-hover > tbody > tr:hover > * {
    background: #edf6fc;
    color: #26343e;
}

.table thead th {
    background: #f6f8fa;
    border-bottom: 1px solid #dce3e8;
    color: #4c5a65;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    white-space: nowrap;
}

.table-plant-link {
    align-items: center;
    display: inline-flex;
    gap: 9px;
    font-weight: 600;
}

.barcode-value {
    align-items: center;
    color: #26343e;
    display: inline-flex;
    font-family: Consolas, "Courier New", monospace;
    font-weight: 700;
    gap: 9px;
    white-space: nowrap;
}

.barcode-value i {
    color: var(--primary);
}

.status-badge {
    border-radius: 20px;
    display: inline-flex;
    font-size: 10px;
    font-weight: 800;
    justify-content: center;
    min-width: 72px;
    padding: 5px 9px;
}

.status-accepted { background: var(--success-soft); color: var(--success); }
.status-duplicate { background: var(--danger-soft); color: var(--danger); }
.status-review { background: var(--amber-soft); color: var(--amber); }

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    color: var(--muted);
    font-size: 12px;
    padding: 5px 0;
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    border: 1px solid #cad3da;
    border-radius: 4px;
    margin-left: 7px;
}

.page-link {
    color: var(--primary);
}

.page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
}

.chart-card .card-header h3 {
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 2px;
}

.chart-legend-note {
    color: var(--muted);
    font-size: 11px;
}

.legend-swatch {
    border-radius: 2px;
    display: inline-block;
    height: 9px;
    margin-right: 6px;
    width: 9px;
}

.legend-blue { background: var(--primary); }

.chart-frame {
    height: 365px;
    min-height: 365px;
    position: relative;
}

.chart-frame-pie {
    align-items: center;
    display: flex;
    justify-content: center;
}

.chart-frame canvas {
    max-height: 100%;
    max-width: 100%;
}

.plant-selector-wrap {
    min-width: 260px;
}

.plant-selector-wrap label,
.table-search-control label,
.barcode-report-search label {
    color: #56636e;
    display: block;
    font-size: 10px;
    font-weight: 800;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.plant-table-header {
    gap: 20px;
}

.table-search-control {
    min-width: 310px;
}

.input-group-text {
    background: #f2f5f7;
    border-color: #cad3da;
    color: #6b7882;
}

.form-control,
.form-select {
    border-color: #cad3da;
    border-radius: 5px;
    color: #2e3b45;
    min-height: 38px;
}

.form-control:focus,
.form-select:focus {
    border-color: #72a9d1;
    box-shadow: 0 0 0 3px rgba(23, 105, 170, 0.12);
}

.report-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.report-actions .btn {
    align-items: center;
    display: inline-flex;
    gap: 8px;
}

.report-tabs-wrap {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 6px;
    overflow: hidden;
}

.report-tabs {
    background: #f7f9fa;
    border-bottom: 1px solid var(--line);
    gap: 3px;
    padding: 12px 16px 0;
}

.report-tabs .nav-link {
    align-items: center;
    border-radius: 5px 5px 0 0;
    color: #53616c;
    display: inline-flex;
    font-weight: 600;
    gap: 8px;
    min-height: 42px;
}

.report-tabs .nav-link.active {
    border-top: 2px solid var(--primary);
    color: var(--primary);
}

.report-tab-content {
    padding: 20px;
}

.report-panel-heading {
    align-items: flex-end;
    display: flex;
    gap: 20px;
    justify-content: space-between;
    margin-bottom: 18px;
}

.report-table {
    border: 1px solid #e1e6ea;
}

.search-report-heading {
    align-items: center;
}

.barcode-report-search {
    min-width: 420px;
}

.search-result-summary {
    background: var(--primary-soft);
    border-left: 3px solid var(--primary);
    color: var(--primary-dark);
    margin-bottom: 14px;
    padding: 10px 12px;
}

.empty-report-state {
    align-items: center;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 280px;
    text-align: center;
}

.empty-report-state > i {
    color: #aec2d1;
    font-size: 38px;
    margin-bottom: 13px;
}

.empty-report-state h3 {
    color: #33414b;
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 4px;
}

.empty-report-state p {
    margin: 0;
}

.settings-layout {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 6px;
    max-width: 920px;
    overflow: hidden;
}

.settings-section {
    padding: 21px 24px 5px;
}

.settings-section + .settings-section {
    border-top: 1px solid var(--line);
}

.settings-section-heading {
    align-items: center;
    display: flex;
    gap: 13px;
    margin-bottom: 15px;
}

.settings-icon {
    align-items: center;
    background: var(--primary-soft);
    border-radius: 6px;
    color: var(--primary);
    display: inline-flex;
    flex: 0 0 40px;
    height: 40px;
    justify-content: center;
}

.settings-icon-amber {
    background: var(--amber-soft);
    color: var(--amber);
}

.settings-row {
    align-items: center;
    border-top: 1px solid #edf0f2;
    display: flex;
    gap: 20px;
    justify-content: space-between;
    min-height: 74px;
    padding: 13px 0;
}

.settings-row:hover {
    background: #f8fbfd;
}

.settings-row label {
    font-weight: 700;
    margin: 0;
}

.settings-row p {
    color: var(--muted);
    font-size: 12px;
    margin: 2px 0 0;
}

.settings-control {
    max-width: 190px;
}

.form-check-input {
    cursor: pointer;
}

.form-switch .form-check-input {
    height: 22px;
    width: 42px;
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.settings-actions {
    background: #f7f9fa;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: flex-end;
    padding: 15px 24px;
}

.main-footer {
    border-top: 1px solid var(--line);
    color: #6b7882;
    font-size: 12px;
    padding: 13px 20px;
}

.main-footer strong {
    color: #394650;
}

.footer-separator {
    color: #c4ccd2;
    margin: 0 8px;
}

.app-notification {
    background: #1f2d36;
    border-left: 4px solid #4ea5df;
    border-radius: 5px;
    bottom: 22px;
    color: #ffffff;
    max-width: 340px;
    opacity: 0;
    padding: 12px 16px;
    pointer-events: none;
    position: fixed;
    right: 22px;
    transform: translateY(12px);
    transition: opacity 0.18s ease, transform 0.18s ease;
    z-index: 2000;
}

.app-notification.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.login-page-shell {
    background: #ffffff;
    min-height: 100vh;
}

.login-layout {
    display: grid;
    grid-template-columns: minmax(360px, 0.9fr) minmax(420px, 1.1fr);
    min-height: 100vh;
}

.login-brand-panel {
    align-items: center;
    background: #173b54;
    color: #ffffff;
    display: flex;
    justify-content: center;
    padding: 50px;
    position: relative;
}

.login-brand-panel::after {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    content: "";
    height: 170px;
    left: 0;
    position: absolute;
    right: 0;
    top: 12%;
}

.login-brand-content {
    max-width: 450px;
    position: relative;
    z-index: 1;
}

.login-brand-mark {
    font-size: 28px;
    height: 58px;
    margin-bottom: 27px;
    width: 58px;
}

.login-official-logo {
    align-items: center;
    background: #ffffff;
    border-left: 4px solid var(--brand-red);
    border-radius: 6px;
    display: flex;
    height: 76px;
    justify-content: center;
    margin-bottom: 23px;
    max-width: 235px;
    padding: 10px 13px;
}

.login-signal-grid {
    display: grid;
    gap: 1px;
    grid-template-columns: repeat(3, 1fr);
    margin-top: 29px;
    max-width: 430px;
}

.login-signal-grid div {
    background: rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    min-height: 72px;
    padding: 13px 14px;
}

.login-signal-grid div:first-child {
    border-radius: 5px 0 0 5px;
}

.login-signal-grid div:last-child {
    border-radius: 0 5px 5px 0;
}

.login-signal-grid strong {
    color: #ffffff;
    font-size: 20px;
}

.login-signal-grid span {
    color: #a9c8da;
    font-size: 10px;
    margin-top: 3px;
    text-transform: uppercase;
}

.login-company {
    color: #ff8e94;
    font-size: 11px;
    font-weight: 800;
    margin: 0 0 8px;
}

.login-brand-content h1 {
    font-size: 36px;
    font-weight: 700;
    line-height: 1.18;
    margin: 0 0 15px;
    max-width: 430px;
}

.login-subtitle {
    color: #c8dbe8;
    font-size: 16px;
    line-height: 1.6;
    margin: 0;
    max-width: 420px;
}

.login-network-status {
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.13);
    color: #d9e6ee;
    display: flex;
    font-size: 12px;
    margin-top: 22px;
    padding-top: 20px;
}

@keyframes panelEnter {
    from { opacity: 0; transform: translateY(7px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes livePulse {
    0%, 100% { box-shadow: 0 0 0 2px rgba(36, 168, 112, 0.12); }
    50% { box-shadow: 0 0 0 5px rgba(36, 168, 112, 0.2); }
}

@keyframes brandScan {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(22px); }
}

@keyframes ribbonScan {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(27px); }
}

.login-form-panel {
    align-items: center;
    display: flex;
    justify-content: center;
    padding: 48px;
}

.login-form {
    max-width: 470px;
    width: 100%;
}

.login-access-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 17px;
}

.login-access-grid .form-label {
    margin-bottom: 6px;
}

.login-access-grid .form-select-lg {
    font-size: 13px;
    min-height: 46px;
    padding-bottom: 8px;
    padding-top: 8px;
}

.plant-mode .main-header,
.plant-mode .content-wrapper,
.plant-mode .main-footer {
    margin-left: 0 !important;
}

.plant-mode .content-wrapper {
    min-height: calc(100vh - 108px);
}

.plant-mode .content-header {
    padding: 13px 8px 9px;
}

.plant-mode .page-heading h1 {
    font-size: 21px;
    margin-bottom: 2px;
}

.plant-mode .page-heading p {
    font-size: 12px;
}

.plant-mode .metric-card {
    min-height: 94px;
    padding: 11px 14px;
}

.plant-mode .metric-icon {
    flex-basis: 40px;
    font-size: 17px;
    height: 40px;
    margin-right: 11px;
}

.plant-mode .metric-content strong {
    font-size: 22px;
}

.plant-mode .metric-content strong.metric-time {
    font-size: 16px;
}

.plant-mode .metric-content small {
    font-size: 10px;
}

.plant-mode .page-section {
    margin-top: 14px;
}

.plant-mode .section-heading {
    margin-bottom: 8px;
}

.plant-mode .section-heading h2,
.plant-mode .data-card .card-header h2 {
    font-size: 15px;
}

.plant-mode .chart-card .card-header,
.plant-mode .data-card .card-header {
    padding: 10px 14px;
}

.plant-mode .chart-card .card-header h3 {
    font-size: 14px;
}

.plant-mode .chart-card .card-header p,
.plant-mode .data-card .card-header p {
    font-size: 11px;
}

.plant-mode .plant-chart-frame {
    height: 245px;
    min-height: 245px;
    padding: 10px 12px;
}

.plant-mode .scan-tabs {
    padding-top: 6px;
}

.plant-mode .scan-tabs .nav-link {
    min-height: 35px;
    padding-bottom: 7px;
    padding-top: 7px;
}

.plant-mode .scan-tab-content {
    padding: 8px 13px 12px;
}

.plant-mode .table > :not(caption) > * > * {
    padding-bottom: 7px;
    padding-top: 7px;
}

.plant-mode .all-scans-toolbar {
    margin-bottom: 8px;
}

.plant-mode .content-header .container-fluid,
.plant-mode .content .container-fluid {
    max-width: 1480px;
}

.plant-top-brand {
    align-items: center;
    color: var(--ink);
    display: inline-flex;
    gap: 9px;
    margin-right: 16px;
    min-height: 44px;
}

.plant-top-brand:hover {
    color: var(--ink);
}

.plant-top-mark {
    align-items: center;
    background: var(--primary);
    border-radius: 5px;
    color: #ffffff;
    display: inline-flex;
    flex: 0 0 34px;
    height: 34px;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.plant-top-logo {
    align-items: center;
    background: #ffffff;
    border: 1px solid #d6dfe5;
    border-radius: 5px;
    display: inline-flex;
    flex: 0 0 90px;
    height: 35px;
    justify-content: center;
    overflow: hidden;
    padding: 3px 5px;
}

.plant-top-brand > span:last-child {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.plant-top-brand strong {
    font-size: 13px;
}

.plant-top-brand small {
    color: var(--muted);
    font-size: 9px;
    margin-top: 2px;
    text-transform: uppercase;
}

.plant-logout {
    align-items: center;
    display: inline-flex;
    justify-content: center;
}

.plant-session-label {
    align-items: center;
    color: var(--primary);
    display: inline-flex;
    font-size: 10px;
    font-weight: 800;
    gap: 6px;
    text-transform: uppercase;
}

.live-chip,
.scan-total-chip {
    align-items: center;
    border-radius: 20px;
    display: inline-flex;
    font-size: 11px;
    font-weight: 700;
    min-height: 30px;
    padding: 6px 11px;
    white-space: nowrap;
}

.live-chip {
    background: var(--success-soft);
    color: var(--success);
}

.live-chip .status-dot {
    box-shadow: none;
    height: 6px;
    margin-right: 6px;
    width: 6px;
}

.scan-total-chip {
    background: var(--primary-soft);
    color: var(--primary-dark);
    gap: 7px;
}

.plant-chart-frame {
    height: 325px;
    min-height: 325px;
}

.scan-log-body {
    padding: 0 !important;
}

.scan-tabs {
    background: #f7f9fa;
    border-bottom: 1px solid var(--line);
    gap: 3px;
    padding: 10px 14px 0;
}

.scan-tabs .nav-link {
    align-items: center;
    border-radius: 5px 5px 0 0;
    color: #56636e;
    display: inline-flex;
    font-size: 12px;
    font-weight: 700;
    gap: 7px;
    min-height: 40px;
}

.scan-tabs .nav-link.active {
    color: var(--primary);
}

.scan-tab-content {
    padding: 14px 18px 18px;
}

.all-scans-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.all-scans-toolbar .table-search-control {
    min-width: 340px;
}

.recent-scan-table tbody tr:first-child td {
    background: #f4faf7;
}

@media (max-width: 767.98px) {
    .login-access-grid {
        grid-template-columns: 1fr;
    }

    .plant-top-brand {
        margin-right: 4px;
    }

    .plant-top-brand small {
        display: none;
    }

    .plant-top-brand strong {
        font-size: 12px;
    }

    .plant-chart-frame {
        height: 275px;
        min-height: 275px;
    }

    .scan-tab-content {
        padding: 10px;
    }

    .all-scans-toolbar .table-search-control {
        min-width: 0;
        width: 100%;
    }
}

.login-form-heading {
    margin-bottom: 28px;
}

.login-form-heading h2 {
    font-size: 29px;
    font-weight: 700;
    margin: 4px 0 5px;
}

.login-form-heading > p:last-child {
    color: var(--muted);
    margin: 0;
}

.mobile-brand-mark {
    display: none;
}

.mobile-official-logo {
    align-items: center;
    background: #ffffff;
    border-left: 4px solid var(--brand-red);
    border-radius: 5px;
    display: none;
    height: 52px;
    justify-content: center;
    margin-bottom: 22px;
    padding: 7px 10px;
    width: 170px;
}

.login-form .form-label {
    color: #3f4c56;
    font-size: 12px;
    font-weight: 700;
}

.login-form .input-group-lg > .form-control,
.login-form .input-group-lg > .input-group-text {
    font-size: 14px;
    min-height: 48px;
}

.login-submit {
    min-height: 49px;
}

.login-help {
    color: #89949d;
    font-size: 11px;
    margin: 17px 0 0;
    text-align: center;
}

@media (max-width: 1199.98px) {
    .chart-frame {
        height: 330px;
        min-height: 330px;
    }

    .barcode-report-search {
        min-width: 380px;
    }
}

@media (max-width: 991.98px) {
    .system-status,
    .user-label {
        display: none;
    }

    .page-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 13px;
    }

    .page-date-chip,
    .plant-selector-wrap {
        width: 100%;
    }

    .plant-table-header,
    .report-panel-heading,
    .search-report-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .table-search-control,
    .barcode-report-search {
        min-width: 0;
        width: 100%;
    }

    .operations-ribbon {
        grid-template-columns: 1.2fr 1fr;
    }

    .operations-ribbon-item:nth-child(3) {
        border-left: 0;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .operations-ribbon-item:nth-child(4) {
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .login-layout {
        grid-template-columns: minmax(300px, 0.8fr) minmax(390px, 1.2fr);
    }

    .login-brand-panel {
        padding: 38px;
    }

    .login-brand-content h1 {
        font-size: 30px;
    }
}

@media (max-width: 767.98px) {
    .app-topbar {
        min-height: 54px;
        padding: 0 10px;
    }

    .current-date {
        font-size: 11px;
        padding-left: 5px;
        padding-right: 5px;
    }

    .content-header {
        padding: 17px 2px 12px;
    }

    .page-heading h1 {
        font-size: 21px;
    }

    .metric-card {
        min-height: 108px;
        padding: 13px 11px;
    }

    .metric-icon {
        flex-basis: 39px;
        font-size: 16px;
        height: 39px;
        margin-right: 10px;
    }

    .metric-content strong {
        font-size: 22px;
    }

    .metric-content strong.metric-time {
        font-size: 15px;
    }

    .metric-content small {
        display: none;
    }

    .section-heading {
        align-items: flex-start;
        gap: 12px;
    }

    .data-card .card-header,
    .chart-card .card-header {
        padding: 13px 14px;
    }

    .data-card .card-body,
    .report-tab-content {
        padding: 12px;
    }

    .chart-frame {
        height: 280px;
        min-height: 280px;
    }

    .operations-ribbon {
        display: flex;
        min-height: 66px;
        overflow-x: auto;
    }

    .operations-ribbon-lead {
        flex: 0 0 210px;
    }

    .operations-ribbon-item {
        border-left: 1px solid rgba(255, 255, 255, 0.1) !important;
        border-top: 0 !important;
        flex: 0 0 155px;
    }

    .operations-ribbon-lead,
    .operations-ribbon-item {
        padding: 10px 12px;
    }

    .report-actions {
        justify-content: flex-start;
        width: 100%;
    }

    .report-actions .btn span {
        display: none;
    }

    .report-actions .btn {
        min-width: 40px;
    }

    .report-tabs {
        overflow-x: auto;
        padding-left: 8px;
        padding-right: 8px;
        white-space: nowrap;
    }

    .report-tabs .nav-link {
        font-size: 12px;
        padding: 8px 10px;
    }

    .barcode-report-search .input-group {
        flex-wrap: nowrap;
    }

    .barcode-report-search .btn {
        padding-left: 12px;
        padding-right: 12px;
    }

    .settings-section {
        padding: 18px 16px 4px;
    }

    .settings-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 9px;
    }

    .settings-control {
        max-width: none;
        width: 100%;
    }

    .settings-actions {
        padding: 13px 16px;
    }

    .login-layout {
        display: block;
    }

    .login-brand-panel {
        display: none;
    }

    .login-form-panel {
        min-height: 100vh;
        padding: 30px 22px;
    }

    .mobile-brand-mark {
        display: inline-flex;
        font-size: 22px;
        height: 48px;
        margin-bottom: 23px;
        width: 48px;
    }

    .mobile-official-logo {
        display: inline-flex;
    }

    .mobile-brand-mark {
        background: var(--primary);
        color: #ffffff;
    }

    .main-footer {
        padding-left: 13px;
        padding-right: 13px;
    }
}

.plant-header-actions {
    align-items: flex-end;
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    justify-content: flex-end;
}

.btn-scan {
    align-items: center;
    background: var(--brand-red);
    border-color: var(--brand-red);
    box-shadow: 0 4px 10px rgba(214, 40, 50, 0.2);
    color: #ffffff;
    display: inline-flex;
    gap: 8px;
    justify-content: center;
    min-height: 38px;
}

.btn-scan:hover,
.btn-scan:focus {
    background: #b91f28;
    border-color: #b91f28;
    color: #ffffff;
}

.plant-card-actions {
    display: grid;
    gap: 7px;
    grid-template-columns: 1fr 1fr;
}

.plant-card-actions .btn {
    align-items: center;
    display: inline-flex;
    gap: 6px;
    justify-content: center;
}

.btn-scan-lite {
    background: #fff0f1;
    border: 1px solid #f0b8bc;
    color: #b72029;
}

.btn-scan-lite:hover,
.btn-scan-lite:focus {
    background: var(--brand-red);
    border-color: var(--brand-red);
    color: #ffffff;
}

.scanner-modal {
    border: 0;
    border-radius: 6px;
    box-shadow: 0 18px 45px rgba(9, 25, 35, 0.26);
    overflow: hidden;
}

.scanner-modal .modal-header {
    align-items: flex-start;
    background: #18262f;
    border-bottom: 3px solid var(--brand-red);
    color: #ffffff;
    padding: 14px 18px;
}

.scanner-modal .modal-header .section-kicker {
    color: #75c5ef !important;
}

.scanner-modal .modal-header h2 {
    font-size: 18px;
    font-weight: 700;
    margin: 1px 0 3px;
}

.scanner-modal .modal-header p:last-child {
    color: #aebfc9;
    margin: 0;
}

.scanner-modal .modal-header .btn-close {
    filter: invert(1);
    margin-top: 3px;
}

.scanner-modal .modal-body {
    background: #f4f7f9;
    padding: 14px;
}

.scanner-stage {
    aspect-ratio: 16 / 9;
    background: #080d11;
    border: 1px solid #263945;
    border-radius: 6px;
    max-height: 390px;
    min-height: 250px;
    overflow: hidden;
    position: relative;
}

#barcodeScannerVideo {
    background: #080d11;
    height: 100%;
    object-fit: cover;
    width: 100%;
}

.scanner-target {
    height: 44%;
    left: 15%;
    position: absolute;
    top: 24%;
    width: 70%;
}

.scanner-corner {
    border-color: #ffffff;
    border-style: solid;
    height: 25px;
    position: absolute;
    width: 25px;
}

.scanner-corner-tl { border-width: 3px 0 0 3px; left: 0; top: 0; }
.scanner-corner-tr { border-width: 3px 3px 0 0; right: 0; top: 0; }
.scanner-corner-bl { border-width: 0 0 3px 3px; bottom: 0; left: 0; }
.scanner-corner-br { border-width: 0 3px 3px 0; bottom: 0; right: 0; }

.scanner-line {
    background: var(--brand-red);
    box-shadow: 0 0 8px rgba(214, 40, 50, 0.75);
    height: 2px;
    left: 8px;
    position: absolute;
    right: 8px;
    top: 8px;
    animation: cameraScan 2s ease-in-out infinite;
}

.scanner-status {
    align-items: center;
    background: rgba(10, 20, 27, 0.88);
    border-radius: 4px;
    bottom: 10px;
    color: #dce8ee;
    display: inline-flex;
    font-size: 11px;
    left: 10px;
    max-width: calc(100% - 20px);
    padding: 7px 10px;
    position: absolute;
}

.scanner-status .status-dot {
    background: #8e9ba3;
    box-shadow: none;
    flex: 0 0 7px;
    height: 7px;
    width: 7px;
}

.scanner-status.is-active .status-dot {
    background: #39ca8d;
}

.continuous-scan-notice {
    align-items: center;
    background: #13764f;
    border: 2px solid #7ee1b8;
    border-radius: 6px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
    color: #ffffff;
    display: flex;
    gap: 11px;
    left: 50%;
    max-width: calc(100% - 30px);
    min-width: 230px;
    padding: 11px 14px;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 4;
    animation: scanSavedPop 0.2s ease;
}

.continuous-scan-notice.is-duplicate {
    background: #8a5004;
    border-color: #f0be72;
}

.continuous-scan-notice.is-error {
    background: #9c2932;
    border-color: #f2a3a9;
}

.continuous-scan-icon {
    align-items: center;
    background: rgba(255, 255, 255, 0.16);
    border-radius: 50%;
    display: inline-flex;
    flex: 0 0 36px;
    font-size: 17px;
    height: 36px;
    justify-content: center;
}

.continuous-scan-notice > span:last-child {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.continuous-scan-notice strong {
    font-size: 14px;
}

.continuous-scan-notice small {
    color: #e8fff5;
    font-family: Consolas, "Courier New", monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scanner-alert {
    align-items: center;
    display: flex;
    gap: 9px;
    margin: 10px 0 0;
}

.photo-capture-fallback {
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--line);
    border-left: 4px solid var(--brand-red);
    border-radius: 6px;
    display: grid;
    gap: 14px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    min-height: 150px;
    padding: 20px;
}

.photo-capture-icon {
    align-items: center;
    background: var(--primary-soft);
    border-radius: 50%;
    color: var(--primary);
    display: inline-flex;
    flex: 0 0 54px;
    font-size: 22px;
    height: 54px;
    justify-content: center;
    width: 54px;
}

.photo-capture-fallback h3 {
    color: #26343e;
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 3px;
}

.photo-capture-fallback p {
    color: var(--muted);
    margin: 0;
}

.manual-scan-panel {
    align-items: flex-end;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 6px;
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(180px, 0.85fr) minmax(300px, 1.15fr);
    margin-top: 10px;
    padding: 11px 13px;
}

.manual-scan-panel label {
    color: #34424c;
    font-size: 12px;
    font-weight: 700;
    margin: 0;
}

.manual-scan-panel p {
    color: var(--muted);
    font-size: 10px;
    margin: 2px 0 0;
}

.scanner-result {
    background: #ffffff;
    border: 1px solid var(--line);
    border-top: 4px solid var(--success);
    border-radius: 6px;
    padding: 18px;
}

.scanner-result-heading {
    align-items: center;
    display: flex;
    gap: 12px;
    margin-bottom: 15px;
}

.scanner-result-heading h3 {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 2px;
}

.scanner-result-heading p {
    color: var(--muted);
    margin: 0;
}

.scanner-result-icon {
    align-items: center;
    background: var(--success-soft);
    border-radius: 50%;
    color: var(--success);
    display: inline-flex;
    flex: 0 0 46px;
    font-size: 21px;
    height: 46px;
    justify-content: center;
}

.scanner-result-icon.is-duplicate {
    background: var(--danger-soft);
    color: var(--danger);
}

.scanner-detail-grid {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 0 0 15px;
}

.scanner-detail-grid > div {
    background: #f5f8fa;
    border-left: 3px solid #a9c7da;
    min-width: 0;
    padding: 9px 10px;
}

.scanner-detail-grid dt {
    color: #7a8790;
    font-size: 9px;
    font-weight: 800;
    margin-bottom: 3px;
    text-transform: uppercase;
}

.scanner-detail-grid dd {
    color: #28353e;
    font-size: 12px;
    font-weight: 700;
    margin: 0;
    overflow-wrap: anywhere;
}

.barcode-detail-value {
    font-family: Consolas, "Courier New", monospace;
}

.scanner-modal .modal-footer {
    background: #ffffff;
    border-top: 1px solid var(--line);
    justify-content: space-between;
    padding: 10px 14px;
}

.scanner-privacy {
    color: var(--muted);
    font-size: 10px;
}

.scanner-privacy i {
    color: var(--success);
    margin-right: 5px;
}

.new-scan-row {
    animation: newScanFlash 1.2s ease;
}

@keyframes cameraScan {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(125px); }
}

@keyframes newScanFlash {
    0% { background: #ccefdc; }
    100% { background: transparent; }
}

@keyframes scanSavedPop {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.92); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@media (max-width: 767.98px) {
    .plant-header-actions {
        align-items: stretch;
        width: 100%;
    }

    .plant-header-actions .plant-selector-wrap,
    .plant-header-actions .page-date-chip {
        flex: 1 1 100%;
    }

    .plant-header-actions .btn-scan {
        flex: 1 1 100%;
    }

    .scanner-modal .modal-body {
        padding: 9px;
    }

    .scanner-stage {
        min-height: 210px;
    }

    .photo-capture-fallback {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
    }

    .photo-capture-fallback .btn {
        width: 100%;
    }

    .manual-scan-panel,
    .scanner-detail-grid {
        grid-template-columns: 1fr;
    }

    .manual-scan-panel {
        gap: 9px;
    }

    .scanner-modal .modal-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .scanner-modal .modal-footer .btn {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}

@media (max-width: 420px) {
    .compact-metrics .col-6 {
        width: 100%;
    }

    .page-date-chip {
        white-space: normal;
    }

    .section-count {
        white-space: nowrap;
    }
}
