/* ============================================================
   全局字体变量 — 改一处即全局生效
   ============================================================ */
:root {
    /* 字体大小基准 */
    --fs-xs:      0.75rem;   /* 12px */
    --fs-sm:      0.875rem;  /* 14px */
    --fs-base:    1rem;      /* 16px */
    --fs-lg:      1.125rem;  /* 18px */
    --fs-xl:      1.25rem;   /* 20px */
    --fs-2xl:     1.5rem;    /* 24px */
    --fs-3xl:     1.875rem;  /* 30px */

    --content-max-width: 1080px;
    --xf-tree-caret-gap: 8px;
    --xf-tree-caret-offset: 14px;
    --xf-tree-child-indent: 24px;
    --xf-tree-child-index-indent: calc(var(--xf-tree-child-indent) + var(--xf-tree-caret-offset));
    --xf-sequence-column-width: 55px;

    --clr-primary:       #2563eb;
    --clr-primary-light: #4a5568;
    --clr-primary-dark:  #1d4ed8;

    /* 辅助色 */
    --clr-secondary:    #ed8936;
    --clr-success:      #48bb78;
    --clr-warning:      #ecc94b;
    --clr-danger:       #f56565;
    --clr-info:         #4299e1;

    /* 基础颜色 - 白色主题 */
    --clr-bg:            #ffffff;
    --clr-surface:       #ffffff;
    --clr-surface-light: #edf2f7;
    --clr-border:        #e2e8f0;
    --clr-border-focus:  #cbd5e1;

    /* 文字颜色 */
    --clr-text:         #2d3748;
    --clr-text-muted:   #718096;
    --clr-text-light:   #a0aec0;
    --clr-text-white:   #ffffff;

    /* 阴影和透明度 */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.03), 0 1px 1px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);

    --card-shadow: 0 8px 20px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.08);

    --clr-shadow: rgba(0, 0, 0, 0.06);
    --clr-overlay: rgba(0, 0, 0, 0.4);
    --clr-danger-dark:  #c53030;
    --clr-success-dark: #2f855a;

    /* 圆角和间距 */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    --gap-xs: 0.5rem;
    --gap-sm: 1rem;
    --gap-md: 1.5rem;
    --gap-lg: 2rem;

    /* 输入高度 */
    --input-h: 2.75rem;
}

/* ============================================================
   基础重置
   ============================================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--clr-bg);
    color: var(--clr-text);
    font-size: var(--fs-base);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-text-size-adjust: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

/* ============================================================
   通用容器
   ============================================================ */
.container {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: var(--gap-md) var(--gap-sm);
}
.req-container,
.req-list-container,
.home-main {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: var(--gap-md) var(--gap-sm);
    box-sizing: border-box;
}

/* ============================================================
   页面标题
   ============================================================ */
.page-title {
    font-size: var(--fs-2xl);
    font-weight: 700;
    color: var(--clr-text);
    text-align: center;
    margin-bottom: var(--gap-md);
    letter-spacing: -0.02em;
}

/* ============================================================
   卡片
   ============================================================ */
.card {
    background: var(--clr-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    padding: var(--gap-md);
    margin-bottom: var(--gap-sm);
    transition: box-shadow 0.2s ease;
    border: 1px solid var(--clr-border);
}
.card:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
}
.card-title {
    font-size: var(--fs-lg);
    font-weight: 600;
    color: var(--clr-text);
    padding-bottom: var(--gap-xs);
    border-bottom: 1px solid var(--clr-border);
    margin-bottom: var(--gap-sm);
}
.card-badge {
    font-size: var(--fs-sm);
    font-weight: 400;
    color: var(--clr-text-muted);
    margin-left: 8px;
}

/* ============================================================
   表单
   ============================================================ */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--gap-sm);
}

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: var(--gap-sm);
    min-width: 0;
}

.form-group label {
    font-size: var(--fs-sm);
    font-weight: 500;
    color: var(--clr-text-muted);
    margin-bottom: 6px;
}

.form-group label .required {
    color: var(--clr-danger);
    margin-left: 2px;
}
.required {
    color: var(--clr-danger);
}
input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
input[type="date"],
input[type="tel"],
input[type="search"],
textarea,
select {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: var(--input-h);
    padding: 0 12px;
    border: 1.5px solid var(--clr-border);
    border-radius: var(--radius-md);
    font-size: var(--fs-base);
    font-family: inherit;
    color: var(--clr-text);
    background: var(--clr-surface);
    transition: border-color 0.2s, box-shadow 0.2s;
    appearance: none;
    -webkit-appearance: none;
}

textarea {
    height: auto;
    padding: 10px 12px;
    resize: vertical;
    line-height: 1.5;
    min-height: 96px;
    max-height: 480px;
    min-width: 100%;
    max-width: 100%;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--clr-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

input:disabled,
textarea:disabled,
select:disabled {
    background: var(--clr-bg);
    color: var(--clr-text-muted);
    cursor: not-allowed;
}

/* ============================================================
   按钮
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: var(--input-h);
    padding: 0 20px;
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--fs-base);
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
    white-space: nowrap;
    text-decoration: none;
    user-select: none;
}

.btn:active { transform: translateY(1px); }
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: var(--clr-primary-dark);
    color: #fff;
}
.btn-primary:hover:not(:disabled) {
    background: var(--clr-primary-dark);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-danger {
    background: var(--clr-danger);
    color: #fff;
}
.btn-danger:hover:not(:disabled) {
    background: var(--clr-danger-dark);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.btn-success {
    background: var(--clr-success);
    color: #fff;
}
.btn-success:hover:not(:disabled) {
    background: var(--clr-success-dark);
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

.btn-outline {
    background: transparent;
    color: var(--clr-primary-dark);
    border: 1.5px solid var(--clr-primary-dark);
}
.btn-outline:hover:not(:disabled) {
    background: rgba(26, 32, 44, 0.06);
}

.btn-secondary {
    background: var(--clr-bg);
    color: var(--clr-text);
    border: 1.5px solid var(--clr-border);
}
.btn-secondary:hover:not(:disabled) {
    background: #e9edf3;
}

.btn-sm {

    padding: 0 12px;
    font-size: var(--fs-sm);
}

.btn-block { width: 100%; }

.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap-xs);
}

/* ============================================================
   右键菜单
   ============================================================ */
.context-menu {
    position: fixed;
    z-index: 10000;
    background: var(--clr-surface);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 160px;
    padding: 4px 0;
    display: none;
}

.context-menu.show { display: block; }

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: var(--fs-sm);
    cursor: pointer;
    color: var(--clr-text);
    transition: background 0.1s;
}
.context-menu-item:hover { background: var(--clr-bg); }
.context-menu-item.danger { color: var(--clr-danger); }
.context-menu-divider {
    height: 1px;
    background: var(--clr-border);
    margin: 4px 0;
}

/* ============================================================
   模态框
   ============================================================ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--clr-overlay);
    z-index: 9000;
    align-items: center;
    justify-content: center;
    padding: var(--gap-sm);
}
.modal-overlay.show { display: flex; }

.modal {
    background: var(--clr-surface);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--gap-sm) var(--gap-md);
    border-bottom: 1px solid var(--clr-border);
    background: var(--clr-primary);
    color: #fff;
}

.modal-header h3 {
    font-size: var(--fs-lg);
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    font-size: var(--fs-2xl);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: background 0.15s, color 0.15s;
}
.modal-close:hover { background: rgba(255,255,255,0.15); color: #fff; }

.modal-body {
    padding: var(--gap-md);
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    gap: var(--gap-xs);
    justify-content: flex-end;
    padding: var(--gap-sm) var(--gap-md);
    border-top: 1px solid var(--clr-border);
}

/* ============================================================
   三级联动
   ============================================================ */
.linkage-box {
    display: flex;
    gap: var(--gap-xs);
    align-items: flex-start;
}

.linkage-box select {
    flex: 1;
    cursor: pointer;
}

/* ============================================================
   表格
   ============================================================ */
.table-wrap {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 440px;
    border-radius: var(--radius-md);
    border: 1px solid var(--clr-border);
}

.table-wrap.table-wrap-full {
    max-height: none;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--fs-sm);
    background: var(--clr-surface);
}

thead { background: var(--clr-bg); }
.table-wrap thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--clr-bg);
}

th, td {
    padding: 10px 12px;
    text-align: left;
    white-space: nowrap;
}

th {
    font-weight: 600;
    color: var(--clr-text);
    border-bottom: 2px solid var(--clr-border);
}

tbody tr {
    border-bottom: 1px solid var(--clr-border);
    transition: background 0.1s;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }

/* ============================================================
   树形表格
   ============================================================ */
.xf-tree-table-host {
    min-width: 0;
}

.xf-tree-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}

.xf-tree-table th,
.xf-tree-table td {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    vertical-align: top;
}

.xf-tree-table th {
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: keep-all;
}

.xf-tree-group-row {
    background: #fff;
    cursor: pointer;
}

.xf-tree-group-row:hover {
    background: #f8fafc;
}

.xf-tree-group-row:focus-visible {
    outline: 2px solid var(--clr-primary);
    outline-offset: -2px;
}

.xf-tree-index-cell {
    white-space: nowrap;
    overflow: visible;
}

.xf-tree-index-wrap {
    position: relative;
    display: block;
    width: auto;
    min-width: 0;
    box-sizing: border-box;
}

.xf-tree-caret {
    position: absolute;
    left: 4px;
    top: 0.75em;
    display: block;
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 6px solid var(--clr-text-muted);
    transform: translateY(-50%);
    transition: transform 0.12s ease;
}

.xf-tree-group-row[aria-expanded="true"] .xf-tree-caret {
    transform: translateY(-50%) rotate(90deg);
}

.xf-tree-index-number {
    display: inline-block;
    transform: translateX(calc(10px + var(--xf-tree-caret-gap)));
}

.xf-tree-index-sub {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    line-height: 1.1;
    color: var(--clr-text-muted);
    white-space: nowrap;
    transform: translateX(calc(10px + var(--xf-tree-caret-gap)));
}

.xf-tree-parent-text {
    color: var(--clr-text);
    font-weight: 700;
}

.xf-tree-count {
    color: var(--clr-text-muted);
    font-weight: 600;
}

.xf-tree-child-row .xf-tree-index-cell {
    text-align: left;
}

.xf-tree-child-row {
    background: #f6faff;
    cursor: pointer;
}

.xf-tree-child-row:hover {
    background: #e8f3ff;
}

.xf-tree-child-row.xf-tree-row-selected,
.xf-tree-child-row.xf-tree-row-selected:hover {
    background: #bfdbfe;
}

.xf-tree-child-row.xf-tree-row-selected td:first-child {
    box-shadow: inset 3px 0 0 var(--clr-primary);
}

.xf-tree-child-row .xf-tree-index-wrap {
    padding-left: 0;
}

.xf-tree-child-index-wrap .xf-tree-index-number {
    transform: translateX(var(--xf-tree-child-index-indent));
}

.xf-tree-child-index-wrap .xf-tree-index-sub {
    transform: translateX(var(--xf-tree-child-index-indent));
}

.xf-tree-child-row .xf-tree-indent-cell {
    padding-left: var(--xf-tree-child-indent);
}

.equipment-list-table col.xf-sequence-col,
.equipment-filter-table col.xf-sequence-col,
.equipment-list-table th.list-index-cell,
.equipment-list-table td.list-index-cell,
.equipment-filter-table th.filter-index-cell,
.equipment-filter-table td.filter-index-cell,
.equipment-filter-table th:first-child,
.equipment-filter-table td:first-child {
    width: var(--xf-sequence-column-width) !important;
    min-width: var(--xf-sequence-column-width) !important;
    max-width: var(--xf-sequence-column-width) !important;
}

.equipment-list-table th.list-index-cell,
.equipment-list-table td.list-index-cell {
    padding-left: 4px;
    padding-right: 4px;
    text-align: center;
    white-space: nowrap;
    box-sizing: border-box;
}
.equipment-list-table td.xf-tree-index-cell {
    text-align: left;
}
.equipment-list-table th.name-cell,
.equipment-list-table td.name-cell,
.equipment-list-table th.spec-cell,
.equipment-list-table td.spec-cell,
.equipment-list-table th.status-cell,
.equipment-list-table td.status-cell,
.equipment-list-table th.action-cell,
.equipment-list-table td.action-cell,
.equipment-list-table th.unit-cell,
.equipment-list-table td.unit-cell {
    width: auto !important;
}
.equipment-list-table col.name-cell { width: 60%; }
.equipment-list-table col.spec-cell { width: 40%; }
.equipment-list-table col.status-cell { width: 58px; }
.equipment-list-table col.action-cell { width: 56px; }
.equipment-list-table.has-unit-column col.unit-cell { width: 16%; }
.equipment-list-table.has-unit-column col.name-cell { width: 50.4%; }
.equipment-list-table.has-unit-column col.spec-cell { width: 33.6%; }
.equipment-list-table.has-action-column:not(.has-unit-column) col.name-cell { width: 60%; }
.equipment-list-table.has-action-column:not(.has-unit-column) col.spec-cell { width: 40%; }
.equipment-list-table.has-action-column.has-unit-column col.name-cell { width: 52.8%; }
.equipment-list-table.has-action-column.has-unit-column col.spec-cell { width: 35.2%; }
.equipment-list-table.has-action-column.has-unit-column col.unit-cell { width: 12%; }
.equipment-list-table .status-cell { text-align: center; }
.equipment-list-table .action-cell { text-align: center; }
.equipment-list-table .status-badge { padding: 2px 5px; white-space: nowrap; }
.equipment-list-table .actions { justify-content: center; }
.xf-equipment-name-main,
.xf-equipment-spec-main {
    line-height: 1.45;
}
.xf-equipment-name-sub,
.xf-equipment-spec-sub {
    margin-top: 2px;
    color: var(--clr-text-muted);
    line-height: 1.35;
}
.xf-tree-group-row .xf-equipment-name-sub,
.xf-tree-group-row .xf-equipment-spec-sub {
    color: #64748b;
}
.xf-tree-child-row .xf-equipment-name-sub,
.xf-tree-child-row .xf-equipment-spec-sub {
    color: #475569;
}

/* ============================================================
   图片预览
   ============================================================ */
.photo-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap-xs);
}

.photo-thumb {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--clr-border);
    overflow: hidden;
    cursor: pointer;
}
.photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.photo-thumb .remove-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(220, 38, 38, 0.85);
    color: #fff;
    border: none;
    font-size: 12px;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================================
   图片轮播
   ============================================================ */
.carousel {
    position: relative;
    background: #000;
    border-radius: var(--radius-lg);
    overflow: hidden;
    user-select: none;
}

.carousel-img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: contain;
    display: block;
    max-height: 60vh;
    margin: 0 auto;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    font-size: var(--fs-xl);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 2;
}
.carousel-btn:hover { background: rgba(0, 0, 0, 0.75); }
.carousel-prev { left: 10px; }
.carousel-next { right: 10px; }
.carousel-btn:disabled { opacity: 0.3; cursor: default; }

.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 8px;
}
.carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}
.carousel-dot.active { background: #fff; }

/* ============================================================
   全屏查看器
   ============================================================ */
.fullscreen-viewer {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.95);
    z-index: 20000;
    align-items: center;
    justify-content: center;
}
.fullscreen-viewer.show { display: flex; }

.fullscreen-viewer img {
    max-width: 95vw;
    max-height: 95vh;
    object-fit: contain;
}

.fs-close {
    position: fixed;
    top: 12px;
    right: 16px;
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
    font-size: var(--fs-xl);
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20001;
}
.fs-close:hover { background: rgba(255,255,255,0.25); }

/* ============================================================
   Toast / 提示
   ============================================================ */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translate(-50%, -12px);
    background: var(--clr-text);
    color: #fff;
    padding: 10px 24px;
    border-radius: var(--radius-md);
    font-size: var(--fs-sm);
    z-index: 99999;
    opacity: 0;
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: none;
    max-width: min(420px, calc(100vw - 32px));
    line-height: 1.5;
    text-align: center;
    overflow-wrap: anywhere;
}
.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}
.toast.error { background: var(--clr-danger); }
.toast.success { background: var(--clr-success); }
.toast.warning { background: #b45309; }

.login-security-notice {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: min(360px, calc(100vw - 32px));
    background: var(--clr-surface);
    border: 1px solid #f59e0b;
    border-left: 4px solid #f59e0b;
    border-radius: var(--radius-md);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.18);
    z-index: 99999;
    padding: 12px 14px 14px;
    color: var(--clr-text);
}

.login-security-notice-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.login-security-notice-title {
    font-size: var(--fs-sm);
    font-weight: 700;
    color: #92400e;
    line-height: 1.4;
}

.login-security-notice-close {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 50%;
    background: rgba(245, 158, 11, 0.12);
    color: #92400e;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.login-security-notice-close:hover {
    background: rgba(245, 158, 11, 0.2);
}

.login-security-notice-body {
    font-size: var(--fs-sm);
    line-height: 1.55;
    color: var(--clr-text);
    margin-bottom: 8px;
}

.login-security-notice-meta {
    font-size: var(--fs-xs);
    line-height: 1.6;
    color: var(--clr-text-muted);
    overflow-wrap: anywhere;
}

#catTextArea {
    font-size: var(--fs-sm);
    line-height: 1.5;
    border: 1.5px solid var(--clr-border);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    font-family: monospace;
}

/* ============================================================
   标签徽章
   ============================================================ */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: var(--fs-xs);
    font-weight: 600;
}
.badge-active    { background: #dcfce7; color: #15803d; }
.badge-disabled  { background: #fee2e2; color: #b91c1c; }
.badge-locked     { background: #fef9c3; color: #a16207; }

/* ============================================================
   状态栏 / 导航栏
   ============================================================ */
.nav-bar {
    background: var(--clr-bg);
    box-shadow: var(--card-shadow);

    border-bottom: 1px solid var(--clr-border);
    position: sticky;
    top: 0;
    z-index: 1000;
    max-width: calc(var(--content-max-width) - 2 * var(--gap-sm));
    margin: 0 auto;

    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 48px;
    padding: 0 var(--gap-sm);
}

.nav-left {
    flex-shrink: 0;
    font-size: var(--fs-lg);
    font-weight: 700;
    color: var(--clr-text-white);
    padding: 0 12px;
    display: flex;
    align-items: center;
    white-space: nowrap;
}
.nav-left a {
    text-decoration: none;
    color: var(--clr-text);
    font-weight: 600;
    font-size: var(--fs-lg);
}
.nav-left a:hover {
    color: var(--clr-info);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.nav-user {
    flex-shrink: 0;
    font-size: var(--fs-lg);
    font-weight: 600;
    color: var(--clr-text);
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 8px;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}
.nav-user-arrow {
    font-size: 18px;
    transition: transform 0.2s;
    line-height: 1;
}
.nav-user:hover {
    color: var(--clr-info);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.user-dropdown {
    display: none;
    position: absolute;
    padding: 8px 0;
    top: 100%;
    right: 8px;
    background: var(--clr-surface);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 300px;
    z-index: 1001;
}
.user-dropdown.show {
    display: block;
}
.user-dropdown-item {
    padding: 10px 16px;
    font-size: var(--fs-sm);
    cursor: pointer;
    transition: background 0.15s;
}
.user-dropdown-item:hover {
    background: var(--clr-bg);
}
.user-info-panel {
    padding: 0 16px 8px 16px;
    margin-bottom: 4px;
    user-select: text;
    cursor: text;
}
.info-row {
    display: flex;
    font-size: var(--fs-sm);
    line-height: 1.6;
    margin: 6px 0;
    color: var(--clr-text);
}
.info-row .info-label {
    width: 86px;
    flex-shrink: 0;
    color: var(--clr-text-muted);
    font-weight: normal;
}
.info-row .info-value {
    flex: 1;
    color: var(--clr-text);
    word-break: break-word;
}
.dropdown-divider {
    height: 1px;
    background: var(--clr-border);
    margin: 6px 0;
}
.logout-item {
    color: var(--clr-danger);
    cursor: pointer;
}
.logout-item:hover {
    background: var(--clr-bg);
}



#navLinks {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0;
}

#navLinks li {
    margin: 0;
}

#navLinks a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--clr-text);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: background-color 0.2s;
}

#navLinks a:hover {
    background-color: var(--clr-surface-light);
}

#navLinks a.active {
    background-color: var(--clr-primary);
    color: #fff;
}

/* ============================================================
   分隔线
   ============================================================ */
.divider {
    height: 1px;
    background: var(--clr-border);
    margin: var(--gap-sm) 0;
}

/* ============================================================
   搜索提示列表（拼音搜索）
   ============================================================ */
.pinyin-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 2px);
    background: var(--clr-surface);
    border: 1.5px solid var(--clr-primary);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    z-index: 500;
    max-height: 240px;
    overflow-y: auto;
    display: none;
}
.pinyin-dropdown.show { display: block; }

.pinyin-item {
    padding: 8px 12px;
    font-size: var(--fs-sm);
    cursor: pointer;
    transition: background 0.1s;
    border-bottom: 1px solid var(--clr-border);
}
.pinyin-item:last-child { border-bottom: none; }
.pinyin-item:hover { background: #eff6ff; }
.pinyin-item.selected { background: var(--clr-primary); color: #fff; }
.pinyin-item.selected span { color: rgba(255,255,255,0.8) !important; }
.pinyin-highlight { color: #dc2626 !important; font-weight: 700; }
.pinyin-item.selected .pinyin-highlight { color: #dc2626 !important; }

/* ============================================================
   装备科目树 + 器材名称联动
   ============================================================ */
.xf-picker-subject,
.xf-picker-name,
.xf-picker-unit {
    position: relative;
}

.xf-picker-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.xf-picker-input-row input {
    cursor: pointer;
}

.xf-tree-select-wrap,
.xf-name-select-wrap {
    position: relative;
}

.xf-tree-dropdown {
    display: none;
    position: absolute;
    left: 0;
    right: auto;
    top: calc(100% + 1px);
    z-index: 110004;
    width: min(640px, calc(100vw - 32px));
    min-width: 100%;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-shadow: var(--shadow-lg);
    padding-bottom: 10px;
    text-align: center;
    overscroll-behavior: contain;
}

.xf-tree-dropdown.show {
    display: block;
}

.xf-tree-list {
    min-height: 200px;
    max-height: var(--xf-tree-height, 233px);
    overflow-y: auto;
    overflow-x: auto;
    margin: 0;
    padding: 5px;
    color: #333;
    background: #fff;
    border: none;
    border-radius: 5px;
    list-style: none;
    font-size: 16px;
    overscroll-behavior: contain;
}

.xf-tree-list ul {
    margin: 0;
    padding: 0 0 0 18px;
    list-style: none;
}

.xf-tree-list::-webkit-scrollbar {
    width: 10px;
    height: 1px;
}

.xf-tree-list::-webkit-scrollbar-thumb {
    border-radius: 10px;
    background-color: #c1c1c1;
    background-image: linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.2) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0.2) 75%,
        transparent 75%,
        transparent
    );
}

.xf-tree-list::-webkit-scrollbar-track {
    border-radius: 10px;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
}

.xf-tree-li {
    position: relative;
    margin: 0;
    padding: 0;
    list-style: none;
    line-height: 17px;
    text-align: left;
    white-space: nowrap;
    outline: 0;
}

.xf-tree-children {
    display: none;
    background-image: repeating-linear-gradient(
        to bottom,
        #b9c0ca 0,
        #b9c0ca 2px,
        transparent 2px,
        transparent 5px
    );
    background-position: 10px 0;
    background-repeat: no-repeat;
    background-size: 1px 100%;
}

.xf-tree-children.open {
    display: block;
}

.xf-tree-node {
    display: inline-flex;
    align-items: center;
    position: relative;
    z-index: 1;
    width: max-content;
    min-width: 100%;
    height: 24px;
    margin: 0;
    padding: 1px 3px 1px 0;
    color: #333;
    background: transparent;
    cursor: pointer;
    font-family: Verdana, Arial, Helvetica, AppleGothic, sans-serif;
    font-size: 16px;
    line-height: 21px;
    text-decoration: none;
    vertical-align: top;
    white-space: nowrap;
}

.xf-tree-node:hover .xf-tree-text {
    text-decoration: underline;
}

.xf-tree-node.active {
    background: #e5e5e5;
    color: #000;
    opacity: 0.85;
}

.xf-tree-switch {
    position: relative;
    flex: 0 0 auto;
    width: 21px;
    height: 21px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    vertical-align: middle;
}

.xf-tree-switch.docu {
    cursor: default;
}

.xf-tree-switch::before,
.xf-tree-switch::after {
    content: "";
    position: absolute;
    background: #9ca3af;
}

.xf-tree-switch::before {
    left: 4px;
    top: 10px;
    width: 13px;
    height: 1px;
}

.xf-tree-switch::after {
    left: 10px;
    top: 4px;
    width: 1px;
    height: 13px;
}

.xf-tree-switch.open::after,
.xf-tree-switch.docu::before,
.xf-tree-switch.docu::after {
    display: none;
}

.xf-tree-radio {
    position: relative;
    flex: 0 0 auto;
    width: 13px;
    height: 13px;
    margin: 0 4px 0 2px;
    border: 1px solid #8f8f8f;
    border-radius: 50%;
    background: #fff;
}

.xf-tree-node.active .xf-tree-radio::after {
    content: "";
    position: absolute;
    left: 3px;
    top: 3px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #2563eb;
}

.xf-tree-check {
    position: relative;
    display: inline-block;
    box-sizing: border-box;
    flex: 0 0 14px;
    width: 14px;
    height: 14px;
    min-width: 14px;
    max-width: 14px;
    min-height: 14px;
    max-height: 14px;
    margin: 0 4px 0 2px;
    border: 1px solid #8f8f8f;
    border-radius: 2px;
    background: #fff;
}

.xf-tree-check.checked {
    border-color: #2563eb;
    background: #2563eb;
}

.xf-tree-check.checked::after {
    content: "";
    position: absolute;
    left: 3px;
    top: 1px;
    width: 5px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.xf-tree-check.partial {
    border-color: #2563eb;
    background: #eff6ff;
}

.xf-tree-check.partial::after {
    content: "";
    position: absolute;
    left: 3px;
    right: 3px;
    top: 6px;
    height: 2px;
    background: #2563eb;
}

.xf-tree-text {
    display: inline-block;
    line-height: 21px;
    margin-right: 2px;
    white-space: nowrap;
}

.xf-tree-children > .xf-tree-li::before {
    content: "";
    position: absolute;
    left: -8px;
    top: 12px;
    width: 18px;
    border-top: 1px dashed #b9c0ca;
}

.xf-tree-children > .xf-tree-li:last-child::after {
    content: "";
    position: absolute;
    left: -8px;
    top: 13px;
    bottom: 0;
    width: 1px;
    background: #fff;
}

.xf-tree-empty {
    min-height: 200px;
    padding: 24px 12px;
    color: var(--clr-text-muted);
    font-size: var(--fs-sm);
    text-align: center;
}

.xf-name-dropdown {
    position: absolute;
    left: 0;
    top: calc(100% + 2px);
    z-index: 110003;
    display: none;
    width: max-content;
    min-width: 100%;
    max-width: min(var(--xf-name-dropdown-max-width, 760px), calc(100vw - 32px));
    max-height: 260px;
    overflow-y: auto;
    overflow-x: hidden;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-shadow: var(--shadow-lg);
}

.xf-name-dropdown.show {
    display: block;
}

.xf-name-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 8px 12px;
    color: #000;
    font-size: var(--fs-sm);
    line-height: 1.4;
    white-space: normal;
    cursor: pointer;
    border-bottom: 1px solid var(--clr-border);
}

.xf-name-item:hover,
.xf-name-item.selected {
    background: #eff6ff;
}

.xf-name-item:last-child {
    border-bottom: 0;
}

.xf-name-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.xf-name-initial {
    flex: 0 0 auto;
    color: var(--clr-text-muted);
    font-size: var(--fs-xs);
    overflow-wrap: anywhere;
    word-break: break-word;
}

.xf-name-highlight {
    color: #dc2626;
    font-weight: 700;
}

/* ============================================================
   Shared page layout utilities
   ============================================================ */
.toolbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 16px;
}
.toolbar.toolbar-bottom { align-items: flex-end; }
.toolbar.toolbar-between { justify-content: space-between; }
.toolbar .form-group {
    flex: 1;
    min-width: 160px;
    margin-bottom: 0;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
}

.empty,
.empty-tip {
    text-align: center;
    color: var(--clr-text-muted);
    padding: 6px;
}
.empty-tip {
    padding: 6px;
    font-size: var(--fs-sm);
}

.eq-link {
    color: var(--clr-primary);
    text-decoration: none;
    font-weight: 600;
}
.eq-link:hover { text-decoration: underline; }

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 18px;
}
.info-item {
    border-bottom: 1px solid var(--clr-border);
    padding-bottom: 8px;
}
.info-item.full-row { grid-column: 1 / -1; }
.info-label {
    color: var(--clr-text-muted);
    font-size: var(--fs-sm);
    margin-bottom: 2px;
}
.info-value { word-break: break-word; }
.info-value.multiline { white-space: pre-wrap; }
.eq-id {
    font-family: Consolas, monospace;
    letter-spacing: .06em;
    color: var(--clr-primary-dark);
    font-weight: 700;
}

.status-badge,
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    background: #eef2ff;
    color: #3730a3;
    font-size: var(--fs-xs);
}
.badge-active { background: #dcfce7; color: #15803d; }
.badge-disabled { background: #fee2e2; color: #b91c1c; }
.badge-locked { background: #fef9c3; color: #a16207; }

input[type="datetime-local"] {
    width: 100%;
    height: var(--input-h);
    padding: 0 12px;
    border: 1.5px solid var(--clr-border);
    border-radius: var(--radius-md);
    font-size: var(--fs-base);
    font-family: inherit;
    color: var(--clr-text);
    background: var(--clr-surface);
}
input[type="datetime-local"]:focus {
    outline: none;
    border-color: var(--clr-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.payload-box {
    white-space: pre-wrap;
    word-break: break-word;
    background: #0f172a;
    color: #e2e8f0;
    border-radius: var(--radius-md);
    padding: 12px;
    font-family: Consolas, monospace;
    font-size: var(--fs-sm);
}

.detail-modal {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.52);
}
.detail-modal.show { display: flex; }
.detail-modal-card {
    width: min(1080px, 100%);
    height: min(760px, calc(100vh - 48px));
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.28);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.detail-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--clr-border);
}
.detail-modal-title {
    flex: 1;
    min-width: 0;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.detail-modal-actions {
    flex: 0 0 auto;
    flex-direction: row;
    flex-wrap: nowrap;
    white-space: nowrap;
}
.detail-modal-actions .btn {
    flex: 0 0 auto;
}
.detail-modal iframe {
    flex: 1;
    min-height: 0;
    width: 100%;
    border: 0;
    background: #fff;
}

.linkage-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.linkage-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ============================================================
   Shared equipment filter/storage grids
   ============================================================ */
.equipment-filter-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.15fr) minmax(0, 0.9fr) minmax(0, 0.9fr) minmax(96px, 0.55fr) 96px;
    gap: 12px;
    align-items: start;
}
.equipment-filter-grid.no-unit {
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr) 96px;
}
.unit-filter-row {
    position: relative;
}
.unit-filter-row .xf-unit-tree-dropdown {
    position: absolute;
    top: calc(100% + 1px);
    left: 0;
    right: auto;
    width: min(640px, var(--xf-unit-dropdown-width, calc(100vw - 32px)));
    min-width: 420px;
    max-width: var(--xf-unit-dropdown-width, calc(100vw - 32px));
}
.unit-filter-row input {
    width: 100%;
}
.storage-grid {
    display: grid;
    grid-template-columns: 160px repeat(4, minmax(0, 1fr));
    gap: 12px;
    align-items: end;
}
.equipment-filter-grid > .form-group,
.storage-grid > .form-group,
.form-row > .form-group {
    min-width: 0;
}
.equipment-filter-grid input,
.equipment-filter-grid select,
.storage-grid input,
.storage-grid select,
.form-row input,
.form-row select {
    min-width: 0;
    max-width: 100%;
}
.storage-field.is-hidden,
.card .form-group.storage-field.is-hidden,
.modal-body .form-group.storage-field.is-hidden,
.toolbar .form-group.storage-field.is-hidden {
    display: none;
}
.equipment-filter-grid .btn { width: 100%; }
.filter-spacer { visibility: hidden; }
.equipment-filter-action {
    align-self: end;
}
.equipment-filter-action .filter-spacer {
    display: block;
    visibility: hidden;
    height: 0;
    margin: 0;
    padding: 0;
    line-height: 0;
}
.storage-location { grid-column: 1 / -1; }
.storage-location input {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.selected-equipment-summary {
    width: 100%;
    max-width: 100%;
    padding: 10px 12px;
    color: var(--clr-text-muted);
    font-size: var(--fs-sm);
    line-height: 1.5;
    overflow-wrap: anywhere;
    word-break: break-word;
    border: 1px dashed var(--clr-border);
    border-radius: var(--radius-sm);
    background: var(--clr-bg);
}
.selected-equipment-summary.selected {
    color: var(--clr-text);
    border-style: solid;
    background: #f8fafc;
}
#equipmentInfoFields {
    margin-top: 12px;
}
#equipmentInfoFields.is-hidden {
    display: none;
}
.equipment-filter-row {
    cursor: pointer;
}
.equipment-filter-table-wrap {
    overflow-x: hidden;
}
.equipment-filter-table {
    table-layout: fixed;
}
.equipment-filter-table th,
.equipment-filter-table td {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    vertical-align: top;
}
.equipment-filter-table th {
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: keep-all;
}
.equipment-filter-table th:first-child,
.equipment-filter-table td:first-child {
    padding-left: 4px;
    padding-right: 4px;
    text-align: center;
    box-sizing: border-box;
}
.equipment-filter-table th:nth-child(2),
.equipment-filter-table td:nth-child(2) {
    width: 34%;
}
.equipment-filter-table th:nth-child(3),
.equipment-filter-table td:nth-child(3) {
    width: 28%;
}
.equipment-filter-table th:nth-child(4),
.equipment-filter-table td:nth-child(4) {
    width: 28%;
}
.equipment-filter-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
}
.equipment-filter-page-summary,
.equipment-filter-page-info,
.equipment-filter-page-jump {
    color: var(--clr-text-muted);
    font-size: var(--fs-sm);
}
.equipment-filter-page-controls {
    margin-top: 0;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
}
.equipment-filter-page-summary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
}
.equipment-filter-page-btn {
    width: 30px;
    min-width: 30px;
    height: 30px;
    padding: 0;
    line-height: 1;
    font-size: 16px;
    flex: 0 0 auto;
}
.equipment-filter-page-btn img,
.equipment-filter-locate-btn img {
    display: block;
    width: 18px;
    height: 18px;
    max-width: 18px;
    max-height: 18px;
    object-fit: contain;
    pointer-events: none;
    flex: 0 0 auto;
}
.equipment-filter-locate-btn {
    width: 30px;
    min-width: 30px;
    height: 30px;
    padding: 0;
    line-height: 1;
    font-size: 14px;
}
.equipment-filter-page-select {
    width: 96px;
    min-width: 96px;
    height: 30px;
    min-height: 30px;
    padding: 2px 20px 2px 8px;
    font-size: var(--fs-sm);
}
.equipment-filter-page-jump {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

@media (max-width: 600px) and (orientation: portrait) {
    .equipment-filter-pagination {
        flex-wrap: nowrap;
        gap: 3px;
    }
    .equipment-filter-page-summary {
        gap: 4px;
        min-width: 0;
        flex: 1 1 auto;
        overflow: hidden;
    }
    .equipment-filter-page-controls {
        flex-wrap: nowrap;
        gap: 2px;
        flex: 0 0 auto;
    }
    .equipment-filter-page-btn,
    .equipment-filter-locate-btn {
        width: 30px !important;
        min-width: 30px !important;
        height: 30px !important;
        min-height: 30px !important;
        max-height: 30px !important;
        padding: 0 !important;
        flex: 0 0 auto !important;
        align-self: center !important;
        box-sizing: border-box;
    }
    .equipment-filter-page-btn {
        font-size: 14px;
    }
    .equipment-filter-page-btn img,
    .equipment-filter-locate-btn img {
        width: 18px;
        height: 18px;
        max-width: 18px;
        max-height: 18px;
    }
    .equipment-filter-page-select {
        width: 96px;
        min-width: 96px;
        height: 30px;
        min-height: 30px;
        padding: 2px 20px 2px 8px;
        font-size: var(--fs-sm);
    }
}
.equipment-filter-page-jump input {
    width: 72px;
    min-width: 72px;
}
.table-wrap tr.selected,
.table-wrap tr.selected:hover {
    background: #dbeafe !important;
    outline: 2px solid #60a5fa;
    outline-offset: -2px;
}
/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 768px) {
    html { font-size: 15px; }

    .form-row {
        grid-template-columns: 1fr;
    }

    .btn-group {
        flex-direction: column;
    }

    .detail-modal-head {
        gap: 8px;
        padding: 10px 12px;
        flex-shrink: 0;
    }

    .detail-modal-actions {
        flex-direction: row;
        flex-wrap: nowrap;
    }

    .detail-modal-actions .btn {
        width: auto;
        height: 2.25rem;
        min-width: 0;
        padding: 0 10px;
        font-size: var(--fs-sm);
        white-space: nowrap;
    }

    .btn {
        height: 2.75rem;
        font-size: var(--fs-base);
    }

    .carousel-img {
        max-height: 45vh;
    }

    .modal {
        max-height: 95vh;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .detail-modal {
        align-items: stretch;
        justify-content: flex-start;
        padding: 0;
        height: 100vh;
        height: 100dvh;
    }

    .detail-modal-card {
        width: 100%;
        height: 100%;
        max-height: none;
        border-radius: 0;
    }

    .toolbar.toolbar-bottom {
        flex-direction: column;
        align-items: stretch;
    }

    .linkage-row {
        flex-direction: column;
    }

    .linkage-row select {
        width: 100%;
    }

    table {
        font-size: var(--fs-base);
    }
    th, td {
        padding: 8px 10px;
    }
}

@media (max-width: 1024px) and (orientation: landscape) {
    .equipment-filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .equipment-filter-grid .form-group:last-child {
        grid-column: auto;
    }
    .storage-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .storage-location {
        grid-column: 1 / -1;
    }
}

@media (max-width: 600px) and (orientation: portrait) {
    :root {
        --mobile-form-label-width: 86px;
    }

    .card .form-row,
    .card .equipment-filter-grid,
    .card .storage-grid,
    .modal-body .form-row,
    .toolbar .form-row {
        display: block;
    }

    .card .form-group,
    .modal-body .form-group,
    .toolbar .form-group {
        display: grid;
        grid-template-columns: var(--mobile-form-label-width) minmax(0, 1fr);
        gap: 10px;
        align-items: center;
        min-width: 0;
        margin-bottom: 10px;
    }

    .card .form-group > label,
    .modal-body .form-group > label,
    .toolbar .form-group > label {
        margin: 0;
        line-height: 1.35;
        text-align: right;
        align-self: center;
    }

    .card .form-group > input,
    .card .form-group > select,
    .card .form-group > textarea,
    .card .form-group > button,
    .card .form-group > .btn,
    .card .form-group > .btn-group,
    .card .form-group > .xf-picker-input-row,
    .card .form-group > .linkage-box,
    .card .form-group > .linkage-wrap,
    .card .form-group > .linkage-row,
    .modal-body .form-group > input,
    .modal-body .form-group > select,
    .modal-body .form-group > textarea,
    .modal-body .form-group > button,
    .modal-body .form-group > .btn,
    .modal-body .form-group > .btn-group,
    .modal-body .form-group > .xf-picker-input-row,
    .modal-body .form-group > .linkage-box,
    .modal-body .form-group > .linkage-wrap,
    .modal-body .form-group > .linkage-row,
    .toolbar .form-group > input,
    .toolbar .form-group > select,
    .toolbar .form-group > textarea,
    .toolbar .form-group > button,
    .toolbar .form-group > .btn,
    .toolbar .form-group > .btn-group,
    .toolbar .form-group > .xf-picker-input-row,
    .toolbar .form-group > .linkage-box,
    .toolbar .form-group > .linkage-wrap,
    .toolbar .form-group > .linkage-row {
        grid-column: 2;
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    .card .form-group > textarea,
    .modal-body .form-group > textarea,
    .toolbar .form-group > textarea {
        align-self: stretch;
    }

    .card .form-group > input[type="hidden"],
    .modal-body .form-group > input[type="hidden"],
    .toolbar .form-group > input[type="hidden"] {
        display: none;
    }

    .xf-picker-subject .xf-tree-dropdown {
        left: calc(var(--mobile-form-label-width) + 10px);
        right: 0;
        width: auto;
        min-width: 0;
        max-width: none;
    }

    .xf-picker-name .xf-name-dropdown {
        left: calc(var(--mobile-form-label-width) + 10px);
        width: max-content;
        min-width: calc(100% - var(--mobile-form-label-width) - 10px);
        max-width: min(var(--xf-name-dropdown-max-width, 100vw), calc(100vw - var(--mobile-form-label-width) - 24px));
    }

    .xf-picker-unit .xf-unit-tree-dropdown {
        left: calc(var(--mobile-form-label-width) + 10px);
        right: 0;
        width: auto;
        min-width: 0;
        max-width: none;
    }

    .submit-row {
        display: block;
    }

    .submit-actions {
        margin-left: calc(var(--mobile-form-label-width) + 10px);
    }
}
@media (max-width: 640px) {
    .nav-bar {
        padding: 0 var(--gap-sm);
        min-height: 3rem;
    }

    .nav-left .home-link,
    .nav-center .home-link,
    .nav-user {
        padding: 0.4rem 0.8rem;
        font-size: var(--fs-sm);
    }

    .nav-center {
        display: none;
    }
}
@media (max-width: 480px) {
    html { font-size: 14px; }

    .container {
        padding: var(--gap-xs);
    }

    .card {
        padding: var(--gap-sm);
        border-radius: var(--radius-md);
    }
    .user-dropdown {
        min-width: 260px;
        right: 8px;
    }
    .info-row .info-label {
        width: 70px;
    }
}

/* ============================================================
   Home page
   ============================================================ */
.home-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--clr-bg);
}

.home-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: var(--gap-md) var(--gap-sm);
    width: 100%;
    box-sizing: border-box;
    justify-content: center;
}

.cards-grid-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: auto;
    overflow-y: visible;
    margin: auto 0;
}

.cards-grid {
    display: grid;
    gap: 1.5rem;
    justify-content: center;
    margin: 0 auto;
    padding: 0.5rem 0.25rem;
    width: 100%;
}

.nav-card {
    background: var(--clr-surface);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
    padding: 1.75rem 1rem;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: all 0.25s cubic-bezier(0.2, 0, 0, 1);
    border: 1px solid var(--clr-border);
    cursor: pointer;
    color: var(--clr-text);
    will-change: transform;
}

.nav-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 28px -12px rgba(0, 0, 0, 0.2), 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: var(--clr-primary);
    background: #ffffff;
}

.nav-card:active {
    transform: translateY(-2px);
    transition-duration: 0.05s;
}

.card-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    background: rgba(0, 64, 128, 0.08);
    border-radius: 60px;
    transition: background 0.2s;
}

.nav-card:hover .card-icon {
    background: rgba(0, 64, 128, 0.15);
}

.card-icon span {
    font-size: 2.5rem;
}

.nav-card .card-title {
    font-size: var(--fs-lg);
    font-weight: 700;
    margin-bottom: 0.35rem;
    color: var(--clr-text);
}

.card-desc {
    font-size: var(--fs-sm);
    color: var(--clr-text-muted);
    margin-top: 4px;
    line-height: 1.4;
}

.status-message {
    color: var(--clr-text-muted);
    font-size: var(--fs-sm);
    text-align: center;
}

.status-message.error-message {
    color: var(--clr-danger);
}

.cards-grid-wrapper::-webkit-scrollbar {
    height: 8px;
}
.cards-grid-wrapper::-webkit-scrollbar-track {
    background: var(--clr-bg);
    border-radius: 10px;
}
.cards-grid-wrapper::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

@media (max-width: 640px) {
    .cards-grid {
        gap: 1rem;
        grid-template-columns: minmax(280px, 1fr) !important;
    }
    .nav-card {
        padding: 1.25rem 1rem;
    }
    .card-icon {
        width: 64px;
        height: 64px;
    }
    .card-icon span {
        font-size: 2.2rem;
    }
    .nav-card .card-title {
        font-size: var(--fs-base);
    }
    .card-desc {
        font-size: 0.8rem;
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    .cards-grid {
        grid-template-columns: repeat(2, minmax(280px, 1fr)) !important;
        gap: 1.25rem;
    }
}

@media (min-width: 1025px) {
    .cards-grid {
        gap: 1.5rem;
    }
}
