:root {
    --bg: #f3f5f7;
    --sidebar: #182331;
    --sidebar-text: #d7e1ea;
    --surface: #ffffff;
    --surface-soft: #f8fafb;
    --text: #17202a;
    --muted: #697685;
    --line: #d8e0e7;
    --primary: #166b5c;
    --primary-dark: #105045;
    --danger: #b42318;
    --ok: #1f7a4d;
    --warn: #a15c07;
    --shadow: 0 8px 24px rgba(19, 32, 44, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

input,
select,
textarea,
button {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    max-width: 100%;
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 0 10px;
    background: #fff;
    color: var(--text);
}

textarea {
    min-height: 92px;
    padding: 9px 10px;
    resize: vertical;
}

label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 6px;
    font-size: 24px;
    line-height: 1.2;
}

h2 {
    margin-bottom: 14px;
    font-size: 18px;
}

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 14px;
}

img,
svg,
canvas,
video {
    max-width: 100%;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
    text-align: left;
    vertical-align: middle;
    overflow-wrap: anywhere;
    word-break: break-word;
}

th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f8fafb;
    color: #526170;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.3;
    white-space: normal;
}

.wrap-cell {
    max-width: 260px;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

tbody tr:hover {
    background: #fbfcfd;
}

.admin-shell {
    display: grid;
    grid-template-columns: 224px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    padding: 18px 14px;
    background: var(--sidebar);
    color: var(--sidebar-text);
}

.brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    padding: 0 6px;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
}

.brand-text {
    display: block;
    min-width: 0;
    line-height: 1.25;
    text-align: center;
}

.brand-mark {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
    width: 42px;
    height: 34px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.32);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(22, 107, 92, 0.96), rgba(20, 44, 68, 0.98)),
        repeating-linear-gradient(45deg, rgba(255,255,255,0.12) 0 2px, transparent 2px 8px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 8px 18px rgba(0, 0, 0, 0.16);
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0;
}

.brand-mark::after {
    content: "";
    position: absolute;
    right: -8px;
    bottom: -10px;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
}

.side-nav-tools {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 14px;
    padding: 0 6px;
}

.side-nav-tools button {
    min-height: 0;
    border: 1px solid rgba(215, 225, 234, 0.18);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(215, 225, 234, 0.88);
    cursor: pointer;
    font-size: 14px;
    line-height: 1.35;
}

.side-nav-tools button:hover {
    border-color: rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.side-nav-all-toggle {
    display: inline-flex;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.side-nav-all-toggle-icon,
.side-nav-all-toggle-icon::before,
.side-nav-all-toggle-icon::after {
    display: block;
    width: 15px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.side-nav-all-toggle-icon {
    position: relative;
}

.side-nav-all-toggle-icon::before,
.side-nav-all-toggle-icon::after {
    content: "";
    position: absolute;
    left: 0;
}

.side-nav-all-toggle-icon::before {
    top: -6px;
}

.side-nav-all-toggle-icon::after {
    top: 6px;
}

.side-nav-all-toggle.is-expanded .side-nav-all-toggle-icon::before {
    transform: translateY(2px) rotate(45deg);
}

.side-nav-all-toggle.is-expanded .side-nav-all-toggle-icon::after {
    transform: translateY(-2px) rotate(-45deg);
}

.side-nav {
    display: grid;
    gap: 12px;
}

.side-nav-group {
    display: grid;
    gap: 6px;
    border-left: 2px solid transparent;
    padding-left: 6px;
}

.side-nav-group.active {
    border-left-color: rgba(255, 255, 255, 0.42);
}

.side-nav-toggle {
    position: relative;
    display: flex;
    width: 100%;
    min-height: 34px;
    align-items: center;
    justify-content: space-between;
    margin: 0;
    border: 0;
    border-radius: 4px;
    padding: 7px 8px;
    background: transparent;
    color: rgba(215, 225, 234, 0.62);
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: 0;
    text-align: left;
}

.side-nav-toggle::after {
    content: "▾";
    color: rgba(215, 225, 234, 0.62);
    font-size: 12px;
    transition: transform 0.18s ease;
}

.side-nav-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.side-nav-group.expanded .side-nav-toggle::after {
    transform: rotate(0deg);
}

.side-nav-group.collapsed .side-nav-toggle::after {
    transform: rotate(-90deg);
}

.side-nav-group.active .side-nav-toggle {
    color: rgba(255, 255, 255, 0.92);
}

.side-nav-items {
    display: grid;
    gap: 4px;
}

.side-nav-items[hidden] {
    display: none;
}

.side-nav-group.collapsed .side-nav-items {
    display: none;
}

.side-nav a {
    border-radius: 4px;
    min-height: 38px;
    padding: 9px 10px 9px 14px;
    color: var(--sidebar-text);
    font-size: 16px;
    line-height: 1.35;
}

.side-nav a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.side-nav a.active {
    background: #ffffff;
    color: #13202c;
    font-weight: 700;
}

.main-shell {
    min-width: 0;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 64px;
    border-bottom: 1px solid var(--line);
    padding: 8px 24px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(20, 32, 44, 0.04);
}

.app-header-title {
    display: flex;
    min-width: 0;
    align-items: baseline;
    gap: 12px;
}

.app-header-title span {
    flex: 0 0 auto;
    color: #13202c;
    font-size: 20px;
    font-weight: 700;
}

.app-header-title small {
    min-width: 0;
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-header-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.logout-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.page {
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 20px 16px 56px;
}

.page-title {
    display: none;
}

.page-title p,
.muted {
    color: var(--muted);
}

.panel,
.metric,
.pda-panel {
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.panel {
    min-width: 0;
    margin-bottom: 14px;
    padding: 16px;
}

.table-panel {
    padding: 0;
    overflow: hidden;
}

.query-panel {
    padding: 14px;
}

.workorder-query-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.workorder-search-form {
    justify-content: flex-start;
    flex: 1 1 auto;
}

.workorder-search-form > input[name="q"] {
    width: min(360px, 100%);
    min-width: 240px;
    flex: 0 1 360px;
}

.table-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    border-bottom: 1px solid var(--line);
    padding: 12px 14px;
    background: #fff;
}

.table-wrap {
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: visible;
}

.wide-table {
    overflow-x: hidden;
    overflow-y: visible;
}

.table-panel:has(.action-menu[open]),
.table-wrap:has(.action-menu[open]) {
    overflow: visible;
}

.wide-table table {
    min-width: 0;
    table-layout: fixed;
}

.table-panel table {
    table-layout: fixed;
}

.table-panel th,
.table-panel td {
    min-width: 0;
}

.list-data-table th,
.list-data-table td {
    padding: 9px 10px;
    line-height: 1.35;
}

.list-data-table .select-col {
    width: 38px;
}

.list-data-table .actions-col {
    width: 150px;
}

.list-data-table .actions-col.wide-actions,
.list-data-table .wide-actions {
    width: 190px;
}

.list-data-table .date-col {
    width: 116px;
}

.list-data-table .status-col,
.list-data-table .count-col {
    width: 86px;
}

.list-data-table .compact-col {
    width: 74px;
}

.list-cell {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.list-cell-main,
.list-cell-sub,
.list-cell-note {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-cell-main {
    color: var(--text);
    font-weight: 700;
    line-height: 1.35;
}

.list-cell-sub {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
    white-space: nowrap;
}

.list-cell-note {
    display: -webkit-box;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.list-cell-main.clamp-2,
.cell-title.clamp-2 {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.list-cell-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    min-width: 0;
}

.list-detail-text {
    max-height: 72px;
    overflow: auto;
    white-space: pre-wrap;
}

.actions-col {
    width: 150px;
}

.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    position: relative;
    align-items: center;
}

.compact-actions,
.compact-data-table .row-actions {
    flex-wrap: nowrap;
    gap: 6px;
}

.compact-data-table th,
.compact-data-table td {
    padding: 9px 10px;
}

.compact-data-table .button.small {
    min-height: 30px;
    padding: 0 8px;
}

.cell-title,
.cell-subtle {
    display: block;
    min-width: 0;
}

.cell-title {
    margin-bottom: 3px;
    font-weight: 700;
    line-height: 1.3;
}

.cell-subtle {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
}

.form-choice-group {
    display: flex;
    flex-wrap: wrap;
    align-content: start;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
}

.form-choice-group > span {
    flex: 1 0 100%;
}

.form-choice-group label {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    gap: 7px;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 0 12px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
}

.form-choice-group input[type="radio"] {
    width: auto;
    min-height: 0;
}

.select-col {
    width: 32px;
    min-width: 32px;
    max-width: 32px;
    padding-right: 4px;
    padding-left: 4px;
    text-align: center;
}

.select-col input[type="checkbox"] {
    width: auto;
    min-height: 0;
    margin: 0;
}

.process-content-usage-list {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.process-content-usage-item {
    display: grid;
    min-width: 0;
}

.process-content-usage-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rework-order-table {
    table-layout: fixed;
}

.rework-order-table th,
.rework-order-table td {
    vertical-align: middle;
}

.rework-order-table .rework-no-col {
    width: 118px;
}

.rework-order-table .source-col {
    width: 150px;
}

.rework-order-table .device-col {
    width: 150px;
}

.rework-order-table .type-col {
    width: 92px;
}

.rework-order-table .flow-col {
    width: auto;
}

.rework-order-table .progress-col,
.rework-order-table .status-col {
    width: 72px;
}

.rework-order-table .created-col {
    width: 116px;
}

.rework-order-table .actions-col {
    width: 188px;
}

.rework-order-table .cell-title,
.rework-order-table .cell-subtle,
.rework-order-table td {
    overflow-wrap: anywhere;
}

.rework-order-table .row-actions {
    flex-wrap: wrap;
    gap: 5px;
}

.rework-flow-progress-list {
    display: grid;
    gap: 14px;
}

.rework-flow-progress-card {
    display: grid;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 14px;
    background: #fff;
}

.rework-flow-progress-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.rework-flow-progress-head h3 {
    margin: 0 0 4px;
    font-size: 16px;
}

.grouped-rework-stepper {
    overflow-x: auto;
    padding-bottom: 2px;
}

.rework-step-table {
    table-layout: fixed;
}

.rework-step-table th:first-child,
.rework-step-table td:first-child {
    width: 56px;
}

.rework-step-table th:nth-child(3),
.rework-step-table td:nth-child(3),
.rework-step-table th:nth-child(7),
.rework-step-table td:nth-child(7) {
    width: 78px;
}

.rework-step-table th:nth-child(4),
.rework-step-table td:nth-child(4) {
    width: 150px;
}

.rework-step-table th:nth-child(5),
.rework-step-table td:nth-child(5),
.rework-step-table th:nth-child(6),
.rework-step-table td:nth-child(6) {
    width: 110px;
}

.rework-step-table td {
    overflow-wrap: anywhere;
}

.action-menu {
    position: relative;
    display: inline-block;
}

.action-menu summary {
    display: inline-flex;
    min-height: 32px;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 0 12px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    list-style: none;
    white-space: nowrap;
}

.action-menu summary::-webkit-details-marker {
    display: none;
}

.action-menu summary::after {
    content: "▾";
    color: var(--muted);
    font-size: 11px;
}

.action-menu[open] summary {
    border-color: var(--primary);
    color: var(--primary);
}

.action-menu-panel {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 30;
    display: grid;
    min-width: 132px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 5px;
    background: #fff;
    box-shadow: 0 12px 28px rgba(19, 32, 44, 0.16);
}

.action-menu-panel form {
    margin: 0;
}

.action-menu-panel button,
.action-menu-panel a {
    display: flex;
    width: 100%;
    min-height: 34px;
    align-items: center;
    border: 0;
    border-radius: 4px;
    padding: 0 10px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font: inherit;
    text-align: left;
    white-space: nowrap;
}

.action-menu-panel button:hover,
.action-menu-panel a:hover {
    background: #f3f6f8;
}

.action-menu-panel .danger {
    color: var(--danger);
}

.action-menu-panel .danger:hover {
    background: #fff1f0;
}

.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.inline-form > input,
.inline-form > select {
    width: auto;
    min-width: 200px;
    flex: 1 1 220px;
}

.compact-actions {
    gap: 6px;
    flex-wrap: nowrap;
}

.compact-actions form {
    margin: 0;
}

.section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.dictionary-inline-form label,
.number-rule-form label {
    display: grid;
    gap: 6px;
}

.number-rule-form {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr)) auto;
    gap: 12px;
    align-items: end;
}

.number-rule-guide {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.number-rule-guide-card {
    display: grid;
    gap: 8px;
}

.number-rule-guide-card span {
    color: var(--muted);
    font-size: 13px;
}

.number-rule-guide-card strong {
    font-size: 17px;
}

.number-rule-guide-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.number-rule-editor {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto;
    gap: 14px;
    align-items: end;
}

.number-rule-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    background: #fbfcfd;
}

.number-rule-group h2 {
    grid-column: 1 / -1;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.number-rule-group label {
    display: grid;
    gap: 6px;
}

.number-rule-sequence-panel {
    padding: 18px;
}

.number-sequence-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 0.55fr);
    align-items: end;
    gap: 16px;
}

.number-sequence-summary span,
.number-sequence-summary small,
.number-sequence-summary strong {
    display: block;
}

.number-sequence-summary span,
.number-sequence-summary small {
    color: var(--muted);
}

.number-sequence-summary strong {
    margin-top: 4px;
    font-size: 20px;
}

.number-sequence-summary small {
    margin-top: 8px;
    line-height: 1.5;
}

.number-sequence-form {
    display: grid;
    grid-template-columns: minmax(130px, 1fr) auto;
    align-items: end;
    gap: 10px;
}

.number-rule-list-panel {
    padding: 0;
    overflow: hidden;
}

.number-rule-card-list {
    display: grid;
    gap: 12px;
    padding: 14px;
}

.number-rule-card {
    display: grid;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 12px;
    background: #fbfcfd;
}

.number-rule-card-head,
.number-rule-facts,
.number-rule-card-actions,
.number-rule-row-editor {
    min-width: 0;
}

.number-rule-card-head {
    display: grid;
    grid-template-columns: minmax(160px, 1fr) minmax(140px, 0.8fr) auto;
    align-items: center;
    gap: 12px;
}

.number-rule-card-head span,
.number-rule-facts span {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.number-rule-card-head strong,
.number-rule-facts strong {
    display: block;
    margin-top: 3px;
    overflow-wrap: anywhere;
}

.number-rule-facts {
    display: grid;
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    gap: 10px;
}

.number-rule-facts div {
    border: 1px solid #dfe7ed;
    border-radius: 5px;
    padding: 9px 10px;
    background: #fff;
}

.number-rule-card-actions {
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.number-rule-edit-details {
    position: relative;
}

.number-rule-edit-details summary {
    list-style: none;
}

.number-rule-edit-details summary::-webkit-details-marker {
    display: none;
}

.number-rule-row-editor {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr)) auto auto;
    align-items: end;
    gap: 10px;
    width: 100%;
    margin-top: 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 12px;
    background: #fff;
}

.number-rule-active {
    min-height: 38px;
}

.number-rule-table input[type="text"],
.number-rule-table input[type="number"],
.number-rule-table input:not([type]) {
    min-width: 120px;
}

.form-stack {
    display: grid;
    gap: 12px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.field-display {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
}

.field-display strong {
    display: flex;
    min-height: 38px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f8fafc;
    padding: 0 10px;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
}

.workorder-add-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.product-image-strip {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 42px;
}

.product-preview-thumb {
    display: block;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
}

.product-image-strip img {
    display: block;
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 4px;
    object-fit: cover;
    background: #fff;
}

.product-device-picker {
    display: grid;
    gap: 8px;
}

.searchable-check-list-filter {
    width: 100%;
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0 10px;
    background: #fff;
    color: var(--text);
}

.searchable-check-list-empty {
    grid-column: 1 / -1;
    margin: 0;
}

label .searchable-check-list-filter {
    margin-top: 6px;
    margin-bottom: 8px;
}

.async-combobox {
    position: relative;
    display: block;
}

.async-combobox-panel {
    position: absolute;
    z-index: 80;
    top: calc(100% - 4px);
    left: 0;
    right: 0;
    max-height: 260px;
    overflow: auto;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
}

.async-combobox-option {
    display: flex;
    width: 100%;
    flex-direction: column;
    gap: 2px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    padding: 8px 10px;
    color: var(--text);
    text-align: left;
    cursor: pointer;
}

.async-combobox-option:hover,
.async-combobox-option:focus {
    background: var(--soft);
}

.async-combobox-option small,
.async-combobox-empty {
    color: var(--muted);
    font-size: 12px;
}

.async-combobox-empty {
    display: block;
    padding: 8px 10px;
}

.product-device-picker > span,
.product-album-head > span {
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
}

.product-device-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
    max-height: 168px;
    overflow: auto;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fbfcfe;
}

.product-album {
    display: grid;
    gap: 10px;
}

.product-album-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.product-album-head small {
    color: var(--muted);
}

.product-album-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
    gap: 10px;
}

.product-image-card {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 116px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
}

.product-image-card img {
    width: 100%;
    height: 116px;
    object-fit: cover;
}

.product-upload-card {
    gap: 4px;
    color: var(--muted);
    border-style: dashed;
    cursor: pointer;
}

.product-upload-card input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.product-upload-card span {
    font-weight: 700;
    color: var(--primary);
}

.product-upload-card small {
    color: var(--muted);
}

.product-image-remove {
    position: absolute;
    right: 6px;
    top: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 26px;
    min-width: 34px;
    padding: 0 8px;
    border: 0;
    border-radius: 4px;
    background: rgba(185, 28, 28, 0.94);
    color: #fff;
    box-shadow: var(--shadow-sm);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.product-image-remove:hover {
    background: #991b1b;
}

.product-image-remove input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.product-image-preview-badge {
    position: absolute;
    left: 6px;
    bottom: 6px;
    min-height: 24px;
    padding: 3px 7px;
    border-radius: 4px;
    background: rgba(23, 92, 211, 0.92);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.product-image-card.marked-remove img {
    filter: grayscale(1);
    opacity: 0.35;
}

.product-preview-dialog {
    width: min(980px, calc(100vw - 32px));
}

.product-preview-card {
    max-height: calc(100vh - 40px);
}

.product-preview-stage {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    align-items: center;
    gap: 12px;
    min-height: 420px;
    padding: 12px;
    background: #0f172a;
}

.product-preview-stage img {
    display: block;
    max-width: 100%;
    max-height: min(68vh, 720px);
    margin: 0 auto;
    object-fit: contain;
}

.product-preview-nav {
    min-width: 40px;
    min-height: 40px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text);
    font-size: 28px;
}

.product-preview-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px 16px;
}

.employee-photo-thumb,
.employee-photo-placeholder {
    display: inline-grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f8fafc;
    color: var(--muted);
    font-size: 12px;
    object-fit: cover;
}

.chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.section-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
    max-height: 190px;
    overflow: auto;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fbfcfe;
}

.section-checkbox-grid > span {
    grid-column: 1 / -1;
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
}

.section-checkbox-grid .searchable-check-list-filter {
    grid-column: 1 / -1;
}

.employee-photo-album .product-album-grid {
    grid-template-columns: repeat(auto-fill, minmax(116px, 116px));
}

.employee-card-print-body {
    min-height: 100vh;
    padding: 12px;
    background: #eef2f6;
}

.employee-card-toolbar {
    align-items: center;
}

.employee-card-title-control {
    display: flex;
    align-items: center;
    gap: 6px;
}

.employee-card-title-control span {
    color: var(--muted);
    font-size: 13px;
}

.employee-card-title-control input {
    width: 170px;
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0 10px;
}

.employee-card-batch-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.employee-card-batch-controls input[name="cardTitle"] {
    width: 160px;
    flex: 0 1 160px;
}

.employee-card-batch-controls select {
    flex: 0 0 120px;
}

.employee-card-batch-controls .button {
    white-space: nowrap;
}

.table-toolbar .inline-form select[name="layout"] {
    min-width: 120px;
}

.employee-card-sheet {
    display: flex;
    flex-wrap: wrap;
    gap: 5mm;
    align-items: flex-start;
    justify-content: flex-start;
}

.employee-card {
    display: grid;
    box-sizing: border-box;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    justify-items: center;
    overflow: hidden;
    break-inside: avoid;
    page-break-inside: avoid;
    border: 0.35mm solid #111827;
    border-radius: 1.5mm;
    background: #fff;
    color: #111827;
    text-align: center;
}

.employee-card-sheet.landscape .employee-card {
    width: 90mm;
    height: 54mm;
    grid-template-columns: 29mm minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) 13mm;
    column-gap: 5mm;
    padding: 3mm 5mm;
}

.employee-card-sheet.portrait .employee-card {
    width: 54mm;
    height: 90mm;
    padding: 5mm 4.5mm 4mm;
    grid-template-rows: auto 43mm auto 16mm;
}

.employee-card-title {
    width: 100%;
    padding-bottom: 1.8mm;
    border-bottom: 0.2mm solid #d1d5db;
    font-size: 9pt;
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1.1;
}

.employee-card-sheet.landscape .employee-card-title {
    grid-column: 1 / -1;
    grid-row: 1;
}

.employee-card-photo {
    align-self: center;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 0.25mm solid #374151;
    border-radius: 1mm;
    background: #fff;
}

.employee-card-sheet.landscape .employee-card-photo {
    grid-column: 1;
    grid-row: 2 / 4;
    width: 27mm;
    height: 34mm;
}

.employee-card-sheet.portrait .employee-card-photo {
    width: 32mm;
    height: 40mm;
}

.employee-card-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.employee-card-info {
    display: grid;
    gap: 0.8mm;
    width: 100%;
    min-width: 0;
    margin-top: 1mm;
}

.employee-card-sheet.landscape .employee-card-info {
    grid-column: 2;
    grid-row: 2;
    align-self: end;
    justify-items: start;
    margin-top: 0;
    text-align: left;
}

.employee-card-info strong {
    overflow: hidden;
    font-size: 13pt;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.employee-card-info span {
    overflow: hidden;
    font-size: 8pt;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.employee-card-barcode {
    display: grid;
    place-items: center;
    width: 100%;
    align-self: end;
}

.employee-card-sheet.landscape .employee-card-barcode {
    grid-column: 2;
    grid-row: 3;
    align-self: start;
}

.employee-card-barcode .engineering-barcode-svg {
    width: 100%;
    max-width: 62mm;
    height: 12mm;
}

.employee-card-sheet.landscape .employee-card-barcode .engineering-barcode-svg {
    max-width: 46mm;
    height: 12mm;
}

.employee-card-sheet.portrait .employee-card-barcode .engineering-barcode-svg {
    max-width: 42mm;
    height: 14mm;
}

@media print {
    .employee-card-print-body {
        padding: 0;
        background: #fff;
    }

    .employee-card-toolbar {
        display: none !important;
    }

    .employee-card-sheet {
        gap: 3mm;
    }

    .employee-card {
        box-shadow: none;
    }
}

.process-sheet-product-picker {
    display: grid;
    gap: 8px;
}

.process-sheet-product-picker > span {
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
}

.process-sheet-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 8px;
    max-height: 260px;
    overflow: auto;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fbfcfe;
}

.process-sheet-product-grid .is-hidden {
    display: none;
}

.process-flow-print-body {
    margin: 0;
    padding-top: 74px;
    background: #e5e7eb;
    color: #111827;
    font-family: "Microsoft YaHei", Arial, sans-serif;
}

.process-flow-print-toolbar {
    position: fixed;
    z-index: 100;
    top: 0;
    left: 0;
    right: 0;
    margin: 0;
    border-width: 0 0 1px;
    border-radius: 0;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}

.process-flow-print-toolbar > div:first-child {
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    gap: 8px;
    align-items: baseline;
}

.process-flow-print-page {
    width: 210mm;
    min-height: 297mm;
    margin: 16px auto;
    padding: 14mm;
    background: #fff;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
}

.process-flow-print-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 13px;
}

.process-flow-print-table td {
    height: 36px;
    padding: 6px 8px;
    border: 1px solid #111827;
    vertical-align: middle;
    word-break: break-word;
}

.process-flow-print-title {
    height: 52px;
    text-align: center;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 0;
}

.process-flow-print-subhead td,
.process-flow-print-table .form-label {
    background: #f3f4f6;
    text-align: center;
    font-weight: 700;
}

.process-flow-clean-page {
    display: grid;
    align-content: start;
    gap: 10px;
    font-family: SimSun, "Microsoft YaHei", Arial, sans-serif;
}

.process-flow-blank-page {
    min-height: 297mm;
    box-shadow: none;
}

.process-flow-clean-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 1.35fr 48mm;
    align-items: end;
    gap: 10px;
    font-size: 12px;
    line-height: 1.8;
}

.process-flow-clean-head > div,
.process-flow-clean-head > table {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.process-flow-clean-side {
    display: grid;
    gap: 4px;
    align-self: start;
}

.process-flow-batch-barcode {
    display: grid;
    justify-items: center;
    gap: 2px;
    padding: 2px 0;
}

.process-flow-batch-barcode-label {
    font-size: 10px;
    line-height: 1;
    font-weight: 700;
}

.process-flow-batch-barcode .engineering-barcode-svg {
    display: block;
    width: 46mm;
    height: 15mm;
}

.process-flow-clean-title {
    text-align: center;
}

.process-flow-clean-title h1 {
    margin: 0 0 8px;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 0;
}

.process-flow-clean-title span {
    display: inline-block;
    padding: 3px 12px;
    border: 2px solid #111;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 700;
}

.process-flow-clean-approval {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 12px;
    line-height: 1.2;
}

.process-flow-clean-approval th,
.process-flow-clean-approval td {
    border: 1px solid #111;
    padding: 4px;
    text-align: center;
    vertical-align: middle;
}

.process-flow-clean-approval th {
    height: 8mm;
    background: #f3f4f6;
    font-weight: 700;
}

.process-flow-clean-approval td {
    height: 12mm;
}

.process-flow-clean-table,
.process-flow-clean-meta,
.process-flow-clean-parts-meta,
.process-flow-clean-remarks,
.process-flow-clean-form,
.process-flow-clean-steps,
.process-flow-clean-parts,
.process-flow-clean-sign {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.process-flow-clean-table th,
.process-flow-clean-table td,
.process-flow-clean-meta th,
.process-flow-clean-meta td,
.process-flow-clean-parts-meta th,
.process-flow-clean-parts-meta td,
.process-flow-clean-remarks th,
.process-flow-clean-remarks td,
.process-flow-clean-form th,
.process-flow-clean-form td,
.process-flow-clean-steps th,
.process-flow-clean-steps td,
.process-flow-clean-parts th,
.process-flow-clean-parts td,
.process-flow-clean-sign td {
    border: 1px solid #111;
    padding: 6px;
    box-sizing: border-box;
    vertical-align: middle;
    line-height: 1.35;
    overflow: hidden;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.process-flow-clean-table th,
.process-flow-clean-meta th,
.process-flow-clean-parts-meta th,
.process-flow-clean-remarks th {
    width: 22mm;
    background: #f3f4f6;
    text-align: center;
}

.process-flow-clean-form th {
    background: #f3f4f6;
    text-align: center;
}

.process-flow-clean-meta,
.process-flow-clean-parts-meta,
.process-flow-clean-remarks,
.process-flow-clean-form {
    font-size: 12px;
}

.process-flow-clean-meta th,
.process-flow-clean-meta td,
.process-flow-clean-parts-meta th,
.process-flow-clean-parts-meta td {
    height: 9mm;
}

.process-flow-clean-remarks th {
    width: 18mm;
}

.process-flow-clean-remarks td {
    height: 24mm;
    text-align: left;
    white-space: pre-wrap;
}

.process-flow-clean-form {
    font-size: 11px;
    line-height: 1.22;
}

.process-flow-clean-form th,
.process-flow-clean-form td {
    height: 7.7mm;
    padding: 2px 3px;
}

.process-flow-clean-form .no-col {
    width: 8mm;
}

.process-flow-clean-form .sign-col {
    width: 23mm;
}

.process-flow-clean-form .process-col {
    width: 23mm;
}

.process-flow-clean-form .content-col {
    width: 62mm;
}

.process-flow-clean-form .time-col {
    width: 17mm;
}

.process-flow-clean-form .complete-col {
    width: 17mm;
}

.process-flow-clean-form .operator-col {
    width: 16mm;
}

.process-flow-clean-form .confirm-col {
    width: 24mm;
}

.process-flow-clean-form .step-content-cell {
    text-align: left;
    vertical-align: top;
}

.process-flow-cell-text {
    display: -webkit-box;
    width: 100%;
    min-width: 0;
    max-height: 2.5em;
    overflow: hidden;
    line-height: 1.25;
    white-space: pre-line;
    word-break: break-word;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.step-content-cell .process-flow-cell-text {
    max-height: 3.75em;
    -webkit-line-clamp: 3;
}

.process-flow-cell-center {
    text-align: center;
}

.process-flow-cell-strong {
    font-size: 13px;
    font-weight: 700;
}

.process-flow-clean-form .process-flow-clean-remark-content-row td {
    height: 42mm;
    text-align: left;
    vertical-align: top;
    font-size: 12px;
}

.process-flow-clean-form .process-flow-clean-remark-content-row .process-flow-cell-text {
    margin-top: 4px;
    max-height: 34mm;
    -webkit-line-clamp: 8;
}

.process-flow-clean-parts {
    font-size: 13px;
}

.process-flow-clean-steps {
    font-size: 12px;
}

.process-flow-clean-steps th {
    height: 30px;
    background: #f3f4f6;
    text-align: center;
    font-weight: 700;
}

.process-flow-clean-steps td {
    height: 18mm;
    text-align: center;
}

.process-flow-clean-steps .no-col {
    width: 8mm;
}

.process-flow-clean-steps .sign-col {
    width: 19mm;
}

.process-flow-clean-steps .process-col {
    width: 22mm;
}

.process-flow-clean-steps .content-col {
    width: 58mm;
}

.process-flow-clean-steps .time-col {
    width: 18mm;
}

.process-flow-clean-steps .complete-col {
    width: 18mm;
}

.process-flow-clean-steps .operator-col {
    width: 15mm;
}

.process-flow-clean-steps .confirm-col {
    width: 20mm;
}

.process-flow-clean-steps .step-content-cell {
    text-align: left;
    line-height: 1.5;
    white-space: pre-wrap;
}

.process-flow-clean-parts th {
    height: 34px;
    background: #f3f4f6;
    text-align: center;
    font-weight: 700;
}

.process-flow-clean-parts th span {
    font-size: 12px;
    font-weight: 400;
}

.process-flow-clean-parts td {
    height: 32mm;
    text-align: center;
}

.process-flow-clean-parts .no-col {
    width: 8mm;
}

.process-flow-clean-parts .part-name-col,
.process-flow-clean-parts .part-name-cell {
    width: 34mm;
}

.process-flow-clean-parts .shape-col {
    width: 44mm;
}

.process-flow-clean-parts .material-col {
    width: 16mm;
}

.process-flow-clean-parts .mark-col {
    width: 16mm;
}

.process-flow-clean-parts .base-col,
.process-flow-clean-parts .count-col {
    width: 10mm;
}

.process-flow-clean-parts .part-remark-col {
    width: 28mm;
}

.part-name-cell {
    display: grid;
    gap: 6px;
    align-content: center;
}

.part-name-cell strong,
.part-name-cell span {
    display: block;
}

.process-flow-clean-parts img {
    display: block;
    width: 100%;
    height: 28mm;
    max-height: 28mm;
    object-fit: contain;
}

.process-flow-empty-cell {
    height: 42mm;
    color: #6b7280;
}

.process-flow-clean-sign td {
    height: 18mm;
    width: 33.333%;
}

@media print {
    @page {
        size: A4;
        margin: 8mm;
    }

    .process-flow-print-body {
        background: #fff;
        padding-top: 0;
    }

    .process-flow-print-page {
        width: auto;
        min-height: auto;
        margin: 0;
        padding: 0;
        box-shadow: none;
    }

    .process-flow-print-table td {
        border-color: #000;
    }

    .process-flow-clean-page {
        display: block;
        break-after: page;
        break-inside: auto;
        page-break-after: always;
        page-break-inside: auto;
        gap: 6px;
    }

    .process-flow-blank-page {
        min-height: 270mm;
    }

    .process-flow-clean-page:last-child {
        break-after: auto;
        page-break-after: auto;
    }

    .process-flow-clean-head,
    .process-flow-clean-parts-meta {
        break-inside: avoid;
        margin-bottom: 6px;
        page-break-inside: avoid;
    }

    .process-flow-clean-form,
    .process-flow-clean-parts {
        break-inside: auto;
        page-break-inside: auto;
    }

    .process-flow-clean-form thead,
    .process-flow-clean-parts thead {
        display: table-header-group;
    }

    .process-flow-clean-form tr,
    .process-flow-clean-parts tr {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .process-flow-clean-table th,
    .process-flow-clean-table td,
    .process-flow-clean-meta th,
    .process-flow-clean-meta td,
    .process-flow-clean-parts-meta th,
    .process-flow-clean-parts-meta td,
    .process-flow-clean-remarks th,
    .process-flow-clean-remarks td,
    .process-flow-clean-form th,
    .process-flow-clean-form td,
    .process-flow-clean-steps th,
    .process-flow-clean-steps td,
    .process-flow-clean-parts th,
    .process-flow-clean-parts td {
        position: static;
        overflow: visible;
        padding: 3px;
        line-height: 1.25;
    }

    .process-flow-cell-text,
    .step-content-cell .process-flow-cell-text,
    .process-flow-clean-form .process-flow-clean-remark-content-row .process-flow-cell-text {
        display: block;
        max-height: none;
        overflow: visible;
        -webkit-line-clamp: unset;
    }

    .process-flow-clean-form th,
    .process-flow-clean-form td {
        padding: 2px 3px;
    }

    .process-flow-clean-form {
        font-size: 10.5px;
    }

    .process-flow-clean-steps {
        font-size: 10.5px;
    }

    .process-flow-clean-parts {
        font-size: 11px;
    }

    .process-flow-clean-parts td {
        height: 26mm;
    }

    .process-flow-clean-parts img {
        height: 24mm;
        max-height: 24mm;
    }
}

.full-span {
    grid-column: 1 / -1;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 0 14px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
}

.button.small {
    min-height: 30px;
    padding: 0 10px;
    font-size: 13px;
}

.button:hover {
    border-color: #a8b6c3;
}

.button.primary {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.button.primary:hover {
    background: var(--primary-dark);
}

.button.ghost {
    background: transparent;
}

.button.danger {
    border-color: #f1b5af;
    color: var(--danger);
}

.button.disabled {
    pointer-events: none;
    opacity: 0.5;
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 4px;
    background: #edf1f4;
    cursor: pointer;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    border-radius: 999px;
    padding: 0 9px;
    font-size: 12px;
}

.badge.ok {
    background: #e2f4eb;
    color: var(--ok);
}

.badge.warn {
    background: #fff1d6;
    color: var(--warn);
}

.badge.danger {
    background: #fbe3e3;
    color: #b42323;
}

.chip {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    border-radius: 999px;
    padding: 0 9px;
    background: #eef3f5;
    font-size: 13px;
}

.mono {
    font-family: Consolas, "SFMono-Regular", monospace;
}

.notice {
    margin-bottom: 14px;
    border-radius: 6px;
    padding: 11px 14px;
}

.notice.success {
    background: #e2f4eb;
    color: var(--ok);
}

.notice.error {
    background: #fde8e6;
    color: var(--danger);
}

.notice.warn {
    background: #fff1d6;
    color: var(--warn);
}

.toast-source {
    display: none;
}

.toast-host {
    position: fixed;
    top: 18px;
    left: 50%;
    z-index: 3000;
    display: grid;
    gap: 10px;
    width: min(520px, calc(100vw - 28px));
    transform: translateX(-50%);
    pointer-events: none;
}

.toast {
    justify-self: center;
    max-width: 100%;
    border: 1px solid rgba(18, 32, 43, 0.12);
    border-radius: 8px;
    padding: 11px 16px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 14px 34px rgba(18, 32, 43, 0.18);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-success {
    border-color: rgba(34, 152, 89, 0.28);
    background: #edf8f1;
    color: #16633a;
}

.toast-error {
    border-color: rgba(194, 65, 12, 0.26);
    background: #fff0ea;
    color: #a53610;
}

.toast-info {
    border-color: rgba(41, 111, 145, 0.24);
    background: #eef7fb;
    color: #20556d;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(140px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.metric {
    padding: 18px;
}

.metric span {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.metric strong {
    display: block;
    margin-top: 6px;
    font-size: 28px;
}

.content-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(420px, 0.9fr);
    gap: 18px;
}

.section-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}

.status-tile {
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 16px;
    background: var(--surface);
}

.status-bar {
    overflow: hidden;
    height: 8px;
    border-radius: 999px;
    background: #e8edf0;
}

.status-bar span {
    display: block;
    height: 100%;
    background: var(--primary);
}

.report-metrics .metric {
    display: grid;
    gap: 4px;
}

.report-metrics .metric em {
    color: var(--muted);
    font-size: 12px;
    font-style: normal;
}

.report-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: 14px;
    margin-bottom: 14px;
}

.panel-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.analysis-list {
    display: grid;
    gap: 10px;
}

.analysis-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 170px auto auto;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px 12px;
}

.analysis-row strong,
.analysis-row span {
    display: block;
}

.analysis-meter {
    height: 8px;
    border-radius: 999px;
    background: #e8edf0;
    overflow: hidden;
}

.analysis-meter span {
    display: block;
    height: 100%;
    background: var(--primary);
}

.analysis-row b {
    font-size: 15px;
}

.analysis-row small {
    color: var(--muted);
}

.bucket-chart {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
    align-items: end;
    min-height: 230px;
}

.bucket {
    display: grid;
    gap: 8px;
    justify-items: center;
}

.bucket strong {
    font-size: 12px;
    color: var(--text);
}

.bucket small {
    font-size: 12px;
    color: var(--muted);
}

.bucket-bar {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    width: 100%;
    min-height: 20px;
    border-radius: 6px 6px 3px 3px;
    background: linear-gradient(180deg, #2e9d89, #166b5c);
}

.bucket-bar span {
    margin-bottom: 6px;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.dashboard-screen {
    display: grid;
    gap: 14px;
}

.dashboard-hero {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
    border: 1px solid #264658;
    border-radius: 8px;
    padding: 18px;
    color: #d8f8ff;
    background: radial-gradient(circle at left top, #1b4f63 0%, #10232e 68%);
    box-shadow: 0 14px 34px rgba(10, 27, 36, 0.26);
}

.screen-kicker {
    display: inline-block;
    margin-bottom: 6px;
    color: #80d7e7;
    font-size: 12px;
    letter-spacing: 0.3px;
}

.dashboard-hero h1 {
    margin-bottom: 8px;
    color: #ebfeff;
}

.dashboard-hero p {
    margin-bottom: 0;
    color: #8ec0ce;
}

.screen-clock {
    text-align: right;
}

.screen-clock span {
    display: block;
    color: #89b6c4;
    font-size: 12px;
}

.screen-clock strong {
    color: #ecfbff;
    font-size: 24px;
}

.screen-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.screen-metrics article {
    border: 1px solid #d4dce3;
    border-radius: 6px;
    padding: 12px;
    background: #fff;
}

.screen-metrics span {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.screen-metrics strong {
    display: block;
    margin-top: 4px;
    font-size: 27px;
    line-height: 1.2;
    white-space: nowrap;
}

.screen-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr) minmax(0, 0.9fr);
    gap: 14px;
}

.screen-panel {
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 14px;
    background: #fff;
    box-shadow: var(--shadow);
}

.screen-panel-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.screen-panel-title h2 {
    margin-bottom: 0;
}

.screen-panel-title span {
    color: var(--muted);
    font-size: 12px;
}

.screen-section-list {
    display: grid;
    gap: 9px;
}

.screen-section {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 160px auto auto 80px;
    align-items: center;
    gap: 9px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px;
}

.screen-section strong,
.screen-section span {
    display: block;
}

.screen-section span {
    color: var(--muted);
    font-size: 12px;
}

.screen-progress {
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
    background: #e8edf0;
}

.screen-progress span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #2b9a87, #176f5f);
}

.screen-section b {
    font-size: 14px;
}

.screen-section small {
    color: var(--muted);
}

.screen-section i {
    display: block;
    height: 6px;
    border-radius: 999px;
    background: #9cb8c4;
}

.screen-buckets {
    display: grid;
    gap: 8px;
}

.screen-buckets > div {
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 9px 10px;
}

.screen-buckets span {
    color: var(--muted);
    font-size: 12px;
}

.screen-buckets strong {
    display: block;
    margin-top: 2px;
    margin-bottom: 8px;
    font-size: 18px;
}

.screen-scan-list {
    display: grid;
    gap: 8px;
    max-height: 330px;
    overflow: auto;
}

.screen-scan-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 9px 10px;
}

.screen-scan-item strong,
.screen-scan-item span {
    display: block;
}

.screen-scan-item span,
.screen-scan-item time {
    color: var(--muted);
    font-size: 12px;
}

.screen-scan-item b {
    min-width: 48px;
    text-align: center;
    border-radius: 999px;
    padding: 1px 8px;
    background: #eef3f5;
    color: #375163;
    font-size: 12px;
}

.screen-scan-item.done b {
    background: #e2f4eb;
    color: #1f7a4d;
}

.screen-scan-item.pending b {
    background: #fff1d6;
    color: #a15c07;
}

.screen-alert-wrap {
    max-height: 340px;
    overflow: auto;
}

.screen-alert-table {
    min-width: 1080px;
}

.screen-alert-table td {
    font-size: 13px;
}

.screen-alert-row.warn {
    background: #fffbf4;
}

.screen-alert-row.danger {
    background: #fff5f5;
}

.screen-empty {
    margin: 8px 0;
    color: var(--muted);
}

.screen-table table {
    min-width: 760px;
}

.pager {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    border-top: 1px solid var(--line);
    padding: 12px 14px;
    background: #fff;
    color: var(--muted);
    font-size: 13px;
}

.pager-summary {
    line-height: 30px;
}

.pager-body {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.pager-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pager-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pager-form label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
}

.pager-form select {
    width: 78px;
    min-height: 30px;
}

.pager-form input {
    width: 78px;
    min-height: 30px;
    padding: 0 8px;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(17, 29, 43, 0.45);
}

.modal.open {
    display: flex;
}

.modal-dialog {
    width: min(720px, 100%);
    max-height: min(780px, calc(100vh - 48px));
    overflow: auto;
}

.modal-lg {
    width: min(1120px, 100%);
}

.app-dialog-panel {
    width: min(460px, 100%);
}

.app-dialog-card {
    gap: 14px;
}

.app-dialog-message {
    margin: 0;
    color: var(--text);
    line-height: 1.6;
    white-space: pre-wrap;
}

.app-loading {
    background: rgba(17, 29, 43, 0.28);
}

.app-loading-panel {
    width: min(280px, calc(100% - 40px));
}

.app-loading-card {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 92px;
}

.app-loading-card strong {
    color: #17202a;
    font-size: 15px;
}

.app-loading-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #d8e2e8;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: app-loading-spin 0.8s linear infinite;
}

@keyframes app-loading-spin {
    to {
        transform: rotate(360deg);
    }
}

.modal-card {
    display: grid;
    gap: 16px;
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 22px 70px rgba(16, 30, 44, 0.24);
    padding: 18px;
}

.modal-card.app-loading-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.modal-header,
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.modal-footer {
    justify-content: flex-end;
}

.modal-permissions {
    max-height: 280px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 12px;
}

.import-progress {
    display: grid;
    gap: 10px;
    border: 1px solid #d9e4ec;
    border-radius: 6px;
    background: #f8fbfd;
    padding: 12px;
}

.import-progress-panel {
    display: grid;
    gap: 12px;
}

.import-progress-panel[hidden] {
    display: none;
}

.import-progress-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.import-progress-title strong {
    display: block;
    color: #17202a;
    font-size: 16px;
}

.import-progress-title p {
    margin: 4px 0 0;
}

.import-progress-title > span {
    flex: 0 0 auto;
    color: var(--primary);
    font-size: 22px;
    font-weight: 800;
    line-height: 1;
}

.import-progress[hidden] {
    display: none;
}

.import-progress-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.import-progress-head strong,
.import-progress-head span {
    color: #17202a;
    font-size: 14px;
}

.import-progress-bar {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #dce6ee;
}

.import-progress-bar span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--primary);
    transition: width 0.2s ease;
}

.import-progress-panel[data-import-state="running"] .import-progress-bar span,
.import-progress-panel[data-import-state="queued"] .import-progress-bar span {
    background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.35) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.35) 50%, rgba(255, 255, 255, 0.35) 75%, transparent 75%, transparent);
    background-size: 24px 24px;
    animation: import-progress-stripes 0.8s linear infinite;
}

@keyframes import-progress-stripes {
    from {
        background-position: 0 0;
    }

    to {
        background-position: 24px 0;
    }
}

.import-result-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.import-result-grid[hidden] {
    display: none;
}

.import-result-grid div {
    display: grid;
    gap: 4px;
    border-radius: 6px;
    background: #fff;
    padding: 8px;
}

.import-result-grid span {
    color: var(--muted);
    font-size: 12px;
}

.import-result-grid strong {
    color: #17202a;
    font-size: 18px;
}

.permission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px 14px;
}

.checkbox-line {
    display: inline-flex;
    flex-direction: row;
    gap: 8px;
    align-items: center;
    color: var(--text);
}

.checkbox-line input,
td input[type="checkbox"],
.pda-item input {
    width: 16px;
    min-height: 16px;
}

.process-flow-checkbox-group {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
}

.process-flow-checkbox-group > span {
    font-weight: 600;
}

.process-flow-checkbox-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.process-flow-checkbox-title {
    display: grid;
    gap: 2px;
    min-width: 220px;
    color: var(--muted);
}

.process-flow-checkbox-title span {
    font-weight: 600;
    color: var(--text);
}

.process-flow-checkbox-title small {
    color: var(--muted);
}

.process-flow-checkbox-head .searchable-check-list-filter {
    flex: 0 1 220px;
    width: 220px;
    max-width: 100%;
}

.process-flow-checkbox-grid {
    display: grid;
    max-height: 230px;
    overflow: auto;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 8px;
    background: var(--surface-soft);
}

.process-flow-checkbox-grid .muted {
    margin: 0;
}

.process-flow-option {
    align-items: flex-start;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 8px;
    background: var(--surface);
}

.process-flow-option-text {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.process-flow-option-text strong,
.process-flow-option-text small {
    overflow-wrap: anywhere;
}

.process-flow-option-text strong {
    color: var(--text);
    font-size: 13px;
}

.process-flow-option-text small {
    color: var(--muted);
}

.process-flow-date-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(150px, 190px));
    gap: 12px;
    align-items: end;
}

.process-flow-date-row input[type="date"] {
    max-width: 190px;
}

@media (max-width: 520px) {
    .process-flow-date-row {
        grid-template-columns: 1fr;
    }

    .process-flow-date-row input[type="date"] {
        max-width: 100%;
    }
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
}

.detail-grid div {
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 10px;
    background: var(--surface-soft);
}

.detail-grid span,
.detail-grid strong {
    display: block;
}

.detail-grid span {
    color: var(--muted);
    font-size: 12px;
}

.detail-grid strong {
    margin-top: 4px;
    overflow-wrap: anywhere;
    font-weight: 600;
}

.workorder-edit-details {
    margin-top: 14px;
}

.workorder-edit-details summary {
    width: max-content;
    list-style: none;
}

.workorder-edit-details summary::-webkit-details-marker {
    display: none;
}

.workorder-edit-grid {
    margin-top: 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 12px;
    background: #fbfcfd;
}

.empty-state {
    display: grid;
    gap: 8px;
    min-height: 150px;
    align-content: center;
}

.login-body {
    display: grid;
    min-height: 100vh;
    place-items: center;
    background: #edf2f4;
}

.login-panel {
    width: min(420px, calc(100% - 32px));
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 28px;
    background: #fff;
    box-shadow: var(--shadow);
}

.login-panel h1 {
    font-size: 24px;
}

.login-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 22px;
    color: #13202c;
    text-align: center;
}

.login-brand-mark {
    width: 54px;
    height: 44px;
    border-color: rgba(22, 107, 92, 0.26);
    font-size: 11px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 10px 24px rgba(22, 107, 92, 0.22);
}

.button.full {
    width: 100%;
}

.pda-body {
    background: #edf2f4;
}

.pda-shell {
    width: min(900px, calc(100% - 20px));
    margin: 14px auto 40px;
}

.pda-title {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 14px;
}

.pda-title h1 {
    font-size: 24px;
}

.pda-panel {
    margin-bottom: 14px;
    padding: 16px;
}

.pda-sn-form,
.scan-form {
    display: grid;
    gap: 12px;
}

.scan-form input {
    min-height: 56px;
    font-size: 18px;
}

.button.big {
    min-height: 56px;
    font-size: 17px;
}

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

.pda-list {
    display: grid;
    gap: 10px;
}

.pda-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 12px;
    background: #fff;
}

.pda-item strong,
.pda-item small {
    display: block;
}

.pda-item small {
    color: var(--muted);
}

.pda-item.finished {
    opacity: 0.62;
}

.print-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 12px;
    background: #fff;
}

.label-sheet {
    display: flex;
    flex-wrap: wrap;
    gap: 2mm;
    align-items: flex-start;
}

.qr-label {
    display: grid;
    grid-template-columns: 1fr 24mm;
    align-items: center;
    width: 50mm;
    height: 30mm;
    overflow: hidden;
    border: 0.2mm solid #111;
    background: #fff;
    break-inside: avoid;
}

.label-batch {
    display: grid;
    align-items: center;
    justify-content: center;
    align-content: center;
    gap: 1mm;
    height: 100%;
    padding: 2mm;
    line-height: 1.2;
    text-align: center;
    overflow-wrap: anywhere;
}

.label-batch strong,
.label-batch small {
    display: block;
    overflow-wrap: anywhere;
}

.label-batch strong {
    font-size: 10pt;
    font-weight: 700;
}

.label-batch small {
    font-size: 7pt;
}

.qr-label img {
    width: 23mm;
    height: 23mm;
    object-fit: contain;
}

@media (max-width: 980px) {
    .admin-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
    }

    .side-nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .metric-grid,
    .content-split,
    .form-grid,
    .report-grid,
    .screen-metrics,
    .screen-grid {
        grid-template-columns: 1fr;
    }

    .analysis-row,
    .screen-section,
    .screen-scan-item {
        grid-template-columns: 1fr;
    }

    .bucket-chart {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        min-height: 0;
    }

    .screen-clock {
        text-align: left;
    }
}

@media print {
    @page {
        margin: 4mm;
    }

    body {
        background: #fff;
    }

    .print-toolbar {
        display: none;
    }

    .pda-shell {
        width: auto;
        margin: 0;
    }

    .label-sheet {
        gap: 0;
    }

    .qr-label {
        page-break-inside: avoid;
    }
}

.section-select-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.section-select-panel {
    display: grid;
    gap: 8px;
}

.section-option {
    min-height: 44px;
    justify-content: flex-start;
}

.section-option.active {
    border-color: var(--primary);
    background: #e8f2ef;
    color: #11473d;
}

.dispatch-mode-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.dispatch-mode-option {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    align-items: flex-start;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px;
    color: var(--text);
    background: #fff;
    cursor: pointer;
}

.dispatch-mode-option input {
    width: 16px;
    min-height: 16px;
    margin: 2px 0 0;
}

.dispatch-mode-option strong,
.dispatch-mode-option small {
    display: block;
}

.dispatch-mode-option small {
    margin-top: 3px;
    color: var(--muted);
}

.dispatch-mode-option.active {
    border-color: var(--primary);
    background: #e8f2ef;
}

.dispatch-mode-option.disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.dispatch-append-panel {
    display: grid;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px;
    background: var(--surface-soft);
}

.dispatch-append-panel[hidden] {
    display: none;
}

.dispatch-selected {
    color: var(--muted);
    font-size: 13px;
}

.dispatch-selected strong {
    color: var(--text);
}

.dispatch-serial-panel {
    padding: 0;
    overflow: hidden;
}

.dispatch-serial-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 12px;
}

.dispatch-serial-card {
    display: grid;
    grid-template-columns: minmax(140px, 1fr) minmax(120px, 0.8fr) minmax(100px, 0.7fr) minmax(140px, 1fr) auto;
    gap: 10px;
    align-items: center;
    border: 1px solid #dce5ec;
    border-radius: 6px;
    padding: 10px;
    background: #fbfdff;
}

.dispatch-serial-card span,
.dispatch-serial-card strong,
.dispatch-serial-card b {
    display: block;
}

.dispatch-serial-card strong,
.dispatch-serial-card b {
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dispatch-serial-card form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.report-range-text {
    margin: 10px 0 0;
    font-size: 13px;
}

.bi-dashboard {
    gap: 12px;
}

.bi-dashboard .dashboard-hero {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    border: 1px solid #233044;
    background:
        linear-gradient(135deg, rgba(20, 31, 42, 0.96), rgba(38, 68, 79, 0.94)),
        repeating-linear-gradient(90deg, rgba(255,255,255,0.05) 0 1px, transparent 1px 80px);
    box-shadow: 0 10px 26px rgba(17, 27, 39, 0.18);
}

.screen-hero-stats {
    display: grid;
    grid-template-columns: repeat(3, auto minmax(72px, 1fr));
    align-items: baseline;
    gap: 4px 10px;
}

.screen-hero-stats strong {
    color: #f7fbff;
    font-size: 28px;
    line-height: 1;
}

.screen-hero-stats span {
    color: #bed0dc;
    font-size: 12px;
}

.bi-dashboard .screen-clock {
    display: grid;
    justify-items: end;
    gap: 2px;
}

.screen-fullscreen-button {
    margin-top: 6px;
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.12);
    color: #f4faff;
}

.screen-fullscreen-button:hover {
    border-color: rgba(255, 255, 255, 0.7);
}

.screen-clock em {
    color: #f0b45c;
    font-size: 12px;
    font-style: normal;
}

.bi-dashboard .screen-metrics {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.bi-dashboard .screen-metrics article {
    position: relative;
    overflow: hidden;
    border: 1px solid #d9e2ea;
    border-radius: 6px;
    min-height: 96px;
    padding: 13px 14px 12px;
    box-shadow: 0 8px 18px rgba(24, 36, 48, 0.05);
}

.bi-dashboard .screen-metrics article::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: #64748b;
}

.bi-dashboard .screen-metrics article[data-tone="blue"]::before { background: #2563eb; }
.bi-dashboard .screen-metrics article[data-tone="green"]::before { background: #16a34a; }
.bi-dashboard .screen-metrics article[data-tone="orange"]::before { background: #ea7a1a; }
.bi-dashboard .screen-metrics article[data-tone="gray"]::before { background: #64748b; }
.bi-dashboard .screen-metrics article[data-tone="purple"]::before { background: #7c3aed; }
.bi-dashboard .screen-metrics article[data-tone="cyan"]::before { background: #0891b2; }
.bi-dashboard .screen-metrics article[data-tone="teal"]::before { background: #0f766e; }

.bi-dashboard .screen-metrics span {
    color: #647384;
    font-weight: 700;
}

.bi-dashboard .screen-metrics strong {
    color: #111d2a;
    font-size: 26px;
}

.bi-dashboard .screen-metrics small {
    display: block;
    margin-top: 6px;
    color: #7a8794;
    font-size: 12px;
}

.bi-dashboard .screen-panel {
    border-color: #dbe4ec;
    box-shadow: 0 8px 18px rgba(24, 36, 48, 0.05);
}

.bi-dashboard .screen-panel-title {
    border-bottom: 1px solid #e6edf3;
    padding-bottom: 8px;
}

.bi-dashboard .screen-panel-title h2 {
    color: #142232;
    font-size: 15px;
}

.bi-dashboard .screen-alert-wrap {
    max-height: 260px;
}

.dashboard-screen {
    display: grid;
    gap: 16px;
}

.dashboard-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 16px;
    border: 1px solid #1e3652;
    border-radius: 8px;
    padding: 18px;
    background: linear-gradient(130deg, #0f1b2d 0%, #162741 48%, #143a51 100%);
    color: #eef7ff;
}

.screen-kicker {
    display: inline-block;
    margin-bottom: 8px;
    color: #8bb6dc;
    font-size: 12px;
}

.dashboard-hero h1 {
    margin-bottom: 10px;
    color: #f4faff;
}

.dashboard-hero p {
    margin-bottom: 0;
    color: #b3cbe0;
}

.screen-clock {
    text-align: right;
}

.screen-clock span {
    display: block;
    color: #9ab8d2;
    font-size: 12px;
}

.screen-clock strong {
    color: #f4faff;
    font-size: 24px;
}

.screen-metrics {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}

.screen-metrics article {
    border: 1px solid #d3dde7;
    border-radius: 6px;
    padding: 12px;
    background: #fff;
}

.screen-metrics span {
    display: block;
    color: #637588;
    font-size: 12px;
}

.screen-metrics strong {
    display: block;
    margin-top: 6px;
    font-size: 24px;
    line-height: 1.15;
    color: #122232;
}

.screen-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 0.7fr) minmax(0, 0.9fr);
    gap: 14px;
}

.screen-panel {
    border: 1px solid #d8e1ea;
    border-radius: 6px;
    padding: 14px;
    background: #fff;
    box-shadow: 0 8px 20px rgba(16, 33, 51, 0.06);
}

.screen-panel-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.screen-panel-title h2 {
    margin-bottom: 0;
    font-size: 16px;
}

.screen-panel-title span {
    color: #6e7f90;
    font-size: 12px;
}

.screen-table table {
    min-width: 860px;
}

.screen-table tbody td b {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #2a4359;
}

.screen-progress {
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
    background: #e6edf4;
}

.screen-progress span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #2668a8, #14a19e);
}

.screen-buckets {
    display: grid;
    gap: 8px;
}

.screen-bucket-item {
    border: 1px solid #dbe4ec;
    border-radius: 6px;
    padding: 10px;
    background: #fbfdff;
}

.screen-bucket-item span {
    display: block;
    color: #6e7f90;
    font-size: 12px;
}

.screen-bucket-item strong {
    display: block;
    margin-top: 2px;
    margin-bottom: 8px;
    color: #152738;
    font-size: 18px;
}

.screen-bucket-item small {
    display: block;
    margin-top: 4px;
    color: #6e7f90;
    font-size: 12px;
}

.screen-scan-list {
    display: grid;
    gap: 8px;
    max-height: 360px;
    overflow: auto;
}

.screen-scan-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 8px;
    border: 1px solid #dbe3ea;
    border-radius: 6px;
    padding: 9px 10px;
}

.screen-scan-item strong,
.screen-scan-item span {
    display: block;
}

.screen-scan-item span,
.screen-scan-item time {
    color: #6e7f90;
    font-size: 12px;
}

.screen-scan-item b {
    min-width: 58px;
    text-align: center;
    border-radius: 999px;
    padding: 2px 10px;
    background: #eef3f7;
    color: #2c4358;
    font-size: 12px;
}

.screen-scan-item.done b {
    background: #e2f4eb;
    color: #1f7a4d;
}

.screen-scan-item.pending b {
    background: #fff1d6;
    color: #a15c07;
}

.screen-empty {
    margin: 8px 0;
    color: var(--muted);
}

@media (max-width: 980px) {
    .screen-metrics,
    .screen-grid,
    .section-select-grid,
    .dispatch-mode-grid,
    .dispatch-serial-grid {
        grid-template-columns: 1fr;
    }

    .app-header {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .app-header-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .app-header-actions {
        margin-left: 0;
    }

    .dispatch-serial-card {
        grid-template-columns: 1fr;
    }

    .dashboard-hero {
        grid-template-columns: 1fr;
    }

    .screen-clock {
        text-align: left;
        justify-items: start;
    }

    .screen-scan-item {
        grid-template-columns: 1fr;
    }
}

.page:has(.one-page-dashboard) {
    width: 100%;
    margin: 0;
    padding: 12px 12px 56px;
}

.one-page-dashboard {
    gap: 10px;
}

.one-page-dashboard .dashboard-hero {
    min-height: 92px;
    padding: 16px 18px;
}

.one-page-dashboard .screen-metrics {
    grid-template-columns: repeat(5, minmax(150px, 1fr));
}

.one-page-dashboard .screen-metrics article {
    min-height: 84px;
    padding: 10px 14px 9px;
}

.one-page-dashboard .screen-metrics strong {
    font-size: 23px;
}

.one-page-dashboard .screen-metrics small {
    margin-top: 4px;
}

.screen-grid-stat {
    grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.85fr) minmax(300px, 0.75fr);
    align-items: stretch;
}

.screen-panel-main {
    min-width: 0;
}

.screen-section-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.screen-section-card {
    display: grid;
    grid-template-columns: minmax(130px, 1fr) minmax(90px, 0.55fr) 48px;
    align-items: center;
    gap: 8px;
    border: 1px solid #dbe4ec;
    border-radius: 6px;
    padding: 9px 10px;
    background: #fbfdff;
}

.screen-section-card span,
.screen-section-card strong,
.screen-section-card small {
    display: block;
}

.screen-section-card span {
    color: #6e7f90;
    font-size: 12px;
}

.screen-section-card strong {
    overflow: hidden;
    color: #152738;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.screen-section-card b {
    color: #15384e;
    font-size: 13px;
    text-align: right;
}

.screen-section-card small {
    grid-column: 1 / -1;
    color: #6e7f90;
    font-size: 12px;
}

.screen-section-running {
    grid-column: 1 / -1;
    display: grid;
    gap: 5px;
    border: 1px solid #c7d8f4;
    border-radius: 6px;
    padding: 7px 8px;
    background: #f5f9ff;
}

.screen-section-running > span {
    color: #255a95;
    font-size: 12px;
    font-weight: 700;
}

.screen-section-running div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
}

.screen-section-running p {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    margin: 0;
}

.screen-section-running strong,
.screen-section-running small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.screen-section-running strong {
    flex: 0 0 auto;
    max-width: 35%;
    color: #123459;
    font-size: 13px;
}

.screen-section-running small {
    flex: 1 1 0;
    min-width: 0;
    color: #526b85;
    font-size: 12px;
    line-height: 1.25;
}

.screen-section-running time,
.screen-section-running em {
    color: #4f6e91;
    font-size: 12px;
    font-style: normal;
    white-space: nowrap;
}

.screen-section-running.empty {
    border-color: #e2e8f0;
    background: #f8fafc;
}

.screen-section-running.empty > span,
.screen-section-running.empty em {
    color: #7a8794;
}

.screen-alert-summary {
    display: grid;
    gap: 10px;
}

.screen-alert-headline {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: end;
    gap: 10px;
    border: 1px solid #f2d2b0;
    border-radius: 6px;
    padding: 12px;
    background: #fff8ef;
}

.screen-alert-headline strong {
    color: #b45309;
    font-size: 36px;
    line-height: 1;
}

.screen-alert-headline span {
    color: #7a4b19;
    font-size: 13px;
}

.screen-alert-cards {
    display: grid;
    gap: 8px;
}

.screen-alert-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px 10px;
    border: 1px solid #efd2a5;
    border-radius: 6px;
    padding: 9px 10px;
    background: #fffaf2;
}

.screen-alert-card.danger {
    border-color: #efb6b6;
    background: #fff5f5;
}

.screen-alert-card span,
.screen-alert-card small,
.screen-alert-card strong {
    display: block;
    min-width: 0;
}

.screen-alert-card span {
    color: #a15c07;
    font-size: 12px;
}

.screen-alert-card.danger span {
    color: #b42318;
}

.screen-alert-card strong {
    overflow: hidden;
    color: #17202a;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.screen-alert-card small {
    overflow: hidden;
    color: #6e7f90;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.screen-alert-card b {
    grid-row: 1 / span 3;
    grid-column: 2;
    align-self: center;
    border-radius: 999px;
    padding: 2px 9px;
    background: #fff1d6;
    color: #a15c07;
    font-size: 12px;
}

.one-page-dashboard:fullscreen {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 10px;
    padding: 14px;
    background: #eef3f7;
}

.one-page-dashboard:fullscreen .dashboard-hero {
    min-height: 86px;
}

.one-page-dashboard:fullscreen .screen-metrics article {
    min-height: 78px;
}

.one-page-dashboard:fullscreen .screen-grid-stat {
    min-height: 0;
}

.one-page-dashboard:fullscreen .screen-panel {
    min-height: 0;
    overflow: hidden;
}

.one-page-dashboard:fullscreen .screen-section-cards,
.one-page-dashboard:fullscreen .screen-alert-cards,
.one-page-dashboard:fullscreen .screen-buckets {
    min-height: 0;
    overflow: hidden;
}

.one-page-dashboard:fullscreen .screen-fullscreen-button {
    border-color: var(--primary);
    background: #fff;
    color: var(--primary);
}

.dashboard-command-view {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 10px;
}

.dashboard-command-hero {
    display: grid;
    grid-template-columns: minmax(340px, 1fr) repeat(3, minmax(118px, 0.18fr)) auto;
    align-items: stretch;
    gap: 10px;
    border: 1px solid #233044;
    border-radius: 8px;
    padding: 12px;
    background:
        linear-gradient(135deg, rgba(20, 31, 42, 0.97), rgba(28, 59, 70, 0.94)),
        repeating-linear-gradient(90deg, rgba(255,255,255,0.04) 0 1px, transparent 1px 72px);
    box-shadow: 0 10px 24px rgba(17, 27, 39, 0.16);
}

.dashboard-command-hero .screen-kicker {
    margin-bottom: 6px;
}

.dashboard-primary-status,
.dashboard-focus-card,
.dashboard-command-hero .screen-clock {
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.07);
}

.dashboard-primary-status {
    display: grid;
    align-content: center;
    min-height: 86px;
    padding: 10px 12px;
}

.dashboard-primary-row {
    display: grid;
    grid-template-columns: auto minmax(180px, 1fr);
    align-items: end;
    gap: 18px;
}

.dashboard-primary-row strong {
    display: block;
    color: #f8fbff;
    font-size: 46px;
    line-height: 0.95;
}

.dashboard-primary-row span,
.dashboard-primary-progress small {
    color: #c3d4df;
}

.dashboard-primary-progress {
    display: grid;
    gap: 8px;
    padding-bottom: 5px;
}

.dashboard-primary-progress .screen-progress {
    height: 10px;
    background: rgba(255, 255, 255, 0.17);
}

.dashboard-focus-card {
    display: grid;
    align-content: center;
    min-height: 86px;
    padding: 9px 11px;
}

.dashboard-focus-card span,
.dashboard-focus-card small {
    color: #c3d4df;
    font-size: 12px;
}

.dashboard-focus-card strong {
    margin: 3px 0;
    color: #fff;
    font-size: 32px;
    line-height: 1;
}

.dashboard-focus-card.alert {
    border-color: rgba(245, 158, 11, 0.45);
    background: rgba(146, 64, 14, 0.28);
}

.dashboard-focus-card.rework {
    border-color: rgba(20, 184, 166, 0.4);
    background: rgba(15, 118, 110, 0.24);
}

.dashboard-command-hero .screen-clock {
    display: grid;
    min-width: 178px;
    align-content: center;
    justify-items: end;
    padding: 9px 10px;
}

.dashboard-command-hero .screen-clock strong {
    font-size: 18px;
}

.dashboard-compact-metrics {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
}

.dashboard-compact-metrics article {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    border: 1px solid #d9e2ea;
    border-radius: 6px;
    min-height: 54px;
    padding: 8px 10px;
    background: #fff;
    box-shadow: 0 6px 14px rgba(24, 36, 48, 0.04);
}

.dashboard-compact-metrics span {
    overflow: hidden;
    color: #637384;
    font-size: 13px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-compact-metrics strong {
    color: #111d2a;
    font-size: 22px;
    line-height: 1;
    white-space: nowrap;
}

.dashboard-main-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(350px, 400px);
    gap: 10px;
    min-height: 0;
}

.dashboard-section-panel,
.dashboard-side-rail {
    min-height: 0;
}

.dashboard-side-rail {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 10px;
}

.dashboard-command-view .screen-panel {
    padding: 11px;
}

.dashboard-command-view .screen-panel-title {
    align-items: center;
    margin-bottom: 8px;
    border-bottom: 1px solid #e6edf3;
    padding-bottom: 7px;
}

.dashboard-command-view .screen-panel-title > div {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.dashboard-command-view .screen-panel-title h2 {
    font-size: 16px;
}

.dashboard-section-panel .screen-section-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.dashboard-command-view .screen-section-card {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px 10px;
    min-height: 126px;
    padding: 9px 10px;
}

.section-card-title {
    min-width: 0;
}

.section-card-counts {
    display: grid;
    min-width: 64px;
    justify-items: end;
}

.section-card-counts b {
    color: #a15c07;
    font-size: 26px;
    line-height: 1;
}

.section-card-counts span {
    color: #7a4b19;
    font-size: 12px;
}

.dashboard-command-view .screen-section-card .screen-progress,
.dashboard-command-view .screen-section-card > small,
.dashboard-command-view .screen-section-running {
    grid-column: 1 / -1;
}

.dashboard-command-view .screen-section-running {
    gap: 4px;
    padding: 6px 7px;
}

.dashboard-command-view .screen-section-running div {
    gap: 6px;
}

.dashboard-command-view .screen-section-running p {
    gap: 8px;
}

.dashboard-command-view .screen-section-running strong {
    max-width: 28%;
}

.dashboard-command-view .screen-section-running > span {
    display: none;
}

.dashboard-command-view .screen-section-card > small:last-child {
    display: none;
}

.dashboard-alert-panel .screen-alert-summary {
    gap: 8px;
}

.dashboard-alert-panel .screen-alert-headline {
    align-items: center;
    padding: 8px 10px;
}

.dashboard-alert-panel .screen-alert-headline strong {
    font-size: 34px;
}

.dashboard-alert-panel .screen-alert-cards {
    gap: 6px;
}

.dashboard-alert-panel .screen-alert-card {
    min-height: 58px;
    padding: 7px 9px;
}

.dashboard-rework-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 8px;
}

.dashboard-rework-summary div {
    border: 1px solid #dbe4ec;
    border-radius: 6px;
    padding: 7px 8px;
    background: #fbfdff;
}

.dashboard-rework-summary span {
    display: block;
    color: #647384;
    font-size: 12px;
}

.dashboard-rework-summary strong {
    display: block;
    margin-top: 3px;
    color: #152738;
    font-size: 22px;
    line-height: 1;
}

.dashboard-mini-lists {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.dashboard-mini-lists h3 {
    margin: 0 0 5px;
    color: #526170;
    font-size: 13px;
}

.rework-stat-list.compact {
    gap: 5px;
}

.rework-stat-list.compact div {
    gap: 6px;
    padding: 6px 7px;
}

.rework-stat-list.compact strong {
    font-size: 12px;
}

.rework-stat-list.compact span {
    min-width: 28px;
    padding: 1px 7px;
    font-size: 12px;
}

.dashboard-bucket-panel .screen-buckets {
    gap: 6px;
}

.dashboard-bucket-panel .screen-bucket-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 4px 8px;
    padding: 7px 8px;
}

.dashboard-bucket-panel .screen-bucket-item strong {
    margin: 0;
    font-size: 18px;
}

.dashboard-bucket-panel .screen-bucket-item .screen-progress,
.dashboard-bucket-panel .screen-bucket-item small {
    grid-column: 1 / -1;
}

.one-page-dashboard:fullscreen.dashboard-command-view {
    grid-template-rows: auto auto minmax(0, 1fr);
}

.one-page-dashboard:fullscreen .dashboard-command-hero {
    min-height: 0;
}

.one-page-dashboard:fullscreen .dashboard-main-layout {
    min-height: 0;
}

.one-page-dashboard:fullscreen .dashboard-section-panel,
.one-page-dashboard:fullscreen .dashboard-side-rail,
.one-page-dashboard:fullscreen .dashboard-side-rail .screen-panel {
    min-height: 0;
    overflow: hidden;
}

@media (min-width: 1760px) {
    .dashboard-section-panel .screen-section-cards {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1360px) {
    .dashboard-command-hero {
        grid-template-columns: minmax(320px, 1fr) repeat(3, minmax(108px, 0.18fr));
    }

    .dashboard-command-hero .screen-clock {
        grid-column: 1 / -1;
        grid-template-columns: repeat(4, auto);
        align-items: center;
        justify-content: end;
        gap: 10px;
    }

    .dashboard-compact-metrics {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1180px) {
    .dashboard-command-hero,
    .dashboard-main-layout,
    .dashboard-side-rail,
    .dashboard-mini-lists {
        grid-template-columns: 1fr;
    }

    .dashboard-command-hero .screen-clock {
        grid-column: auto;
        grid-template-columns: 1fr;
        justify-items: start;
    }

    .dashboard-primary-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .dashboard-compact-metrics,
    .dashboard-rework-summary {
        grid-template-columns: 1fr;
    }

    .dashboard-command-view .screen-section-running p {
        display: grid;
        gap: 2px;
    }

    .dashboard-command-view .screen-section-running strong {
        max-width: 100%;
    }
}

.management-metrics {
    grid-template-columns: repeat(5, minmax(130px, 1fr));
}

.rework-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.rework-stat-list {
    display: grid;
    gap: 8px;
}

.rework-stat-list div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    border: 1px solid #dbe4ec;
    border-radius: 6px;
    padding: 9px 10px;
    background: #fbfdff;
}

.rework-stat-list strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rework-stat-list span {
    min-width: 36px;
    border-radius: 999px;
    padding: 2px 9px;
    background: #eef3f7;
    color: #15384e;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
}

.rework-step-dialog {
    overflow: hidden;
}

.modal-card.rework-step-editor {
    grid-template-rows: auto minmax(0, 1fr) auto;
    max-height: min(780px, calc(100vh - 48px));
    overflow: hidden;
    gap: 0;
    padding: 0;
}

.rework-step-editor > .modal-header,
.rework-step-editor > .modal-footer {
    position: relative;
    z-index: 3;
    padding: 18px;
    background: #fff;
}

.rework-step-editor > .modal-header {
    border-bottom: 1px solid var(--line);
}

.rework-step-editor > .modal-footer {
    border-top: 1px solid var(--line);
    box-shadow: 0 -8px 18px rgba(16, 30, 44, 0.08);
}

.rework-step-footer > [data-rework-step-add] {
    margin-right: auto;
}

.rework-step-list-wrap {
    min-height: 240px;
    overflow: auto;
    overscroll-behavior: contain;
    padding: 14px;
    background: #f4f7f9;
}

.rework-step-list {
    display: grid;
    gap: 12px;
}

.rework-step-item {
    border: 1px solid #d7e1e8;
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 2px 7px rgba(16, 30, 44, 0.04);
    transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

.rework-step-item.is-dragging {
    z-index: 2;
    border-color: var(--primary);
    box-shadow: 0 8px 22px rgba(26, 111, 126, 0.18);
}

.rework-step-item-header {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    border-bottom: 1px solid #e4ebf0;
    padding: 7px 10px;
    background: #f9fbfc;
}

.rework-step-item-header strong {
    color: #203746;
    font-size: 14px;
}

.rework-step-item-header .button {
    margin-left: auto;
}

.rework-step-fields {
    display: grid;
    grid-template-columns: minmax(220px, 2fr) minmax(150px, 1.25fr) 88px 104px 130px;
    gap: 12px;
    padding: 13px;
}

.rework-step-fields label {
    display: grid;
    min-width: 0;
    gap: 5px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.rework-step-fields select,
.rework-step-fields input,
.rework-step-fields textarea {
    width: 100%;
    min-width: 0;
    color: var(--text);
    font-size: 14px;
    font-weight: 400;
}

.rework-step-fields textarea {
    min-height: 64px;
    resize: vertical;
}

.rework-step-remark-field {
    grid-column: 1 / -1;
}

.rework-step-no {
    display: inline-block;
    min-width: 18px;
    font-weight: 700;
}

.rework-step-grip {
    width: 14px;
    height: 18px;
    flex: 0 0 auto;
    background-image: radial-gradient(circle, currentColor 1.5px, transparent 1.7px);
    background-position: 0 0;
    background-size: 7px 6px;
}

body.is-rework-step-dragging {
    cursor: grabbing;
    user-select: none;
}

.row-actions .button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.rework-sort-dialog {
    width: min(660px, 100%);
    overflow: hidden;
}

.modal-card.rework-sort-editor {
    grid-template-rows: auto minmax(0, 1fr) auto;
    max-height: min(760px, calc(100vh - 48px));
    overflow: hidden;
    gap: 0;
    padding: 0;
}

.rework-sort-editor > .modal-header,
.rework-sort-editor > .modal-footer {
    position: relative;
    z-index: 3;
    padding: 18px;
    background: #fff;
}

.rework-sort-editor > .modal-header {
    border-bottom: 1px solid var(--line);
}

.rework-sort-editor > .modal-footer {
    border-top: 1px solid var(--line);
    box-shadow: 0 -8px 18px rgba(16, 30, 44, 0.08);
}

.rework-sort-list-wrap {
    min-height: 240px;
    overflow: auto;
    overscroll-behavior: contain;
    padding: 14px;
    background: #f4f7f9;
}

.rework-sort-list {
    display: grid;
    gap: 9px;
}

.rework-sort-item {
    position: relative;
    border: 1px solid #d5e0e7;
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 2px 7px rgba(16, 30, 44, 0.05);
    will-change: transform;
}

.rework-sort-handle {
    display: grid;
    width: 100%;
    min-height: 56px;
    grid-template-columns: 36px 18px minmax(0, 1fr);
    align-items: center;
    gap: 11px;
    border: 0;
    border-radius: 6px;
    padding: 8px 14px;
    background: transparent;
    color: #253a48;
    cursor: grab;
    text-align: left;
    touch-action: none;
}

.rework-sort-handle:hover,
.rework-sort-handle:focus-visible {
    background: #f4fafb;
    color: var(--primary);
    outline: 2px solid rgba(26, 111, 126, 0.22);
    outline-offset: -2px;
}

.rework-sort-handle strong {
    overflow: hidden;
    font-size: 15px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rework-sort-index {
    display: inline-grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 4px;
    background: #e9f0f4;
    color: #314b5c;
    font-weight: 800;
}

.rework-sort-item.is-dragging {
    pointer-events: none;
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 18px 42px rgba(16, 30, 44, 0.24);
    opacity: 0.97;
}

.rework-sort-item.is-dragging .rework-sort-handle {
    cursor: grabbing;
}

.rework-sort-placeholder {
    position: relative;
    min-height: 56px;
    border: 2px dashed #4c95a3;
    border-radius: 6px;
    background: #eaf5f7;
    animation: rework-sort-placeholder-pulse 0.9s ease-in-out infinite alternate;
}

.rework-sort-placeholder::after {
    content: "放置位置";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #3a7884;
    font-size: 13px;
    font-weight: 700;
}

@keyframes rework-sort-placeholder-pulse {
    from {
        border-color: #77aeb8;
        background: #eff8f9;
    }

    to {
        border-color: #277c8d;
        background: #e2f2f5;
    }
}

@media (prefers-reduced-motion: reduce) {
    .rework-sort-placeholder {
        animation: none;
    }
}

@media (max-width: 980px) {
    .rework-step-fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .rework-step-operation-field,
    .rework-step-section-field,
    .rework-step-remark-field {
        grid-column: 1 / -1;
    }
}

@media (max-width: 620px) {
    .rework-step-editor > .modal-header,
    .rework-step-editor > .modal-footer,
    .rework-sort-editor > .modal-header,
    .rework-sort-editor > .modal-footer {
        padding: 12px;
    }

    .rework-step-list-wrap,
    .rework-sort-list-wrap {
        padding: 10px;
    }

    .rework-step-fields {
        grid-template-columns: minmax(0, 1fr);
        padding: 10px;
    }

    .rework-step-fields > label {
        grid-column: 1;
    }

    .rework-step-footer {
        flex-wrap: wrap;
    }

    .rework-step-footer > [data-rework-step-add] {
        width: 100%;
        margin-right: 0;
    }
}

.rework-stepper {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.rework-stepper article {
    display: grid;
    gap: 5px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 11px;
    background: #fbfdff;
}

.rework-stepper b {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: #e8edf3;
    color: #415365;
}

.rework-stepper article.done {
    border-color: #b8dfc7;
    background: #f0fbf4;
}

.rework-stepper article.done b {
    background: #1f7a4d;
    color: #fff;
}

.rework-stepper article.active {
    border-color: #e6b56d;
    background: #fff8eb;
}

.rework-stepper article.active b {
    background: #a15c07;
    color: #fff;
}

.rework-stepper strong,
.rework-stepper span,
.rework-stepper small {
    display: block;
}

.rework-stepper span,
.rework-stepper small {
    color: var(--muted);
    font-size: 12px;
}

.engineering-print-body {
    margin: 0;
    background: #e9edf2;
    color: #000;
    font-family: "SimSun", "Microsoft YaHei", Arial, sans-serif;
}

.engineering-toolbar {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 12px;
}

.engineering-form-page {
    width: 210mm;
    min-height: 297mm;
    margin: 0 auto 24px;
    padding: 8mm;
    background: #fff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

.engineering-form-table {
    width: 100%;
    table-layout: fixed;
    border: 2px solid #000;
    border-collapse: collapse;
    color: #000;
    font-size: 10pt;
}

.engineering-form-table td,
.engineering-form-table th {
    position: static;
    height: 8.5mm;
    border: 1px solid #000;
    padding: 1.5mm 2mm;
    text-align: center;
    vertical-align: middle;
    word-break: break-word;
}

.engineering-title-cell {
    height: 18mm;
    font-size: 26pt;
    font-weight: 700;
    letter-spacing: 8px;
}

.approval-cell {
    height: 8mm;
    font-weight: 700;
}

.approval-sign {
    height: 12mm;
}

.form-label {
    width: 18mm;
    background: #f5f5f5;
    font-weight: 700;
}

.engineering-barcode {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 20mm;
}

.engineering-barcode-svg {
    width: 70mm;
    height: 22mm;
}

.process-head td {
    height: 7mm;
    background: #f5f5f5;
    font-weight: 700;
}

.process-row td {
    height: 9mm;
}

.engineering-notice,
.engineering-remark {
    text-align: left;
    line-height: 1.5;
}

.engineering-screw {
    font-size: 13pt;
    font-weight: 700;
}

.dispatch-print-page {
    page-break-before: always;
}

.dispatch-print-table .engineering-title-cell {
    height: 20mm;
}

.dispatch-barcode {
    min-height: 32mm;
}

.dispatch-barcode .engineering-barcode-svg {
    width: 95mm;
    height: 30mm;
}

@media print {
    @page {
        size: A4 portrait;
        margin: 6mm;
    }

    .engineering-print-body {
        background: #fff;
    }

    .engineering-toolbar,
    .print-toolbar {
        display: none !important;
    }

    .engineering-form-page {
        width: auto;
        min-height: 0;
        margin: 0;
        padding: 0;
        box-shadow: none;
    }

    .dispatch-print-page {
        page-break-before: always;
    }

    .engineering-form-table {
        page-break-inside: avoid;
        font-size: 9pt;
    }

    .engineering-form-table tr {
        page-break-inside: avoid;
    }

    .engineering-title-cell {
        font-size: 24pt;
    }

    .engineering-barcode-svg {
        width: 68mm;
        height: 21mm;
    }
}

@media (max-width: 1200px) {
    .one-page-dashboard .screen-metrics,
    .screen-grid-stat,
    .screen-section-cards,
    .management-metrics,
    .rework-dashboard-grid {
        grid-template-columns: 1fr;
    }

    .screen-section-card,
    .screen-alert-card {
        grid-template-columns: 1fr;
    }

    .screen-alert-card b {
        grid-row: auto;
        grid-column: auto;
        justify-self: start;
    }
}

@media (max-width: 1100px) {
    .number-rule-guide,
    .number-rule-editor,
    .number-sequence-summary,
    .number-rule-facts,
    .number-rule-row-editor,
    .workorder-add-grid {
        grid-template-columns: 1fr;
    }

    .number-sequence-form {
        grid-template-columns: 1fr;
    }

    .number-rule-card-head {
        grid-template-columns: 1fr auto;
    }

    .number-rule-card-head .badge {
        justify-self: start;
    }
}

@media (max-width: 760px) {
    .page,
    .page:has(.one-page-dashboard) {
        width: 100%;
        padding: 12px 10px 40px;
    }

    .app-header {
        padding: 10px 12px;
    }

    .app-header-actions,
    .logout-form,
    .section-title-row,
    .table-toolbar,
    .print-toolbar,
    .pda-title,
    .workorder-query-panel {
        width: 100%;
        align-items: stretch;
        flex-direction: column;
    }

    .app-header-actions .button,
    .logout-form .button,
    .section-title-row .button,
    .table-toolbar .button,
    .print-toolbar .button,
    .workorder-query-panel .button {
        width: 100%;
    }

    .side-nav {
        grid-template-columns: 1fr;
    }

    .inline-form > input,
    .inline-form > select,
    .workorder-search-form > input[name="q"] {
        width: 100%;
        min-width: 0;
        flex: 1 1 100%;
    }

    .employee-card-batch-controls {
        width: 100%;
        flex-direction: row;
        align-items: center;
    }

    .employee-card-batch-controls input[name="cardTitle"] {
        width: min(100%, 160px);
        flex: 1 1 160px;
    }

    .employee-card-batch-controls select {
        width: 120px;
        flex: 0 0 120px;
    }

    .employee-card-batch-controls .button {
        width: auto;
        flex: 0 0 auto;
    }

    .form-grid,
    .workorder-add-grid,
    .section-select-grid,
    .dispatch-mode-grid,
    .permission-grid,
    .detail-grid,
    .pda-actions,
    .dispatch-serial-grid,
    .number-rule-group {
        grid-template-columns: 1fr;
    }

    .modal {
        padding: 12px;
    }

    .modal-card,
    .panel,
    .pda-panel {
        padding: 12px;
    }

    .number-rule-card-list {
        padding: 10px;
    }

    .number-rule-card-head {
        grid-template-columns: 1fr;
    }

    .number-rule-card-actions {
        justify-content: stretch;
    }

    .number-rule-card-actions > *,
    .number-rule-card-actions .button,
    .number-rule-card-actions form,
    .number-rule-edit-details {
        width: 100%;
    }

    .number-rule-row-editor {
        padding: 10px;
    }
}

@media (max-width: 1080px) {
    .dashboard-command-view .dashboard-section-panel .screen-section-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .dashboard-command-view .screen-section-card {
        grid-template-columns: minmax(0, 1fr) auto !important;
    }
}
