/* CSS Variables & Theme Definitions */
:root {
    /* Light Theme (Default fallback) */
    --bg-primary: #f0f2f5;
    --bg-secondary: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --border-color: rgba(0, 0, 0, 0.1);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --danger: #ef4444;
    --success: #10b981;
}

[data-theme="dark"] {
    /* Dark Theme */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #3b82f6;
    --accent-hover: #60a5fa;
    --border-color: rgba(255, 255, 255, 0.1);
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
}

/* Global Reset & Typography */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
    height: 100vh;
    overflow: hidden;
}

/* Utilities */
.glass-effect {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.05);
}

.btn {
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.btn-primary {
    background-color: var(--accent-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: var(--border-color);
}

.btn-danger {
    background-color: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
}

.btn-danger:hover {
    background-color: var(--danger);
    color: white;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: 240px;
    height: 100%;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    z-index: 10;
    transition: width 0.24s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    flex-shrink: 0;
}

/* 折叠状态 */
.sidebar.collapsed {
    width: 64px;
}

.sidebar.collapsed .sidebar-text {
    display: none;
}

.sidebar.collapsed .logo {
    padding: 1.2rem 0.5rem;
    justify-content: center;
}

.sidebar.collapsed .logo-brand {
    display: none;
}

.sidebar.collapsed .nav-menu {
    padding: 0 0.5rem;
}

.sidebar.collapsed .nav-item {
    padding: 0.8rem 0;
    justify-content: center;
    border-radius: 8px;
}

.sidebar.collapsed .settings {
    padding: 1rem 0;
    display: flex;
    justify-content: center;
}

.logo {
    padding: 1.5rem 1.2rem 1.2rem 1.2rem;
    font-size: 1.4rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--accent-color);
}

.logo-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar-collapse-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.sidebar-collapse-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar.collapsed .sidebar-collapse-btn i {
    transform: rotate(180deg);
}

.nav-menu {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0 1rem;
    gap: 0.5rem;
}

.nav-item {
    background: transparent;
    border: none;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.2s ease;
}

.nav-item:hover {
    background-color: var(--border-color);
    color: var(--text-primary);
}

.nav-item.active {
    background-color: var(--accent-color);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.settings {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.theme-toggle {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background-color: var(--border-color);
}

/* Main Content */
.main-content {
    flex: 1;
    position: relative;
    overflow-y: auto;
    padding: 1rem 1.2rem;
}

.view-section {
    display: none;
    animation: fadeIn 0.3s ease forwards;
}

.view-section.active {
    display: block;
}

.main-content.dense-workbench-active,
.main-content:has(#arinc429-view.active) {
    padding: 6px 10px;
    overflow: hidden;
    height: 100vh;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.view-header h1 {
    font-size: 2rem;
    font-weight: 600;
}

.view-header p {
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 1.5rem;
}

.card {
    border-radius: 16px;
    padding: 1.5rem;
}

.card h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

.input-panel {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
}

.chart-panel {
    grid-column: 2 / 3;
    grid-row: 1 / 3;
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

.chart-container {
    flex: 1;
    position: relative;
}

.table-panel {
    grid-column: 1 / 2;
    grid-row: 2 / 3;
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

input[type="text"],
input[type="number"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 0.8rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

td {
    font-size: 0.95rem;
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem !important;
    font-style: italic;
}

/* 工作台模式切换栏 (本地硬盘目录 vs Cloudflare 云端工作台) */
.workspace-container {
    margin-bottom: 1.2rem;
}

.workspace-mode-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.ws-mode-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.ws-mode-btn:hover {
    color: var(--text-primary);
    border-color: rgba(59, 130, 246, 0.4);
    background: rgba(59, 130, 246, 0.05);
}

.ws-mode-btn.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(59, 130, 246, 0.3);
}

.ws-mode-badge {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
    font-weight: 700;
    margin-left: 2px;
}

.ws-mode-btn:not(.active) .ws-mode-badge {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-color);
}

/* 本地工作目录控制栏 (桌面软件级体验) */
.workspace-dir-strip {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 16px;
    margin-bottom: 0;
    gap: 12px;
    flex-wrap: wrap;
    transition: all 0.2s ease;
}

.workspace-dir-strip.connected {
    border-color: rgba(16, 185, 129, 0.45);
    background: rgba(16, 185, 129, 0.05);
}

[data-theme="dark"] .workspace-dir-strip.connected {
    border-color: rgba(16, 185, 129, 0.35);
    background: rgba(16, 185, 129, 0.08);
}

.workspace-cloud-strip {
    border-color: rgba(59, 130, 246, 0.35);
    background: rgba(59, 130, 246, 0.04);
}

[data-theme="dark"] .workspace-cloud-strip {
    border-color: rgba(59, 130, 246, 0.3);
    background: rgba(59, 130, 246, 0.08);
}

.ws-cloud-icon {
    background: rgba(59, 130, 246, 0.15) !important;
    color: var(--accent-color) !important;
}

.ws-cloud-status {
    background: rgba(59, 130, 246, 0.15) !important;
    color: var(--accent-color) !important;
    border: 1px solid rgba(59, 130, 246, 0.3) !important;
}

.ws-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 260px;
}

.ws-icon-box {
    width: 34px;
    height: 34px;
    border-radius: 6px;
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}

.workspace-dir-strip.connected .ws-icon-box {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.ws-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.ws-label {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}

.ws-name {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 500px;
}

.ws-status-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-secondary);
    white-space: nowrap;
}

[data-theme="dark"] .ws-status-badge {
    background: rgba(255, 255, 255, 0.08);
}

.workspace-dir-strip.connected .ws-status-badge {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.ws-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-danger-outline {
    background: transparent;
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.btn-danger-outline:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--danger);
    color: var(--danger);
}

.pstat-file {
    background: rgba(59, 130, 246, 0.08) !important;
    color: var(--accent-color) !important;
    font-family: 'JetBrains Mono', Consolas, monospace !important;
    font-weight: 600;
}

.pstat-cloud {
    background: rgba(16, 185, 129, 0.12) !important;
    color: #10b981 !important;
    border: 1px solid rgba(16, 185, 129, 0.3) !important;
    font-weight: 600;
}

/* Protocol List */
.protocol-list-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
}

.protocol-card {
    border-radius: 12px;
    padding: 16px 18px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    position: relative;
    user-select: none;
}

.protocol-card:hover {
    transform: translateY(-3px);
    border-color: rgba(59, 130, 246, 0.45);
    box-shadow: 0 10px 24px -6px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(59, 130, 246, 0.2);
}

[data-theme="dark"] .protocol-card:hover {
    border-color: rgba(56, 189, 248, 0.45);
    box-shadow: 0 10px 24px -6px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(56, 189, 248, 0.2);
}

.protocol-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 8px;
}

.protocol-card-title-wrap {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.proto-card-icon {
    font-size: 14px;
    color: var(--accent-color);
    margin-top: 3px;
    flex-shrink: 0;
}

.protocol-card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.35;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.protocol-type-badge {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-color);
    border: 1px solid rgba(59, 130, 246, 0.25);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

[data-theme="dark"] .protocol-type-badge {
    background: rgba(56, 189, 248, 0.12);
    color: #38bdf8;
    border-color: rgba(56, 189, 248, 0.25);
}

.protocol-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 8px;
    margin: 6px 0 10px 0;
}

.pstat-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11.5px;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.035);
    padding: 2px 7px;
    border-radius: 4px;
    white-space: nowrap;
}

[data-theme="dark"] .pstat-item {
    background: rgba(255, 255, 255, 0.05);
    color: #94a3b8;
}

.pstat-item i {
    color: var(--accent-color);
    font-size: 11px;
}

.protocol-card-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0 0 12px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 底部精简三按钮 (编辑、导出、删除) */
.protocol-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
    width: 100%;
}

.protocol-actions .btn {
    flex: 1;
    height: 30px !important;
    line-height: 28px !important;
    padding: 0 8px !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    border-radius: 5px !important;
    white-space: nowrap !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    transition: all 0.15s ease !important;
    box-shadow: none !important;
}

.btn-proto-edit {
    background: rgba(59, 130, 246, 0.1) !important;
    color: #2563eb !important;
    border: 1px solid rgba(59, 130, 246, 0.28) !important;
}

.btn-proto-edit:hover {
    background: #2563eb !important;
    color: #ffffff !important;
    border-color: #2563eb !important;
    transform: translateY(-1px);
}

[data-theme="dark"] .btn-proto-edit {
    background: rgba(56, 189, 248, 0.12) !important;
    color: #38bdf8 !important;
    border-color: rgba(56, 189, 248, 0.3) !important;
}

[data-theme="dark"] .btn-proto-edit:hover {
    background: #0284c7 !important;
    color: #ffffff !important;
    border-color: #0284c7 !important;
}

.btn-proto-export {
    background: var(--bg-primary) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
}

.btn-proto-export:hover {
    border-color: var(--accent-color) !important;
    color: var(--accent-color) !important;
    background: rgba(59, 130, 246, 0.06) !important;
    transform: translateY(-1px);
}

.btn-proto-delete {
    background: transparent !important;
    color: var(--text-secondary) !important;
    border: 1px solid var(--border-color) !important;
}

.btn-proto-delete:hover {
    background: rgba(239, 68, 68, 0.1) !important;
    color: #ef4444 !important;
    border-color: rgba(239, 68, 68, 0.35) !important;
    transform: translateY(-1px);
}

[data-theme="dark"] .btn-proto-delete:hover {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #f87171 !important;
    border-color: rgba(239, 68, 68, 0.4) !important;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-16px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ========================================================
   精美模态对话框与表单系统 (Modal & Dialog Components)
   ======================================================== */
.modal-content {
    width: 92%;
    max-width: 640px;
    max-height: 90vh;
    border-radius: 12px;
    padding: 0;
    overflow: hidden;
    position: relative;
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-color);
    box-shadow: 0 24px 50px -12px rgba(0, 0, 0, 0.35), 0 0 0 1px var(--border-color);
    animation: modalSlideIn 0.24s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 22px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
    margin-bottom: 0;
}

.modal-header h2 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0;
}

.close-modal {
    background: transparent;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.close-modal:hover {
    background: rgba(0, 0, 0, 0.07);
    color: var(--danger);
}

[data-theme="dark"] .close-modal:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ff6b6b;
}

.modal-body-scroll {
    padding: 20px 24px;
    overflow-y: auto;
    max-height: calc(85vh - 130px);
}

.modal-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 18px;
}

.modal-form-grid .form-group {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.modal-form-grid .col-span-2 {
    grid-column: 1 / 3;
}

.modal-form-grid label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 0;
}

.modal-form-grid label .req-star {
    color: var(--danger);
    font-size: 13px;
    font-weight: bold;
}

.modal-form-grid label .label-hint {
    font-size: 11px;
    font-weight: 400;
    color: var(--text-secondary);
    margin-left: 4px;
}

.modal-content input[type="text"],
.modal-content input[type="number"],
.modal-content input[type="password"],
.modal-content select,
.modal-content textarea,
.modal-form-grid input[type="text"],
.modal-form-grid input[type="number"],
.modal-form-grid input[type="password"],
.modal-form-grid select,
.modal-form-grid textarea {
    height: 36px;
    line-height: normal;
    padding: 0 12px;
    font-size: 13px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
    width: 100%;
    outline: none;
    box-sizing: border-box;
    font-family: inherit;
}

.modal-content input[type="text"]:hover,
.modal-content input[type="number"]:hover,
.modal-content input[type="password"]:hover,
.modal-content select:hover,
.modal-content textarea:hover,
.modal-form-grid input[type="text"]:hover,
.modal-form-grid input[type="number"]:hover,
.modal-form-grid input[type="password"]:hover,
.modal-form-grid select:hover,
.modal-form-grid textarea:hover {
    border-color: rgba(59, 130, 246, 0.45);
}

.modal-content textarea,
.modal-form-grid textarea {
    height: auto;
    min-height: 60px;
    line-height: 1.5;
    padding: 8px 12px;
    resize: vertical;
}

.modal-content input:focus,
.modal-content select:focus,
.modal-content textarea:focus,
.modal-form-grid input:focus,
.modal-form-grid select:focus,
.modal-form-grid textarea:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
    background-color: var(--bg-secondary);
}

/* 统一定制精致 Select 下拉菜单外观 */
.modal-content select,
.modal-form-grid select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px 12px;
    padding-right: 34px;
    cursor: pointer;
}

[data-theme="dark"] .modal-content select,
[data-theme="dark"] .modal-form-grid select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

.modal-content select option,
.modal-form-grid select option {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    padding: 6px 12px;
}

.modal-section-divider {
    grid-column: 1 / 3;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-top: 10px;
    margin-top: 6px;
    border-top: 1px dashed var(--border-color);
}

.modal-section-divider:first-of-type {
    border-top: none;
    padding-top: 0;
    margin-top: 0;
}

.modal-section-divider i {
    color: var(--accent-color);
    font-size: 12px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding: 14px 22px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
    margin-top: 0 !important;
}

.cloud-settings-body {
    padding: 22px 26px;
    overflow-y: auto;
}

.cloud-info-box {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 20px;
    background: rgba(59, 130, 246, 0.08);
    padding: 14px 16px;
    border-radius: 8px;
    border: 1px solid rgba(59, 130, 246, 0.22);
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.cloud-info-box strong {
    color: var(--text-primary);
    font-size: 13.5px;
    display: block;
    margin-bottom: 2px;
}

#cloud-connection-status {
    padding: 10px 14px;
    border-radius: 6px;
    margin: 14px 0 4px 0;
    font-size: 13px;
    line-height: 1.5;
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid var(--border-color);
}

[data-theme="dark"] #cloud-connection-status {
    background: rgba(255, 255, 255, 0.03);
}

.modal-actions .btn {
    height: 36px;
    padding: 0 16px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
}

.props-summary-box {
    grid-column: 1 / 3;
    margin-top: 4px;
    padding: 8px 14px;
    border-radius: 6px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    display: flex;
    gap: 1.5rem;
    font-size: 12px;
    color: var(--text-secondary);
}

[data-theme="dark"] .props-summary-box {
    background: rgba(255, 255, 255, 0.03);
}

.divider {
    border: 0;
    height: 1px;
    background: var(--border-color);
    margin: 1.5rem 0;
}

.manager-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

/* Frames & Signals Editor */
.frame-item {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    background-color: rgba(0, 0, 0, 0.02);
}
[data-theme="dark"] .frame-item {
    background-color: rgba(255, 255, 255, 0.02);
}

.frame-header {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: center;
}

.signal-list {
    margin-top: 1rem;
    padding-left: 1rem;
    border-left: 2px solid var(--accent-color);
}

.signal-item {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.signal-item input, .signal-item select {
    width: auto;
    flex: 1;
    min-width: 80px;
    padding: 0.4rem;
}


/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ========================================================
   ARINC 429 专用航电工作台精简高效样式
   ======================================================== */
.nav-badge-429 {
    background: linear-gradient(135deg, #06b6d4, #3b82f6);
    color: white;
    font-size: 0.65rem;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    margin-left: auto;
    font-weight: 700;
}

/* ========================================================
   ARINC 429 高数据密度工程工作台 (High Density Workbench)
   ======================================================== */

/* 视图容器：铺满垂直空间 */
#arinc429-view {
    height: 100%;
    display: none;
    flex-direction: column;
    gap: 6px;
    overflow: hidden;
    font-size: 12px;
}

#arinc429-view.active {
    display: flex;
}

/* 作用域强隔离：重置输入框、选择框与表格尺寸，彻底阻断全局的大内边距与大字体污染 */
#arinc429-view input[type="text"],
#arinc429-view input[type="number"],
#arinc429-view select {
    box-sizing: border-box;
    margin: 0;
    padding: 0 8px;
    font-size: 12px;
    line-height: normal;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* 消除数字输入框在紧凑排版下的原生微调箭头挤占宽度 */
#arinc429-view input[type="number"]::-webkit-inner-spin-button,
#arinc429-view input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
#arinc429-view input[type="number"] {
    -moz-appearance: textfield;
}

#arinc429-view select {
    padding-right: 20px;
    cursor: pointer;
}

#arinc429-view input:focus,
#arinc429-view select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

#arinc429-view th,
#arinc429-view td {
    padding: 0 8px;
    margin: 0;
    font-size: 12px;
}

/* 顶部操作工具栏 (统一高度 40px，控件高度 28px) */
.arinc-dense-toolbar {
    height: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 12px;
    gap: 10px;
    flex-wrap: nowrap;
    overflow-x: auto;
}

.dense-tb-left, .dense-tb-center, .dense-tb-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.dense-tb-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-color);
    display: flex;
    align-items: center;
    gap: 5px;
    margin-right: 4px;
}

.dense-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
}

#arinc429-view .dense-select, 
#arinc429-view .dense-input {
    height: 28px;
    padding: 0 8px;
    font-size: 12px;
    border-radius: 4px;
}

.dense-btn {
    height: 28px;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.dense-btn:hover {
    background: var(--border-color);
}

/* 顶部工具栏协议属性摘要徽章 (只读查看属性，整洁高密度) */
.dense-tb-badges {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 6px;
}

.dense-prop-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    font-size: 11px;
    border-radius: 4px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    white-space: nowrap;
    line-height: 1.3;
}

.dense-prop-badge.highlight {
    color: #0891b2;
    background: rgba(6, 182, 212, 0.1);
    border-color: rgba(6, 182, 212, 0.35);
    font-weight: 600;
}

[data-theme="dark"] .dense-prop-badge.highlight {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.15);
    border-color: rgba(56, 189, 248, 0.4);
}

.dense-btn-accent {
    background: rgba(6, 182, 212, 0.12) !important;
    border-color: rgba(6, 182, 212, 0.4) !important;
    color: #0891b2 !important;
    font-weight: 600;
}

.dense-btn-accent:hover {
    background: rgba(6, 182, 212, 0.22) !important;
}

[data-theme="dark"] .dense-btn-accent {
    color: #38bdf8 !important;
    border-color: rgba(56, 189, 248, 0.5) !important;
    background: rgba(56, 189, 248, 0.18) !important;
}

#btn-arinc-back {
    font-weight: 600;
    color: var(--text-secondary);
    border-color: rgba(59, 130, 246, 0.3);
    background: rgba(59, 130, 246, 0.05);
}

#btn-arinc-back:hover {
    color: var(--accent-color);
    border-color: var(--accent-color);
    background: rgba(59, 130, 246, 0.12);
}

.dense-btn-primary {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: #ffffff;
}

.dense-btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    box-shadow: none;
    transform: none;
}

.dense-btn-danger {
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.05);
}

.dense-btn-danger:hover {
    background: var(--danger);
    color: #ffffff;
}

.dense-btn-xs {
    height: 26px;
    padding: 0 8px;
    font-size: 11.5px;
    border-radius: 3px;
}

/* 主工作区：双栏弹性布局 (支持鼠标自由拖拽调整宽度) */
.arinc-dense-workbench {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: row;
    gap: 0;
    overflow: hidden;
    position: relative;
}

/* ========================================================
   左栏：标号字列表 (高密度表格，支持动态宽度拖拽)
   ======================================================== */
.arinc-dense-words-panel {
    width: var(--words-panel-width, 340px);
    min-width: 200px;
    max-width: 700px;
    flex-shrink: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

/* 左右分栏可拖拽调整尺寸手柄 */
.workbench-resizer {
    width: 8px;
    cursor: col-resize;
    background: transparent;
    position: relative;
    z-index: 10;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease;
    user-select: none;
    -webkit-user-select: none;
}

.workbench-resizer::after {
    content: '';
    width: 2px;
    height: 36px;
    border-radius: 1px;
    background: var(--border-color);
    transition: all 0.15s ease;
}

.workbench-resizer:hover,
.workbench-resizer.resizing {
    background: rgba(59, 130, 246, 0.08);
}

.workbench-resizer:hover::after,
.workbench-resizer.resizing::after {
    background: var(--accent-color);
    width: 3px;
    height: 100%;
    box-shadow: 0 0 6px rgba(59, 130, 246, 0.4);
}

body.resizing-active {
    cursor: col-resize !important;
    user-select: none !important;
    -webkit-user-select: none !important;
}

body.resizing-active * {
    user-select: none !important;
    pointer-events: none !important;
}

body.resizing-active .workbench-resizer {
    pointer-events: auto !important;
}

/* 右栏：自动填满剩余宽度 */
.arinc-dense-detail-panel {
    flex: 1;
    min-width: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

.dense-panel-header {
    height: 36px;
    min-height: 36px;
    padding: 0 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.015);
}

[data-theme="dark"] .dense-panel-header {
    background: rgba(255, 255, 255, 0.02);
}

.dense-panel-title {
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-primary);
}

#words-count-badge {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-color);
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 10px;
}

.dense-filter-strip {
    height: 34px;
    min-height: 34px;
    padding: 0 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
}

#arinc429-view .dense-input-sm {
    height: 26px;
    padding: 0 8px;
    font-size: 12px;
    border-radius: 3px;
}

.dense-filter-strip input[type="text"] {
    flex: 1;
    min-width: 0;
}

.dense-btn-group {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    overflow: hidden;
}

.dense-btn-group button {
    height: 26px;
    line-height: 24px;
    padding: 0 11px;
    font-size: 13px;
    font-weight: 500;
    background: var(--bg-secondary);
    border: none;
    border-right: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.12s ease;
}

.dense-btn-group button:last-child {
    border-right: none;
}

.dense-btn-group button.active {
    background: var(--accent-color);
    color: #ffffff;
    font-weight: 700;
}

/* 标号字表格包裹层 */
.dense-words-table-wrap {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.dense-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.dense-words-table {
    table-layout: fixed;
    width: 100%;
}

.dense-table thead th {
    height: 28px;
    line-height: 28px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 11.5px;
    font-weight: 600;
    text-align: left;
    padding: 0 6px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 2;
    white-space: nowrap;
}

.dense-word-row {
    height: 32px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.1s ease;
}

.dense-word-row:hover {
    background: rgba(59, 130, 246, 0.05);
}

.dense-word-row.selected {
    background: rgba(59, 130, 246, 0.12);
    border-left: 3px solid var(--accent-color);
}

.dense-word-row td {
    padding: 0 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
    line-height: 31px;
    vertical-align: middle;
}

.dense-word-row td.col-idx,
.col-idx {
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 11px;
    color: var(--text-secondary);
    padding: 0 2px !important;
    text-overflow: clip !important; /* 不使用省略号，直接完整显示序号如 #10, #100 */
    white-space: nowrap;
    width: 40px;
    min-width: 40px;
    box-sizing: border-box;
}

.col-label {
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 12.5px;
    overflow: hidden;
    text-overflow: clip; /* 单元格自身不加省略号，由内部内容自然展示 */
}

.octal-num {
    font-weight: 700;
    color: #d97706;
    flex-shrink: 0;
}

[data-theme="dark"] .octal-num {
    color: #fbbf24;
}

.dense-dir-tag {
    font-size: 11.5px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 3px;
    display: inline-block;
    line-height: 1.2;
}

.dir-tx {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.dir-rx {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.dense-count-pill {
    font-size: 11px;
    background: rgba(0, 0, 0, 0.05);
    padding: 1px 6px;
    border-radius: 10px;
    color: var(--text-secondary);
    display: inline-block;
    line-height: 1.2;
}

[data-theme="dark"] .dense-count-pill {
    background: rgba(255, 255, 255, 0.08);
}

/* 标号字列表行内简要字名：宽度不够时正常硬截断(clip)，不用省略号(...)替代 */
.word-mini-name {
    margin-left: 5px;
    font-size: 11.5px;
    color: var(--text-secondary);
    font-weight: normal;
    display: inline-block;
    max-width: none;
    overflow: hidden;
    text-overflow: clip; /* 不用...替代，自然硬截断 */
    white-space: nowrap;
    vertical-align: middle;
}

.dense-word-row.selected .word-mini-name {
    color: var(--text-primary);
    font-weight: 500;
}

.word-row-del-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    width: 22px;
    height: 22px;
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    cursor: pointer;
    opacity: 0.55;
    transition: all 0.15s ease;
    padding: 0;
}

.dense-word-row:hover .word-row-del-btn {
    opacity: 1;
}

.word-row-del-btn:hover {
    color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.12) !important;
    transform: scale(1.08);
}

[data-theme="dark"] .word-row-del-btn:hover {
    color: #f87171 !important;
    background: rgba(239, 68, 68, 0.2) !important;
}

/* ========================================================
   右栏：标号字与字段配置详情 (高密度工控视窗)
   ======================================================== */

/* ========================================================
   标号字核心控制栏 (合并去重：突出醒目标号、字名称与模式状态)
   ======================================================== */
.dense-word-primary-bar {
    height: 44px;
    min-height: 44px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    font-size: 12px;
    overflow-x: auto;
    white-space: nowrap;
}

[data-theme="dark"] .dense-word-primary-bar {
    background: rgba(255, 255, 255, 0.025);
}

/* 1. 醒目标号徽章卡片 */
.prominent-label-card {
    display: inline-flex;
    align-items: center;
    background: rgba(217, 119, 6, 0.12);
    border: 1px solid rgba(217, 119, 6, 0.35);
    border-radius: 4px;
    padding: 0 6px 0 8px;
    height: 30px;
    gap: 4px;
    box-shadow: 0 1px 2px rgba(217, 119, 6, 0.08);
    flex-shrink: 0;
}

[data-theme="dark"] .prominent-label-card {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.45);
}

.plc-tag {
    font-size: 11.5px;
    font-weight: 700;
    color: #d97706;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    user-select: none;
}

[data-theme="dark"] .plc-tag {
    color: #fbbf24;
}

.prominent-octal-input {
    width: 44px !important;
    height: 24px !important;
    line-height: 22px !important;
    padding: 0 !important;
    text-align: center;
    font-family: 'JetBrains Mono', Consolas, monospace !important;
    font-size: 15px !important;
    font-weight: 800 !important;
    color: #d97706 !important;
    background: rgba(217, 119, 6, 0.12) !important;
    border: 1px solid rgba(217, 119, 6, 0.3) !important;
    border-radius: 3px;
    outline: none;
    transition: all 0.15s ease;
}

[data-theme="dark"] .prominent-octal-input {
    color: #fbbf24 !important;
    background: rgba(251, 191, 36, 0.15) !important;
    border-color: rgba(251, 191, 36, 0.4) !important;
}

.prominent-octal-input:focus {
    border-color: #d97706 !important;
    box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.25) !important;
}

[data-theme="dark"] .prominent-octal-input:focus {
    border-color: #fbbf24 !important;
    box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.3) !important;
}

.plc-sub {
    font-size: 12px;
    font-weight: 800;
    color: #d97706;
    user-select: none;
}

[data-theme="dark"] .plc-sub {
    color: #fbbf24;
}

.prominent-hex-badge {
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.05);
    padding: 3px 6px;
    border-radius: 3px;
    border: 1px solid var(--border-color);
    white-space: nowrap;
    user-select: none;
    flex-shrink: 0;
}

[data-theme="dark"] .prominent-hex-badge {
    background: rgba(255, 255, 255, 0.06);
}

/* 2. 醒目数据字名称输入区 */
.prominent-word-name-box {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 160px;
    position: relative;
}

.word-name-icon {
    font-size: 13.5px;
    color: var(--accent-color);
    opacity: 0.9;
    flex-shrink: 0;
}

.prominent-word-name-input {
    width: 100%;
    height: 30px !important;
    line-height: 28px !important;
    padding: 0 10px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    color: var(--text-primary) !important;
    background: var(--bg-primary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 4px;
    outline: none;
    transition: all 0.15s ease;
}

.prominent-word-name-input:hover {
    border-color: rgba(59, 130, 246, 0.5) !important;
}

.prominent-word-name-input:focus {
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2) !important;
}

[data-theme="dark"] .prominent-word-name-input {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    color: #f8fafc !important;
}

.dense-mode-indicator-pill {
    font-size: 11.5px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 3px;
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-color);
    border: 1px solid rgba(59, 130, 246, 0.25);
    white-space: nowrap;
    flex-shrink: 0;
}

.dense-form-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.dense-form-item label {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    font-weight: 500;
}

.meta-item-period {
    flex: 0 0 auto;
    gap: 4px;
}

.dense-period-tag {
    font-size: 11.5px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 3px;
    display: inline-block;
    line-height: 1.2;
    background: rgba(139, 92, 246, 0.12);
    color: #8b5cf6;
    border: 1px solid rgba(139, 92, 246, 0.25);
    font-family: 'JetBrains Mono', Consolas, monospace;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s ease;
}

.dense-period-tag:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.45);
}

[data-theme="dark"] .dense-period-tag {
    background: rgba(167, 139, 250, 0.15);
    color: #c4b5fd;
    border-color: rgba(167, 139, 250, 0.35);
}

#badge-proto-period {
    cursor: pointer;
    transition: all 0.15s ease;
}

#badge-proto-period:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.meta-item-direction {
    flex: 0 0 auto;
}

.dense-readonly-tag {
    cursor: default;
    user-select: none;
}

.dense-hint {
    font-size: 11px;
    color: var(--text-secondary);
    font-family: monospace;
    white-space: nowrap;
}

.dense-row-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* 视角 1：经典 5 结构扁平条带 (高度 38px，自适应平铺) */
.dense-struct-strip {
    height: 38px;
    min-height: 38px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
    overflow-x: auto;
}

.dense-struct-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
}

.ds-title {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 11.5px;
}

.ds-val {
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 12px;
}

.ds-bits {
    font-size: 11px;
    color: var(--text-secondary);
    font-family: monospace;
}

#arinc429-view .dense-select-xs {
    height: 26px;
    line-height: 24px;
    padding: 0 6px;
    font-size: 11.5px;
    border-radius: 3px;
    background: var(--bg-secondary);
}

.dense-link-btn {
    background: transparent;
    border: none;
    color: var(--accent-color);
    font-size: 11.5px;
    cursor: pointer;
    padding: 0 4px;
    text-decoration: underline;
}

.ds-item-active {
    background: rgba(59, 130, 246, 0.08);
    border-radius: 3px;
    padding: 2px 6px;
}

/* 视角 2：自由 Bit 流分配状态栏 (高度 38px) */
.dense-bitstream-strip {
    height: 38px;
    min-height: 38px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
    font-size: 12px;
}

.dense-bs-info {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.dense-bs-progress-track {
    flex: 1;
    max-width: 260px;
    height: 8px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 4px;
    overflow: hidden;
}

[data-theme="dark"] .dense-bs-progress-track {
    background: rgba(255, 255, 255, 0.1);
}

.dense-bs-progress-fill {
    height: 100%;
    background: var(--accent-color);
    transition: width 0.2s ease;
}

/* ========================================================
   具体字段高密度表格 (Spreadsheet / IDE Table)
   ======================================================== */
.dense-fields-section {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dense-fields-header {
    height: 34px;
    min-height: 34px;
    padding: 0 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.015);
}

.dense-section-title {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.dense-sub-info {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 400;
}

.dense-fields-cards-scroll,
.dense-fields-table-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* ========================================================
   字段独立卡片组件 (IDE Card Component) - 紧凑高密度 & 醒目层次
   ======================================================== */
.dense-field-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-left: 3.5px solid var(--accent-color); /* 增加左侧鲜艳强调线，字段卡片层次分明 */
    border-radius: 5px;
    padding: 7px 10px;
    transition: all 0.15s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.dense-field-card:hover {
    border-color: rgba(59, 130, 246, 0.45);
    border-left-color: var(--accent-color);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .dense-field-card {
    background: rgba(255, 255, 255, 0.025);
    border-color: rgba(255, 255, 255, 0.08);
    border-left-color: #38bdf8;
}

[data-theme="dark"] .dense-field-card:hover {
    border-color: rgba(56, 189, 248, 0.45);
    border-left-color: #38bdf8;
    background: rgba(255, 255, 255, 0.04);
}

/* 字段卡片高亮闪烁动画 (定位高亮) */
@keyframes fieldLocateFlash {
    0% {
        border-color: #ef4444;
        border-left-color: #ef4444;
        box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.45);
        background: rgba(239, 68, 68, 0.12);
        transform: scale(1.01);
    }
    50% {
        border-color: #ef4444;
        border-left-color: #ef4444;
        box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.25);
        background: rgba(239, 68, 68, 0.08);
        transform: scale(1.01);
    }
    100% {
        border-color: var(--border-color);
        border-left-color: var(--accent-color);
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
        background: var(--bg-primary);
        transform: scale(1);
    }
}

.dense-field-card.field-highlight-flash {
    animation: fieldLocateFlash 1.4s ease-out forwards;
    z-index: 5;
    position: relative;
}

/* 标号字列表中搜索命中的放大镜定位按钮 */
.word-search-match-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: rgba(59, 130, 246, 0.12);
    color: var(--accent-color);
    border: 1px solid rgba(59, 130, 246, 0.3);
    margin-left: 5px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.15s ease;
    vertical-align: middle;
}

.word-search-match-btn:hover {
    background: #ef4444 !important;
    border-color: #ef4444 !important;
    color: #ffffff !important;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.4);
    transform: scale(1.15);
}

/* 卡片顶栏 - 醒目标题区 */
.field-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 3px 6px 5px 4px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(59, 130, 246, 0.035);
    border-radius: 3px 3px 0 0;
}

[data-theme="dark"] .field-card-header {
    background: rgba(56, 189, 248, 0.05);
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

.field-card-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

/* 序号徽章更醒目 */
.field-card-idx {
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 11.5px;
    font-weight: 800;
    color: #ffffff;
    background: var(--accent-color);
    padding: 2px 7px;
    border-radius: 3px;
    flex-shrink: 0;
    box-shadow: 0 1px 2px rgba(59, 130, 246, 0.25);
}

[data-theme="dark"] .field-card-idx {
    background: #0284c7;
    color: #ffffff;
}

/* 醒目字段名称输入区：占 2/3 */
.field-card-name-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 2;
    min-width: 0;
}

/* 顶栏状态字典区：占 1/3 */
.field-card-header-dict {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 140px;
    max-width: 360px;
}

.field-card-name-icon {
    font-size: 12px;
    color: var(--accent-color);
    opacity: 0.9;
    flex-shrink: 0;
}

.field-card-name-input {
    flex: 1;
    font-size: 13.5px !important;
    font-weight: 700 !important;
    color: var(--text-primary) !important;
    background: rgba(0, 0, 0, 0.03) !important;
    border: 1px solid rgba(59, 130, 246, 0.25) !important;
    border-radius: 3px;
    padding: 2px 8px !important;
    height: 26px !important;
    line-height: 24px !important;
    outline: none;
    transition: all 0.12s ease;
}

[data-theme="dark"] .field-card-name-input {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(56, 189, 248, 0.3) !important;
    color: #f1f5f9 !important;
}

.field-card-name-input:hover {
    border-color: var(--accent-color) !important;
    background: var(--bg-primary) !important;
}

.field-card-name-input:focus {
    border-color: var(--accent-color) !important;
    background: var(--bg-primary) !important;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2) !important;
}

.field-card-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* 卡片属性紧凑流式网格 (严格约束各输入框宽度，节省大量空间) */
.field-card-props-flow {
    display: flex;
    align-items: flex-start;
    gap: 6px 8px;
    flex-wrap: wrap;
}

.field-card-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex-shrink: 0;
}

.field-card-cell-remark {
    flex: 1;
    min-width: 160px;
    flex-shrink: 1;
}

.field-card-cell-remark input {
    width: 100%;
}

.field-card-label {
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 3px;
    user-select: none;
    white-space: nowrap;
    line-height: 1.2;
}

.field-card-label i {
    font-size: 9px;
    color: var(--accent-color);
    opacity: 0.85;
}

.field-card-input, .field-card-select {
    height: 24px;
    line-height: 22px;
    padding: 0 4px !important;
    font-size: 11.5px !important;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    outline: none;
    transition: all 0.12s ease;
    box-sizing: border-box;
}

.field-card-input:focus, .field-card-select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 1px var(--accent-color);
}

.field-card-input-wrap {
    display: flex;
    align-items: center;
    position: relative;
    width: 100%;
}

.field-card-input-wrap input {
    width: 100%;
    padding-right: 15px !important;
    text-align: center;
}

.field-card-addon {
    position: absolute;
    right: 4px;
    font-size: 9.5px;
    color: var(--text-secondary);
    pointer-events: none;
    user-select: none;
}

.field-card-minmax {
    display: flex;
    align-items: center;
    gap: 3px;
    width: 100%;
}

.field-card-minmax input {
    width: 62px;
    text-align: center;
    padding: 0 4px !important;
}

.field-card-minmax span {
    font-size: 10px;
    color: var(--text-secondary);
    user-select: none;
}

.field-card-dict-box {
    display: flex;
    align-items: center;
    gap: 5px;
    min-height: 24px;
    min-width: 0;
    flex-wrap: wrap;
}

.field-card-empty-state {
    text-align: center;
    padding: 32px 20px;
    color: var(--text-secondary);
    font-size: 13px;
    background: var(--bg-primary);
    border: 1px dashed var(--border-color);
    border-radius: 6px;
    margin: 10px;
}

.dense-fields-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.dense-fields-table thead th {
    height: 28px;
    line-height: 28px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 11.5px;
    font-weight: 600;
    padding: 0 8px;
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 2;
    white-space: nowrap;
}

.dense-field-row {
    height: 34px;
    border-bottom: 1px solid var(--border-color);
}

.dense-field-row:hover {
    background: rgba(0, 0, 0, 0.015);
}

[data-theme="dark"] .dense-field-row:hover {
    background: rgba(255, 255, 255, 0.02);
}

.dense-field-row td {
    padding: 2px 6px;
    vertical-align: middle;
    font-size: 12px;
}

/* 单元格扁平输入框 (高度 26px，字体 12px，彻底阻断大内边距) */
#arinc429-view .dense-cell-input {
    width: 100%;
    height: 26px;
    line-height: 24px;
    padding: 0 6px !important;
    font-size: 12px !important;
    border: 1px solid transparent;
    border-radius: 3px;
    background: transparent;
    color: var(--text-primary);
    outline: none;
    transition: all 0.12s ease;
}

#arinc429-view .dense-cell-input:hover {
    border-color: var(--border-color);
    background: var(--bg-primary);
}

#arinc429-view .dense-cell-input:focus {
    border-color: var(--accent-color);
    background: var(--bg-secondary);
    box-shadow: 0 0 0 1px var(--accent-color);
}

.dense-cell-bitcount {
    display: flex;
    align-items: center;
    gap: 4px;
}

#arinc429-view .dense-cell-bitcount input {
    width: 48px;
    text-align: center;
}

.dense-cell-bitcount span {
    font-size: 11px;
    color: var(--text-secondary);
}

.dense-bit-span {
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 11px;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.04);
    padding: 2px 6px;
    border-radius: 3px;
    white-space: nowrap;
}

[data-theme="dark"] .dense-bit-span {
    background: rgba(255, 255, 255, 0.06);
}

.dense-bit-span-overflow {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #ef4444 !important;
    border: 1px solid rgba(239, 68, 68, 0.4);
    font-weight: 700;
}

#arinc429-view .field-in-start {
    font-family: 'JetBrains Mono', Consolas, monospace !important;
    font-weight: 600;
    text-align: center;
}

#arinc429-view .field-in-endian {
    font-size: 11.5px !important;
    padding: 0 4px !important;
    height: 26px;
    border-radius: 3px;
    cursor: pointer;
}

#arinc429-view .dense-cell-input:disabled {
    opacity: 0.45 !important;
    cursor: not-allowed !important;
    background: transparent !important;
    border-color: transparent !important;
}

/* 数据字典单元格 */
.dense-dict-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.dense-dict-list {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    overflow: visible;
}

.dense-dict-tag {
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 3px;
    background: rgba(6, 182, 212, 0.1);
    color: #0891b2;
    border: 1px solid rgba(6, 182, 212, 0.25);
    white-space: nowrap;
}

.dense-dict-empty {
    font-size: 11.5px;
    color: var(--text-secondary);
    font-style: italic;
}

.dense-dict-btn {
    height: 24px;
    line-height: 22px;
    padding: 0 6px;
    font-size: 11px;
    background: transparent;
    border: 1px dashed var(--border-color);
    border-radius: 3px;
    color: var(--accent-color);
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    transition: all 0.15s ease;
}

.dense-dict-btn:hover {
    border-color: var(--accent-color);
    background: rgba(59, 130, 246, 0.08);
}

.dense-clone-btn {
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.4);
    color: var(--accent-color);
    cursor: pointer;
    padding: 0 11px;
    height: 26px;
    line-height: 24px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.15s ease;
    user-select: none;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(59, 130, 246, 0.15);
}

.dense-clone-btn:hover {
    background: var(--accent-color);
    color: #ffffff;
    border-color: var(--accent-color);
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
}

[data-theme="dark"] .dense-clone-btn {
    background: rgba(56, 189, 248, 0.18);
    border-color: rgba(56, 189, 248, 0.45);
    color: #38bdf8;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .dense-clone-btn:hover {
    background: #0284c7;
    color: #ffffff;
    border-color: #0284c7;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.5);
    transform: translateY(-1px);
}

/* 标号字顶栏的克隆字专属强化样式 */
.dense-clone-word-btn {
    height: 28px;
    line-height: 26px;
    padding: 0 13px;
    font-size: 12.5px;
}

.dense-del-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    border-radius: 3px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.dense-del-btn:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

/* ========================================================
   极简高密度仿真底栏 (统一高度 34px)
   ======================================================== */
.dense-bottom-sim-bar {
    height: 34px;
    min-height: 34px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
    font-size: 12px;
}

.dsim-left {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.dsim-label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 11.5px;
}

.dsim-hex {
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-weight: 800;
    color: var(--accent-color);
    font-size: 13px;
}

.dsim-copy-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 2px 4px;
    font-size: 12px;
}

.dsim-copy-btn:hover {
    color: var(--accent-color);
}

.dsim-binary {
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 11.5px;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.dsim-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

#arinc429-view .dsim-input {
    height: 26px;
    line-height: 24px;
    width: 210px;
    padding: 0 8px !important;
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 12px !important;
    border-radius: 3px;
}

/* 字典编辑弹窗样式 */
.dict-presets-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.8rem;
    flex-wrap: wrap;
}

.btn-dict-preset {
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.btn-dict-preset:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.dict-table {
    width: 100%;
    border-collapse: collapse;
}

.dict-table th, .dict-table td {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
}

.dict-table input,
.dict-table input[type="text"] {
    height: 30px;
    padding: 0 8px;
    font-size: 12px;
    border-radius: 4px;
}

/* 模板卡片与本地模板管理横幅 */
.local-template-banner {
    background: rgba(59, 130, 246, 0.06);
    border: 1px dashed var(--accent-color);
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 1.2rem;
    transition: all 0.2s ease;
}

[data-theme="dark"] .local-template-banner {
    background: rgba(56, 189, 248, 0.08);
    border-color: rgba(56, 189, 248, 0.4);
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
    margin-top: 0.8rem;
}

.template-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

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

.template-card h4 {
    font-size: 1rem;
    margin-bottom: 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.template-card p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    flex: 1;
    margin-bottom: 0.8rem;
}

.template-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ========================================================
   上位机代码生成器弹窗与语法代码框样式
   ======================================================== */
.codegen-top-strip {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 10px;
    padding-bottom: 4px;
    gap: 12px;
}

.codegen-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
}

.codegen-tab {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 6px 14px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.codegen-tab:hover {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.03);
    border-radius: 4px 4px 0 0;
}

.codegen-tab.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
    font-weight: 600;
}

.codegen-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.codegen-editor-container {
    flex: 1;
    min-height: 0;
    background: #0d1117;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* 协议检查报告样式 */
.check-card {
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    padding: 12px 16px;
    margin-bottom: 10px;
    transition: all 0.15s ease;
}

.check-card.card-error {
    border-left: 4px solid #ef4444;
    background: rgba(239, 68, 68, 0.04);
}

.check-card.card-warning {
    border-left: 4px solid #f59e0b;
    background: rgba(245, 158, 11, 0.04);
}

.check-card.card-info {
    border-left: 4px solid #3b82f6;
    background: rgba(59, 130, 246, 0.04);
}

.check-card.card-success {
    border-left: 4px solid #10b981;
    background: rgba(16, 185, 129, 0.04);
}

.check-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.check-card-title {
    font-size: 13.5px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.check-card.card-error .check-card-title { color: #dc2626; }
.check-card.card-warning .check-card-title { color: #d97706; }
.check-card.card-info .check-card-title { color: #2563eb; }
.check-card.card-success .check-card-title { color: #059669; }

[data-theme="dark"] .check-card.card-error .check-card-title { color: #f87171; }
[data-theme="dark"] .check-card.card-warning .check-card-title { color: #fbbf24; }
[data-theme="dark"] .check-card.card-info .check-card-title { color: #60a5fa; }
[data-theme="dark"] .check-card.card-success .check-card-title { color: #34d399; }

.check-card-desc {
    font-size: 12.5px;
    color: var(--text-primary);
    line-height: 1.6;
}

.check-tag {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 3px;
    font-family: 'JetBrains Mono', Consolas, monospace;
}

.check-tag-error { background: rgba(239, 68, 68, 0.15); color: #dc2626; }
.check-tag-warning { background: rgba(245, 158, 11, 0.15); color: #d97706; }
.check-tag-info { background: rgba(59, 130, 246, 0.15); color: #2563eb; }

.check-location {
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 11px;
    background: var(--bg-hover);
    padding: 2px 6px;
    border-radius: 3px;
    color: var(--text-secondary);
    margin-right: 6px;
}

.codegen-pre {
    margin: 0;
    padding: 14px 16px;
    height: 100%;
    overflow: auto;
    font-family: 'JetBrains Mono', Consolas, 'Fira Code', monospace;
    font-size: 12px;
    line-height: 1.6;
    color: #e6edf3;
    background: transparent;
    tab-size: 4;
}

.codegen-code {
    font-family: inherit;
    white-space: pre;
    overflow-x: auto;
}

/* 上位机高密度表格输入控件适配 */
.field-in-minmax {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    justify-content: center;
}

.field-in-minmax input {
    width: 46px !important;
    text-align: center;
    font-family: 'JetBrains Mono', Consolas, monospace !important;
    font-size: 11px !important;
}

.field-in-minmax span {
    color: var(--text-secondary);
    font-size: 11px;
}

.field-in-key {
    font-family: 'JetBrains Mono', Consolas, monospace !important;
    font-size: 11.5px !important;
    color: #0284c7 !important;
}

[data-theme="dark"] .field-in-key {
    color: #38bdf8 !important;
}

.field-in-type {
    font-size: 11px !important;
    height: 26px !important;
    padding: 0 4px !important;
}

.meta-item-key .key-input {
    font-family: 'JetBrains Mono', Consolas, monospace !important;
    font-weight: 600;
    color: #0284c7 !important;
}

[data-theme="dark"] .meta-item-key .key-input {
    color: #38bdf8 !important;
}

/* 桌面端隐藏移动端专属控件 */
.arinc-mobile-tab-bar {
    display: none;
}

.mobile-back-words-btn {
    display: none;
}

/* ========================================================
   移动端浏览器专属深度自适应优化 (@media (max-width: 768px))
   ======================================================== */
@media (max-width: 768px) {
    /* 1. 全局容器与导航 */
    .app-container {
        flex-direction: column !important;
        height: 100dvh !important;
        height: 100vh !important;
        overflow: hidden !important;
    }

    /* 原桌面侧边栏自动转为顶部 44px 紧凑工控顶栏 */
    .sidebar {
        width: 100% !important;
        height: 44px !important;
        min-height: 44px !important;
        max-height: 44px !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 0 10px !important;
        border-right: none !important;
        border-bottom: 1px solid var(--border-color) !important;
        flex-shrink: 0 !important;
        z-index: 100 !important;
    }

    .sidebar .logo {
        padding: 0 !important;
        font-size: 1.1rem !important;
    }

    .sidebar-collapse-btn {
        display: none !important;
    }

    .sidebar .nav-menu {
        flex-direction: row !important;
        padding: 0 !important;
        gap: 6px !important;
        flex: 0 0 auto !important;
    }

    .sidebar .nav-item {
        padding: 4px 10px !important;
        font-size: 12px !important;
        border-radius: 6px !important;
        gap: 4px !important;
        height: 30px !important;
    }

    .sidebar .settings {
        padding: 0 !important;
        border-top: none !important;
    }

    .sidebar .theme-toggle {
        width: 30px !important;
        height: 30px !important;
        font-size: 12px !important;
    }

    /* 2. 主内容区 */
    .main-content {
        padding: 8px 10px !important;
        flex: 1 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .main-content.dense-workbench-active,
    .main-content:has(#arinc429-view.active) {
        padding: 4px 6px !important;
        height: calc(100dvh - 44px) !important;
        height: calc(100vh - 44px) !important;
        overflow: hidden !important;
    }

    /* 3. 协议列表视图头部 */
    .view-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
        margin-bottom: 10px !important;
    }

    .view-header h1 {
        font-size: 1.3rem !important;
    }

    .view-header p {
        font-size: 0.8rem !important;
    }

    .view-header > div:last-child {
        width: 100% !important;
        display: flex !important;
        gap: 8px !important;
    }

    .view-header > div:last-child .btn {
        flex: 1 !important;
        justify-content: center !important;
        font-size: 13px !important;
        padding: 8px 10px !important;
    }

    /* 4. 工作台模式选择与目录同步条 */
    .workspace-mode-nav {
        width: 100% !important;
    }

    .ws-mode-btn {
        flex: 1 !important;
        justify-content: center !important;
        padding: 7px 4px !important;
        font-size: 11.5px !important;
    }

    .workspace-dir-strip {
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 10px 10px !important;
        gap: 8px !important;
    }

    .ws-left {
        width: 100% !important;
        min-width: 0 !important;
    }

    .ws-info {
        flex: 1 !important;
        min-width: 0 !important;
    }

    .ws-name {
        max-width: 100% !important;
        font-size: 12px !important;
        white-space: normal !important;
        word-break: break-all !important;
    }

    .ws-right {
        width: 100% !important;
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
        justify-content: flex-end !important;
    }

    .ws-right .btn {
        flex: 1 1 calc(50% - 6px) !important;
        min-width: 75px !important;
        justify-content: center !important;
        height: 32px !important;
        padding: 0 4px !important;
        font-size: 11px !important;
    }

    /* 5. 协议卡片列表 */
    .protocol-list-container {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    .protocol-card {
        padding: 12px 12px !important;
    }

    .protocol-stats {
        gap: 4px !important;
    }

    .pstat-item {
        font-size: 10.5px !important;
        padding: 2px 5px !important;
    }

    .protocol-actions {
        margin-top: 8px !important;
        padding-top: 8px !important;
        gap: 6px !important;
    }

    .protocol-actions .btn {
        height: 32px !important;
        font-size: 11.5px !important;
    }

    /* 6. ARINC 429 工作台工具栏 (横向滚动支持，保存按钮高亮最易点击) */
    .arinc-dense-toolbar {
        height: auto !important;
        min-height: 40px !important;
        flex-wrap: wrap !important;
        padding: 4px 6px !important;
        gap: 5px !important;
    }

    .dense-tb-left {
        width: 100% !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
        -webkit-overflow-scrolling: touch !important;
        padding-bottom: 2px !important;
    }

    .dense-tb-actions {
        width: 100% !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
        -webkit-overflow-scrolling: touch !important;
        justify-content: flex-start !important;
        padding-bottom: 2px !important;
        gap: 4px !important;
    }

    .dense-tb-actions .dense-btn {
        flex-shrink: 0 !important;
        height: 28px !important;
        padding: 0 7px !important;
        font-size: 11px !important;
    }

    #btn-arinc-save {
        order: -1 !important; /* 保存按钮排在最前面，便于右手大拇指触达 */
        font-weight: 700 !important;
        background: var(--accent-color) !important;
        color: #fff !important;
    }

    /* 7. 移动端专属：双栏 Tab 切换条 */
    .arinc-mobile-tab-bar {
        display: flex !important;
        gap: 6px !important;
        margin-bottom: 5px !important;
        padding: 0 2px !important;
        flex-shrink: 0 !important;
    }

    .arinc-mobile-tab-btn {
        flex: 1 !important;
        height: 32px !important;
        line-height: 30px !important;
        border-radius: 6px !important;
        border: 1px solid var(--border-color) !important;
        background: var(--bg-secondary) !important;
        color: var(--text-secondary) !important;
        font-size: 12px !important;
        font-weight: 600 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 5px !important;
        cursor: pointer !important;
        transition: all 0.15s ease !important;
    }

    .arinc-mobile-tab-btn.active {
        background: var(--accent-color) !important;
        border-color: var(--accent-color) !important;
        color: #ffffff !important;
        box-shadow: 0 2px 5px rgba(59, 130, 246, 0.3) !important;
    }

    /* 移动端工作区主布局：单栏全宽切换 */
    .arinc-dense-workbench {
        flex-direction: column !important;
        flex: 1 !important;
        min-height: 0 !important;
        overflow: hidden !important;
    }

    .workbench-resizer {
        display: none !important;
    }

    /* tab-words 激活时展示左栏字列表，隐藏右栏 */
    .arinc-dense-workbench.mobile-view-words .arinc-dense-words-panel {
        display: flex !important;
        width: 100% !important;
        max-width: 100% !important;
        flex: 1 !important;
        min-height: 0 !important;
    }

    .arinc-dense-workbench.mobile-view-words .arinc-dense-detail-panel {
        display: none !important;
    }

    /* tab-detail 激活时展示右栏字段详情，隐藏左栏 */
    .arinc-dense-workbench.mobile-view-detail .arinc-dense-words-panel {
        display: none !important;
    }

    .arinc-dense-workbench.mobile-view-detail .arinc-dense-detail-panel {
        display: flex !important;
        width: 100% !important;
        max-width: 100% !important;
        flex: 1 !important;
        min-height: 0 !important;
    }

    /* 移动端专属返回字列表按钮 */
    .mobile-back-words-btn {
        display: inline-flex !important;
        align-items: center !important;
        gap: 3px !important;
        margin-right: 4px !important;
        flex-shrink: 0 !important;
        height: 28px !important;
        padding: 0 6px !important;
        font-size: 11px !important;
        background: rgba(59, 130, 246, 0.12) !important;
        color: var(--accent-color) !important;
        border: 1px solid rgba(59, 130, 246, 0.25) !important;
    }

    /* 8. 标号字核心控制栏 (移动端两行自适应) */
    .dense-word-primary-bar {
        height: auto !important;
        min-height: 40px !important;
        flex-wrap: wrap !important;
        padding: 6px 8px !important;
        gap: 6px !important;
    }

    .prominent-label-card {
        padding: 0 4px 0 6px !important;
        height: 28px !important;
    }

    .prominent-octal-input {
        width: 38px !important;
        font-size: 13.5px !important;
    }

    .prominent-word-name-box {
        flex: 1 1 120px !important;
        min-width: 100px !important;
    }

    .prominent-word-name-input {
        height: 28px !important;
        font-size: 13px !important;
        padding: 0 6px !important;
    }

    .dense-row-actions {
        width: 100% !important;
        display: flex !important;
        justify-content: flex-end !important;
        gap: 6px !important;
        margin-left: 0 !important;
        margin-top: 2px !important;
    }

    .dense-row-actions .dense-btn {
        flex: 1 !important;
        height: 28px !important;
        justify-content: center !important;
        font-size: 11px !important;
    }

    /* 9. 字段卡片在手机上的紧凑流式展示 */
    .dense-field-card {
        padding: 6px 8px !important;
        margin-bottom: 8px !important;
    }

    .field-card-header {
        flex-wrap: wrap !important;
        gap: 6px !important;
        padding: 4px 6px !important;
    }

    .field-card-header-left {
        width: 100% !important;
        gap: 6px !important;
        flex-wrap: wrap !important;
    }

    .field-card-name-wrap {
        flex: 1 1 130px !important;
        min-width: 110px !important;
    }

    .field-card-name-input {
        height: 28px !important;
        font-size: 12.5px !important;
    }

    .field-card-header-dict {
        flex: 1 1 90px !important;
        min-width: 80px !important;
        max-width: 100% !important;
    }

    .field-card-header-right {
        width: 100% !important;
        justify-content: flex-end !important;
        gap: 6px !important;
    }

    .field-card-props-flow {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 5px !important;
    }

    .field-card-cell {
        min-width: 0 !important;
        flex: none !important;
    }

    .field-card-cell-remark {
        grid-column: 1 / -1 !important;
        width: 100% !important;
    }

    .field-card-input, .field-card-select {
        height: 28px !important;
        line-height: 26px !important;
        font-size: 12px !important;
    }

    /* 10. 弹窗在手机上的全屏自适应 */
    .modal-content {
        width: 95vw !important;
        max-width: 95vw !important;
        max-height: 90vh !important;
        padding: 14px 14px !important;
        margin: 10px !important;
        border-radius: 12px !important;
    }

    .modal-actions {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }

    .modal-actions .btn {
        flex: 1 !important;
        justify-content: center !important;
    }

    /* 11. 同步中心手机自适应 */
    .sync-status-grid {
        grid-template-columns: 1fr !important;
        gap: 6px !important;
    }

    .sync-flow-indicator {
        transform: rotate(90deg) !important;
        margin: 2px 0 !important;
    }

    .sync-dir-card {
        padding: 8px 10px !important;
    }

    .sync-dir-desc {
        font-size: 11px !important;
    }

    .sync-metrics-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }
}

/* ---------------------------------------------------- */
/* 硬盘与云端协议同步中心 (Sync Hub Modal) 样式           */
/* ---------------------------------------------------- */
.btn-primary-soft {
    background: rgba(59, 130, 246, 0.12) !important;
    color: #2563eb !important;
    border: 1px solid rgba(59, 130, 246, 0.35) !important;
    font-weight: 600 !important;
}

.btn-primary-soft:hover {
    background: #2563eb !important;
    color: #ffffff !important;
    border-color: #2563eb !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25) !important;
}

[data-theme="dark"] .btn-primary-soft {
    background: rgba(56, 189, 248, 0.15) !important;
    color: #38bdf8 !important;
    border-color: rgba(56, 189, 248, 0.35) !important;
}

[data-theme="dark"] .btn-primary-soft:hover {
    background: #0284c7 !important;
    color: #ffffff !important;
    border-color: #0284c7 !important;
}

.btn-xs {
    padding: 2px 8px !important;
    font-size: 11px !important;
    height: 22px !important;
    line-height: 20px !important;
    border-radius: 4px !important;
}

.sync-status-grid {
    display: grid;
    grid-template-columns: 1fr 40px 1fr;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

.sync-endpoint-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.sync-ep-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sync-ep-icon {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    background: rgba(16, 185, 129, 0.14);
    color: #10b981;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.sync-ep-icon-cloud {
    background: rgba(59, 130, 246, 0.14) !important;
    color: #3b82f6 !important;
}

.sync-ep-info {
    flex: 1;
    min-width: 0;
}

.sync-ep-title {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}

.sync-ep-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sync-ep-stat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11.5px;
    gap: 6px;
}

.sync-count-badge {
    padding: 1px 7px;
    border-radius: 10px;
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
    font-weight: 600;
    font-size: 11px;
}

.sync-count-badge.badge-cloud {
    background: rgba(59, 130, 246, 0.12);
    color: #3b82f6;
}

.sync-flow-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-color);
    font-size: 18px;
    font-weight: bold;
    transition: transform 0.2s ease;
}

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

.sync-direction-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.sync-dir-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1.5px solid var(--border-color);
    background: var(--bg-secondary);
    cursor: pointer;
    transition: all 0.18s ease;
    user-select: none;
}

.sync-dir-card:hover {
    border-color: rgba(59, 130, 246, 0.45);
    background: rgba(59, 130, 246, 0.03);
}

.sync-dir-card.active {
    border-color: var(--accent-color);
    background: rgba(59, 130, 246, 0.08);
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.25);
}

.sync-dir-radio {
    font-size: 16px;
    color: var(--accent-color);
    margin-top: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sync-dir-body {
    flex: 1;
    min-width: 0;
}

.sync-dir-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3px;
    gap: 8px;
}

.sync-dir-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.sync-dir-tag {
    font-size: 10.5px;
    font-weight: 700;
    padding: 1px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

.tag-upload {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.tag-download {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.tag-both {
    background: rgba(168, 85, 247, 0.15);
    color: #a855f7;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.sync-dir-desc {
    font-size: 11.5px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.sync-options-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 12px;
}

.sync-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
}

.sync-progress-area {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 14px;
    margin-top: 8px;
    animation: fadeIn 0.2s ease;
}

.sync-progress-bar-wrap {
    height: 7px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

[data-theme="dark"] .sync-progress-bar-wrap {
    background: rgba(255, 255, 255, 0.1);
}

.sync-progress-bar-inner {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #10b981);
    border-radius: 4px;
    transition: width 0.2s ease;
}

.sync-progress-status {
    font-size: 12px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 10px;
    font-weight: 500;
}

.sync-metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    text-align: center;
    border-top: 1px dashed var(--border-color);
    padding-top: 10px;
}

.sync-metric-item {
    padding: 4px 2px;
}

.sync-metric-val {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.2;
}

.sync-metric-lbl {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}




