:root {
    --ink: #17202a;
    --muted: #667085;
    --line: #d9e0e8;
    --panel: #ffffff;
    --canvas: #f5f7fb;
    --primary: #176b87;
    --primary-strong: #0e4f63;
    --accent: #2d9c72;
    --warning: #b36b00;
    --info: #2f5fb8;
    --shadow: 0 16px 48px rgba(23, 32, 42, .08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--canvas);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

.login-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px;
    background: linear-gradient(135deg, #eef6f7 0%, #f7f9fc 48%, #eaf2ee 100%);
}

.login-shell {
    width: min(1040px, 100%);
    display: grid;
    grid-template-columns: 1.15fr .85fr;
    gap: 28px;
    align-items: stretch;
}

.login-brand,
.login-panel,
.metric-card,
.workflow,
.table-panel,
.profile-panel,
.form-panel,
.detail-panel,
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.login-brand {
    padding: 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.brand-mark {
    width: 44px;
    height: 44px;
    display: inline-grid;
    place-items: center;
    border-radius: 8px;
    color: #fff;
    background: var(--primary);
    font-weight: 800;
}

.login-brand h1 {
    max-width: 680px;
    margin: 28px 0 14px;
    font-size: clamp(34px, 5vw, 56px);
    line-height: 1.02;
}

.login-brand p {
    max-width: 620px;
    color: var(--muted);
    font-size: 18px;
    line-height: 1.6;
}

.login-highlights {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 26px;
}

.login-highlights span,
.status {
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 700;
}

.login-highlights span {
    color: var(--primary-strong);
    background: #e6f3f4;
}

.login-panel {
    padding: 34px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.login-panel h2,
.section-title h2,
.profile-panel h2 {
    margin: 0;
}

label {
    display: grid;
    gap: 8px;
    color: #344054;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 13px 14px;
    background: #fff;
}

input:focus {
    outline: 3px solid rgba(23, 107, 135, .18);
    border-color: var(--primary);
}

button,
.logout,
.action-button,
.secondary-button {
    border: 0;
    border-radius: 8px;
    padding: 12px 16px;
    color: #fff;
    background: var(--primary);
    font-weight: 800;
    cursor: pointer;
}

.secondary-button {
    color: var(--primary);
    background: #e6f3f4;
}

.danger-button {
    color: #9b3a3a;
    background: #fff0f0;
}

.certificate-form-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.alert {
    border: 1px solid #f0c8c8;
    border-radius: 8px;
    padding: 12px;
    color: #8a1f1f;
    background: #fff0f0;
}

.success-alert {
    margin-bottom: 16px;
    color: #17603a;
    border-color: #b9e5cd;
    background: #edf9f2;
}

.form-note {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px 1fr;
    overflow-x: hidden;
    transition: grid-template-columns .24s ease;
}

body.sidebar-collapsed .app-shell {
    grid-template-columns: 84px 1fr;
}

.sidebar {
    position: sticky;
    top: 0;
    z-index: 30;
    height: 100vh;
    padding: 22px;
    border-right: 1px solid var(--line);
    background: #fff;
    transition: transform .24s ease, box-shadow .24s ease;
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 20;
    visibility: hidden;
    opacity: 0;
    background: rgba(23, 32, 42, .42);
    transition: opacity .2s ease, visibility .2s ease;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 900;
}

.brand-text,
.menu-text {
    transition: opacity .18s ease, visibility .18s ease;
}

.menu {
    display: grid;
    gap: 8px;
    margin-top: 32px;
}

.menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 8px;
    color: #344054;
    font-weight: 750;
}

body.sidebar-collapsed .sidebar {
    padding-right: 14px;
    padding-left: 14px;
}

body.sidebar-collapsed .brand,
body.sidebar-collapsed .menu a {
    justify-content: center;
}

body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .menu-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    white-space: nowrap;
}

.menu a:hover {
    background: #eef6f7;
    color: var(--primary-strong);
}

.menu-icon {
    width: 28px;
    height: 28px;
    display: inline-grid;
    place-items: center;
    border-radius: 8px;
    color: var(--primary);
    background: #e6f3f4;
    font-size: 12px;
}

.workspace {
    padding: 26px;
}

.topbar,
.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 24px;
}

.topbar h1 {
    margin: 0;
    font-size: 30px;
}

.topbar-title {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.sidebar-toggle {
    display: inline-flex;
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    gap: 5px;
    flex-direction: column;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--primary);
    background: #fff;
    box-shadow: 0 8px 22px rgba(23, 32, 42, .06);
}

.sidebar-toggle span {
    width: 19px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
    transition: transform .2s ease, opacity .2s ease;
}

body.sidebar-open .sidebar-toggle span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

body.sidebar-open .sidebar-toggle span:nth-child(2) {
    opacity: 0;
}

body.sidebar-open .sidebar-toggle span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

@media (min-width: 961px) {
    body:not(.sidebar-collapsed) .sidebar-toggle span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    body:not(.sidebar-collapsed) .sidebar-toggle span:nth-child(2) {
        opacity: 0;
    }

    body:not(.sidebar-collapsed) .sidebar-toggle span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }
}

.userbox {
    display: flex;
    align-items: center;
    gap: 14px;
    font-weight: 800;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.dashboard-metrics {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.metric-card {
    padding: 20px;
}

.metric-card p,
.metric-card span {
    margin: 0;
    color: var(--muted);
}

.metric-card strong {
    display: block;
    margin: 10px 0;
    font-size: 34px;
}

.metric-card span {
    color: var(--accent);
    font-weight: 800;
}

.metric-primary strong {
    color: var(--primary);
}

.metric-warning strong {
    color: var(--warning);
}

.metric-success strong {
    color: var(--accent);
}

.metric-danger strong {
    color: #9b3a3a;
}

.metric-muted strong {
    color: #6b7280;
}

.workflow,
.table-panel,
.profile-panel,
.form-panel,
.detail-panel {
    margin-top: 18px;
    padding: 24px;
}

.form-panel {
    max-width: 100%;
    overflow: hidden;
}

.form-grid,
.upload-grid,
.detail-grid {
    display: grid;
    gap: 16px;
}

.form-grid,
.upload-grid,
.detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.upload-grid {
    margin-top: 18px;
}

.upload-box {
    padding: 18px;
    border: 1px dashed #a9b7c5;
    border-radius: 8px;
    background: #fbfcfe;
}

.upload-box span,
.table-subtext {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.detail-grid {
    margin: 22px 0 0;
}

.detail-grid div {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
}

.button-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.link-action {
    color: var(--primary);
    font-weight: 900;
}

.status-track {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 10px;
}

.status-track div {
    min-height: 74px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
}

.status-track span {
    display: block;
    width: 12px;
    height: 12px;
    margin-bottom: 10px;
    border-radius: 999px;
    background: #c7d1dc;
}

.status-track strong {
    font-size: 13px;
}

.status-track .active {
    border-color: rgba(23, 107, 135, .35);
    background: #eef6f7;
}

.status-track .active span {
    background: var(--primary);
}

.panel {
    padding: 22px;
}

.dashboard-grid,
.chart-grid,
.monitor-grid {
    display: grid;
    gap: 16px;
    margin-top: 18px;
}

.dashboard-grid {
    grid-template-columns: .95fr 1.55fr;
}

.chart-grid,
.monitor-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.section-title.compact {
    margin-bottom: 14px;
}

.section-title.compact h3 {
    margin: 0;
}

.chart-panel {
    min-height: 320px;
}

.dashboard-chart {
    display: block;
    width: 100%;
    height: 240px;
}

.progress-list {
    display: grid;
    gap: 14px;
}

.progress-row {
    display: grid;
    gap: 8px;
}

.progress-row div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 14px;
}

.progress-row span {
    color: var(--muted);
    font-weight: 800;
}

.progress-row strong {
    color: var(--ink);
}

meter {
    width: 100%;
    height: 10px;
}

meter::-webkit-meter-bar {
    border: 0;
    border-radius: 999px;
    background: #edf1f5;
}

meter::-webkit-meter-optimum-value {
    border-radius: 999px;
    background: var(--primary);
}

.activity-list,
.notification-list {
    display: grid;
    gap: 12px;
}

.activity-item {
    display: grid;
    grid-template-columns: 12px 1fr;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.activity-item:last-child,
.notification-item:last-child {
    border-bottom: 0;
}

.activity-item > span {
    width: 10px;
    height: 10px;
    margin-top: 5px;
    border-radius: 999px;
    background: var(--accent);
}

.activity-item strong,
.notification-item strong {
    display: block;
    margin-bottom: 4px;
}

.activity-item p,
.notification-item p,
.empty-state {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.45;
}

.notification-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.notification-item .status {
    display: inline-block;
    margin-top: 8px;
}

.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 900;
}

.live-indicator::before {
    content: "";
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: var(--accent);
}

.admin-grid,
.permission-grid {
    display: grid;
    gap: 16px;
}

.admin-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-tile,
.permission-card {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
}

.admin-tile strong,
.permission-card strong {
    display: block;
    margin-bottom: 8px;
}

.admin-tile span,
.permission-card em {
    color: var(--muted);
    font-size: 13px;
    font-style: normal;
    line-height: 1.45;
}

.inline-form {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr)) auto;
    gap: 12px;
    align-items: end;
}

.audit-filter {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 160px 160px auto;
    gap: 12px;
    align-items: end;
}

.check-label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.check-label input,
.permission-card input {
    width: auto;
}

.option-stack {
    display: grid;
    gap: 8px;
}

.action-cell {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.text-button {
    padding: 0;
    color: var(--primary);
    background: transparent;
}

.danger-link {
    color: #9b3a3a;
}

.metadata-code {
    display: block;
    max-width: 360px;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--muted);
    font-size: 12px;
}

.permission-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.permission-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.permission-matrix {
    display: grid;
    gap: 18px;
}

.permission-module {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
}

.permission-module h3 {
    margin: 0 0 12px;
    font-size: 16px;
}

.sub-panel {
    margin-top: 18px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
}

.sub-panel h3 {
    margin: 0 0 14px;
}

.form-section {
    margin-top: 20px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.form-section h3 {
    margin: 0;
}

.form-section .form-note {
    margin-top: 8px;
    margin-bottom: 0;
}

.form-section-header,
.form-section-actions {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.form-section-header button {
    flex: 0 0 auto;
}

.form-section .secondary-button {
    white-space: nowrap;
}

.dynamic-table {
    min-width: 820px;
}

.dynamic-table th,
.dynamic-table td {
    vertical-align: top;
}

.dynamic-table input,
.dynamic-table select,
.dynamic-table textarea {
    min-width: 110px;
    padding: 10px 12px;
}

.dynamic-table .check-label {
    white-space: nowrap;
}

.repeat-row {
    display: grid;
    grid-template-columns: 1.2fr 1fr .7fr 1fr 1.2fr;
    gap: 10px;
    margin-bottom: 10px;
}

.checklist-row {
    grid-template-columns: 90px 1.4fr 1fr;
}

.kanban {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.kanban article {
    min-height: 180px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
}

.kanban span {
    color: var(--primary);
    font-weight: 900;
}

.kanban p {
    color: var(--muted);
    line-height: 1.55;
}

table {
    width: 100%;
    border-collapse: collapse;
    overflow: hidden;
}

.datatable-filter-row {
    display: flex;
    justify-content: flex-end;
    margin: -4px 0 16px;
}

.datatable-filter-row label {
    width: min(260px, 100%);
}

.dataTables_wrapper {
    color: var(--ink);
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    color: var(--muted);
    font-weight: 700;
}

.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    width: auto;
    min-width: 88px;
    margin: 0 6px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.dataTables_wrapper .dataTables_filter input {
    min-width: 220px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--primary) !important;
    font-weight: 800;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    border-color: var(--primary);
    color: #fff !important;
    background: var(--primary);
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    border-color: rgba(23, 107, 135, .25);
    color: var(--primary-strong) !important;
    background: #eef6f7;
}

th,
td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.status.warning {
    color: var(--warning);
    background: #fff4df;
}

.status.info {
    color: var(--info);
    background: #edf3ff;
}

.status.success {
    color: var(--accent);
    background: #eaf7f1;
}

.status.draft {
    color: #6b7280;
    background: #f1f3f5;
}

.status.submitted,
.status.process,
.status.review {
    color: var(--info);
    background: #edf3ff;
}

.status.approved,
.status.published {
    color: var(--accent);
    background: #eaf7f1;
}

.status.rejected {
    color: #9b3a3a;
    background: #fff0f0;
}

.status.cancelled {
    color: #9b3a3a;
    background: #fff0f0;
}

.status.blocked { color: #9b2c2c; background: #fee2e2; }
.section-description { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.result-count { padding: 7px 12px; border-radius: 999px; color: var(--primary-strong); background: #eef6f7; font-size: 13px; font-weight: 800; }
.final-filter { display: grid; grid-template-columns: minmax(220px, 1.4fr) repeat(2, minmax(170px, .8fr)) auto; align-items: end; gap: 12px; margin-bottom: 22px; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: #f8fbfc; }
.final-filter-actions { display: flex; gap: 8px; }
.select2-container { width: 100% !important; }
.select2-container--default .select2-selection--single { height: 42px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.select2-container--default .select2-selection--single .select2-selection__rendered { padding-left: 12px; color: var(--text); line-height: 40px; }
.select2-container--default .select2-selection--single .select2-selection__arrow { top: 1px; right: 6px; height: 40px; }
.final-table-wrap { overflow-x: auto; }

.barcode-generator .section-title {
    align-items: flex-end;
}

.barcode-generator .section-title h2,
.barcode-list-heading h3 {
    margin: 0;
}

.barcode-generator .section-description {
    margin-top: 8px;
}

.barcode-header-actions {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

.barcode-generate-form {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex: 0 0 auto;
}

.barcode-generate-form label {
    width: 140px;
}

.barcode-generate-form input,
.barcode-assign-form select {
    padding: 10px 12px;
}

.barcode-list-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin: 24px 0 12px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.barcode-list-heading .form-note {
    margin: 6px 0 0;
}

.barcode-print-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.barcode-table-wrap {
    overflow-x: auto;
}

.barcode-pagination {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 16px;
}

.barcode-pagination[hidden] {
    display: none;
}

.barcode-pagination .secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
}

.barcode-pagination .secondary-button[aria-current="page"] {
    color: #fff;
    border-color: var(--primary);
    background: var(--primary);
}

.pagination-ellipsis,
.pagination-summary {
    display: inline-flex;
    align-items: center;
    color: var(--muted);
    font-size: 13px;
}

.pagination-summary {
    flex-basis: 100%;
    justify-content: center;
}

.barcode-print-status {
    padding: 16px;
    color: var(--muted);
    text-align: center;
}

.barcode-table {
    min-width: 760px;
}

.barcode-select {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.barcode-order-link {
    color: var(--primary-strong);
    font-weight: 800;
}

.barcode-no-data {
    color: var(--muted);
    font-weight: 700;
}

.barcode-assign-form {
    display: grid;
    grid-template-columns: minmax(190px, 1.2fr) minmax(170px, 1fr) minmax(150px, .8fr) auto;
    align-items: end;
    gap: 8px;
    min-width: 700px;
}

.barcode-assign-form label {
    min-width: 0;
    font-size: 12px;
}

.barcode-assign-form button {
    white-space: nowrap;
}

.barcode-assign-form input,
.barcode-assign-form select {
    padding: 9px 10px;
    font-size: 13px;
}

.barcode-empty-state {
    padding: 34px 16px;
    border: 1px dashed #a9b7c5;
    color: var(--muted);
    text-align: center;
}

.barcode-print-area {
    display: none;
}

.qr-print-label {
    display: grid;
    grid-template-columns: 1fr;
    align-items: center;
    justify-items: center;
    gap: .3mm;
    width: 20mm;
    height: 25mm;
    padding: .2mm;
    border: 1px solid #d5d9dc;
    color: #111;
    text-align: center;
    font-family: Arial, sans-serif;
}

.qr-print-label strong {
    grid-column: 1;
    font-size: 6pt;
    line-height: 1;
    overflow-wrap: anywhere;
}

.qr-print-label .qr-code-value,
.qr-print-label .qr-code-value img,
.qr-print-label .qr-code-value canvas {
    display: block;
    width: 17mm !important;
    height: 17mm !important;
}

.qr-print-label span {
    grid-column: 1;
    max-width: 100%;
    font-size: 7.5pt;
    line-height: 1.1;
    overflow-wrap: anywhere;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 720px) {
    .barcode-generator .section-title,
    .barcode-list-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .barcode-header-actions {
        justify-content: flex-start;
    }

    .barcode-print-actions {
        justify-content: space-between;
    }

    .barcode-generate-form label {
        flex: 1;
        width: auto;
    }

    .barcode-generate-form button {
        min-height: 45px;
    }
}

@media print {
    @page {
        margin: 5mm;
    }

    body * {
        visibility: hidden;
    }

    .app-shell,
    .app-shell * {
        visibility: hidden;
    }

    .barcode-print-area,
    .barcode-print-area * {
        visibility: visible;
    }

    .barcode-print-area {
        position: absolute;
        inset: 0;
        display: grid;
        grid-template-columns: repeat(6, 20mm);
        justify-content: center;
        align-content: start;
        gap: 5mm;
    }

    .qr-print-label {
        break-inside: avoid;
        border: 1px solid #bbb;
    }

    .qr-print-label.print-hidden {
        display: none;
    }
}
.final-table { min-width: 940px; }
.empty-table-cell { padding: 42px; text-align: center; color: var(--muted); }
.block-reason { max-width: 220px; color: #9b2c2c; }
.link-button { padding: 0; border: 0; color: var(--primary); background: none; font: inherit; font-weight: 800; cursor: pointer; }
.final-edit-dialog { width: min(520px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 14px; box-shadow: 0 24px 80px rgba(20, 35, 45, .28); }
.final-edit-dialog::backdrop { background: rgba(20, 35, 45, .55); }
.final-edit-dialog form { display: grid; gap: 18px; padding: 24px; }
.dialog-header { display: flex; justify-content: space-between; gap: 18px; }
.dialog-header h3 { margin: 3px 0 0; }
.dialog-close { border: 0; background: none; color: var(--muted); font-size: 30px; cursor: pointer; }
.dialog-help { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.dialog-actions { justify-content: flex-end; }

@media (max-width: 960px) { .final-filter { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .final-filter { grid-template-columns: 1fr; } .final-filter-actions > * { flex: 1; text-align: center; } }
.inspection-date-filter { grid-template-columns: minmax(220px, 280px) auto; }
@media (max-width: 640px) { .inspection-date-filter { grid-template-columns: 1fr; } }

.profile-panel {
    max-width: 760px;
}

.profile-panel dl {
    display: grid;
    gap: 12px;
    margin: 24px 0 0;
}

.profile-panel dl div {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

dt {
    color: var(--muted);
    font-weight: 800;
}

dd {
    margin: 0;
    font-weight: 800;
}

@media (max-width: 960px) {
    .login-shell,
    .metric-grid,
    .kanban,
    .dashboard-metrics,
    .dashboard-grid,
    .chart-grid,
    .monitor-grid,
    .admin-grid,
    .permission-grid,
    .inline-form,
    .audit-filter,
    .repeat-row,
    .checklist-row,
    .form-grid,
    .upload-grid,
    .detail-grid,
    .status-track {
        grid-template-columns: 1fr;
    }

    .app-shell {
        display: block;
    }

    body.sidebar-collapsed .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: min(300px, 84vw);
        max-width: 100%;
        transform: translateX(-105%);
        box-shadow: 24px 0 56px rgba(23, 32, 42, .16);
        overflow-y: auto;
    }

    body.sidebar-collapsed .sidebar {
        padding: 22px;
        transform: translateX(-105%);
    }

    body.sidebar-collapsed .brand,
    body.sidebar-collapsed .menu a {
        justify-content: flex-start;
    }

    body.sidebar-collapsed .brand-text,
    body.sidebar-collapsed .menu-text {
        position: static;
        width: auto;
        height: auto;
        overflow: visible;
        opacity: 1;
        visibility: visible;
        white-space: normal;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    body.sidebar-open .sidebar-backdrop {
        visibility: visible;
        opacity: 1;
    }

    body.sidebar-open {
        overflow: hidden;
    }

    .menu {
        grid-template-columns: 1fr;
    }
}

/* ================================================================
   MODERN LOGIN
   ================================================================ */
.login-screen {
    position: relative;
    min-height: 100svh;
    padding: clamp(16px, 3vw, 40px);
    overflow-x: hidden;
    background:
        radial-gradient(circle at 8% 12%, rgba(45, 156, 114, .14), transparent 27%),
        radial-gradient(circle at 92% 88%, rgba(23, 107, 135, .14), transparent 30%),
        #edf3f5;
}

.login-screen::before,
.login-screen::after {
    content: '';
    position: fixed;
    z-index: 0;
    border-radius: 50%;
    pointer-events: none;
    filter: blur(2px);
}

.login-screen::before { width: 260px; height: 260px; top: -150px; right: 12%; background: rgba(255, 255, 255, .65); }
.login-screen::after { width: 190px; height: 190px; bottom: -110px; left: 8%; border: 32px solid rgba(23, 107, 135, .06); }

.login-screen .login-shell {
    position: relative;
    z-index: 1;
    width: min(1120px, 100%);
    min-height: min(700px, calc(100svh - 64px));
    grid-template-columns: minmax(0, 1.08fr) minmax(400px, .92fr);
    gap: 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .72);
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 30px 90px rgba(20, 56, 68, .16);
}

.login-screen .login-brand {
    position: relative;
    padding: clamp(38px, 5vw, 64px);
    overflow: hidden;
    justify-content: space-between;
    border: 0;
    border-radius: 0;
    color: #fff;
    background: linear-gradient(145deg, #0b4354 0%, #12647a 56%, #14776f 100%);
    box-shadow: none;
}

.login-screen .login-brand::before {
    content: '';
    position: absolute;
    width: 420px;
    height: 420px;
    right: -190px;
    bottom: -190px;
    border: 1px solid rgba(255, 255, 255, .13);
    border-radius: 50%;
    box-shadow: 0 0 0 60px rgba(255,255,255,.035), 0 0 0 120px rgba(255,255,255,.025);
}

.login-brand-top,
.login-brand-copy,
.login-feature-grid,
.login-brand-footer { position: relative; z-index: 1; }

.login-brand-top { display: flex; align-items: center; gap: 13px; }
.login-brand-top .brand-mark { width: 48px; height: 48px; border: 1px solid rgba(255,255,255,.28); border-radius: 14px; background: rgba(255,255,255,.13); backdrop-filter: blur(8px); }
.login-brand-top > div { display: grid; gap: 2px; }
.login-brand-top strong { font-size: 18px; letter-spacing: -.01em; }
.login-brand-top div span { color: rgba(255,255,255,.66); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }

.login-brand-copy { margin: auto 0; padding: 54px 0 42px; }
.login-kicker { display: inline-flex; align-items: center; gap: 8px; color: #b9eee0; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.login-kicker i { width: 7px; height: 7px; border-radius: 50%; background: #69d4ad; box-shadow: 0 0 0 5px rgba(105,212,173,.14); }
.login-screen .login-brand h1 { max-width: 610px; margin: 22px 0 18px; color: #fff; font-size: clamp(35px, 4.2vw, 54px); line-height: 1.08; letter-spacing: -.045em; }
.login-screen .login-brand-copy > p { max-width: 540px; margin: 0; color: rgba(255,255,255,.72); font-size: 16px; line-height: 1.7; }

.login-feature-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.login-feature-grid article { display: flex; align-items: center; gap: 11px; min-width: 0; padding: 13px; border: 1px solid rgba(255,255,255,.13); border-radius: 13px; background: rgba(255,255,255,.075); backdrop-filter: blur(8px); }
.login-feature-grid article > div { display: grid; min-width: 0; gap: 3px; }
.login-feature-grid strong { color: #fff; font-size: 13px; }
.login-feature-grid article div span { overflow: hidden; color: rgba(255,255,255,.6); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.login-feature-icon { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border-radius: 10px; color: #8be2c1; background: rgba(105,212,173,.12); }
.login-feature-icon svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.login-brand-footer { margin: 22px 0 0; color: rgba(255,255,255,.42) !important; font-size: 11px !important; }

.login-access { display: flex; min-width: 0; padding: clamp(34px, 5vw, 64px); align-items: center; justify-content: center; flex-direction: column; background: #fff; }
.login-screen .login-panel { width: min(390px, 100%); padding: 0; gap: 20px; border: 0; border-radius: 0; box-shadow: none; }
.login-heading { margin-bottom: 8px; }
.login-heading .eyebrow { margin-bottom: 8px; color: var(--accent); }
.login-screen .login-panel h2 { color: #142a33; font-size: clamp(27px, 3vw, 34px); letter-spacing: -.035em; }
.login-heading > p:last-child { margin: 10px 0 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.login-mobile-brand { display: none; }

.login-field { gap: 9px; color: #29424c; font-size: 13px; }
.login-input-wrap { position: relative; display: block; }
.login-input-wrap > svg { position: absolute; z-index: 1; width: 19px; top: 50%; left: 15px; color: #7b929b; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; transform: translateY(-50%); pointer-events: none; }
.login-input-wrap input { min-height: 50px; padding: 13px 46px; border-color: #d8e2e6; border-radius: 12px; color: #142a33; background: #fbfcfd; transition: border-color .18s ease, box-shadow .18s ease, background .18s ease; }
.login-input-wrap input::placeholder { color: #9aabb2; }
.login-input-wrap input:focus { border-color: #23859a; outline: 0; background: #fff; box-shadow: 0 0 0 4px rgba(23,107,135,.11); }
.password-toggle { position: absolute; z-index: 2; width: 38px; height: 38px; top: 50%; right: 6px; display: grid; padding: 0; place-items: center; border-radius: 9px; color: #70868f; background: transparent; transform: translateY(-50%); }
.password-toggle:hover { color: var(--primary); background: #edf5f6; }
.password-toggle svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.password-toggle .eye-closed, .password-toggle.is-visible .eye-open { display: none; }
.password-toggle.is-visible .eye-closed { display: block; }

.login-submit { display: flex; min-height: 50px; margin-top: 3px; align-items: center; justify-content: center; gap: 10px; border-radius: 12px; background: linear-gradient(135deg, #176b87, #14776f); box-shadow: 0 10px 24px rgba(23,107,135,.22); transition: transform .18s ease, box-shadow .18s ease; }
.login-submit:hover { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(23,107,135,.28); }
.login-submit:active { transform: translateY(0); }
.login-submit svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.login-alert { display: flex; align-items: flex-start; gap: 10px; border-radius: 11px; font-size: 13px; line-height: 1.45; }
.login-alert svg { width: 19px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.login-security-note { display: flex; align-items: center; justify-content: center; gap: 10px; padding-top: 2px; color: #71868f; }
.login-security-note > svg { width: 22px; flex: 0 0 auto; color: #479477; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.login-security-note p { display: grid; margin: 0; gap: 2px; font-size: 11px; }
.login-security-note strong { color: #526971; font-size: 12px; }
.login-copyright { margin: 32px 0 0; color: #9aabb2; font-size: 11px; text-align: center; }

@media (max-width: 860px) {
    .login-screen .login-shell { width: min(520px, 100%); min-height: auto; grid-template-columns: 1fr; }
    .login-screen .login-brand { display: none; }
    .login-access { min-height: min(680px, calc(100svh - 32px)); padding: clamp(28px, 8vw, 52px); }
    .login-mobile-brand { display: flex; margin-bottom: 34px; align-items: center; gap: 10px; color: #163b48; font-size: 18px; font-weight: 900; }
    .login-mobile-brand .brand-mark { width: 40px; height: 40px; border-radius: 11px; font-style: normal; font-size: 12px; }
}

@media (max-width: 480px) {
    body.login-screen { display: block; padding: 0; background: #fff; }
    .login-screen .login-shell { width: 100%; min-height: 100svh; border: 0; border-radius: 0; box-shadow: none; }
    .login-access { min-height: 100svh; padding: 28px 22px; justify-content: center; }
    .login-mobile-brand { margin-bottom: 38px; }
    .login-screen .login-panel h2 { font-size: 28px; }
    .login-copyright { margin-top: 28px; }
}

@media (prefers-reduced-motion: reduce) {
    .login-submit, .login-input-wrap input { transition: none; }
}

@media (max-width: 640px) {
    .login-screen,
    .workspace,
    .login-brand,
    .login-panel {
        padding: 20px;
    }

    .form-panel,
    .workflow,
    .table-panel,
    .profile-panel,
    .detail-panel,
    .panel {
        padding: 16px;
    }

    .topbar,
    .section-title,
    .userbox {
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar-title {
        width: 100%;
        align-items: flex-start;
    }

    .topbar-title h1 {
        font-size: 24px;
        line-height: 1.2;
    }

    .menu {
        grid-template-columns: 1fr;
    }

    .table-panel {
        overflow-x: auto;
    }

    .button-row {
        flex-wrap: wrap;
        width: 100%;
    }

    .button-row button,
    .button-row .action-button,
    .button-row .secondary-button {
        flex: 1 1 180px;
        text-align: center;
    }

    .section-title button,
    .section-title .action-button,
    .section-title .secondary-button {
        width: 100%;
        text-align: center;
    }

    .form-section {
        margin-right: -4px;
        margin-left: -4px;
        padding: 14px;
    }

    .form-section h3 {
        font-size: 16px;
        line-height: 1.35;
    }

    .form-section-header,
    .form-section-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .dynamic-table {
        min-width: 900px;
    }

    .dynamic-table th,
    .dynamic-table td {
        padding: 10px 8px;
        font-size: 12px;
    }

    .dynamic-table input,
    .dynamic-table select,
    .dynamic-table textarea {
        min-width: 105px;
        padding: 9px 10px;
    }

    .dynamic-table td:first-child input {
        min-width: 150px;
    }
}

@media (max-width: 420px) {
    .login-screen,
    .workspace,
    .login-brand,
    .login-panel {
        padding: 14px;
    }

    .form-panel,
    .workflow,
    .table-panel,
    .profile-panel,
    .detail-panel,
    .panel {
        padding: 14px;
    }

    .dynamic-table {
        min-width: 820px;
    }
}

/* ================================================================
   APPROVAL MODULE
   ================================================================ */

/* ---- Stage Pills (Index) ---- */
.approval-stage-pills {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    padding: 14px 18px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f8fbfc;
}

.stage-pill {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}

.stage-pill-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: rgba(255,255,255,.55);
}

.stage-arrow {
    color: var(--muted);
    font-size: 18px;
    font-weight: 900;
}

/* ---- Approval Table ---- */
.approval-table td {
    vertical-align: middle;
}

.app-no {
    color: var(--primary);
    font-family: monospace;
    font-size: 14px;
}

.stage-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    background: #eef6f7;
    color: var(--primary-strong);
    font-size: 12px;
    font-weight: 800;
}

.btn-sm {
    padding: 8px 12px;
    font-size: 13px;
}

/* ---- Empty State ---- */
.approval-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 64px 24px;
    text-align: center;
    color: var(--muted);
}

.approval-empty-icon {
    width: 64px;
    height: 64px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: #edf9f2;
    color: var(--accent);
    font-size: 28px;
}

/* ---- Pipeline (Show) ---- */
.approval-pipeline-panel {
    overflow-x: auto;
}

.approval-pipeline {
    display: flex;
    align-items: flex-start;
    gap: 0;
    padding: 8px 0 16px;
    overflow-x: auto;
}

.pipeline-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 140px;
    position: relative;
    text-align: center;
}

.pipeline-connector {
    position: absolute;
    top: 24px;
    right: calc(50% + 22px);
    left: calc(-50% + 22px);
    height: 2px;
    background: var(--line);
    z-index: 0;
}

.pipeline-connector.hidden {
    display: none;
}

.pipeline-step--approved .pipeline-connector {
    background: var(--accent);
}

.pipeline-node {
    position: relative;
    z-index: 1;
}

.node-icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 999px;
    font-size: 20px;
    font-weight: 900;
    border: 3px solid var(--line);
    background: #fff;
    color: var(--muted);
    transition: all .2s ease;
}

.node-approved {
    border-color: var(--accent);
    background: #edf9f2;
    color: var(--accent);
}

.node-rejected {
    border-color: #c9453a;
    background: #fff0f0;
    color: #c9453a;
}

.node-revision {
    border-color: var(--warning);
    background: #fff8ec;
    color: var(--warning);
}

.pipeline-step--current .node-pending {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
    box-shadow: 0 0 0 6px rgba(23, 107, 135, .18);
    animation: pulse-ring 2s ease infinite;
}

@keyframes pulse-ring {
    0%   { box-shadow: 0 0 0 0   rgba(23,107,135,.3); }
    70%  { box-shadow: 0 0 0 10px rgba(23,107,135,.0); }
    100% { box-shadow: 0 0 0 0   rgba(23,107,135,.0); }
}

.pipeline-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 0 8px;
}

.pipeline-info strong {
    font-size: 13px;
    color: var(--ink);
}

.pipeline-meta {
    font-size: 12px;
    color: var(--muted);
}

.pipeline-sig {
    font-size: 12px;
    color: var(--accent);
    font-weight: 700;
    cursor: help;
}

/* ---- Decision Cards ---- */
.approval-decision-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 8px;
}

.decision-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 14px;
    border: 2px solid var(--line);
    border-radius: 12px;
    cursor: pointer;
    text-align: center;
    transition: all .18s ease;
    background: #fbfcfe;
}

.decision-card input[type="radio"] {
    width: 0;
    height: 0;
    opacity: 0;
    position: absolute;
}

.decision-card__icon {
    font-size: 28px;
    line-height: 1;
}

.decision-card__label {
    font-weight: 800;
    font-size: 14px;
}

.decision-card__desc {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.4;
}

.decision-card:hover {
    border-color: var(--primary);
    background: #eef6f7;
}

.decision-card--approve.selected,
.decision-card--approve:has(input:checked) {
    border-color: var(--accent);
    background: #edf9f2;
}

.decision-card--revision.selected,
.decision-card--revision:has(input:checked) {
    border-color: var(--warning);
    background: #fff8ec;
}

.decision-card--reject.selected,
.decision-card--reject:has(input:checked) {
    border-color: #c9453a;
    background: #fff0f0;
}

/* ---- Digital Signature Preview ---- */
.digital-sig-preview {
    margin-top: 18px;
    padding: 16px 20px;
    border: 1px solid rgba(45, 156, 114, .35);
    border-radius: 10px;
    background: linear-gradient(135deg, #edf9f2 0%, #f7fcfa 100%);
}

.sig-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.sig-icon {
    font-size: 22px;
}

.digital-sig-preview p {
    margin: 0 0 10px;
    font-size: 13px;
    color: #2d6e52;
    line-height: 1.55;
}

.sig-token-mock {
    font-family: monospace;
    font-size: 12px;
    color: var(--accent);
    background: #d4f5e6;
    padding: 6px 12px;
    border-radius: 6px;
    display: inline-block;
}

/* ---- Signature Chip (History) ---- */
.sig-chip {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    background: #edf9f2;
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    font-family: monospace;
    cursor: help;
}

/* ---- History Table Extras ---- */
.history-notes p {
    margin: 0;
    font-size: 13px;
    line-height: 1.45;
}

.revision-note {
    margin-top: 4px !important;
    color: var(--warning);
}

.muted-text {
    color: var(--muted);
}

/* ---- Notice Boxes ---- */
.no-action-notice,
.fully-approved-notice {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 18px;
    border-radius: 10px;
}

.no-action-notice {
    background: #f8f4ff;
    border: 1px solid #d4c5f9;
}

.fully-approved-notice {
    background: #edf9f2;
    border: 1px solid #b9e5cd;
}

.notice-icon {
    font-size: 32px;
}

.no-action-notice strong,
.fully-approved-notice strong {
    display: block;
    margin-bottom: 4px;
}

.no-action-notice p,
.fully-approved-notice p {
    margin: 0;
    font-size: 14px;
    color: var(--muted);
}

/* ---- Status extensions ---- */
.status.pending {
    color: #6b7280;
    background: #f1f3f5;
}

.status.revision {
    color: var(--warning);
    background: #fff4df;
}

/* ---- Approval Responsive ---- */
@media (max-width: 960px) {
    .approval-decision-cards {
        grid-template-columns: 1fr;
    }

    .approval-pipeline {
        flex-direction: column;
        align-items: stretch;
    }

    .pipeline-step {
        flex-direction: row;
        min-width: auto;
        text-align: left;
    }

    .pipeline-connector {
        display: none;
    }

    .pipeline-info {
        align-items: flex-start;
    }
}
