:root {
    --page-bg: #f5f5f7;
    --surface: #ffffff;
    --surface-muted: #fbfbfd;
    --border: #d8d8dc;
    --border-strong: #c6c6cc;
    --text: #1d1d1f;
    --text-muted: #6e6e73;
    --brand: #0071e3;
    --brand-hover: #0067d1;
    --brand-soft: #e8f2ff;
    --ink: #1d1d1f;
    --table-head: #fbfbfd;
    --notice-bg: #fffdf5;
    --notice-border: #e9dfc5;
    --shadow: 0 14px 34px rgba(0, 0, 0, 0.045);
    --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.04);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--page-bg);
}

body {
    margin: 0;
    min-height: 100vh;
    padding: 44px 18px 64px;
    background:
        linear-gradient(180deg, #ffffff 0%, var(--page-bg) 280px),
        var(--page-bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;
    font-size: 16px;
    line-height: 1.55;
}

a {
    color: var(--brand);
}

.page {
    width: min(100%, 1060px);
    margin: 0 auto;
}

.page-header {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.back-link {
    display: inline-block;
    margin-bottom: 16px;
    color: var(--text-muted);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
}

.back-link::before {
    content: "< ";
}

.back-link:hover {
    color: var(--text);
}

h1,
h2,
h3,
h4 {
    margin: 0;
    color: var(--text);
    line-height: 1.25;
    letter-spacing: 0;
}

h1 {
    color: var(--text);
    font-size: 40px;
    font-weight: 700;
}

h2 {
    font-size: 21px;
    font-weight: 700;
}

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

.panel {
    padding: 22px;
    margin: 24px 0;
}

.panel-accent {
    background: var(--surface);
    border-color: var(--border);
}

.section {
    padding: 22px;
    margin-top: 14px;
}

.section h2 {
    margin-bottom: 18px;
    color: var(--text);
    padding-bottom: 13px;
    border-bottom: 1px solid var(--border);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    align-items: end;
}

.form-row {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto;
    gap: 14px;
    align-items: end;
}

.form-row + .form-row {
    margin-top: 16px;
}

.lookup-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    align-items: end;
    margin-top: 16px;
}

.field label {
    display: block;
    margin-bottom: 7px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
}

.field-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 7px;
}

.field-label-row label {
    margin-bottom: 0;
}

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

.field-voice-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    min-width: 36px;
    min-height: 36px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.86);
    color: var(--text);
    font: inherit;
    font-size: 15px;
    cursor: pointer;
    box-shadow: var(--shadow-soft);
}

.field-voice-button:hover {
    background: #fff;
}

.field-voice-button.is-recording {
    border-color: #b42318;
    color: #b42318;
}

.field-voice-button.is-playing {
    border-color: var(--text);
    background: var(--surface-muted);
}

.field-voice-status {
    min-height: 20px;
    margin: 6px 0 0;
    color: var(--text-muted);
    font-size: 13px;
}

input,
select,
textarea {
    width: 100%;
    min-height: 48px;
    padding: 10px 13px;
    border: 1px solid #cfcfd4;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--text);
    font: inherit;
}

input[type="radio"],
input[type="checkbox"] {
    width: auto;
    min-height: 0;
    padding: 0;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--brand);
    outline: 3px solid rgba(0, 113, 227, 0.14);
    outline-offset: 1px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 10px 19px;
    border: 1px solid #cfcfd4;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text);
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.button:hover {
    background: #f5f5f7;
    border-color: #b8b8bf;
    color: var(--text);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.button-small {
    min-height: 40px;
    padding: 8px 12px;
    font-size: 14px;
}

.button-danger {
    border-color: #d8b8b4;
    background: #fffafa;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
}

.status-muted {
    color: var(--text-muted);
    background: var(--surface-muted);
}

.record-cancelled {
    color: var(--text-muted);
}

.record-cancelled td {
    background: rgba(248, 248, 250, 0.72);
}

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

.button-secondary {
    align-self: flex-end;
    border-color: var(--border);
    background: #fff;
    color: var(--text);
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.form-divider {
    height: 1px;
    margin: 22px 0;
    background: var(--border);
}

.checkbox-cell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.checkbox-cell input {
    width: 18px;
    height: 18px;
    margin: 0;
}

.permission-role-list {
    display: grid;
    gap: 16px;
}

.permission-role-block {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}

.permission-role-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.permission-role-header h3 {
    font-size: 18px;
}

.permission-page-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0;
}

.permission-page-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 28px;
    gap: 12px;
    align-items: center;
    min-height: 64px;
    padding: 12px 14px;
    border-right: 1px solid var(--border);
}

.permission-page-row:nth-child(odd) {
    background: var(--surface-muted);
}

.permission-page-row input {
    width: 18px;
    height: 18px;
    justify-self: center;
}

.permission-page-row .muted {
    display: block;
    margin-top: 2px;
    font-size: 13px;
}

.permission-fixed-note {
    display: inline-flex;
    margin-top: 7px;
    padding: 2px 8px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
}

.hint {
    margin: 14px 0 0;
    color: var(--text-muted);
}

.hint-list {
    margin: 0;
    padding-left: 20px;
    color: var(--text-muted);
}

.hint-list li + li {
    margin-top: 8px;
}

.notice {
    margin: 14px 0;
    padding: 14px 16px;
    border: 1px solid var(--notice-border);
    border-radius: 8px;
    background: var(--notice-bg);
    color: var(--text-muted);
}

.order-list {
    display: grid;
    gap: 14px;
}

.order-card {
    padding: 18px;
}

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

.order-title-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}

.order-meta {
    color: var(--text-muted);
    font-size: 14px;
}

.order-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 700;
}

.status-active {
    background: #fff;
}

.status-due-soon {
    border-color: #d8c9a8;
    background: #fff8e8;
    color: #6f5b24;
}

.status-overdue {
    border-color: #e4b9b9;
    background: #fff1f1;
    color: #8a2f2f;
}

.status-complete {
    border-color: #c9d3c7;
    background: #f3f8f2;
    color: #3e6542;
}

.status-ready,
.status-partial {
    border-color: #b9cce0;
    background: #f2f7fc;
    color: #315d82;
}

.status-restock {
    border-color: #dfc39d;
    background: #fff7eb;
    color: #7a5422;
}

.status-closed {
    border-color: #c8c8ce;
    background: #f2f2f4;
    color: #55555b;
}

.status-cancelled {
    border-color: #d6c8c8;
    background: #f7f2f2;
    color: #765050;
}

.status-counts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--text-muted);
    font-size: 14px;
}

.status-chip {
    padding: 5px 9px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-muted);
}

.status-chip-warning {
    border-color: #dfc39d;
    background: #fff7eb;
    color: #7a5422;
}

.order-card-actions,
.order-detail-heading,
.order-detail-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.order-card-actions {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.batch-confirm-form {
    margin-top: 18px;
}

.confirm-dialog {
    width: min(560px, calc(100vw - 32px));
    max-height: min(720px, calc(100vh - 32px));
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.18);
}

.confirm-dialog::backdrop {
    background: rgba(29, 29, 31, 0.28);
}

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

.confirm-dialog-header {
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border);
}

.confirm-dialog-header h3 {
    margin: 0;
    font-size: 20px;
}

.confirm-dialog-note {
    margin: 0;
    padding: 14px 20px 0;
    color: var(--text-muted);
}

.confirm-summary-list {
    display: grid;
    gap: 10px;
    padding: 14px 20px 4px;
}

.confirm-summary-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 14px;
    align-items: center;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-muted);
}

.confirm-summary-main,
.confirm-summary-detail {
    min-width: 0;
}

.confirm-summary-main {
    font-weight: 700;
}

.confirm-summary-detail {
    grid-column: 1 / -1;
    color: var(--text-muted);
    font-size: 14px;
}

.confirm-dialog-actions {
    justify-content: flex-end;
    margin: 0;
    padding: 16px 20px 20px;
}

.batch-issues {
    margin-top: 18px;
    padding: 14px 16px;
    border: 1px solid var(--notice-border);
    border-radius: 8px;
    background: var(--notice-bg);
    color: var(--text-muted);
}

.batch-issues ul {
    margin: 8px 0 0;
    padding-left: 20px;
}

.order-detail-heading {
    align-items: flex-end;
}

.order-detail-heading h1 {
    margin-bottom: 6px;
}

.order-detail-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.status-reason {
    max-width: 440px;
    margin: 0;
    color: var(--text-muted);
    text-align: right;
}

.lifecycle-form {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) auto;
    align-items: end;
    gap: 14px;
}

.assignment-block {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

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

.assignment-header h4 {
    margin: 0;
    font-size: 17px;
}

.assignment-form {
    display: grid;
    grid-template-columns: minmax(150px, 0.8fr) minmax(100px, 0.45fr) minmax(180px, 1fr) auto;
    gap: 12px;
    align-items: end;
    margin-bottom: 14px;
}

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

.assignment-card {
    display: grid;
    grid-template-columns: minmax(180px, 0.45fr) minmax(0, 1fr);
    align-items: center;
    gap: 14px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-muted);
}

.assignment-card p {
    margin: 4px 0 0;
}

.worker-assignment-card {
    grid-template-columns: minmax(220px, 0.45fr) minmax(0, 1fr);
}

.worker-assignment-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 12px;
}

.model-card-list {
    display: grid;
    gap: 14px;
}

.model-card {
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

.model-card-header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

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

.part-status-row {
    display: grid;
    grid-template-columns: minmax(80px, 1fr) minmax(120px, 1.2fr);
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-muted);
}

.part-status-row select {
    min-height: 40px;
}

.part-status-row .delete-option {
    color: #8a2f2f;
}

.part-name {
    font-weight: 700;
}

.add-part-row {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(150px, 0.8fr) auto;
    align-items: end;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(29, 29, 31, 0.38);
}

.modal-toggle {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.modal-toggle:not(:checked) ~ .modal-backdrop {
    display: none;
}

.modal-card {
    width: min(100%, 680px);
    max-height: min(760px, 92vh);
    overflow: auto;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.18);
}

.part-check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin: 16px 0;
}

.part-check-grid .check-option {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-muted);
    font-weight: 600;
}

.home-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
}

.home-subtitle {
    margin: 10px 0 0;
    color: var(--text-muted);
}

.home-account {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.home-user {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
}

.notification-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--text);
    text-decoration: none;
}

.notification-link span {
    min-width: 22px;
    min-height: 22px;
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--text);
    color: #fff;
    font-size: 12px;
    text-align: center;
}

.logout-link {
    color: var(--text-muted);
    text-decoration: none;
}

.logout-link:hover {
    color: var(--text);
}

.login-body {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 24px;
}

.login-shell {
    width: min(100%, 420px);
}

.login-card {
    padding: 30px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.login-header {
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

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

.login-header p {
    margin: 8px 0 0;
    color: var(--text-muted);
}

.login-form {
    display: grid;
    gap: 14px;
}

.login-button {
    width: 100%;
}

.login-error {
    margin: 0;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
    margin-top: 24px;
}

.menu-section {
    padding: 18px;
}

.menu-section h2 {
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
    font-size: 18px;
}

.menu-links {
    display: grid;
    gap: 8px;
}

.menu-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    padding: 9px 12px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
}

.menu-link::after {
    content: ">";
    color: var(--text-muted);
    font-weight: 600;
}

.menu-link:hover {
    border-color: var(--border);
    background: var(--surface-muted);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
    margin-top: 24px;
}

.dashboard-card {
    display: flex;
    min-height: 230px;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    box-shadow: var(--shadow);
}

.dashboard-card:hover {
    border-color: var(--border-strong);
    background: var(--surface-muted);
}

.dashboard-label {
    width: fit-content;
    margin-bottom: 18px;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 700;
}

.dashboard-card h2 {
    margin-bottom: 10px;
    padding-bottom: 0;
    border-bottom: 0;
}

.dashboard-card p {
    margin: 0;
    color: var(--text-muted);
    font-size: 15px;
}

.dashboard-action {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 24px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    color: var(--text);
    font-weight: 700;
}

.dashboard-action::after {
    content: ">";
    color: var(--text-muted);
}

.report-filter-form {
    display: grid;
    grid-template-columns: 1.1fr 1fr 1fr auto;
    gap: 14px;
    align-items: end;
}

.report-copy {
    min-height: 300px;
    resize: vertical;
    white-space: pre-wrap;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 14px;
    line-height: 1.7;
}

.report-grid,
.health-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 14px;
}

.report-card,
.health-card {
    min-width: 0;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}

.report-card h2,
.health-card h2 {
    margin-bottom: 14px;
}

.report-subblocks {
    display: grid;
    gap: 16px;
    margin-top: 18px;
}

.report-subblocks h3 {
    margin-bottom: 8px;
    font-size: 16px;
}

.report-line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin: 8px 0;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-muted);
}

.report-line span {
    overflow-wrap: anywhere;
}

.report-large-number {
    margin: 0 0 16px;
    font-size: 34px;
    font-weight: 700;
}

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

.compact-stat-grid div {
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-muted);
}

.compact-stat-grid span,
.key-value-list dt {
    display: block;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 700;
}

.compact-stat-grid strong {
    display: block;
    margin-top: 4px;
    font-size: 20px;
}

.key-value-list {
    display: grid;
    grid-template-columns: minmax(90px, 0.7fr) minmax(0, 1.3fr);
    gap: 10px 14px;
    margin: 0;
}

.key-value-list dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.compact-list {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.compact-list a,
.compact-list span {
    display: grid;
    gap: 3px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-muted);
    color: var(--text);
    text-decoration: none;
}

.compact-list a:hover {
    border-color: var(--border-strong);
    background: #fff;
}

.compact-list span span,
.compact-list a span {
    color: var(--text-muted);
    font-size: 14px;
}

.health-status-row {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.health-issue-list {
    display: grid;
    gap: 12px;
}

.health-issue {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-muted);
}

.metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px;
    margin: 22px 0;
}

.metric {
    padding: 18px;
    border-top: 0;
    box-shadow: none;
}

.metric-label {
    margin-bottom: 7px;
    color: var(--text-muted);
    font-size: 14px;
}

.metric-value {
    font-size: 20px;
    font-weight: 700;
}

.table-wrap {
    overflow-x: auto;
}

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

.inline-form input,
.inline-form select {
    min-width: 130px;
    min-height: 40px;
}

.table-tools {
    display: flex;
    align-items: end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
}

.search-field {
    flex: 1;
    min-width: 220px;
    margin-bottom: 0;
}

.order-filter-form {
    display: flex;
    align-items: end;
    flex: 1;
    flex-wrap: wrap;
    gap: 12px;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

th,
td {
    padding: 13px 15px;
    border: 0;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

tr:last-child th,
tr:last-child td {
    border-bottom: 0;
}

th {
    background: var(--table-head);
    font-weight: 700;
    color: var(--text-muted);
}

.stock-summary-table th,
.stock-summary-table td {
    padding: 12px 10px;
    text-align: center;
    vertical-align: middle;
}

.stock-summary-table {
    min-width: 980px;
    table-layout: fixed;
}

.stock-summary-table thead tr:nth-child(2) th:first-child,
.stock-summary-table thead tr:nth-child(2) th:nth-child(2),
.stock-summary-table td:first-child,
.stock-summary-table td:nth-child(2) {
    text-align: left;
}

.stock-summary-table thead .stock-group-head {
    text-align: center;
}

.stock-summary-table thead tr:nth-child(2) th:first-child,
.stock-summary-table td:first-child {
    width: 86px;
    white-space: nowrap;
}

.stock-summary-table thead tr:nth-child(2) th:nth-child(2),
.stock-summary-table td:nth-child(2) {
    width: 96px;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.stock-summary-table .stock-group-head {
    color: var(--text);
    background: var(--surface-muted);
    border-left: 1px solid var(--border);
    border-bottom-color: var(--border-strong);
}

.stock-summary-table .stock-group-head:first-child {
    border-left: 0;
}

.stock-summary-table thead tr:last-child th {
    border-bottom: 1px solid var(--border);
}

.stock-summary-table thead tr:nth-child(2) th:nth-child(3),
.stock-summary-table thead tr:nth-child(2) th:nth-child(8),
.stock-summary-table thead tr:nth-child(2) th:nth-child(13),
.stock-summary-table tbody td:nth-child(3),
.stock-summary-table tbody td:nth-child(8),
.stock-summary-table tbody td:nth-child(13) {
    border-left: 1px solid var(--border);
}

.stock-summary-table thead tr:nth-child(2) th:nth-child(7),
.stock-summary-table thead tr:nth-child(2) th:nth-child(12),
.stock-summary-table thead tr:nth-child(2) th:nth-child(17),
.stock-summary-table tbody td:nth-child(7),
.stock-summary-table tbody td:nth-child(12),
.stock-summary-table tbody td:nth-child(17) {
    background: color-mix(in srgb, var(--surface-muted) 68%, transparent);
}

.return-record-table .inline-control,
.inline-action-form .inline-control {
    min-height: 34px;
    padding: 5px 7px;
    border-color: transparent;
    border-radius: 6px;
    background: transparent;
    box-shadow: none;
}

.return-record-table .inline-control:hover,
.return-record-table .inline-control:focus,
.inline-action-form .inline-control:hover,
.inline-action-form .inline-control:focus {
    border-color: var(--border);
    background: var(--surface-muted);
    outline: none;
}

.return-record-table .button-small,
.inline-action-form .button-small {
    min-height: 34px;
    padding: 5px 10px;
    box-shadow: none;
    white-space: nowrap;
    word-break: keep-all;
    flex: 0 0 auto;
}

.inline-action-form .inline-control {
    min-width: 86px;
    width: 96px;
    flex: 0 0 96px;
}

.assistant-widget {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 1000;
    color: var(--text);
    font-family: inherit;
}

.assistant-launcher {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.94);
    color: var(--text);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(12px);
    letter-spacing: 0;
}

.assistant-panel {
    display: none;
    width: min(360px, calc(100vw - 32px));
    height: 430px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.16);
    backdrop-filter: blur(16px);
}

.assistant-open .assistant-launcher {
    display: none;
}

.assistant-open .assistant-panel {
    display: grid;
    grid-template-rows: auto 1fr auto auto;
}

.assistant-large .assistant-panel {
    width: min(520px, calc(100vw - 32px));
    height: min(620px, calc(100vh - 48px));
}

.assistant-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 14px;
    border-bottom: 1px solid var(--border);
    user-select: none;
}

.assistant-header strong,
.assistant-header span {
    display: block;
}

.assistant-header span {
    color: var(--text-muted);
    font-size: 13px;
}

.assistant-actions {
    display: flex;
    gap: 6px;
}

.assistant-actions button {
    width: 30px;
    height: 30px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.assistant-messages {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    overflow-y: auto;
    background: linear-gradient(180deg, #fff, var(--surface-muted));
}

.assistant-message {
    position: relative;
    max-width: 88%;
    padding: 10px 12px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    white-space: pre-wrap;
    font-size: 14px;
    line-height: 1.5;
}

.assistant-message-bot {
    align-self: flex-start;
    background: #fff;
}

.assistant-message-user {
    align-self: flex-end;
    background: var(--text);
    color: #fff;
    border-color: var(--text);
}

.assistant-related-pages,
.assistant-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.assistant-related-pages {
    margin-top: 8px;
    padding-right: 24px;
}

.assistant-related-pages a,
.assistant-quick-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 5px 9px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: var(--text);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 5px 14px rgba(15, 23, 42, 0.06);
}

.assistant-related-pages a:hover,
.assistant-quick-actions button:hover {
    border-color: var(--text-muted);
}

.assistant-quick-actions {
    padding: 8px 12px 10px;
    border-top: 1px solid var(--border);
    background: #fff;
}

.assistant-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--border);
    background: #fff;
}

.assistant-form textarea {
    min-height: 44px;
    max-height: 120px;
    resize: vertical;
}

.assistant-form-actions {
    display: flex;
    align-items: stretch;
    gap: 6px;
}

.assistant-form button {
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-soft);
}

.assistant-form .assistant-icon-button {
    width: 44px;
    min-width: 44px;
    padding: 0;
    font-size: 16px;
}

.assistant-icon-button.assistant-active {
    border-color: var(--text);
    background: var(--surface-muted);
}

.assistant-icon-button.assistant-recording {
    border-color: #b42318;
    color: #b42318;
}

.assistant-form button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.assistant-speak-button {
    position: absolute;
    right: 8px;
    bottom: -11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: var(--text-muted);
    font: inherit;
    font-size: 11px;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.assistant-speak-button:hover {
    color: var(--text);
}

.assistant-speak-button.assistant-speaking {
    border-color: var(--text);
    color: var(--text);
}

@media (max-width: 640px) {
    .assistant-widget {
        right: 12px;
        bottom: 12px;
    }

    .assistant-open .assistant-panel {
        width: calc(100vw - 24px);
        height: min(520px, calc(100vh - 24px));
    }
}

.photo-thumb {
    max-width: 120px;
    max-height: 120px;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.model-photo-thumb {
    display: block;
    width: 92px;
    height: 68px;
    object-fit: cover;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-muted);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.model-photo-preview {
    display: block;
    width: 160px;
    height: 118px;
    margin-top: 16px;
    object-fit: cover;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-muted);
}

.model-data-table th,
.model-data-table td {
    vertical-align: middle;
}

.model-data-table .button-small {
    white-space: nowrap;
}

@media (max-width: 760px) {
    body {
        padding: 24px 10px 88px;
        font-size: 16px;
        background:
            linear-gradient(180deg, #ffffff 0%, var(--page-bg) 220px),
            var(--page-bg);
    }

    .page {
        width: 100%;
    }

    .page-header {
        margin-bottom: 18px;
        padding-bottom: 18px;
    }

    .back-link {
        margin-bottom: 12px;
    }

    h1 {
        font-size: 31px;
    }

    h2 {
        font-size: 20px;
    }

    .panel,
    .section {
        padding: 15px;
        margin-top: 12px;
        border-radius: 8px;
        box-shadow: 0 8px 22px rgba(0, 0, 0, 0.035);
    }

    .section h2 {
        margin-bottom: 14px;
        padding-bottom: 11px;
    }

    .form-grid,
    .lookup-row,
    .form-row,
    .order-filter-form,
    .report-filter-form,
    .assignment-form,
    .lifecycle-form {
        display: grid;
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .field {
        min-width: 0;
    }

    input,
    select,
    textarea,
    .button {
        min-height: 50px;
        font-size: 16px;
    }

    .button-row {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .button-row .button,
    .form-row .button,
    .table-tools .button {
        width: 100%;
    }

    .section-title-row,
    .notification-title-row,
    .rule-card-header,
    .notification-card {
        display: grid;
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .notification-card .button,
    .section-title-row .button {
        width: 100%;
    }

    .button-secondary {
        align-self: stretch;
    }

    .check-option {
        width: 100%;
        min-height: 46px;
        padding: 10px 12px;
        border: 1px solid var(--border);
        border-radius: 8px;
        background: var(--surface-muted);
    }

    input[type="file"] {
        padding: 10px;
    }

    textarea#rfid_code {
        min-height: 150px;
    }

    .confirm-dialog {
        width: calc(100vw - 20px);
    }

    .confirm-dialog-header {
        display: grid;
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .confirm-dialog-header .button {
        width: 100%;
    }

    .confirm-summary-item {
        grid-template-columns: 1fr;
    }

    .report-copy {
        min-height: 220px;
    }

    .metrics {
        grid-template-columns: 1fr;
        gap: 10px;
        margin: 16px 0;
    }

    .report-grid,
    .health-grid {
        grid-template-columns: 1fr;
    }

    .key-value-list {
        grid-template-columns: 1fr;
    }

    .metric {
        padding: 15px;
    }

    .metric-value {
        font-size: 19px;
        overflow-wrap: anywhere;
    }

    .table-tools {
        display: grid;
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .search-field {
        min-width: 0;
    }

    .table-wrap {
        margin-right: -6px;
        padding-bottom: 4px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table-wrap table:has(tr:first-child th:nth-child(3)) {
        min-width: 620px;
    }

    .table-wrap table:has(tr:first-child th:nth-child(5)) {
        min-width: 760px;
    }

    .model-data-wrap {
        margin-right: 0;
        padding-bottom: 0;
        overflow-x: visible;
    }

    .model-data-wrap .model-data-table {
        display: block;
        width: 100%;
        min-width: 0 !important;
        border: 0;
        background: transparent;
    }

    .model-data-wrap .model-data-table tbody {
        display: block;
        width: 100%;
    }

    .model-data-wrap .model-data-table tr:first-child {
        display: none;
    }

    .model-data-wrap .model-data-table tr[data-model-row] {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
        width: 100%;
        max-width: 100%;
        margin-bottom: 12px;
        padding: 14px;
        overflow: hidden;
        border: 1px solid var(--border);
        border-radius: 8px;
        background: var(--surface);
        box-shadow: var(--shadow);
    }

    .model-data-wrap .model-data-table td {
        display: grid;
        grid-template-columns: 84px minmax(0, 1fr);
        gap: 10px;
        align-items: center;
        width: 100%;
        min-width: 0;
        padding: 0;
        border-bottom: 0;
        overflow-wrap: anywhere;
    }

    .model-data-wrap .model-data-table td::before {
        content: attr(data-label);
        color: var(--text-muted);
        font-size: 13px;
        font-weight: 700;
    }

    .model-data-wrap .model-data-table .model-card-image-cell,
    .model-data-wrap .model-data-table td[data-label="操作"] {
        display: block;
    }

    .model-data-wrap .model-data-table .model-card-image-cell::before,
    .model-data-wrap .model-data-table td[data-label="操作"]::before {
        display: none;
    }

    .model-data-wrap .model-data-table .model-card-image-cell a {
        display: block;
        width: 100%;
        aspect-ratio: 4 / 3;
        overflow: hidden;
        border-radius: 8px;
        background: var(--surface-muted);
    }

    .model-data-wrap .model-data-table .model-photo-thumb {
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        object-fit: cover;
    }

    .model-data-wrap .model-data-table .model-card-image-cell .muted {
        display: grid;
        min-height: 120px;
        place-items: center;
        border: 1px dashed var(--border);
        border-radius: 8px;
        background: var(--surface-muted);
    }

    .model-data-wrap .model-data-table td[data-label="操作"] .button {
        width: 100%;
    }

    th,
    td {
        padding: 10px 11px;
        vertical-align: middle;
    }

    .photo-thumb {
        max-width: 92px;
        max-height: 92px;
    }

    .model-photo-thumb {
        width: 82px;
        height: 62px;
    }

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

    .defect-radio {
        width: 38px;
        height: 38px;
    }

    .menu-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .menu-section {
        padding: 16px;
    }

    .menu-link {
        min-height: 50px;
        padding: 9px 2px;
    }

    .assistant-widget {
        right: 12px;
        bottom: 12px;
    }

    .assistant-open {
        right: 8px;
        bottom: 8px;
    }

    .assistant-open .assistant-panel,
    .assistant-large .assistant-panel {
        width: calc(100vw - 16px);
        height: min(560px, calc(100vh - 18px));
    }

    .assistant-message {
        max-width: 94%;
    }
}

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

.defect-table th,
.defect-table td {
    text-align: center;
}

.defect-table th:first-child {
    text-align: left;
    min-width: 88px;
}

.defect-radio {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
}

.check-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: fit-content;
    min-height: 32px;
    margin-top: 8px;
    color: var(--text);
    font-weight: 500;
}

.section-title-row,
.notification-title-row,
.rule-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.section > .section-title-row {
    margin-bottom: 18px;
    padding-bottom: 13px;
    border-bottom: 1px solid var(--border);
}

.section > .section-title-row h2 {
    margin: 0;
    padding: 0;
    border-bottom: 0;
}

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

.notification-list,
.rule-list {
    display: grid;
    gap: 12px;
}

.notification-card,
.rule-card {
    display: grid;
    gap: 16px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}

.notification-card {
    grid-template-columns: minmax(0, 1fr) auto;
    position: relative;
}

.notification-card p {
    margin: 8px 0 0;
}

.notification-summary-list {
    display: grid;
    gap: 6px;
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
}

.notification-summary-list li {
    position: relative;
    padding-left: 14px;
    line-height: 1.55;
}

.notification-summary-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.7em;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #5f646d;
}

.notification-title-main {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.notification-unread {
    border-color: #aeb3bd;
    background: #ffffff;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.055);
}

.notification-unread::before {
    content: "";
    position: absolute;
    left: 0;
    top: 14px;
    bottom: 14px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: #1f2328;
}

.notification-read {
    background: #f7f8fa;
    color: #5f646d;
}

.notification-read strong {
    color: #3d424a;
}

.notification-read-state {
    border-color: #1f2328;
    background: #1f2328;
    color: #ffffff;
}

.rule-card h3 {
    margin: 0;
    font-size: 20px;
}

.toggle-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    white-space: nowrap;
}

.compact-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.recipient-picker {
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.recipient-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 4px 14px;
    margin-top: 8px;
}

.order-member-grid {
    margin: 14px 0;
}

.order-member-note {
    margin-top: 6px;
}

.preview-image {
    display: none;
    max-width: 220px;
    margin-top: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.feedback-filter {
    display: grid;
    grid-template-columns: repeat(3, minmax(160px, 1fr)) auto;
    align-items: end;
    gap: 14px;
}

.feedback-chart-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 0.35fr);
    gap: 18px;
    margin-top: 20px;
}

.feedback-empty {
    display: none;
    margin: 0;
    padding: 34px 18px;
    border: 1px dashed var(--border);
    border-radius: 8px;
    text-align: center;
}

.feedback-bars {
    display: grid;
    gap: 10px;
}

.feedback-stage-list {
    display: grid;
    gap: 16px;
}

.feedback-stage {
    display: grid;
    gap: 10px;
}

.feedback-stage h3 {
    margin: 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    font-size: 18px;
}

.feedback-bar {
    display: grid;
    grid-template-columns: minmax(120px, 0.5fr) minmax(180px, 1fr) auto;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 48px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    box-shadow: var(--shadow-soft);
}

.feedback-bar:hover {
    border-color: var(--border-strong);
    background: var(--surface-muted);
}

.feedback-bar-name {
    font-weight: 700;
}

.feedback-bar-track {
    height: 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #f1f1f3;
    overflow: hidden;
}

.feedback-bar-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--text);
}

.feedback-bar-count {
    color: var(--text-muted);
    font-size: 14px;
    white-space: nowrap;
}

.feedback-chart-note {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-muted);
}

.feedback-chart-note h3 {
    margin-bottom: 8px;
    font-size: 17px;
}

.feedback-chart-note p {
    margin: 0;
    color: var(--text-muted);
    font-size: 14px;
}

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

.feedback-card {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

.feedback-card:target {
    border-color: var(--text);
    box-shadow: 0 0 0 3px rgba(29, 29, 31, 0.08), var(--shadow);
}

.feedback-card-header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.feedback-records {
    display: grid;
    gap: 10px;
}

.feedback-record {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    min-height: 76px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-muted);
}

.feedback-record p {
    margin: 4px 0 0;
}

.feedback-photo-button {
    width: 88px;
    height: 62px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
}

.feedback-photo-button img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.feedback-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    place-items: center;
    padding: 20px;
    background: rgba(29, 29, 31, 0.55);
}

.feedback-modal-card {
    width: min(100%, 920px);
    max-height: 88vh;
    overflow: auto;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.2);
}

.feedback-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.feedback-photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}

.feedback-photo-item {
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-muted);
}

.feedback-photo-item img {
    width: 100%;
    max-height: 260px;
    margin-top: 8px;
    border-radius: 8px;
    object-fit: contain;
    background: #fff;
}

.inspection-record-filter {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr)) auto;
    align-items: end;
    gap: 14px;
}

.inspection-date-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.inspection-date-chip {
    color: var(--text);
    text-decoration: none;
}

.inspection-date-chip.is-active {
    border-color: var(--text);
    background: var(--text);
    color: #fff;
}

.inspection-model-list,
.inspection-pot-list,
.inspection-record-list {
    display: grid;
    gap: 14px;
}

.inspection-model-card {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

.inspection-model-header,
.inspection-pot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.inspection-model-header {
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.inspection-pot-card {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-muted);
}

.inspection-pot-header {
    margin-bottom: 12px;
}

.inspection-pot-header h4 {
    font-size: 20px;
}

.inspection-record-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    min-height: 76px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}

.inspection-record-photo {
    width: 96px;
    height: 68px;
}

.inspection-no-photo {
    display: grid;
    place-items: center;
    width: 96px;
    min-height: 68px;
    border: 1px dashed var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 14px;
    background: var(--surface-muted);
}

.stats-filter {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr)) auto;
    align-items: end;
    gap: 14px;
}

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

.stats-panel {
    min-height: 310px;
}

.stats-panel-header {
    margin-bottom: 16px;
}

.stats-panel-header h2 {
    margin-bottom: 6px;
}

.stats-bars {
    display: grid;
    gap: 10px;
}

.stats-bar {
    display: grid;
    grid-template-columns: minmax(120px, 0.5fr) minmax(150px, 1fr) auto;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 48px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    box-shadow: var(--shadow-soft);
}

.stats-bar:hover {
    border-color: var(--border-strong);
    background: var(--surface-muted);
}

.stats-bar-name {
    font-weight: 700;
}

.stats-bar-track {
    height: 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #f1f1f3;
    overflow: hidden;
}

.stats-bar-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--text);
}

.stats-bar-count {
    color: var(--text-muted);
    font-size: 14px;
    white-space: nowrap;
}

.stats-empty {
    display: none;
    padding: 30px 16px;
    border: 1px dashed var(--border);
    border-radius: 8px;
    text-align: center;
}

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

.member-card {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

.member-card-header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.member-card-header p {
    margin: 4px 0 0;
}

.member-workload {
    display: grid;
    gap: 10px;
}

.member-workload-row {
    display: grid;
    grid-template-columns: minmax(100px, 0.35fr) minmax(160px, 1fr) auto;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
    font-size: 14px;
}

.member-track {
    height: 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #f1f1f3;
    overflow: hidden;
}

.member-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--text);
}

.member-workload-row strong {
    min-width: 28px;
    color: var(--text);
    text-align: right;
}

@media (max-width: 640px) {
    body {
        padding: 20px 12px;
    }

    h1 {
        font-size: 30px;
    }

    .panel,
    .section {
        padding: 16px;
    }

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

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

    .home-header {
        display: block;
    }

    .home-account {
        margin-top: 10px;
    }

    .model-card-header {
        display: block;
    }

    .add-part-row {
        grid-template-columns: 1fr;
    }

    .feedback-filter,
    .feedback-chart-layout,
    .feedback-bar,
    .feedback-record,
    .inspection-record-filter,
    .inspection-record-item,
    .stats-filter,
    .stats-grid,
    .stats-bar,
    .assignment-form,
    .assignment-card,
    .worker-assignment-card,
    .member-workload-row {
        grid-template-columns: 1fr;
    }

    .order-detail-metrics,
    .lifecycle-form,
    .order-detail-heading,
    .order-detail-summary,
    .order-card-actions {
        align-items: flex-start;
        flex-direction: column;
    }

    .status-reason {
        text-align: left;
    }

    .worker-assignment-actions {
        justify-content: flex-start;
    }

    .feedback-card-header,
    .member-card-header,
    .inspection-model-header,
    .inspection-pot-header,
    .feedback-modal-header {
        display: block;
    }

    .feedback-modal-header .button {
        margin-top: 12px;
    }

    .feedback-photo-button,
    .inspection-no-photo {
        width: 100%;
        height: 160px;
    }

    th,
    td {
        padding: 9px;
    }
}
