:root {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    color-scheme: light dark;

    /* ── Color Variables ── */

    /* Base */
    --color-bg: #f5f7fb;
    --color-surface: #ffffff;
    --color-surface-hover: #f3f4f6;
    --color-surface-subtle: #f8fafc;
    --color-surface-muted: #f9fafb;
    --color-surface-raised: #fafafa;

    /* Text */
    --color-text: #1f2937;
    --color-text-dark: #111827;
    --color-text-secondary: #374151;
    --color-text-tertiary: #4b5563;
    --color-text-muted: #6b7280;
    --color-text-placeholder: #9ca3af;
    --color-text-disabled: #d1d5db;

    /* Borders */
    --color-border: #e5e7eb;
    --color-border-light: #f3f4f6;
    --color-border-lighter: #f1f5f9;
    --color-border-medium: #d1d5db;
    --color-border-input: #e2e8f0;
    --color-border-table: #eef2f7;

    /* Primary (Blue) */
    --color-primary: #2563eb;
    --color-primary-text: #1d4ed8;
    --color-primary-dark: #1e3a8a;
    --color-primary-light: #60a5fa;
    --color-primary-hover-border: #93c5fd;
    --color-primary-border: #bfdbfe;
    --color-primary-bg: #eff6ff;
    --color-primary-bg-alt: #e5edff;
    --color-primary-gradient-start: #f0f4ff;

    /* Accent (Indigo) */
    --color-accent: #6366f1;
    --color-accent-border: #c7d2fe;

    /* Success (Green) */
    --color-success: #22c55e;
    --color-success-text: #059669;
    --color-success-text-dark: #166534;
    --color-success-border: #a7f3d0;
    --color-success-bg: #ecfdf5;
    --color-success-bg-alt: #dcfce7;

    /* Danger (Red) */
    --color-danger: #dc2626;
    --color-danger-text: #b91c1c;
    --color-danger-bg: #fef2f2;
    --color-danger-bg-alt: #ffe5e5;
    --color-danger-border: #fecaca;
    --color-danger-dark: #991b1b;
    --color-danger-light: #ef4444;
    --color-danger-light-border: #fca5a5;

    /* Warning (Amber) */
    --color-warning: #f59e0b;
    --color-warning-text: #b45309;
    --color-warning-text-dark: #92400e;
    --color-warning-text-alt: #d97706;
    --color-warning-border: #fde68a;
    --color-warning-bg: #fef3c7;
    --color-warning-bg-alt: #fffbeb;

    /* Info (Sky) */
    --color-info-text: #0284c7;
    --color-info-border: #bae6fd;
    --color-info-bg: #f0f9ff;

    /* Shadows */
    --shadow-sm: 0 2px 12px rgba(15, 23, 42, .08);
    --shadow-md: 0 1px 6px rgba(15, 23, 42, .1);
    --shadow-lg: 0 18px 40px rgba(15, 23, 42, .28);
    --shadow-drawer: -4px 0 20px rgba(15, 23, 42, .15);
    --shadow-toast: 0 6px 24px rgba(2, 6, 23, .28);
    --shadow-card-hover: 0 4px 12px rgba(0, 0, 0, .06);
    --shadow-sub: 0 12px 32px rgba(15, 23, 42, .25);

    /* Overlays */
    --overlay-backdrop: rgba(15, 23, 42, .45);
    --overlay-sub: rgba(15, 23, 42, .35);

    /* Spinners */
    --color-spinner: #242424;
    --color-spinner-muted: #6b7280;
    --color-spinner-placeholder: #9ca3af;

    /* Device card gradients */
    --device-header-bg: linear-gradient(135deg, #f0f4ff 0%, #f8fafc 100%);
    --device-header-offline-bg: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);

}

/* body / reset / input / button 基础已由 common.css 提供 */

.container {
    max-width: 1360px;
    padding-top: 52px;
}

/* ---------- Topbar ---------- */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 52px;
    background: var(--color-surface);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    box-shadow: var(--shadow-md);
    z-index: 200;
}

.topbar-btn {
    background: transparent;
    border: none;
    color: var(--color-text-secondary);
    padding: 2px;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.topbar-btn .material-icons {
    font-size: 22px;
}

.topbar-left,
.topbar-right,
.topbar-logo {
    flex: 1;
    height: 100%;
    display: flex;
    align-items: center;
}

.topbar-left {
    justify-content: flex-start;
    gap: 12px;
    position: relative;
}

.topbar-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text);
}

.topbar-right {
    justify-content: flex-end;
    gap: 8px;
}

.topbar-logo-img {
    width: 24px;
    height: 24px;
    border-radius: 8px;
}

/* ---------- Brand Loader ---------- */
.topbar-logo {
    position: relative;
}

.topbar-logo a {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.brand-loader {
    width: 26px;
    height: 26px;
    display: flex;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s;
}

.brand-loader.active {
    opacity: 1;
}

.brand-loader.active+.topbar-logo-img {
    opacity: 0;
}

.topbar-logo-img {
    transition: opacity .3s;
}

.brand-loader__svg {
    width: 26px;
    height: 26px;
    display: block;
    transform-origin: 50% 50%;
    animation: lagexSpinnerRotate 1.5s linear infinite;
}

.brand-loader__track {
    stroke: transparent;
}

.brand-loader__ring {
    stroke: var(--color-spinner);
    stroke-linecap: round;
    stroke-dasharray: 1, 200;
    stroke-dashoffset: 0;
    animation: lagexSpinnerDash 1.5s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {

    .brand-loader__svg,
    .brand-loader__ring {
        animation: none;
    }
}

@keyframes lagexSpinnerRotate {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes lagexSpinnerDash {
    0% {
        stroke-dasharray: 1, 200;
        stroke-dashoffset: 0;
    }

    50% {
        stroke-dasharray: 90, 200;
        stroke-dashoffset: -35;
    }

    100% {
        stroke-dasharray: 1, 200;
        stroke-dashoffset: -125;
    }
}

/* ---------- Image Loader ---------- */
.img-loader {
    display: none;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    pointer-events: none;
    z-index: 2;
}

.img-loading .img-loader {
    display: block;
}

.img-loader__svg {
    width: 32px;
    height: 32px;
    display: block;
    transform-origin: 50% 50%;
    animation: lagexSpinnerRotate 1.5s linear infinite;
}

.img-loader__track {
    stroke: transparent;
}

.img-loader__ring {
    stroke: var(--color-spinner-muted);
    stroke-linecap: round;
    stroke-dasharray: 1, 200;
    stroke-dashoffset: 0;
    animation: lagexSpinnerDash 1.5s ease-in-out infinite;
}

/* ---------- Side Drawer ---------- */
.drawer-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--overlay-backdrop);
    z-index: 300;
    backdrop-filter: blur(2px);
}

.drawer-backdrop.open {
    display: block;
}

.drawer {
    position: fixed;
    top: 0;
    right: -300px;
    width: 280px;
    height: 100vh;
    background: var(--color-surface);
    z-index: 310;
    box-shadow: var(--shadow-drawer);
    transition: right .25s ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.drawer.open {
    right: 0;
}

.drawer-header {
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    border-bottom: 1px solid var(--color-border);
    gap: 8px;
}

.drawer-nav {
    display: flex;
    flex-direction: column;
    padding: 8px;
    gap: 2px;
}

.drawer-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 6px;
    background: transparent;
    border: none;
    color: var(--color-text-secondary);
    font-size: 14px;
    cursor: pointer;
    text-align: left;
    justify-content: flex-start;
}

.drawer-item:hover {
    background: var(--color-surface-hover);
}

.drawer-item.active {
    background: var(--color-primary-bg);
    color: var(--color-primary);
    font-weight: 600;
}

.drawer-item .material-icons {
    font-size: 20px;
}

.drawer-divider {
    height: 1px;
    background: var(--color-border);
    margin: 4px 16px;
}

h1 {
    margin: 0;
    font-size: 22px;
}

h3 {
    margin: 0 0 10px;
    padding-right: 1rem;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

#btnWlQueryAdd {
    width: 100%;
    font-size: 16px;
    padding: 8px 0;
    margin-top: 30px;
}



.material-icons.spin {
    animation: icon-spin 1s linear infinite;
}

@keyframes icon-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ---------- Inline text loader ---------- */
.text-loader {
    display: inline-flex;
    width: 14px;
    height: 14px;
    vertical-align: -2px;
    margin-right: 4px;
}

/* ---------- Icon button compact loader ---------- */
.icon-btn-loader {
    display: inline-flex;
    width: 14px;
    height: 14px;
}

.icon-btn-loader svg {
    width: 100%;
    height: 100%;
    display: block;
    animation: lagexSpinnerRotate 1.5s linear infinite;
}

.text-loader__svg {
    width: 100%;
    height: 100%;
    display: block;
    animation: lagexSpinnerRotate 1.5s linear infinite;
}

.text-loader__track {
    stroke: transparent;
}

.text-loader__ring {
    stroke: var(--color-spinner-placeholder);
    stroke-linecap: round;
    stroke-dasharray: 1, 200;
    stroke-dashoffset: 0;
    animation: lagexSpinnerDash 1.5s ease-in-out infinite;
}

.status {
    font-size: 13px;
    color: var(--color-text-secondary);
}

.table-wrap {
    overflow-x: auto;
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 760px;
}

th,
td {
    border-bottom: 1px solid var(--color-border-table);
    text-align: left;
    padding: 8px;
    vertical-align: top;
    white-space: nowrap;
}

th {
    background: var(--color-surface-raised);
}

.wl-found {
    background: var(--color-success-bg-alt);
    color: var(--color-success-text-dark);
}

.wl-temp {
    background: var(--color-warning-bg);
    color: var(--color-warning-text-dark);
}

.wl-clickable {
    cursor: pointer;
    transition: filter 0.15s;
}

.wl-clickable:hover {
    filter: brightness(0.9);
}

/* ── 手机拍照 OCR 区域 ── */
.ocr-capture-area label {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    display: block;
}

.ocr-preview-wrap {
    position: relative;
    border: 1px dashed var(--border-color, #ccc);
    border-radius: 8px;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    background: var(--bg-secondary, #f5f5f5);
    transition: border-color 0.2s;
}

.ocr-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary, #888);
    font-size: 14px;
}

.ocr-placeholder .material-icons {
    font-size: 36px;
}

.ocr-preview-img {
    width: 100%;
    max-height: 140px;
    object-fit: cover;
}

.ocr-loading {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 14px;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.spin {
    animation: spin 1s linear infinite;
}

.ocr-loader {
    display: inline-flex;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.ocr-loader__svg {
    width: 100%;
    height: 100%;
    display: block;
    animation: lagexSpinnerRotate 1.5s linear infinite;
}

.ocr-loader__track {
    stroke: rgba(255, 255, 255, 0.25);
}

.ocr-loader__ring {
    stroke: #fff;
    stroke-linecap: round;
    stroke-dasharray: 1, 200;
    stroke-dashoffset: 0;
    animation: lagexSpinnerDash 1.5s ease-in-out infinite;
}

.ocr-result {
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 15px;
    text-align: center;
}

.ocr-success {
    background: var(--color-success-bg, #e8f5e9);
    color: var(--color-success-text, #2e7d32);
}

.ocr-fail {
    background: var(--color-danger-bg-alt, #fde8e8);
    color: var(--color-danger-text, #c62828);
}

.wl-alarm {
    background: var(--color-danger-bg-alt);
    color: var(--color-danger-text);
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.warn {
    color: var(--color-warning-text);
    font-size: 12px;
}

.page-panel {
    display: none;
    opacity: 0;
    transform: translateY(8px);
}

.page-panel.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
    animation: panelIn .22s ease;
}

.tabs {
    display: flex;
    gap: 8px;
    width: 100%;
    flex-wrap: nowrap;
}

.tabs-wrap {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.tabs .secondary {
    padding: 8px 14px;
    width: -webkit-fill-available;
}

.tab {
    background: var(--color-surface);
    color: var(--color-primary-text);
    border: 1px solid var(--color-primary-border);
}

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

/* toast 基础已由 common.css 提供，仅增量覆盖 */
.toast.recognize {
    background: var(--color-primary-dark);
}

.latest-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ---------- Stat Filter Cards ---------- */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 4px;
    border-radius: 10px;
    border: 1.5px solid var(--color-border);
    background: var(--color-surface-muted);
    cursor: pointer;
    transition: all .18s ease;
    user-select: none;
}

.stat-card:hover {
    border-color: var(--color-primary-hover-border);
    background: var(--color-primary-bg);
}

.stat-card.active {
    border-color: var(--color-primary);
    background: var(--color-primary-bg);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, .13);
}

.stat-card-count {
    font-size: 22px;
    font-weight: 800;
    line-height: 1.1;
    color: var(--color-text);
}

.stat-card.active .stat-card-count {
    color: var(--color-primary);
}

.stat-card-label {
    font-weight: 600;
    font-size: 14px;
    color: var(--color-text-muted);
    margin-top: 2px;
}

.stat-card.active .stat-card-label {
    color: var(--color-primary);
}

.latest-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.latest-grid {
    display: grid;
    grid-template-columns: 1.8fr 1.2fr;
    gap: 14px;
    align-items: stretch;
}

.latest-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    justify-content: center;
}

.latest-info .plate-display {
    padding: 1px;
    width: 120px;
    border-radius: 5.5px;
}

.latest-primary {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.latest-info .icon-btn {
    display: inline-block;
    white-space: nowrap;
    padding: 4px 12px;
    font-size: 16px;
    border-radius: 40px;
    background: var(--color-primary-bg-alt);
    color: var(--color-primary-text);
    border: 1px solid var(--color-primary-border);
}

.latest-info .icon-btn .material-icons {
    font-size: 18px;
}

/* 主页车牌徽章容器（1/4 缩小） */
.latest-plate-display {
    border-radius: 6px;
    margin-bottom: 6px;
    display: inline-block;
}

.latest-plate-display .plate-badge {
    max-width: 120px;
    border-width: 1px;
    border-radius: 5px;
}

.latest-plate-display .plate-badge .plate-char {
    margin: 0 1.2px;
}

.latest-plate-display .plate-badge .plate-char-text {
    font-size: 16px;
}

.latest-plate-display .plate-badge .plate-dot {
    width: 3px;
    height: 3px;
    margin: 0 2px;
}

.latest-plate-display .plate-badge .plate-star {
    font-size: 8px;
    margin: 0;
}

.latest-plate-display .plate-badge .plate-rivet:nth-child(1) {
    top: 1px;
    width: 4px;
    height: 4px;
}

.latest-plate-display .plate-badge .plate-rivet:nth-child(2) {
    top: 1px;
    width: 4px;
    height: 4px;
}

.latest-plate-display .plate-badge .plate-rivet:nth-child(3) {
    left: calc(25% - 2px);
    bottom: 1px;
    width: 8px;
    height: 4px;
}

.latest-plate-display .plate-badge .plate-rivet:nth-child(4) {
    right: calc(25% - 2px);
    bottom: 1px;
    width: 8px;
    height: 4px;
}

.latest-plate-display .plate-badge.empty {
    padding: 6px 16px;
    font-size: 16px;
    letter-spacing: 1px;
    border-radius: 4px;
}

.latest-plate-display .plate-badge .plate-text-fallback {
    font-size: 10px;
}

.latest-primary input,
.latest-primary button {
    height: 28px;
}

.latest-primary button .material-icons {
    font-size: 16px;
}

/* 进出次数箭头 */
.latest-io-counts {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 4px;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-mono, monospace);
}

.io-arrow {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    font-size: 12px;
    padding: 1px 4px;
    border-radius: 4px;
    line-height: 1.4;
}

.io-arrow.enter {
    color: var(--color-success, #10b981);
}

.io-arrow.leave {
    color: var(--color-danger-light, #ef4444);
}

.io-arrow.highlight {
    background: var(--color-danger-light, #ef4444);
    color: #fff;
}

.io-arrow.enter.highlight {
    background: var(--color-success, #10b981);
    color: #fff;
}

.latest-plate-display input {
    font-size: 14px;
    font-weight: 700;
    width: 100%;
    padding: 4px 8px;
    border: 1px solid var(--color-primary-light);
    border-radius: 6px;
    outline: none;
}

.latest-plate-display select {
    font-size: 12px;
    padding: 3px 6px;
    border: 1px solid var(--color-border-medium);
    border-radius: 4px;
    background: var(--color-surface);
    min-width: 0;
    flex: 1;
}

.plate-edit-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 220px;
    padding: 4px;
}

.plate-edit-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.plate-edit-row .icon-btn {
    flex-shrink: 0;
}

/* === 全字段编辑表单（取代 latest-info 内容） === */
.latest-edit-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 4px 0;
}

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

.edit-form-label {
    flex-shrink: 0;
    width: 60px;
    font-size: 13px;
    color: var(--color-text-secondary, #666);
    text-align: right;
}

.edit-form-row input,
.edit-form-row select {
    flex: 1;
    min-width: 0;
    height: 32px;
    padding: 4px 8px;
    font-size: 13px;
    text-align: center;
    border: 1px solid var(--color-border-medium);
    border-radius: 6px;
    background: var(--color-surface);
    color: var(--color-text);
    outline: none;
    transition: border-color .15s;
}

.edit-form-row input:focus,
.edit-form-row select:focus {
    border-color: var(--color-primary);
}

.edit-form-row input[type="text"] {
    font-weight: 700;
}

.edit-form-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.edit-form-actions button {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 40px;
    font-size: 16px;
    border-radius: 6px;
}

.edit-form-actions button .material-icons {
    font-size: 16px;
}

.copyable-plate {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0;
    vertical-align: middle;
    height: 28px;
}

.copyable-plate .plate-char {
    display: inline-block;
    height: 80%;
    aspect-ratio: 1 / 1.87;
    background-repeat: no-repeat;
    background-size: 1000% 800%;
    flex-shrink: 0;
    margin: 0 1px;
}

.copyable-plate .plate-char-text {
    font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
    font-weight: 700;
    font-size: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    aspect-ratio: 1 / 1.87;
    flex-shrink: 0;
    line-height: 1;
}

.copyable-plate .plate-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--color-text-dark);
    margin: 0 2px;
    flex-shrink: 0;
    align-self: center;
}

.copyable-plate .plate-star {
    font-weight: 900;
    font-size: inherit;
    line-height: 1;
    margin: 0 1px;
    flex-shrink: 0;
    align-self: center;
}

.copyable-plate:hover {
    color: var(--color-primary);
}

.latest-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--color-text-muted);
    flex-wrap: wrap;
}

.latest-sep {
    color: var(--color-text-disabled);
    font-size: 11px;
}

.ld {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 2px 0;
}

.ld-k {
    color: var(--color-text-placeholder);
    white-space: nowrap;
    min-width: 28px;
}

.ld-k::after {
    content: '';
}

.latest-images {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 8px;
    align-items: stretch;
    position: relative;
}

.latest-image {
    position: relative;
    display: block;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    overflow: hidden;
    background: var(--color-surface-subtle);
}

#latestThumbImg {
    position: absolute;
    bottom: 15px;
    right: 8px;
    width: 100px;
    height: auto;
    border-radius: 6px;
}

.latest-image.big {
    min-height: 180px;
}

.latest-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.latest-image img[src=""] {
    display: none;
}

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

.latest-actions button {
    flex: 1;
    padding: 8px 0;
    min-width: 80px;
}

/* ---------- History collapsible cards ---------- */

.history-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.history-item {
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-surface);
    transition: box-shadow .15s;
}

.history-item:hover {
    box-shadow: var(--shadow-card-hover);
}

/* 白名单同步状态图标 */
.wl-sync-icon {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    width: 20px;
    height: 20px;
    flex: 1;
}

.wl-sync-ok {
    color: #22c55e;
    font-size: 16px !important;
}

.wl-sync-fail {
    color: #ef4444;
    font-size: 18px !important;
}

/* 全量检查结果弹窗 */
.wl-cr-summary {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 16px;
}

.wl-cr-stat {
    text-align: center;
    padding: 10px 18px;
    border-radius: 8px;
    background: var(--color-surface-alt, #f8fafc);
    border: 2px solid var(--color-border);
    min-width: 80px;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
    user-select: none;
}

.wl-cr-stat:hover {
    box-shadow: 0 0 0 2px rgba(37, 99, 235, .12);
}

.wl-cr-stat-active {
    border-color: var(--color-primary, #2563eb) !important;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, .18);
}

.wl-cr-stat-warn {
    background: #fef2f2;
    border-color: #fca5a5;
}

.wl-cr-stat-ok {
    background: #f0fdf4;
    border-color: #86efac;
}

.wl-cr-num {
    display: block;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
}

.wl-cr-stat-warn .wl-cr-num {
    color: #dc2626;
}

.wl-cr-stat-ok .wl-cr-num {
    color: #16a34a;
}

.wl-cr-label {
    font-size: 12px;
    color: var(--color-text-muted);
}

.wl-cr-synced {
    text-align: center;
    padding: 24px 0;
    color: #16a34a;
}

.wl-cr-synced .material-icons {
    font-size: 48px;
    display: block;
    margin-bottom: 8px;
}

.wl-cr-synced p {
    margin: 0;
    font-size: 15px;
    font-weight: 500;
}

.wl-cr-list {
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: 6px;
}

.wl-cr-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--color-border-light, #f0f0f0);
}

.wl-cr-row:last-child {
    border-bottom: none;
}

.wl-cr-plate {
    font-weight: 600;
    font-size: 14px;
    min-width: 90px;
}

.wl-cr-time {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-left: auto;
}

.wl-cr-status {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 4px;
    background: #fef2f2;
    color: #dc2626;
}

.wl-cr-syncing {
    background: #eff6ff;
    color: #2563eb;
}

.wl-cr-done {
    background: #f0fdf4;
    color: #16a34a;
}

.wl-cr-fail {
    background: #fef2f2;
    color: #dc2626;
}

.history-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    user-select: none;
    justify-content: space-between;
}

.history-summary .material-icons.expand-icon {
    font-size: 18px;
    color: var(--color-text-placeholder);
    transition: transform .2s;
}

.history-item.open .history-summary .expand-icon {
    transform: rotate(180deg);
}

.history-plate {
    font-weight: 600;
    font-size: 15px;
    color: var(--color-text);
    white-space: nowrap;
}

.history-plate.plate-alarm {
    color: var(--color-error, #d32f2f);
}

.history-time {
    font-size: 12px;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.history-detail {
    display: none;
    padding: 0 14px 12px;
    animation: panelIn .15s ease;
}

.history-item.open .history-detail {
    display: block;
}

.history-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 6px 10px;
    font-size: 13px;
    margin-bottom: 8px;
}

.history-detail-grid .dl {
    display: flex;
    gap: 4px;
    align-items: center;
}

.history-detail-grid .dl dt {
    color: var(--color-text-muted);
    white-space: nowrap;
}

.history-detail-grid .dl dd {
    margin: 0;
    display: flex;
    align-items: center;
    font-weight: 600;
}

.parking-duration {
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}

.today-stats-bar {
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--color-info-bg);
    color: var(--color-info-text);
    border: 1px solid var(--color-info-border);
}

.today-stats-bar .tag {
    font-size: 12px;
}

.parking-duration.present {
    background: var(--color-success-bg);
    color: var(--color-success-text);
    border: 1px solid var(--color-success-border);
}

.parking-duration.left {
    background: var(--color-info-bg);
    color: var(--color-info-text);
    border: 1px solid var(--color-info-border);
}

.parking-duration.no-entry {
    background: var(--color-warning-bg-alt);
    color: var(--color-warning-text-alt);
    border: 1px solid var(--color-warning-border);
}

.parking-img-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
}

.parking-img-col {
    min-width: 0;
}

.parking-img-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-bottom: 4px;
    text-align: center;
}

.history-thumb {
    width: 160px;
    max-height: 120px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--color-border);
    margin-top: 4px;
    cursor: pointer;
}

.card-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed var(--color-border);
}

.card-actions button {
    font-size: 15px;
    padding: 6px 14px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.card-actions button .material-icons {
    font-size: 15px;
}

/* ---------- Detail modal nav ---------- */
.detail-nav,
.detail-actions {
    display: flex;
    gap: 6px;
}

.detail-nav button,
.detail-actions button {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 6px;
}

.detail-nav button .material-icons,
.detail-actions button .material-icons {
    font-size: 18px;
}

/* ---------- Whitelist card summary extras ---------- */
.wl-summary-field,
.wl-summary-remark {
    font-size: 12px;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 120px;
}

.wl-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0;
}

.wl-overdue {
    color: var(--color-danger-light) !important;
    font-weight: 600;
}

.wl-auto-del-badge {
    font-size: 10px;
    padding: 2px 6px;
    flex-shrink: 0;
}

.wl-id {
    font-size: 11px;
    color: var(--color-text-placeholder);
    font-family: 'Menlo', 'Consolas', monospace;
    min-width: 30px;
}

/* ---------- Device info panel ---------- */
.device-info-panel {
    padding: 10px 14px;
    background: var(--color-surface-muted);
    border-radius: 8px;
    border: 1px solid var(--color-border);
    font-size: 13px;
}

/* 单设备模式隐藏 */
.single-dev-hidden {
    display: none !important;
}

/* 全局设备选择栏 */
.device-select-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--color-surface-subtle);
    border: 1px solid var(--color-border-input);
    border-radius: 10px;
    margin-bottom: 12px;
}

.device-select-bar .device-select-icon {
    font-size: 20px;
    color: var(--color-text-muted);
}

.device-select-bar select {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    padding: 4px 0;
    outline: none;
    background-image: none;
}

.device-select-bar .icon-btn {
    padding: 4px 2px;
    color: var(--color-primary-text);
}

/* 设备信息卡片 */
.device-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
    transition: border-color .2s;
}

.device-card:last-child {
    margin-bottom: 0;
}

.device-card:hover {
    border-color: var(--color-accent-border);
}

.device-card.offline {
    opacity: .75;
}

.device-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--device-header-bg);
    border-bottom: 1px solid var(--color-border);
}

.device-card.offline .device-card-header {
    background: var(--device-header-offline-bg);
}

.device-card-icon {
    font-size: 20px;
    color: var(--color-accent);
}

.device-card.offline .device-card-icon {
    color: var(--color-text-placeholder);
}

.device-card-sn {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text);
    flex: 1;
}

.device-card-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-muted);
}

.device-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.device-status-dot.online {
    background: var(--color-success);
    box-shadow: 0 0 6px rgba(34, 197, 94, .45);
}

.device-status-dot.offline {
    background: var(--color-text-disabled);
}

.device-card-body {
    padding: 8px 14px 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 16px;
}

.device-card-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--color-text-secondary);
    padding: 3px 0;
}

.device-card-row>.material-icons {
    font-size: 14px;
    color: var(--color-text-placeholder);
    flex-shrink: 0;
}

.device-card-label {
    color: var(--color-text-muted);
    white-space: nowrap;
    margin-right: 2px;
}

.device-card-row .mono {
    font-weight: 600;
}

.device-empty {
    text-align: center;
    padding: 24px 0;
    color: var(--color-text-placeholder);
    font-size: 13px;
}

.device-empty p {
    margin: 8px 0 0;
}

/* --- 设备管理列表 --- */
.dev-mgr-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dev-mgr-card {
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    overflow: hidden;
    transition: border-color .2s;
}

.dev-mgr-card:hover {
    border-color: var(--color-accent-border);
}

.dev-mgr-card.offline {
    opacity: .78;
}

.dev-mgr-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--device-header-bg);
}

.dev-mgr-card.offline .dev-mgr-card-header {
    background: var(--device-header-offline-bg);
}

.dev-mgr-card-header>.material-icons {
    font-size: 20px;
    color: var(--color-accent);
}

.dev-mgr-card-info {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    min-width: 0;
}

.dev-mgr-sn {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text);
    word-break: break-all;
}

.dev-mgr-alias {
    font-size: 12px;
    color: var(--color-text-muted);
}

.dev-mgr-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    white-space: nowrap;
    color: var(--color-text-muted);
}

.dev-mgr-card-actions {
    display: flex;
    gap: 6px;
    padding: 6px 14px 10px;
    justify-content: flex-end;
}

.device-card-alias {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-left: 2px;
}

.tag-group {
    background: var(--color-surface-muted);
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 4px;
}

/* --- 设备授权用户列表 --- */
.dev-users-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
}

.dev-user-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--color-surface-muted);
    border-radius: 8px;
    font-size: 13px;
}

.dev-user-row>.material-icons {
    font-size: 18px;
    color: var(--color-text-muted);
}

.dev-user-name {
    font-weight: 600;
    flex: 1;
}

.dev-user-id {
    font-size: 11px;
    color: var(--color-text-muted);
}

/* modal-wide 扩展 */
.modal-card.modal-wide {
    width: min(960px, 92vw);
    max-height: 80vh;
}

.modal-card.modal-wide .modal-body {
    max-height: 60vh;
    overflow-y: auto;
}

/* filter-input / icon-btn / checkbox / login 基础已由 common.css 提供 */

/* Sub-edit overlay inside detail modal */
.sub-edit-overlay {
    position: absolute;
    inset: 0;
    background: var(--overlay-sub);
    border-radius: 8px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: panelIn .2s ease;
}

.sub-edit-card {
    background: var(--color-surface);
    border-radius: 8px;
    box-shadow: var(--shadow-sub);
    padding: 16px;
    width: min(520px, 96%);
    overflow-y: auto;
}

/* toastIn / toastOut keyframes 已由 common.css 提供 */

@keyframes panelIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 980px) {

    .grid2,
    .grid3 {
        grid-template-columns: 1fr;
    }

    .row>* {
        width: 100%;
    }

    .row>label {
        width: auto;
    }

    .row>button {
        width: 100%;
    }

    h1 {
        font-size: 20px;
    }

    .latest-grid {
        grid-template-columns: 1fr;
    }

    .latest-images {
        grid-template-columns: 1fr;
    }

    table {
        min-width: 640px;
    }
}

/* login / checkbox 基础已由 common.css 提供 */

/* ========== PERM GRID ========== */

.perm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}

/* ========== TAG VARIANTS ========== */

.tag-danger {
    background: var(--color-danger-bg) !important;
    color: var(--color-danger) !important;
    border-color: var(--color-danger-border) !important;
}

.tag-banned {
    background: rgba(239, 68, 68, .12);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, .25);
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
    line-height: 1.5;
}

/* ========== TOPBAR USER BUTTON ========== */

.topbar-user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px 4px 4px;
    border-radius: 12px;
    transition: background .15s;
}

.topbar-user-btn:hover {
    background: var(--color-surface-subtle);
}

.topbar-avatar-wrap {
    position: relative;
    flex-shrink: 0;
    width: 34px;
    height: 34px;
}

.topbar-avatar-wrap .topbar-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--color-border);
    display: block;
}

.topbar-avatar-wrap .topbar-avatar-placeholder {
    font-size: 34px;
    color: var(--color-text-disabled);
    display: block;
    width: 34px;
    height: 34px;
}

.topbar-online-dot {
    position: absolute;
    bottom: 2px;
    right: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--color-text-disabled, #999);
    border: 2px solid var(--topbar-bg, var(--color-surface));
    box-sizing: border-box;
    transition: background .3s ease;
}

.topbar-online-dot.online {
    background: #22c55e;
}

.topbar-online-dot.offline {
    background: var(--color-text-disabled, #999);
}

.topbar-user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
    line-height: 1.3;
}

.topbar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.topbar-user-sub {
    font-size: 11px;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

/* ========== TOPBAR AVATAR (legacy) ========== */

.topbar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--color-border);
    display: block;
}

/* ========== PROFILE AVATAR ========== */

.profile-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--color-border-light);
}

.profile-avatar-wrap {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface-muted);
    border: 2px solid var(--color-border);
    cursor: pointer;
    transition: border-color 0.15s;
}

.profile-avatar-wrap:hover {
    border-color: var(--color-primary);
}

.profile-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-avatar-placeholder {
    font-size: 80px !important;
    color: var(--color-text-disabled);
}

/* ===== 用户下拉菜单 ===== */
.user-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: -8px;
    min-width: 240px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
    z-index: 1200;
    padding: 12px;
    opacity: 0;
    transform: translateY(-8px) scale(.97);
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease, min-width .3s ease, top .3s ease, left .3s ease;
}

.user-dropdown.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.user-dropdown.editing {
    top: calc(100% + 14px);
    left: 2px;
    min-width: 300px;
}

.user-dropdown-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 4px;
}

.user-dropdown-avatar {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    position: relative;
    cursor: pointer;
    border-radius: 10px;
    overflow: hidden;
}

.user-dropdown-avatar-img {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    object-fit: cover;
    border: 2px solid var(--color-border);
}

.user-dropdown-avatar-ph {
    font-size: 44px!important;
    color: var(--color-text-disabled);
}

.user-dropdown-avatar-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    opacity: 0;
    transition: opacity .2s;
}

.user-dropdown-avatar-overlay .material-icons {
    font-size: 20px;
    color: #fff;
}

.user-dropdown-avatar:hover .user-dropdown-avatar-overlay {
    opacity: 1;
}

.user-dropdown-info {
    gap: 2px;
    display: flex;
    flex-direction: column;
}

.user-dropdown-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    justify-content: space-between;
}

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

.user-dropdown-meta {
    font-size: 12px;
    color: var(--color-text-muted);
}

.user-dropdown-device {
    font-size: 11px;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.ud-info-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .85em;
    color: var(--color-text-muted);
    padding: 3px 0;
}

.ud-info-row .material-icons {
    font-size: 16px;
    color: var(--color-text-disabled);
}

.user-dropdown-divider {
    height: 1px;
    background: var(--color-border);
    margin: 8px 0;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    background: none;
    border-radius: 8px;
    font-size: 13px;
    color: var(--color-primary);
    cursor: pointer;
    transition: background .15s;
}

.user-dropdown-item:hover {
    background: var(--color-surface-subtle);
}

.user-dropdown-item .material-icons {
    font-size: 18px;
}

.user-dropdown-danger {
    color: var(--color-danger);
}

.user-dropdown-danger:hover {
    background: color-mix(in srgb, var(--color-danger) 8%, transparent);
}

/* --- 下拉菜单编辑视图 --- */
#udInfoView,
#udEditView {
    transition: opacity .25s ease;
}

#udInfoView.ud-fade-out,
#udEditView.ud-fade-out {
    opacity: 0;
}

.ud-edit-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text);
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 10px;
}

.ud-edit-header .material-icons {
    font-size: 18px;
    color: var(--color-primary);
}

.ud-edit-avatar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    padding: 8px 10px;
    background: var(--color-surface-subtle);
    border-radius: 10px;
}

.ud-edit-avatar-wrap {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
}

.ud-edit-avatar-wrap .user-dropdown-avatar-img {
    width: 52px;
    height: 52px;
    border-radius: 12px;
}

.ud-edit-avatar-wrap .user-dropdown-avatar-ph {
    font-size: 52px;
}

.ud-edit-avatar-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    padding: 6px 12px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-surface);
    color: var(--color-text-muted);
    cursor: pointer;
    transition: background .15s, color .15s;
}

.ud-edit-avatar-btn:hover {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

.ud-edit-field {
    margin-bottom: 6px;
}

.ud-edit-field label {
    display: block;
    font-size: 11px;
    color: var(--color-text-muted);
    margin-bottom: 6px;
    font-weight: 500;
}

.ud-edit-field input,
.ud-edit-field select {
    width: 100%;
    padding: 6px 8px;
    font-size: 13px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-surface);
    color: var(--color-text);
    outline: none;
    transition: border-color .15s;
    box-sizing: border-box;
}

.ud-edit-field input:focus,
.ud-edit-field select:focus {
    border-color: var(--color-primary);
}

.ud-edit-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.ud-edit-actions button {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 0;
    font-size: 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: background .15s, opacity .15s;
}

.ud-edit-actions .material-icons {
    font-size: 16px;
}

/* ===== 用户卡片弹窗 info rows ===== */
.user-card-info-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-card-info-rows .info-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    padding: 6px 0;
    border-bottom: 1px solid var(--color-border-light);
}

.user-card-info-rows .info-label {
    flex-shrink: 0;
    width: 72px;
    color: var(--color-text-muted);
    font-weight: 500;
}

.uc-info-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .88em;
    color: var(--color-text-muted);
}

.uc-info-row .material-icons {
    font-size: 18px;
    color: var(--color-text-disabled);
}

/* ========== USER CARD LIST ========== */

.user-card-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.user-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 16px;
    transition: box-shadow .15s, border-color .15s;
}

.user-card:hover {
    box-shadow: var(--shadow-card-hover);
    border-color: var(--color-border-medium);
}

.user-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.user-card-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--color-border);
    flex-shrink: 0;
}

.user-card-avatar-icon {
    font-size: 44px;
    color: var(--color-text-disabled);
    flex-shrink: 0;
    width: 44px;
    height: 44px;
}

/* 头像外层包裹（用于定位在线圆点） */
.user-card-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

/* 在线状态圆点 */
.user-online-dot {
    position: absolute;
    bottom: 3px;
    right: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--color-surface);
    box-sizing: border-box;
}

.user-online-dot.online {
    background: #22c55e;
}

.user-online-dot.offline {
    background: #a1a1aa;
}

/* 在线状态标签 */
.user-online-tag {
    font-size: 12px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 888px;
    line-height: 1.4;
}

.user-online-tag.online {
    color: #16a34a;
    background: rgba(34, 197, 94, .12);
}

.user-online-tag.offline {
    color: #a1a1aa;
    background: rgba(161, 161, 170, .10);
}

.user-card-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--color-text);
}

.user-card-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--color-text-muted);
}

.user-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--color-text-placeholder);
    padding-top: 10px;
    border-top: 1px solid var(--color-border-light);
    margin-top: auto;
}

.user-card-actions {
    display: flex;
    gap: 4px;
}

.user-card-banned {
    opacity: .55;
    filter: grayscale(.3);
}

.user-card-banned:hover {
    opacity: .8;
}

/* ========== USER LIST AVATAR (legacy) ========== */

.user-list-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--color-border);
    flex-shrink: 0;
}

.user-list-avatar-icon {
    font-size: 36px;
    color: var(--color-text-disabled);
    flex-shrink: 0;
    width: 36px;
    height: 36px;
}

/* ========== PERMISSION DISABLED STATE ========== */

.perm-disabled {
    opacity: 0.45;
    cursor: not-allowed !important;
    user-select: none;
    position: relative;
}

[data-perm-disabled] input,
[data-perm-disabled] select,
[data-perm-disabled] textarea {
    pointer-events: none;
    background: var(--color-surface-muted);
}

/* ========== AUDIT LOG ITEMS ========== */

/* 用户详情 - 头部 */
.user-info-header {
    text-align: center;
    padding: 16px 0 12px;
}

.user-info-avatar img {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--color-border);
}

.user-info-name {
    font-size: 18px;
    font-weight: 700;
    margin: 10px 0 6px;
    color: var(--color-text);
}

/* 用户详情 - 分区 */
.user-info-section {
    background: var(--color-surface-subtle);
    border: 1px solid var(--color-border-lighter);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 10px;
}

.user-info-section:last-child {
    margin-bottom: 0;
}

.user-info-section-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: 10px;
}

.user-info-section-title>.material-icons {
    font-size: 16px;
    color: var(--color-accent);
}

/* 用户详情 - 信息网格 */
.user-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 10px;
}

.user-info-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--color-text-secondary);
    padding: 4px 0;
}

.user-info-row.full {
    grid-column: 1 / -1;
}

.user-info-row>.material-icons {
    font-size: 14px;
    color: var(--color-text-placeholder);
    flex-shrink: 0;
}

.user-info-label {
    color: var(--color-text-muted);
    white-space: nowrap;
    margin-right: 2px;
}

/* 用户详情 - 权限标签 */
.user-info-perm-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.user-info-perm-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    background: var(--color-primary-bg);
    color: var(--color-primary);
}

/* 操作日志 */
.audit-log-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    font-size: 12px;
    border-bottom: 1px solid var(--color-border-lighter);
    flex-wrap: wrap;
    transition: background .15s;
}

.audit-log-item:last-child {
    border-bottom: none;
}

.audit-log-item:hover {
    background: var(--color-surface-subtle);
}

.audit-action {
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
}

.audit-detail {
    flex: 1;
    min-width: 0;
    color: var(--color-text-muted);
    word-break: break-all;
}

.audit-time {
    white-space: nowrap;
    color: var(--color-text-placeholder);
    font-size: 11px;
}

.audit-ip {
    white-space: nowrap;
    color: var(--color-text-placeholder);
    font-size: 11px;
}

/* ========== AUDIT LOG PAGE ========== */
.audit-page-filters {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.audit-page-filters input {
    height: 32px;
    font-size: 13px;
}

.audit-page-filters button {
    height: 32px;
    font-size: 13px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    gap: 2px;
}

.audit-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.audit-log-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 600px;
}

.audit-log-table thead th {
    text-align: left;
    padding: 10px 12px;
    font-weight: 600;
    font-size: 12px;
    color: var(--color-text-secondary);
    background: var(--color-surface-subtle);
    border-bottom: 2px solid var(--color-border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}

.audit-log-table tbody td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--color-border-lighter);
    color: var(--color-text);
    vertical-align: top;
}

.audit-log-table tbody tr:hover {
    background: var(--color-surface-subtle);
}

.audit-log-table tbody tr.selected {
    background: color-mix(in srgb, var(--color-accent) 12%, transparent);
}

.audit-log-table tbody tr.selected td {
    color: var(--color-accent);
}

.audit-row-alt {
    background: color-mix(in srgb, var(--color-surface-subtle) 40%, transparent);
}

.audit-td-user {
    white-space: nowrap;
    font-weight: 500;
}

.audit-td-action {
    white-space: nowrap;
}

.audit-action-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
    background: color-mix(in srgb, var(--color-primary) 12%, transparent);
    color: var(--color-primary);
}

.audit-td-detail {
    color: var(--color-text-muted);
    word-break: break-all;
    max-width: 300px;
}

.audit-td-ip {
    white-space: nowrap;
    font-size: 12px;
    color: var(--color-text-placeholder);
}

.audit-td-time {
    white-space: nowrap;
    font-size: 12px;
    color: var(--color-text-placeholder);
}

/* ========== SITE INFO PAGES ========== */
.site-info-page {
    max-width: 800px;
    margin: 0 auto;
}

.site-info-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 2px solid var(--color-primary);
}

.site-info-header .material-icons {
    font-size: 28px;
    color: var(--color-primary);
}

.site-info-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--color-text);
}

.site-info-content {
    line-height: 1.8;
    color: var(--color-text-secondary);
    font-size: 14px;
    word-break: break-word;
}

.site-info-content table {
    min-width: auto;
}

.site-info-content table th,
.site-info-content table td {
    white-space: normal;
}

.site-info-content h1,
.site-info-content h2,
.site-info-content h3,
.site-info-content h4 {
    color: var(--color-text);
    margin: 16px 0 8px;
}

.site-info-content a {
    color: var(--color-primary);
    text-decoration: underline;
}

.site-info-content ul,
.site-info-content ol {
    padding-left: 20px;
    margin: 8px 0;
}

.site-info-content pre,
.site-info-content code {
    background: var(--color-bg);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 13px;
}

.site-info-content pre {
    padding: 12px;
    overflow-x: auto;
}

.site-info-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
}

.site-info-content th,
.site-info-content td {
    border: 1px solid var(--color-border);
    padding: 8px 12px;
    text-align: left;
}

.site-info-content th {
    background: var(--color-bg);
    font-weight: 600;
}

.site-info-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--color-text-disabled);
}

.site-info-empty .material-icons {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}

.site-info-empty p {
    margin: 0;
    font-size: 14px;
}

/* ========== CONTACT PAGE ========== */
.contact-qrcode-section {
    text-align: center;
    padding-bottom: 12px;
}

.contact-qrcode-section h4 {
    color: var(--color-text-secondary);
    font-size: 14px;
}

.contact-qrcode-section img {
    width: 90%;
    object-fit: contain;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface);
}

.contact-icons-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 4px;
}

.contact-icon-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all .2s ease;
    cursor: pointer;
    gap: 4px;
    min-width: 40px;
}

.contact-icon-circle {
    width: 26px;
    height: 26px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.contact-icon-label {
    font-size: 11px;
    color: var(--color-text-secondary);
    text-align: center;
    max-width: 64px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
}

.contact-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-text-disabled);
    width: 100%;
}

.contact-empty .material-icons {
    font-size: 40px;
    display: block;
    margin-bottom: 8px;
}

.contact-empty p {
    margin: 0;
    font-size: 13px;
}

/* ========== CONTACT MESSAGE FORM ========== */
.contact-msg-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border);
}

.contact-msg-section h4 {
    margin: 0 0 14px;
    font-size: 15px;
    color: var(--color-text);
    display: flex;
    align-items: center;
}

.contact-msg-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.contact-msg-row {
    display: flex;
    gap: 10px;
}

.contact-msg-row input {
    flex: 1;
    min-width: 0;
}

.contact-msg-form textarea {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

/* ========== CLICK-TEXT CAPTCHA MODAL ========== */
.captcha-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    font-weight: 600;
    font-size: 15px;
    border-bottom: 1px solid var(--color-border);
}

.captcha-modal-hint {
    padding: 10px 16px;
    font-size: 13px;
    color: var(--color-text-secondary);
    text-align: center;
    user-select: none;
}

.captcha-modal-hint span {
    color: var(--color-primary);
    font-weight: 600;
    letter-spacing: 6px;
    font-size: 15px;
}

.captcha-modal-board {
    position: relative;
    width: 100%;
    height: 200px;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    overflow: hidden;
    cursor: pointer;
    user-select: none;
    background-image:
        radial-gradient(circle, var(--color-border) 1px, transparent 1px);
    background-size: 20px 20px;
}

.captcha-char {
    position: absolute;
    width: 36px;
    height: 36px;
    line-height: 36px;
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    transition: transform .15s, box-shadow .15s;
    color: var(--color-text);
    z-index: 1;
}

.captcha-char:hover {
    transform: scale(1.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
    z-index: 2;
}

.captcha-char.selected {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
    transform: scale(1.1);
}

.captcha-char.selected::after {
    content: attr(data-order);
    position: absolute;
    top: -6px;
    right: -6px;
    width: 16px;
    height: 16px;
    line-height: 16px;
    font-size: 10px;
    font-weight: 700;
    background: var(--color-danger, #e53935);
    color: #fff;
    border-radius: 50%;
    text-align: center;
}

.captcha-char.wrong {
    animation: captchaShake .4s;
    border-color: var(--color-danger, #e53935);
}

@keyframes captchaShake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-6px);
    }

    40% {
        transform: translateX(6px);
    }

    60% {
        transform: translateX(-4px);
    }

    80% {
        transform: translateX(4px);
    }
}

.captcha-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px 12px;
}

.captcha-modal-progress {
    display: flex;
    gap: 6px;
}

.captcha-progress-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--color-border);
    transition: background .2s;
}

.captcha-progress-dot.done {
    background: var(--color-primary);
}

.captcha-refresh-btn {
    font-size: 13px;
    padding: 4px 12px;
}

.contact-msg-form button.primary {
    align-self: flex-start;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ========== CONTACT CONFIG ROWS ========== */
.contact-cfg-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.contact-cfg-type {
    width: 56px;
    flex-shrink: 0;
    font-weight: 500;
    font-size: 13px;
    color: var(--color-text-secondary);
}

.contact-cfg-preview {
    width: 30px;
    height: 30px;
    background-size: 30px 30px;
    background-repeat: no-repeat;
    background-position: center;
    flex-shrink: 0;
}

.contact-cfg-row input {
    min-width: 0;
    flex: 1;
}

/* ========== RELEASE TIMELINE ========== */
.release-timeline {
    position: relative;
    padding-left: 20px;
}

.release-timeline::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: var(--color-border);
    border-radius: 1px;
}

.release-item {
    position: relative;
    margin-bottom: 28px;
    padding-left: 12px;
}

.release-item::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--color-primary);
    border: 2px solid var(--color-surface);
    box-shadow: 0 0 0 2px var(--color-primary);
}

.release-tag {
    display: inline-block;
    font-weight: 700;
    font-size: 16px;
    color: var(--color-primary);
    margin-bottom: 2px;
}

.release-date {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-bottom: 8px;
}

.release-body {
    color: var(--color-text-secondary);
    font-size: 14px;
    line-height: 1.7;
}

.release-body h4 {
    margin: 0 0 6px;
    color: var(--color-text);
    font-size: 15px;
}

.release-body ul {
    padding-left: 20px;
    margin: 4px 0;
}

.release-body li {
    margin-bottom: 4px;
}

/* ========== DARK MODE ========== */
@media (prefers-color-scheme: dark) {
    :root {
        /* Base */
        --color-bg: #0f1117;
        --color-surface: #1a1d24;
        --color-surface-hover: #252830;
        --color-surface-subtle: #1e2028;
        --color-surface-muted: #1e2028;
        --color-surface-raised: #1e2028;

        /* Text */
        --color-text: #e5e7eb;
        --color-text-dark: #f9fafb;
        --color-text-secondary: #d1d5db;
        --color-text-tertiary: #9ca3af;
        --color-text-muted: #9ca3af;
        --color-text-placeholder: #6b7280;
        --color-text-disabled: #4b5563;

        /* Borders */
        --color-border: #2d3140;
        --color-border-light: #252830;
        --color-border-lighter: #252830;
        --color-border-medium: #3d4250;
        --color-border-input: #3d4250;
        --color-border-table: #252830;

        /* Primary (Blue) */
        --color-primary: #3b82f6;
        --color-primary-text: #60a5fa;
        --color-primary-dark: #1e40af;
        --color-primary-light: #3b82f6;
        --color-primary-hover-border: rgba(59, 130, 246, .5);
        --color-primary-border: rgba(37, 99, 235, .35);
        --color-primary-bg: rgba(37, 99, 235, .12);
        --color-primary-bg-alt: rgba(37, 99, 235, .18);
        --color-primary-gradient-start: rgba(37, 99, 235, .08);

        /* Accent (Indigo) */
        --color-accent: #818cf8;
        --color-accent-border: rgba(99, 102, 241, .35);

        /* Success (Green) */
        --color-success: #22c55e;
        --color-success-text: #34d399;
        --color-success-text-dark: #4ade80;
        --color-success-border: rgba(34, 197, 94, .25);
        --color-success-bg: rgba(34, 197, 94, .1);
        --color-success-bg-alt: rgba(34, 197, 94, .14);

        /* Danger (Red) */
        --color-danger: #f87171;
        --color-danger-text: #fca5a5;
        --color-danger-bg: rgba(220, 38, 38, .12);
        --color-danger-bg-alt: rgba(220, 38, 38, .15);
        --color-danger-border: rgba(220, 38, 38, .3);
        --color-danger-dark: #b91c1c;
        --color-danger-light: #f87171;
        --color-danger-light-border: rgba(220, 38, 38, .4);

        /* Warning (Amber) */
        --color-warning: #fbbf24;
        --color-warning-text: #fcd34d;
        --color-warning-text-dark: #fbbf24;
        --color-warning-text-alt: #fbbf24;
        --color-warning-border: rgba(245, 158, 11, .25);
        --color-warning-bg: rgba(245, 158, 11, .12);
        --color-warning-bg-alt: rgba(245, 158, 11, .08);

        /* Info (Sky) */
        --color-info-text: #38bdf8;
        --color-info-border: rgba(14, 165, 233, .25);
        --color-info-bg: rgba(14, 165, 233, .1);

        /* Shadows */
        --shadow-sm: 0 2px 12px rgba(0, 0, 0, .35);
        --shadow-md: 0 1px 6px rgba(0, 0, 0, .4);
        --shadow-lg: 0 18px 40px rgba(0, 0, 0, .55);
        --shadow-drawer: -4px 0 20px rgba(0, 0, 0, .45);
        --shadow-toast: 0 6px 24px rgba(0, 0, 0, .5);
        --shadow-card-hover: 0 4px 12px rgba(0, 0, 0, .25);
        --shadow-sub: 0 12px 32px rgba(0, 0, 0, .45);

        /* Overlays */
        --overlay-backdrop: rgba(0, 0, 0, .6);
        --overlay-sub: rgba(0, 0, 0, .5);

        /* Spinners */
        --color-spinner: #e5e7eb;
        --color-spinner-muted: #9ca3af;
        --color-spinner-placeholder: #6b7280;

        /* Device card gradients */
        --device-header-bg: linear-gradient(135deg, rgba(37, 99, 235, .08) 0%, rgba(30, 32, 40, 1) 100%);
        --device-header-offline-bg: linear-gradient(135deg, #1e2028 0%, #252830 100%);
    }

    /* Dark mode specific overrides (toast base 已由 common.css 处理) */
    .toast.recognize {
        color: #fff;
    }

    .device-card.offline {
        opacity: .6;
    }

    .device-select-bar select {
        background: transparent;
    }

    img {
        opacity: .92;
    }

    img:hover {
        opacity: 1;
    }

    .stat-card.active {
        box-shadow: 0 0 0 2px rgba(59, 130, 246, .2);
    }
}

/* ========== Plate History Timeline in Detail Modal ========== */
.plate-history-divider {
    display: flex;
    align-items: center;
    margin: 14px 0 8px;
    padding: 6px 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-secondary);
    border-top: 1px solid var(--color-border);
}

.plate-history-list {
    max-height: 180px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: var(--color-bg);
}

.plate-history-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--color-border);
    transition: background .15s;
}

.plate-history-row:last-child {
    border-bottom: none;
}

.plate-history-row:hover {
    background: var(--color-bg-hover);
}

.plate-history-row.active {
    background: rgba(59, 130, 246, .08);
    box-shadow: inset 3px 0 0 var(--color-primary);
}

.plate-history-dir {
    flex-shrink: 0;
}

.plate-history-time {
    font-size: 13px;
    color: var(--color-text-secondary);
}

.plate-history-conf {
    margin-left: auto;
    font-size: 12px;
    color: var(--color-text-placeholder);
    font-family: var(--font-mono, monospace);
}

.plate-history-duration {
    font-size: 12px;
    color: var(--color-primary);
    background: var(--color-primary-bg-alt, rgba(59, 130, 246, .08));
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

.ph-delete-btn {
    margin-left: auto;
}

/* ========== 文件管理页 ========== */
.fm-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.fm-summary-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.fm-summary-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    background: var(--color-bg-alt);
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
}

.fm-summary-chip:hover,
.fm-summary-chip.active {
    background: var(--color-primary-bg-alt, rgba(59, 130, 246, .1));
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.fm-summary-chip .chip-count {
    font-weight: 600;
}

.fm-summary-chip .chip-size {
    opacity: .7;
    font-size: 11px;
}

.fm-multi-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    margin-bottom: 12px;
    background: var(--color-primary-bg-alt, rgba(59, 130, 246, .08));
    border-radius: 8px;
    font-size: 13px;
    color: var(--color-primary);
    flex-wrap: wrap;
}

.fm-grid {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    align-items: flex-start;
}

.fm-grid-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.fm-file-card {
    position: relative;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--color-border);
    background: var(--color-bg-alt);
    cursor: pointer;
    transition: border-color .2s, box-shadow .2s;
}

.fm-file-card:hover {
    border-color: var(--color-primary);
    box-shadow: 0 2px 12px rgba(0, 0, 0, .08);
}

.fm-file-card.selected {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px var(--color-primary-bg-alt, rgba(59, 130, 246, .25));
}

.fm-file-thumb {
    width: 100%;
    display: block;
    background: var(--color-bg);
}

.fm-file-info {
    padding: 6px 8px;
    font-size: 11px;
    color: var(--color-text-secondary);
    overflow: hidden;
}

.fm-file-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
    color: var(--color-text);
    font-size: 12px;
}

.fm-file-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 2px;
    font-size: 11px;
    color: var(--color-text-placeholder);
}

.fm-file-check {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .8);
    background: rgba(0, 0, 0, .3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .2s;
    z-index: 2;
}

.fm-file-check .material-icons {
    font-size: 16px;
    color: transparent;
}

.fm-file-card.selected .fm-file-check {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.fm-file-card.selected .fm-file-check .material-icons {
    color: #fff;
}

.fm-file-cat-tag {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(0, 0, 0, .5);
    color: #fff;
    z-index: 2;
    white-space: nowrap;
}

.drawer-mem-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    line-height: 1.3;
}

.drawer-mem-label {
    font-size: 10px;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.drawer-mem-value {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-variant-numeric: tabular-nums;
}

.fm-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-text-placeholder);
}

.fm-preview-card {
    width: min(680px, 95vw);
    max-height: 90vh;
}

.fm-preview-card .modal-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--color-border);
}

.fm-preview-body {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-card);
    min-height: 200px;
}

.fm-preview-full-img {
    max-width: 100%;
    max-height: 65vh;
    object-fit: contain;
    border-radius: 6px 6px 0 0;
    display: block;
}

.fm-preview-thumb-img {
    position: absolute;
    bottom: 16px;
    right: 8px;
    max-width: 90px;
    max-height: 100px;
    object-fit: contain;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, .85);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
    background: var(--color-bg);
    z-index: 2;
    cursor: pointer;
}

@media (max-width: 600px) {
    .fm-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 4px;
    }

    .fm-toolbar {
        align-items: stretch;
        flex-direction: row;
        flex-wrap: nowrap;
    }

    .fm-toolbar>* {
        width: 100%;
    }

    .fm-summary-bar {
        gap: 6px;
    }

    .fm-summary-chip {
        padding: 4px 12px;
        font-size: 14px;
    }
}

/* ═══ 扫码授权管理 ═══ */
.sa-tabs {
    display: flex;
    gap: 10px;
    border-radius: 8px;
}

.sa-tab {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border-radius: 6px;
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all .2s;
}

.sa-tab:hover {
    color: var(--color-text);
}

.sa-tab.active {
    background: var(--color-primary);
    color: #fff;
}

.sa-panel {
    display: none;
}

.sa-panel.active {
    display: block;
}

.sa-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.sa-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.sa-table th,
.sa-table td {
    padding: 10px 12px;
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid var(--color-border);
}

.sa-table th {
    font-weight: 600;
    color: var(--color-text-muted);
    font-size: 12px;
    background: var(--color-bg-inset, var(--color-bg));
    position: sticky;
    top: 0;
    z-index: 1;
}

.sa-table tbody tr:hover {
    background: var(--color-bg-hover, rgba(0, 0, 0, .02));
}

.sa-table tbody tr.selected {
    background: var(--color-primary-bg-alt, rgba(59, 130, 246, .1));
}

.sa-table tbody tr.selected td {
    color: var(--color-primary);
}

.sa-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.sa-tag-ok {
    background: var(--color-success-bg, #ecfdf5);
    color: var(--color-success, #10b981);
}

.sa-tag-off {
    background: var(--color-danger-bg, #fef2f2);
    color: var(--color-danger-light, #ef4444);
}

.sa-tag-expired {
    background: var(--color-warning-bg, #fffbeb);
    color: var(--color-warning, #f59e0b);
}

.sa-tag-success {
    background: var(--color-success-bg, #ecfdf5);
    color: var(--color-success, #10b981);
}

.sa-tag-fail {
    background: var(--color-danger-bg, #fef2f2);
    color: var(--color-danger-light, #ef4444);
}

.sa-fp {
    font-family: monospace;
    font-size: 11px;
    color: var(--color-text-muted);
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
}

.sa-device-info {
    font-size: 11px;
    color: var(--color-text-muted);
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
}

.sa-actions {
    display: flex;
    gap: 4px;
}

.sa-actions .icon-btn {
    width: 28px;
    height: 28px;
}

.sa-actions .icon-btn .material-icons {
    font-size: 16px;
}

@media (max-width: 600px) {
    .sa-tabs {
        width: 100%;
    }

    .sa-tab {
        flex: 1;
        justify-content: center;
        font-size: 15px;
        padding: 8px 0;
    }
}

#cmdResult {
    white-space: pre-wrap;
    margin-top: 12px;
    padding: 10px;
    background: var(--color-cmd);
    border: 1px solid var(--color-border-cmd);
    border-radius: 8px;
    font-size: 13px;
    color: var(--color-text-cmd);
}

#cmdResult:empty {
    display: none;
}

/* IO 状态弹窗 */
.io-status-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 0;
    color: var(--color-text-muted);
    font-size: 14px;
}

.io-section {
    margin-bottom: 16px;
}

.io-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.io-section-title .material-icons {
    font-size: 18px;
    color: var(--color-primary-text);
}

.io-grid {
    display: flex;
    gap: 8px;
}

.io-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--color-surface-subtle);
    border: 1px solid var(--color-border);
}

.io-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.io-dot.high {
    background: var(--color-success);
    box-shadow: 0 0 6px var(--color-success);
}

/* IO 事件历史表格 */
.io-event-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.io-event-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.io-event-table th,
.io-event-table td {
    padding: 6px 8px;
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid var(--color-border);
}

.io-event-table th {
    font-weight: 600;
    color: var(--color-text-muted);
    font-size: 12px;
    background: var(--color-surface-subtle);
    position: sticky;
    top: 0;
}

.io-event-table tr:last-child td {
    border-bottom: none;
}

/* IO 横向 Toggle 开关 */
.io-h-toggle {
    position: relative;
    width: 44px;
    height: 24px;
    border-radius: 12px;
    background: var(--color-border-input);
    cursor: pointer;
    flex-shrink: 0;
    transition: background .25s;
    border: none;
    padding: 0;
    outline: none;
}

.io-h-toggle.on {
    background: var(--color-success);
}

.io-h-toggle-knob {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
    transition: left .25s;
    pointer-events: none;
}

.io-h-toggle.on .io-h-toggle-knob {
    left: calc(100% - 20px);
}

.io-h-toggle:disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* 小号 toggle（白名单列表用） */
.io-h-toggle-sm {
    width: 32px;
    height: 18px;
    border-radius: 9px;
}

.io-h-toggle-sm .io-h-toggle-knob {
    top: 3px;
    left: 3px;
    width: 12px;
    height: 12px;
}

.io-h-toggle-sm.on .io-h-toggle-knob {
    left: calc(100% - 15px);
}

/* IO 输出点动按钮 */
.io-pulse-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: solid 4px var(--color-primary);
    background: transparent;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background .2s, color .2s, box-shadow .2s;
}

.io-pulse-btn:hover:not(:disabled) {
    background: var(--color-primary);
    color: #fff;
    box-shadow: 0 0 8px rgba(var(--color-primary-rgb, 59, 130, 246), .4);
}

.io-pulse-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.io-pulse-btn.pulsing {
    animation: ioPulseAnim .6s ease;
}

@keyframes ioPulseAnim {
    0% {
        box-shadow: 0 0 0 0 rgba(var(--color-primary-rgb, 59, 130, 246), .5);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(var(--color-primary-rgb, 59, 130, 246), 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(var(--color-primary-rgb, 59, 130, 246), 0);
    }
}

/* IO 锁定三段式选择器 */
.io-lock-seg {
    display: flex;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--color-border);
}

.io-lock-seg-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 0;
    background: var(--color-surface-subtle);
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0;
    transition: background .2s, color .2s;
}

.io-lock-seg .io-lock-seg-btn+.io-lock-seg-btn {
    border-radius: 0;
    border-left: 1px solid var(--color-border);
}

.io-lock-seg-btn .material-icons {
    font-size: 16px;
}

.io-lock-seg-btn:hover:not(:disabled):not(.active) {
    background: var(--color-border-input);
}

.io-lock-seg-btn.active {
    background: var(--color-primary);
    color: #fff;
    font-weight: 600;
}

.io-lock-seg-btn.active[data-value="1"],
.io-lock-seg-btn.active[data-value="2"] {
    background: var(--color-danger, #ef4444);
}

.io-lock-seg-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.io-item-info {
    gap: 4px;
    flex: 1;
    display: flex;
    min-width: 0;
}

.io-item-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
}

.io-item-value {
    font-size: 12px;
    color: var(--color-text-muted);
}

.io-error {
    padding: 12px;
    border-radius: 8px;
    background: var(--color-danger-bg);
    color: var(--color-danger);
    font-size: 13px;
}

/* ========== DANGER BUTTON ========== */
.danger-btn {
    background: var(--color-danger, #ef4444);
    border: 1px solid var(--color-danger-border, rgba(220, 38, 38, .3));
}

.danger-btn:hover {
    opacity: .85;
}

/* ========== FORCE-OFFLINE OVERLAY ========== */
.force-offline-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: foFadeIn .25s ease;
}

@keyframes foFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.force-offline-card {
    background: var(--color-surface, #fff);
    border-radius: 16px;
    padding: 36px 32px 28px;
    text-align: center;
    max-width: 380px;
    width: 90vw;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
    animation: foSlideUp .3s ease;
}

@keyframes foSlideUp {
    from {
        opacity: 0;
        transform: translateY(24px) scale(.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.force-offline-icon {
    font-size: 100px !important;
    color: var(--color-danger, #ef4444);
    display: block;
    margin-bottom: 20px;
}

.force-offline-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text, #111);
    margin-bottom: 8px;
}

.force-offline-msg {
    font-size: 14px;
    color: var(--color-text-muted, #666);
    line-height: 1.6;
    margin-bottom: 24px;
}

.force-offline-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.force-offline-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 28px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    background: var(--color-primary, #3b82f6);
    color: #fff;
    transition: opacity .15s;
}

.force-offline-btn-alt {
    background: var(--bg-card, #f5f5f5);
    color: var(--text, #333);
    border: 1px solid var(--border, #ddd);
}

.force-offline-btn:hover {
    opacity: .85;
}

@media (max-width: 480px) {
    .topbar-user-info {
        max-width: 120px;
    }

    .topbar-user-name {
        max-width: 100%;
    }

    .topbar-user-sub {
        max-width: 100%;
    }
}

/* ===========================================================
   可复用公共样式 — 替代行内样式
   =========================================================== */

/* ── 表单间距 ── */
.form-group {
    margin-bottom: 10px;
}

.form-group-lg {
    margin-bottom: 14px;
}

/* ── 区域标题栏（标题＋工具栏） ── */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    flex-wrap: wrap;
    gap: 16px 10px;
}

/* ── 工具栏行 ── */
.toolbar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.toolbar-row-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

/* ── 分割线变体 ── */
.drawer-divider.divider-flush {
    margin: 0;
}

.drawer-divider.divider-nav {
    margin: 8px 12px;
}

.drawer-divider.divider-section {
    margin: 16px 0;
}

.drawer-divider.divider-sm {
    margin: 12px 0;
}

/* ── 模态框卡片尺寸 ── */
.modal-card-xs {
    width: min(380px, 86vw);
}

.modal-card-sm {
    width: min(420px, 92vw);
}

.modal-card-md {
    width: min(480px, 92vw);
}

.modal-card-md2 {
    width: min(460px, 92vw);
}

.modal-card-lg {
    width: min(520px, 94vw);
}

.modal-card-lg2 {
    width: min(500px, 92vw);
}

.modal-card-lg3 {
    width: min(560px, 94vw);
}

.modal-card-xl {
    width: min(620px, 94vw);
}

.modal-card-full {
    width: min(480px, 94vw);
}

/* ── 模态框正文滚动 ── */
.modal-body-scroll {
    max-height: 65vh;
    overflow-y: auto;
}

.modal-body-scroll-lg {
    max-height: 70vh;
    overflow-y: auto;
}

.modal-body-scroll-sm {
    max-height: 60vh;
    overflow-y: auto;
}

.modal-body-scroll-xs {
    max-height: 50vh;
    overflow-y: auto;
}

/* ── 模态框底栏变体 ── */
.modal-footer-between {
    justify-content: space-between;
}

.modal-footer-center {
    justify-content: center;
    gap: 12px;
}

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

.modal-footer-preview {
    display: flex;
    gap: 8px;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

/* ── 模态框紧凑（无内边距、隐藏溢出，如 CAPTCHA） ── */
.modal-card-compact {
    padding: 0;
    overflow: hidden;
}

/* ── Z-index 层级 ── */
.z-modal-top {
    z-index: 1100;
}

/* ── Material Icon 尺寸修饰 ── */
.material-icons.mi-xs {
    font-size: 12px;
}

.material-icons.mi-sm {
    font-size: 14px;
}

.material-icons.mi-md {
    font-size: 16px;
}

.material-icons.mi-lg {
    font-size: 18px;
}

.material-icons.mi-xl {
    font-size: 20px;
}

.material-icons.mi-2xl {
    font-size: 22px;
}

.material-icons.mi-ic {
    vertical-align: middle;
    margin-right: 4px;
}

/* ── 按钮变体 ── */
.btn-block {
    width: 100%;
    margin-bottom: 10px;
}

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

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

.btn-min-120 {
    min-width: 120px;
}

/* ── 输入框清除按钮（搜索框内 X） ── */
.input-clear-abs {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
}

/* ── 统一空状态 ── */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-text-placeholder);
}

.empty-state .material-icons {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}

.empty-state p {
    margin: 0;
    font-size: 14px;
}

.empty-state-icon {
    font-size: 48px !important;
    color: var(--color-text-placeholder);
}

.empty-state-icon-sm {
    font-size: 40px !important;
    color: var(--color-text-disabled);
}

/* ── 配置页专用 ── */
.cfg-heading {
    margin: 0 0 10px;
}

.cfg-heading-icon {
    margin: 0 0 10px;
    display: flex;
    align-items: center;
}

.cfg-heading-icon>.material-icons {
    vertical-align: middle;
    font-size: 18px;
    margin-right: 4px;
}

.cfg-actions-bar {
    margin-top: 10px;
    position: sticky;
    bottom: 0;
    background-color: var(--color-surface);
}

.cfg-email-port {
    max-width: 80px;
}

.cfg-email-secure {
    max-width: 100px;
}

.cfg-notify-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cfg-notify-label {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    cursor: pointer;
}

.cfg-notify-name {
    width: 140px;
}

.cfg-qr-section {
    margin: 30px 0;
    gap: 20px;
}

.cfg-qr-wrap {
    display: flex;
    align-items: center;
    flex-direction: column;
    gap: 16px;
}

.cfg-qr-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cfg-qr-preview {
    width: 80%;
    object-fit: contain;
    border: 1px dashed var(--color-border);
    border-radius: 6px;
}

/* ── 识别弹窗 ── */
.rec-modal-image {
    margin-bottom: 12px;
    position: relative;
    min-height: 60px;
}

.rec-modal-img {
    max-width: 100%;
    max-height: 240px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
}

.rec-modal-plate {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}

.rec-modal-info {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    justify-content: center;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--color-text-tertiary);
}

#recCountdown {
    font-size: 12px;
    color: var(--color-text-placeholder);
}

/* ── 扫码授权默认设备栏 ── */
.sa-default-device-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--color-bg-inset, var(--color-bg));
    flex-wrap: wrap;
}

.sa-default-device-bar>.material-icons:first-child {
    font-size: 18px;
    color: var(--color-text-muted);
}

.sa-default-device-bar>label {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.sa-default-device-bar>select {
    flex: 1;
    min-width: 120px;
    height: 34px;
    padding: 0 8px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-bg-card);
    color: var(--color-text);
    font-size: 13px;
}

.sa-default-device-bar>button {
    height: 34px;
    padding: 0 12px;
    font-size: 13px;
}

/* ── 扫码授权工具栏间距 ── */
.sa-toolbar {
    margin-bottom: 12px;
}

/* ── 搜索输入框宽度 ── */
.search-input-w {
    width: 150px !important;
}

/* ── 文件预览弹窗 ── */
#fmPreviewTitle {
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fm-preview-meta {
    font-size: 12px;
    color: var(--color-text-muted);
}

.fm-preview-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    text-decoration: none;
    border: 1px solid var(--color-border);
    color: var(--color-text);
}

/* ── 个人设置弹窗 ── */
#btnProfileAvatarUpload {
    margin-top: 10px;
}

.profile-field-sm {
    flex: .4;
}

.profile-field-flex {
    flex: 1;
}

.profile-field-flex2 {
    flex: 2;
}

/* ── 终端控制页 ── */

/* 发送模式切换药丸 */
.topic-mode-pills {
    width: auto;
    display: inline-flex;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--color-border);
    background: var(--color-bg);
}

.topic-mode-pill {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 14px;
    font-size: 13px;
    cursor: pointer;
    user-select: none;
    transition: background .2s, color .2s;
    color: var(--color-text-secondary);
    white-space: nowrap;
}

.topic-mode-pill input[type="radio"] {
    display: none;
}

.topic-mode-pill:has(input:checked) {
    background: var(--color-primary);
    color: #fff;
    font-weight: 600;
}

.topic-mode-pill:not(:last-child) {
    border-right: 1px solid var(--color-border);
}

.cmd-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 700px) {
    .cmd-panels {
        grid-template-columns: 1fr;
    }
}

.cmd-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.cmd-panel-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    padding: 6px 0;
}

.cmd-panel-header .material-icons {
    font-size: 16px;
}

.cmd-pre-wrap {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.cmd-pre {
    flex: 1;
    min-height: 80px;
    max-height: 50vh;
    overflow: auto;
    margin: 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    font-size: 12px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-all;
}

.cmd-copy-btn {
    position: absolute;
    right: 6px;
    bottom: 6px;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--card);
    border: 1px solid var(--border);
    opacity: 0;
    transition: opacity .15s;
    z-index: 1;
}

.cmd-copy-btn .material-icons {
    font-size: 15px;
}

.cmd-pre-wrap:hover .cmd-copy-btn {
    opacity: .7;
}

.cmd-copy-btn:hover {
    opacity: 1 !important;
}

/* ---------- 回执摘要 ---------- */
.cmd-reply-summary {
    padding: 10px 12px;
    margin-bottom: 6px;
    border-radius: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    font-size: 13px;
    line-height: 1.7;
}

.cmd-reply-name {
    font-weight: 600;
    font-size: 14px;
    margin-right: 8px;
}

.cmd-reply-code {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.cmd-code-ok {
    background: #e8f5e9;
    color: #2e7d32;
}

.cmd-code-fail {
    background: #ffebee;
    color: #c62828;
}

.cmd-code-unknown {
    background: #fff3e0;
    color: #e65100;
}

.cmd-reply-sn {
    font-family: 'Roboto Mono', monospace;
    color: var(--text-secondary);
    font-size: 12px;
}

.cmd-reply-ts {
    color: var(--text-secondary);
    font-size: 12px;
}

.cmd-reply-extra {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px dashed var(--border);
    color: var(--text-secondary);
    font-size: 12px;
}

@media (prefers-color-scheme: dark) {
    .cmd-code-ok {
        background: #1b5e20;
        color: #a5d6a7;
    }

    .cmd-code-fail {
        background: #b71c1c;
        color: #ef9a9a;
    }

    .cmd-code-unknown {
        background: #e65100;
        color: #ffcc80;
    }
}

/* ---------- 时间管理弹窗 ---------- */
.set-time-device-row .mono {
    flex: 1;
    font-weight: 600;
    font-size: 14px;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
    gap: 4px;
}

.btn-sm .material-icons {
    font-size: 14px;
}

.control-checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
    font-size: 13px;
}

/* ── 工具栏按钮组 ── */
.btn-group {
    display: flex;
    gap: 6px;
}

/* ── 用户编辑弹窗 ── */
.ue-perm-heading {
    margin: 0 0 8px;
}

/* ── 用户详情弹窗 ── */
.user-info-footer {
    align-items: center;
    gap: 4px;
}

/* ── 用户管理 ── */
.user-info-text-sm {
    font-size: 11px;
}

.user-info-break {
    font-size: 11px;
    word-break: break-all;
}

/* ── 关于页 ── */
.about-hero {
    text-align: center;
    margin-bottom: 24px;
}

.about-hero .material-icons {
    font-size: 90px;
}

.about-hero-icon {
    font-size: 56px;
    color: var(--color-primary);
    margin-bottom: 8px;
    display: block;
}

.about-hero h2 {
    margin: 0 0 4px;
}

.about-hero p {
    color: var(--color-text-muted);
    margin: 0;
}

.about-features-heading {
    margin-top: 28px;
}

/* ── 联系我们页 ── */
.contact-sub-header {
    text-align: center;
    padding: 8px 0 0;
}

.contact-sub-text {
    color: var(--color-text-muted);
    margin: 0 0 4px;
    font-size: 14px;
}

.contact-msg-email {
    width: 100%;
}

/* ══════ JS 模板生成 HTML 用到的公共类 ══════ */

/* ── 文本/颜色工具 ── */
.text-placeholder {
    color: var(--color-text-placeholder);
}

.text-placeholder-sm {
    color: var(--color-text-placeholder);
    font-size: 12px;
}

.text-placeholder-xs {
    color: var(--color-text-placeholder);
    font-size: 13px;
}

.text-muted-xs {
    font-size: 11px;
    font-weight: 400;
    color: var(--color-text-muted);
}

.text-success {
    color: var(--color-success);
}

.text-danger-light {
    color: var(--color-danger-light);
}

.tag-faded {
    opacity: .6;
}

.opacity-7 {
    opacity: .7;
}

/* ── 停车时长 ── */
.parking-row {
    margin: 6px 0;
}

.parking-img-wrap {
    position: relative;
    min-height: 48px;
}

.parking-img {
    width: 100%;
    max-height: 180px;
    object-fit: contain;
    border-radius: 6px;
}

/* ── 历史详情 ── */
.history-checkbox-style {
    width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0;
}

.history-delete-icon {
    font-size: 16px;
    color: var(--color-danger-light);
}

.tag-xs {
    font-size: 11px;
}

.history-thumb-wrap {
    position: relative;
    min-height: 60px;
}

.history-thumb-full {
    width: 100%;
    max-height: 280px;
    object-fit: contain;
}

.ph-delete-icon {
    font-size: 15px;
    color: var(--color-danger-light);
}

/* ── 白名单详情 ── */
.wl-detail-img-wrap {
    margin-top: 6px;
}

.wl-detail-img {
    width: 100%;
    object-fit: contain;
    border-radius: 6px;
    border: 1px solid var(--color-border);
}

.wl-detail-img-time {
    font-size: 11px;
    color: var(--color-text-muted);
    margin-top: 2px;
}

/* ── 编辑表单 (JS 动态) ── */
.rec-edit-footer {
    text-align: right;
    margin-top: 12px;
}

.btn-min-100 {
    min-width: 100px;
}

/* ── 审计日志表 ── */
.audit-loading {
    text-align: center;
    padding: 20px;
}

.audit-error {
    text-align: center;
    padding: 20px;
    color: var(--color-danger-light);
    font-size: 13px;
}

.audit-empty {
    text-align: center;
    padding: 30px;
    color: var(--color-text-placeholder);
    font-size: 13px;
}

.audit-empty-icon {
    font-size: 40px;
    display: block;
    margin-bottom: 8px;
}

.audit-user-icon {
    font-size: 14px;
    vertical-align: middle;
    margin-right: 2px;
    color: var(--color-text-muted);
}

.audit-th-user {
    width: 100px;
}

.audit-th-action {
    width: 120px;
}

.audit-th-ip {
    width: 120px;
}

.audit-th-time {
    width: 150px;
}

/* ── 用户列表/详情 (JS) ── */
.user-list-body {
    flex: 1;
    min-width: 0;
}

.user-list-info {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.user-avatar-lg {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e5e7eb;
}

.user-avatar-placeholder-lg {
    font-size: 64px;
    color: var(--color-text-disabled);
}

.perm-none {
    color: var(--color-text-placeholder);
    font-size: 12px;
}

.mono-fingerprint {
    font-size: 11px;
    margin-left: 2px;
}

/* ── 扫码授权表格 ── */
.sa-perm {
    color: var(--color-success);
}

.sa-delete-btn {
    color: var(--color-danger-light);
}

/* ── 导航菜单图标 ── */
.nav-menu-icon {
    font-size: 14px;
}

/* ── 重新登录按钮图标 ── */
.relogin-icon {
    font-size: 18px;
}

/* ===== 设备配置（前台） ===== */
.dev-cfg-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dev-cfg-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
    flex-wrap: wrap;
}

.dev-cfg-row .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dev-cfg-row .dot.online {
    background: var(--color-success);
}

.dev-cfg-row .dot.offline {
    background: var(--color-text-placeholder);
}

.dev-role-select {
    margin-left: auto;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid var(--color-border-input);
    background: var(--color-surface);
    cursor: pointer;
    font-size: 13px;
}

/* ===== 子账号卡片复用 user-card ===== */
.btn-danger-outline {
    color: var(--color-danger);
}

.btn-danger-outline:hover {
    background: var(--color-danger-bg);
}

/* ===== Perm checks ===== */
.perm-checks {
    border-radius: 6px;
    background: var(--color-bg-secondary, rgba(128, 128, 128, .06));
    display: flex;
    flex-direction: column;
}

.perm-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
}

.perm-group-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-secondary, #888);
    min-width: 60px;
    margin-right: 4px;
}

.perm-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid var(--color-border-medium, #d0d0d0);
    background: transparent;
    color: var(--color-text-secondary, #888);
    cursor: pointer;
    transition: all .15s ease;
    user-select: none;
    line-height: 1.4;
}

.perm-btn:active {
    transform: scale(.96);
}

.perm-btn.active {
    background: var(--color-primary, #3b82f6);
    color: #fff;
    border-color: var(--color-primary, #3b82f6);
}

/* ===== Device Settings Card ===== */
#deviceSettingsCard {
    margin-top: 12px;
}

/* Tab navigation */
.ds-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding-bottom: 2px;
    border-bottom: 1px solid var(--color-border-medium);
    margin-bottom: 12px;
}

.ds-tabs::-webkit-scrollbar {
    height: 2px;
}

.ds-tabs::-webkit-scrollbar-thumb {
    background-color: var(--color-border-medium);
    border-radius: 1px;
}

.ds-tabs::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-secondary);
}

.ds-tab {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: color .2s, border-color .2s;
    border-radius: 0;
}

.ds-tab:hover {
    color: var(--text);
}

.ds-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
    font-weight: 600;
}

.ds-tab .material-icons {
    font-size: 18px;
}

/* Panels */
.ds-panel {
    display: none;
}

.ds-panel.active {
    display: block;
}

/* Sub-tabs (for LCD) */
.ds-sub-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
}

.ds-sub-tab {
    padding: 6px 14px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    border-radius: 4px;
    transition: all .2s;
}

.ds-sub-tab:hover {
    background: var(--surface-hover, rgba(255, 255, 255, .06));
}

.ds-sub-tab.active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

.ds-sub-panel {
    display: none;
}

.ds-sub-panel.active {
    display: block;
}

/* Row label */
.ds-row-label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--color-text-secondary);
    font-size: 14px;
}

.ds-row-label .material-icons {
    font-size: 18px;
    color: var(--color-primary);
}

/* Actions bar */
.ds-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Sub heading inside panels */
.ds-sub-heading {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin: 0;
    font-weight: 600;
    border-bottom: 1px solid var(--color-border-medium);
    padding-bottom: 4px;
}

/* Time control rows (for LCD brightness/volume scheduling) */
.ds-time-ctrl-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.ds-time-ctrl-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ds-time-ctrl-row input[type="time"] {
    width: 100%;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--color-border-medium);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
}

.ds-time-ctrl-row select {
    width: 80px;
    height: 32px;
    padding: 0 8px;
    text-align: center;
    border: 1px solid var(--color-border-medium);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
}

.ds-time-ctrl-row span {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0 4px;
}

/* Monospace textarea */
textarea.mono {
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 12px;
}

@media (max-width: 600px) {
    .ds-tabs {
        gap: 0;
    }

    .ds-tab {
        padding: 6px 8px;
        font-size: 12px;
    }
}