* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, 'SF Pro Text', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background-color: #ececec;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    user-select: none;
}

/* ── App Container ── */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* ── Toolbar (macOS title bar style) ── */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 16px;
    background: linear-gradient(to bottom, #e8e8e8, #d8d8d8);
    border-bottom: 1px solid #c0c0c0;
    color: #333;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    -webkit-app-region: drag;
}

.toolbar-left, .toolbar-center, .toolbar-right {
    display: flex;
    gap: 6px;
    -webkit-app-region: no-drag;
}

.toolbar-divider {
    width: 1px;
    height: 20px;
    background: rgba(0, 0, 0, 0.12);
}

.toolbar-btn {
    padding: 5px 14px;
    background: linear-gradient(to bottom, #ffffff, #e4e4e4);
    border: 1px solid #c5c5c5;
    border-radius: 6px;
    color: #333;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

.toolbar-btn:hover {
    background: linear-gradient(to bottom, #f0f0f0, #d8d8d8);
    border-color: #aaa;
}

.toolbar-btn:active {
    background: linear-gradient(to bottom, #d0d0d0, #c0c0c0);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* ── Main Content ── */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ── Left Panel ── */
.left-panel {
    width: 260px;
    background: linear-gradient(to bottom, #f5f5f7, #ececef);
    border-right: 1px solid #d0d0d0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── Tab Container ── */
.tab-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── Tab Header (macOS style) ── */
.tab-header {
    display: flex;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.03);
    border-bottom: 1px solid #d8d8d8;
    gap: 2px;
}

.tab-btn {
    flex: 1;
    padding: 6px 8px;
    border: none;
    background: transparent;
    color: #666;
    font-size: 12px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s ease;
    font-weight: 500;
}

.tab-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
}

.tab-btn.active {
    background: #ffffff;
    color: #1a1a1a;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 0 0 0.5px rgba(0, 0, 0, 0.08);
    font-weight: 600;
}

.tab-content {
    flex: 1;
    overflow: hidden;
    background: #ffffff;
}

.tab-pane {
    display: none;
    height: 100%;
    overflow-y: auto;
}

.tab-pane.active {
    display: block;
}

/* ── Experiment List ── */
.experiment-list {
    padding: 8px;
}

.experiment-item {
    padding: 10px 12px;
    margin-bottom: 6px;
    background: #ffffff;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid #e0e0e0;
}

.experiment-item:hover {
    background: #f0f4ff;
    border-color: #b0c4de;
    transform: translateX(1px);
}

.experiment-name {
    color: #1a1a1a;
    font-weight: 600;
    margin-bottom: 3px;
    font-size: 13px;
}

.experiment-date {
    font-size: 11px;
    color: #888;
}

/* ── Canvas ── */
.canvas-container {
    flex: 1;
    position: relative;
    background: #f7f8fa;
}

#lab-canvas {
    width: 100%;
    height: 100%;
    cursor: default;
}

.canvas-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

/* ── Right Panel ── */
.right-panel {
    width: 320px;
    background: linear-gradient(to bottom, #f5f5f7, #ececef);
    border-left: 1px solid #d0d0d0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── Search Box ── */
.search-box {
    padding: 8px 10px;
    border-bottom: 1px solid #d8d8d8;
    background: rgba(0, 0, 0, 0.02);
}

.search-box input {
    width: 100%;
    padding: 5px 8px 5px 26px;
    border: 1px solid #c5c5c5;
    border-radius: 6px;
    font-size: 13px;
    background: #ffffff url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="%23999" stroke-width="2"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg>') no-repeat 7px center;
    transition: all 0.15s ease;
}

.search-box input:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.12);
}

/* ── Category Tabs ── */
.category-tabs {
    display: flex;
    flex-wrap: wrap;
    padding: 6px 8px;
    border-bottom: 1px solid #d8d8d8;
    gap: 3px;
}

.category-btn {
    padding: 4px 10px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 5px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    color: #555;
}

.category-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.category-btn.active {
    background: #1a73e8;
    color: white;
    border-color: #1557b0;
}

.category-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

/* ── Equipment Items ── */
.equipment-item {
    padding: 8px 10px;
    margin-bottom: 5px;
    background: #ffffff;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.equipment-item:hover {
    background: #f0f4ff;
    border-color: #9ec5fe;
    transform: translateX(1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.equipment-icon-3d {
    width: 36px;
    height: 44px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.equipment-item:hover .equipment-icon-3d {
    transform: scale(1.08);
}

.eq-3d-svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(1px 2px 1px rgba(0, 0, 0, 0.1));
}

.equipment-icon {
    font-size: 24px;
}

.equipment-info {
    flex: 1;
}

.equipment-name {
    font-weight: 600;
    color: #1a1a1a;
    font-size: 13px;
}

.equipment-spec {
    font-size: 11px;
    color: #888;
}

/* ── Reagent Items ── */
.reagent-item {
    padding: 8px 10px;
    margin-bottom: 4px;
    background: #ffffff;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.reagent-item:hover {
    background: #f0f4ff;
    border-color: #9ec5fe;
    transform: translateX(1px);
}

.reagent-color {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.reagent-info {
    flex: 1;
}

.reagent-name {
    font-weight: 600;
    color: #1a1a1a;
    font-size: 13px;
}

.reagent-formula {
    font-size: 11px;
    color: #888;
    font-family: 'SF Mono', 'Menlo', monospace;
}

/* ── Equation Panel ── */
.equation-content {
    padding: 14px;
    font-size: 15px;
    color: #1a1a1a;
    background: #ffffff;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.equation-item {
    margin-bottom: 12px;
    padding: 10px 12px;
    background: #f5f5f7;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.equation-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.equation-index {
    font-size: 12px;
    color: #888;
    font-weight: 600;
}

.equation-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.equation-status.ongoing {
    background: #fff3cd;
    color: #856404;
}

.equation-status.done {
    background: #d4edda;
    color: #155724;
}

.equation-divider {
    border: none;
    border-top: 1px dashed #ccc;
    margin: 8px 0;
}

.equation-main {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 6px;
    line-height: 1.5;
    color: #1a1a1a;
}

.equation-ionic {
    font-size: 12px;
    color: #555;
    background: #e8f0fe;
    padding: 6px 10px;
    border-radius: 6px;
    font-family: 'SF Mono', 'Menlo', monospace;
}

.equation-empty {
    color: #999;
    font-style: italic;
    text-align: center;
    margin: auto;
}

/* ── Info Panel ── */
.info-content {
    padding: 14px;
    font-size: 14px;
    color: #333;
    background: #ffffff;
    min-height: 100%;
}

.info-section {
    margin-bottom: 14px;
    padding: 10px 12px;
    background: #f5f5f7;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.info-title {
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 5px;
    font-size: 13px;
}

.info-list {
    font-size: 13px;
    line-height: 1.6;
    color: #555;
}

.info-danger {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 600;
}

.info-danger.danger-低 {
    background: #d4edda;
    color: #155724;
}

.info-danger.danger-中 {
    background: #fff3cd;
    color: #856404;
}

.info-danger.danger-高 {
    background: #f8d7da;
    color: #721c24;
}

.info-empty {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* ── Status Bar ── */
.statusbar {
    display: flex;
    align-items: center;
    padding: 5px 16px;
    background: linear-gradient(to bottom, #ececec, #e0e0e0);
    border-top: 1px solid #c5c5c5;
    font-size: 12px;
}

.status-item {
    margin-right: 20px;
    color: #666;
}

.status-item.right {
    margin-left: auto;
    margin-right: 0;
    color: #1a73e8;
    font-weight: 600;
}

/* ── Dialog ── */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.dialog-content {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), 0 0 0 0.5px rgba(0, 0, 0, 0.1);
    width: 320px;
    max-width: 90%;
    overflow: hidden;
    animation: dialogFadeIn 0.2s ease-out;
}

@keyframes dialogFadeIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

.dialog-header {
    padding: 14px 16px;
    background: linear-gradient(to bottom, #f5f5f7, #ececef);
    border-bottom: 1px solid #d8d8d8;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dialog-header h3 {
    margin: 0;
    font-size: 15px;
    color: #1a1a1a;
    font-weight: 600;
}

.dialog-close {
    font-size: 20px;
    cursor: pointer;
    color: #888;
    transition: color 0.15s;
    line-height: 1;
}

.dialog-close:hover {
    color: #333;
}

.dialog-body {
    padding: 18px 16px;
}

.form-group {
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group label {
    font-size: 13px;
    color: #333;
    min-width: 60px;
    flex-shrink: 0;
}

.form-group input[type="number"] {
    padding: 5px 8px;
    border: 1px solid #c5c5c5;
    border-radius: 6px;
    font-size: 13px;
    transition: all 0.15s ease;
}

.form-group input[type="number"]:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.12);
}

.dialog-footer {
    padding: 10px 16px;
    background: #f5f5f7;
    border-top: 1px solid #d8d8d8;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.btn {
    padding: 6px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-weight: 500;
}

.btn-primary {
    background: #1a73e8;
    color: white;
}

.btn-primary:hover {
    background: #1557b0;
}

.btn-primary:active {
    background: #144699;
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

/* ── Scrollbar (macOS style) ── */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.35);
    background-clip: padding-box;
    border: 2px solid transparent;
}

/* ---- 抽屉安全机制 · 实验存档删除按钮 ---- */
.exp-del-btn {
  border: none; background: transparent; color: #ef4444; font-size: 16px;
  cursor: pointer; line-height: 1; padding: 2px 6px; border-radius: 4px; margin-left: 6px;
  opacity: .7;
}
.exp-del-btn:hover { background: rgba(239,68,68,.12); opacity: 1; }
