@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Plus+Jakarta+Sans:wght@500;600;700&display=swap');

:root {
    /* Premium Palette */
    --primary-50: #f0f9ff;
    --primary-100: #e0f2fe;
    --primary-500: #0ea5e9;
    --primary-600: #0284c7;
    --primary-700: #0369a1;

    --slate-50: #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-600: #475569;
    --slate-800: #1e293b;
    --slate-900: #0f172a;

    --success: #10b981;
    --error: #ef4444;

    /* Design Tokens */
    --font-sans: 'Inter', sans-serif;
    --font-heading: 'Plus Jakarta Sans', sans-serif;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-glow: 0 0 20px rgba(14, 165, 233, 0.15);

    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-full: 9999px;

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-sans);
    background-color: var(--slate-50);
    color: var(--slate-800);
    line-height: 1.6;
    min-height: 100vh;
}

/* Layout */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Header */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    padding: 0.25rem 0;
}

.logo-area {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    text-align: left;
}

.logo-icon {
    font-size: 3rem;
    background: linear-gradient(135deg, var(--primary-100), var(--primary-50));
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 0;
}

.logo-text h1 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--slate-900);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.highlight {
    color: var(--primary-600);
}

.subtitle {
    color: var(--slate-600);
    font-size: 1.125rem;
    font-weight: 500;
}

/* Search Hero */
.search-hero {
    max-width: 700px;
    margin: 0 auto;
    width: 100%;
}

.nav-search {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.75rem;
}

.nav-search .search-box {
    width: min(560px, 100%);
    padding: 0.35rem;
    border-radius: var(--radius-lg);
}

.nav-search .search-icon {
    padding: 0 0.75rem;
}

.nav-search input {
    font-size: 1rem;
    padding: 0.5rem 0;
}

.nav-search .primary-btn {
    padding: 0.6rem 1.4rem;
    font-size: 0.9rem;
}

.search-box-wrapper {
    position: relative;
    z-index: 10;
}

.search-box {
    display: flex;
    align-items: center;
    background: white;
    padding: 0.5rem;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    border: 1px solid var(--slate-200);
    transition: var(--transition);
}

.search-box:focus-within {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 30px rgba(14, 165, 233, 0.2);
    border-color: var(--primary-500);
}

.search-icon {
    padding: 0 1.25rem;
    color: var(--slate-300);
    display: flex;
    align-items: center;
}

.search-box input {
    flex: 1;
    border: none;
    font-size: 1.125rem;
    color: var(--slate-800);
    outline: none;
    padding: 0.75rem 0;
    font-family: var(--font-sans);
    background: transparent;
}

.search-box input::placeholder {
    color: var(--slate-300);
}

.primary-btn {
    background: var(--slate-900);
    color: white;
    border: none;
    padding: 0.875rem 2rem;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.secondary-btn {
    background: var(--slate-200);
    color: var(--slate-700);
    border: none;
    padding: 0.875rem 2rem;
    border-radius: var(--radius-full); 
}

.primary-btn:hover {
    background: var(--primary-600);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}

/* Results Area */
.results-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    animation: fadeIn 0.6s ease-out;
}

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

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

/* Cards */
.result-card,
.cas-display {
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--slate-100);
    overflow: hidden;
}

.result-card {
    overflow: visible;
}

.cas-display {
    text-align: center;
    padding: 2rem;
    background: linear-gradient(to right, white, var(--primary-50), white);
}

.cas-display h2 {
    font-family: var(--font-heading);
    color: var(--slate-800);
    font-size: 2rem;
}

.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--slate-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
}

.calibration-panel {
    margin: 0 1.5rem 1.5rem;
    border: 1px solid var(--slate-100);
    border-radius: var(--radius-md);
    background: var(--slate-50);
    box-shadow: none;
    overflow: hidden;
}

.calibration-panel .card-header {
    background: white;
    border-bottom: 1px solid var(--slate-100);
}

.card-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--slate-800);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.card-cas {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--slate-600);
    background: var(--slate-100);
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.card-title::before {
    content: '';
    display: block;
    width: 6px;
    height: 24px;
    background: var(--primary-500);
    border-radius: 4px;
}

.badge {
    background: var(--primary-100);
    color: var(--primary-700);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 600;
}

/* Record Item Container - 新层级布局 */
.record-item-container {
    border-bottom: 1px solid var(--slate-100);
}

.record-item-container:last-child {
    border-bottom: none;
}

.record-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 2rem;
    padding: 1.5rem;
}

.record-left {
    position: sticky;
    top: 1.5rem;
    align-self: start;
    max-height: calc(100vh - 3rem);
    overflow: auto;
    padding-right: 0.25rem;
}

.record-right {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0;
}

.identity-card {
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--slate-100);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.identity-card .record-header {
    padding: 1rem 1.25rem 0.75rem;
    border-bottom: 1px solid var(--slate-100);
}

.identity-card .title-row {
    flex-wrap: wrap;
    margin-bottom: 0.25rem;
}

.identity-card .compound-name {
    flex: 1 1 auto;
    min-width: 0;
    word-break: break-word;
    font-size: 1.35rem;
}

.identity-card .meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.identity-card .cas-number {
    margin: 0;
    font-size: 0.9rem;
}

.identity-card .type-tag {
    font-size: 0.7rem;
    padding: 0.2rem 0.6rem;
}

.structure-card {
    padding: 0.75rem 1.25rem 1rem;
    border-bottom: 1px solid var(--slate-100);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.structure-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--slate-500);
    font-weight: 600;
}

.structure-subtitle {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--slate-400);
    font-weight: 600;
}

.structure-frame {
    background: var(--slate-50);
    border: 1px solid var(--slate-200);
    border-radius: 0.75rem;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    overflow: hidden;
}

.structure-3d-viewer {
    width: 100%;
    height: 160px;
    position: relative;
}

.structure-3d-viewer canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

.structure-3d-frame {
    padding: 0;
    min-height: 160px;
    position: relative;
}

.structure-3d-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--slate-400);
    font-size: 0.875rem;
    background: var(--slate-50);
}

.structure-3d-frame.is-ready .structure-3d-placeholder {
    display: none;
}

.structure-3d-frame.is-error .structure-3d-viewer {
    display: none;
}

.structure-2d-frame {
    min-height: 150px;
}

.structure-2d-image {
    width: 100%;
    height: auto;
    max-height: 160px;
    object-fit: contain;
}

.structure-placeholder {
    color: var(--slate-400);
    font-size: 0.875rem;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
}

.structure-status {
    font-size: 0.75rem;
    color: var(--slate-500);
    margin-top: 0.15rem;
}

.identity-info {
    padding: 0.75rem 1.25rem 1rem;
}

/* 头部区域 */
.record-header {
    padding: 1.5rem 2rem 1rem 2rem;
    background: linear-gradient(to right, #fafbfc, white);
    border-bottom: 2px solid var(--slate-100);
}

.title-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.compound-name {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--slate-900);
    margin: 0;
    flex-shrink: 0;
}

.type-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.type-tag.type-溶剂,
.type-tag.type-solvent {
    background: #dbeafe;
    color: #1e40af;
}

.type-tag.type-添加剂,
.type-tag.type-additive {
    background: #fce7f3;
    color: #9f1239;
}

.type-tag.type-主盐,
.type-tag.type-salt {
    background: #fef3c7;
    color: #92400e;
}

.cas-number {
    font-size: 0.9375rem;
    color: var(--slate-600);
    font-weight: 500;
}

/* 内容区域 */
.record-content-wrapper {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 2rem;
    padding: 2rem;
    background: white;
}

.info-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.info-section.storage-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.info-section.storage-grid .info-field {
    display: grid;
    grid-template-columns: 100px minmax(0, 1fr);
    column-gap: 1rem;
    align-items: center;
}

.info-section.storage-grid .field-label {
    min-width: 0;
}

.info-section.storage-grid .field-value {
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.info-section.storage-grid .location-edit-container {
    width: 100%;
    flex-wrap: wrap;
    align-items: center;
}

.info-section.storage-grid .location-input {
    flex: 1 1 200px;
    min-width: 0;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    color: var(--slate-700);
    margin: 0 0 0.5rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--slate-200);
}

.info-field {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
}

.field-label {
    font-size: 0.875rem;
    color: var(--slate-600);
    font-weight: 500;
    min-width: 80px;
    flex-shrink: 0;
}

.field-value {
    font-size: 0.9375rem;
    color: var(--slate-900);
    font-weight: 500;
    flex: 1;
}

.editable-field {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.file-link-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--primary-600);
    text-decoration: none;
    transition: var(--transition);
    font-size: 0.875rem;
}

.file-link-inline:hover {
    color: var(--primary-700);
    text-decoration: underline;
}

/* 其他字段区域 */
.other-fields-section {
    padding: 1.5rem 2rem;
    background: var(--slate-50);
    border-top: 1px solid var(--slate-100);
}

.other-fields-section .data-grid {
    padding: 0;
}

/* 底部更新时间 */
.record-footer {
    padding: 0.75rem 2rem;
    background: var(--slate-50);
    border-top: 1px solid var(--slate-100);
    font-size: 0.8125rem;
    color: var(--slate-500);
    text-align: right;
}

/* Data Grid (Key-Value) */
.data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    padding: 2rem;
}

.data-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.data-label {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--slate-600);
    font-weight: 600;
}

.data-value {
    color: var(--slate-900);
    font-weight: 500;
    word-break: break-word;
}

/* File Links */
.file-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--slate-100);
    color: var(--slate-800);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    transition: var(--transition);
    border: 1px solid var(--slate-200);
}

.file-link:hover {
    background: white;
    box-shadow: var(--shadow-sm);
    border-color: var(--primary-500);
    color: var(--primary-600);
}

/* Image Pairs */
.pairs-wrapper {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: 2rem;
    background: var(--slate-50);
}

.pair-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.spectrum-structure-row {
    display: flex;
    justify-content: center;
    align-items: start;
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--slate-200);
}

.mnova-file-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: white;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.mnova-file-link svg {
    flex-shrink: 0;
    color: var(--primary-600);
}

.mnova-link {
    color: var(--slate-800);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
}

.mnova-link:hover {
    color: var(--primary-600);
    text-decoration: underline;
}

.image-box {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
    max-width: 800px;
    position: relative;
}

.image-box.has-expand-btn {
    padding-bottom: 2.5rem;
}

.image-header {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--slate-600);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--slate-100);
}

.image-header .header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.expand-spectra-btn {
    position: absolute;
    right: 0.75rem;
    bottom: 0.75rem;
    border: 1px solid var(--primary-300);
    background: var(--primary-50);
    color: var(--primary-700);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    cursor: pointer;
    transition: var(--transition);
}

.expand-spectra-btn:hover {
    background: var(--primary-100);
    border-color: var(--primary-400);
    transform: translateY(-1px);
}

.fid-download-btn {
    border: 1px solid var(--slate-200);
    background: white;
    color: var(--slate-700);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    cursor: pointer;
    transition: var(--transition);
}

.fid-download-btn:hover {
    border-color: var(--primary-400);
    color: var(--primary-600);
    background: var(--primary-50);
}

.refresh-button,
.expand-button {
    background: transparent;
    border: 1px solid var(--slate-200);
    border-radius: 0.375rem;
    padding: 0.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--slate-600);
    transition: var(--transition);
    width: 24px;
    height: 24px;
}

.refresh-button:hover:not(:disabled),
.expand-button:hover {
    background: var(--primary-50);
    border-color: var(--primary-500);
    color: var(--primary-600);
}

.refresh-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.refresh-button svg.spinning {
    animation: spin 1s linear infinite;
}

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

.image-box img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    cursor: zoom-in;
    transition: var(--transition);
    border: 1px solid var(--slate-100);
}

.image-box img:hover {
    box-shadow: var(--shadow-md);
    transform: scale(1.01);
}

/* Empty spectrum box styling */
.empty-spectrum {
    width: 100%;
    max-width: 800px;
}

@media (max-width: 900px) {
    .image-box {
        max-width: 100%;
    }

    .empty-spectrum {
        max-width: 100%;
    }
}

/* Updated Table Styles */
.table-wrapper {
    overflow-x: auto;
    width: 100%;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

.data-table th {
    background: var(--slate-50);
    padding: 1rem 1.5rem;
    text-align: left;
    font-weight: 600;
    color: var(--slate-600);
    border-bottom: 2px solid var(--slate-200);
    white-space: nowrap;
}

.data-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--slate-100);
    color: var(--slate-800);
    vertical-align: middle;
}

.data-table tr:hover td {
    background-color: var(--primary-50);
}

.calibration-table {
    table-layout: fixed;
}

.calibration-table th,
.calibration-table td {
    padding: 0.75rem 0.75rem;
    white-space: normal;
}

.calibration-table col.col-shift {
    width: 7%;
}

.calibration-table col.col-spectrum {
    width: 9%;
}

.calibration-table col.col-equation {
    width: 24%;
}

.calibration-table col.col-rr {
    width: 6%;
}

.calibration-table col.col-x {
    width: 12%;
}

.calibration-table col.col-y {
    width: 9%;
}

.calibration-table col.col-mass {
    width: 11%;
}

.calibration-table col.col-fraction {
    width: 10%;
}

.calibration-table col.col-actions {
    width: 12%;
}

.calibration-table .equation-cell {
    overflow-wrap: anywhere;
    line-height: 1.35;
    color: var(--slate-700);
}

.calibration-table .action-cell {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.calibration-table .calc-input {
    width: 90px;
}

.calibration-table .sample-mass-input {
    width: 100px;
}

.calc-input {
    width: 100px;
    padding: 0.5rem;
    border: 1px solid var(--slate-300);
    border-radius: 6px;
    text-align: center;
    font-family: var(--font-sans);
    transition: var(--transition);
}

.calc-input:focus {
    border-color: var(--primary-500);
    outline: none;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.sample-mass-input {
    width: 120px;
}

.mass-fraction {
    font-weight: 600;
    color: var(--slate-700);
}

.calc-result {
    font-weight: 700;
    color: var(--primary-700);
    font-family: monospace;
    font-size: 1.1em;
}

.calc-result.highlight {
    color: var(--success);
    animation: pop 0.3s ease;
}

@keyframes pop {
    50% {
        transform: scale(1.2);
    }
}

/* Loading */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    color: var(--slate-600);
    gap: 1rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--primary-100);
    border-top-color: var(--primary-600);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.hidden {
    display: none !important;
}

/* Error */
.error-message {
    background: #fef2f2;
    border: 1px solid #fee2e2;
    color: #991b1b;
    padding: 1rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.attachment-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    border: 1px solid var(--slate-200);
    background: white;
    color: var(--slate-700);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.attachment-btn:hover {
    border-color: var(--primary-400);
    color: var(--primary-600);
    background: var(--primary-50);
}

.attachment-upload-btn {
    border: 1px solid var(--slate-200);
    border-radius: 999px;
    padding: 0.35rem;
    background: white;
    color: var(--slate-500);
}

.attachment-upload-btn:hover {
    color: var(--primary-600);
    border-color: var(--primary-300);
    background: var(--primary-50);
}

.location-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0 2rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--slate-700);
    width: 100%;
    text-align: center;
}

.location-label {
    color: var(--slate-600);
    font-weight: 600;
}

.location-value {
    font-size: 1.05rem;
    font-weight: 600;
}

.location-row + .pairs-wrapper {
    margin-top: 0.75rem;
}

/* Add Row Button Inline */
.add-row-btn-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    background: var(--primary-600);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.add-row-btn-inline:hover {
    background: var(--primary-700);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}

.add-row-btn-inline svg {
    flex-shrink: 0;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease-out;
}

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

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--slate-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--slate-900);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: var(--slate-400);
    transition: var(--transition);
    border-radius: 4px;
}

.modal-close:hover {
    color: var(--slate-600);
    background: var(--slate-100);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--slate-700);
    margin-bottom: 0.5rem;
}

.required {
    color: var(--error);
}

.form-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--slate-300);
    border-radius: 6px;
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    transition: var(--transition);
}

.form-input:focus {
    border-color: var(--primary-500);
    outline: none;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.form-input:disabled {
    background: var(--slate-100);
    color: var(--slate-500);
    cursor: not-allowed;
}

/* Equation Inputs */
.equation-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 0.5rem;
}

.equation-param {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.param-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--slate-600);
}

.equation-preview {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: var(--slate-50);
    border: 1px solid var(--slate-200);
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.preview-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--slate-600);
}

.preview-value {
    font-family: monospace;
    font-size: 0.9375rem;
    color: var(--slate-500);
    font-weight: 500;
}

.preview-value.preview-active {
    color: var(--primary-700);
    font-weight: 600;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--slate-200);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Delete Row Button */
.delete-row-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0.375rem;
    cursor: pointer;
    color: var(--slate-400);
    transition: var(--transition);
    border-radius: 4px;
}

.delete-row-btn:hover {
    background: #fee2e2;
    color: var(--error);
    transform: scale(1.1);
}

.delete-row-btn svg {
    display: block;
}

/* Config Button */
.config-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: white;
    border: 1px solid var(--slate-200);
    padding: 0.625rem 1rem;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: var(--transition);
    color: var(--slate-600);
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--shadow-sm);
    position: relative;
}

.config-btn:hover {
    background: var(--slate-50);
    border-color: var(--primary-500);
    color: var(--primary-600);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.config-btn:active {
    transform: translateY(0);
}

.config-status {
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-full);
    font-weight: 600;
}

.config-status.configured {
    background: #d1fae5;
    color: #065f46;
}

.config-status.unconfigured {
    background: #fee2e2;
    color: #991b1b;
}

.config-status::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 0.25rem;
    background: currentColor;
}

/* Password Toggle */
.password-toggle {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--slate-400);
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    transition: var(--transition);
}

.password-toggle:hover {
    color: var(--slate-600);
}

.password-input-wrapper {
    position: relative;
}

.record-row-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.6rem;
    margin-left: 0.4rem;
    border: 1px solid var(--slate-200);
    border-radius: 6px;
    background: white;
    color: var(--slate-700);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.record-row-btn:hover {
    border-color: var(--primary-500);
    color: var(--primary-600);
    background: var(--primary-50);
}

/* Edit Location Icon */
.edit-location-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 4px;
    margin-left: 8px;
    cursor: pointer;
    color: var(--primary-600);
    transition: var(--transition);
    border-radius: 4px;
    opacity: 0.7;
}

.edit-location-icon:hover {
    opacity: 1;
    background: var(--primary-50);
    transform: scale(1.1);
}

.edit-location-icon svg {
    display: block;
}

/* Upload File Icon (for file_all) */
.upload-file-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 4px;
    margin-left: 8px;
    cursor: pointer;
    color: #10b981;
    transition: var(--transition);
    border-radius: 4px;
    opacity: 0.7;
}

.upload-file-icon:hover {
    opacity: 1;
    background: #ecfdf5;
    transform: scale(1.1);
}

.upload-file-icon svg {
    display: block;
}

/* Location Edit Container */
.location-edit-container {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.location-input {
    padding: 0.5rem;
    border: 1px solid var(--slate-300);
    border-radius: 6px;
    font-family: var(--font-sans);
    font-size: 1rem;
    transition: var(--transition);
    min-width: 200px;
}

.location-input:focus {
    border-color: var(--primary-500);
    outline: none;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.save-btn,
.cancel-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.save-btn {
    background: var(--success);
    color: white;
}

.save-btn:hover:not(:disabled) {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.save-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.cancel-btn {
    background: var(--slate-200);
    color: var(--slate-700);
}

.cancel-btn:hover:not(:disabled) {
    background: var(--slate-300);
}

.cancel-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Mobile */
@media (max-width: 768px) {
    .app-container {
        padding: 1rem;
    }
    
    .config-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }
    
    .config-btn svg {
        width: 16px;
        height: 16px;
    }
    
    .config-status {
        display: none;
    }

    .main-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .nav-search {
        width: 100%;
    }

    .nav-search .search-box {
        width: 100%;
    }

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

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .location-edit-container {
        flex-direction: column;
        align-items: flex-start;
    }

    .location-input {
        width: 100%;
    }

    /* 新布局响应式 */
    .record-content-wrapper {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 1.5rem;
    }

    .record-layout {
        grid-template-columns: 1fr;
        padding: 1.5rem;
    }

    .calibration-panel {
        margin: 0 1rem 1rem;
    }

    .record-left {
        position: static;
        max-height: none;
        overflow: visible;
        padding-right: 0;
    }

    .identity-card .record-header {
        padding: 1rem 1.25rem 0.75rem;
    }

    .structure-card,
    .identity-info {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }

    .record-header {
        padding: 1rem;
    }

    .compound-name {
        font-size: 1.25rem;
    }

    .title-row {
        flex-wrap: wrap;
    }

    .field-label {
        min-width: 70px;
    }
}
