:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.1);
    --glass-blur: 12px;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    margin: 0;
    min-height: 100vh;
    padding: 2rem;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
}

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

.title {
    font-size: 1.875rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Glass Card Style */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
}

.section-title {
    margin: 0 0 1.25rem 0;
    font-size: 1.25rem;
    font-weight: 700;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.sub-section {
    margin-bottom: 0.5rem;
}

.sub-section-title {
    margin: 0 0 1rem 0;
    font-size: 1.05rem;
    font-weight: 600;
}

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

.strategy-meta-assets {
    margin-top: 0.75rem;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 0.625rem;
    overflow: hidden;
}

.strategy-meta-assets-header {
    padding: 0.5rem 0.75rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    background: rgba(15, 23, 42, 0.55);
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.strategy-meta-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.strategy-meta-chip {
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 0.5rem;
    padding: 0.45rem 0.6rem;
}

.strategy-meta-chip .label {
    display: block;
    font-size: 0.66rem;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}

.strategy-meta-chip .value {
    font-size: 0.78rem;
    color: var(--text-main);
    font-weight: 600;
}

.strategy-meta-assets-row {
    display: grid;
    grid-template-columns: minmax(120px, 1.2fr) minmax(80px, 0.6fr) minmax(80px, 0.8fr) minmax(90px, 0.8fr) minmax(80px, 0.7fr) minmax(110px, 1fr);
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
    font-size: 0.76rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    align-items: center;
}

.strategy-meta-assets-row-new {
    grid-template-columns: minmax(140px, 1.1fr) minmax(80px, 0.7fr) minmax(80px, 0.7fr) minmax(90px, 0.8fr) minmax(240px, 1.8fr);
}

.strategy-meta-assets-row:last-child {
    border-bottom: none;
}

.strategy-meta-assets-row .asset-name {
    color: var(--text-main);
    font-weight: 600;
}

.strategy-meta-assets-row .muted {
    color: var(--text-muted);
}

.strategy-meta-card-list {
    display: grid;
    gap: 0.75rem;
    padding: 0.75rem;
}

.strategy-meta-card {
    border: 1px solid rgba(99, 102, 241, 0.22);
    border-radius: 0.9rem;
    background: linear-gradient(165deg, rgba(30, 41, 59, 0.72), rgba(15, 23, 42, 0.72));
    padding: 0.8rem 0.85rem;
    box-shadow: 0 8px 20px rgba(2, 6, 23, 0.35);
}

.strategy-meta-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
}

.strategy-meta-card-title {
    font-size: 0.86rem;
    font-weight: 700;
    color: #f8fafc;
    line-height: 1.25;
}

.strategy-meta-card-badge {
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(30, 41, 59, 0.75);
    color: #cbd5e1;
    border-radius: 999px;
    font-size: 0.68rem;
    line-height: 1;
    padding: 0.25rem 0.5rem;
    white-space: nowrap;
}

.strategy-meta-card-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem;
    margin-bottom: 0.55rem;
}

.metric-chip {
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(15, 23, 42, 0.45);
    border-radius: 0.55rem;
    padding: 0.45rem 0.55rem;
}

.metric-chip-wide {
    grid-column: 1 / -1;
}

.strategy-meta-card-grid .label,
.formula-block .label {
    display: block;
    color: var(--text-muted);
    font-size: 0.68rem;
    margin-bottom: 0.18rem;
}

.strategy-meta-card-grid .value,
.formula-block .value {
    display: block;
    color: var(--text-main);
    font-size: 0.8rem;
    line-height: 1.3;
    font-weight: 600;
}

.formula-block {
    border: 1px dashed rgba(99, 102, 241, 0.35);
    background: rgba(15, 23, 42, 0.55);
    border-radius: 0.55rem;
    padding: 0.5rem 0.6rem;
}

.formula-block .value {
    color: #c7d2fe;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.74rem;
    word-break: break-word;
}

.strategy-formula-badge {
    display: inline-block;
    padding: 0.12rem 0.35rem;
    border-radius: 0.35rem;
    background: rgba(99, 102, 241, 0.18);
    border: 1px solid rgba(99, 102, 241, 0.35);
    color: #c7d2fe;
    font-size: 0.68rem;
    line-height: 1.25;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Form Styles */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

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

.field-grow {
    flex: 1;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.field-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.info-display {
    min-height: 2.75rem;
    display: flex;
    align-items: center;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: rgba(15, 23, 42, 0.35);
    font-weight: 600;
}

label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
}

input,
select {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    color: var(--text-main);
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.button-group {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    min-height: 44px;
}

.btn-compact {
    padding: 0.5rem 1rem;
}

.btn-save {
    background-color: #10b981;
}

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

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.settings-back-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    background: #1e293b;
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, 0.25);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    line-height: 1;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.settings-back-link:hover {
    color: #ffffff;
    background: #334155;
    border-color: rgba(148, 163, 184, 0.45);
}

/* Table Styles */
.table-container {
    margin-top: 2rem;
    overflow-x: auto;
}

.table-container-tight {
    margin-top: 0;
}

.list-summary {
    margin: 0 0 0.75rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

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

th {
    text-align: left;
    padding: 1rem;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.asset-row:hover {
    background: rgba(255, 255, 255, 0.02);
}

.actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    min-width: 38px;
    min-height: 38px;
    padding: 0.35rem;
    border-radius: 0.4rem;
    transition: color 0.2s;
}

.empty-state {
    padding: 1.25rem;
    text-align: center;
    color: var(--text-muted);
}

.action-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.1);
}

.action-btn.delete:hover {
    color: #ef4444;
}

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

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

.animate-fade-in {
    animation: fadeIn 0.5s ease forwards;
}

/* Success/Error Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 2rem;
    border-radius: 0.5rem;
    background: #10b981;
    color: white;
    font-weight: 600;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    transform: translateY(100px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
}

.toast.show {
    transform: translateY(0);
}

.toast.error {
    background: #ef4444;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    body {
        padding: 1rem 0.75rem;
    }

    .container {
        max-width: 100%;
    }

    .title {
        font-size: 1.5rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .header {
        flex-direction: row;
        align-items: center;
        gap: 0.75rem;
    }

    .header .btn,
    .button-group .btn {
        width: 100%;
        text-align: center;
    }

    .header .settings-back-link {
        width: auto;
        flex-shrink: 0;
        white-space: nowrap;
    }

    .card {
        padding: 1rem;
    }

    .section-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .inline-field-group {
        flex-direction: column;
        align-items: stretch;
    }

    .inline-field-group .btn {
        width: 100%;
    }

    .button-group {
        flex-direction: column-reverse;
        align-items: stretch;
        gap: 0.75rem;
        position: sticky;
        bottom: 0.5rem;
        z-index: 5;
        padding-top: 0.25rem;
    }

    .toast {
        right: 0.75rem;
        left: 0.75rem;
        bottom: 1rem;
        text-align: center;
        padding: 0.875rem 1rem;
    }

    .strategy-meta-assets {
        overflow-x: auto;
    }

    .strategy-meta-assets-row {
        grid-template-columns: minmax(120px, 1.1fr) repeat(4, minmax(72px, 0.8fr)) minmax(100px, 1fr);
        min-width: 620px;
    }

    .strategy-meta-assets-row-new {
        grid-template-columns: minmax(120px, 1.1fr) minmax(80px, 0.7fr) minmax(80px, 0.7fr) minmax(90px, 0.8fr) minmax(220px, 1.8fr);
        min-width: 680px;
    }

    /* Table to Card View on Mobile */
    .table-container {
        overflow-x: hidden !important;
    }

    .table-container table,
    .table-container thead,
    .table-container tbody,
    .table-container th,
    .table-container td,
    .table-container tr {
        display: block !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .table-container thead tr {
        position: absolute !important;
        top: -9999px !important;
        left: -9999px !important;
    }

    .table-container tr {
        border: 1px solid var(--border-color) !important;
        border-radius: 0.75rem !important;
        margin-bottom: 1.5rem !important;
        padding: 0.5rem !important;
        background: rgba(255, 255, 255, 0.03) !important;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    }

    .table-container td {
        border: none !important;
        position: relative !important;
        padding-left: 40% !important;
        text-align: right !important;
        min-height: 3rem !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
    }

    .table-container td:before {
        content: attr(data-label);
        position: absolute;
        left: 1rem;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: 600;
        color: var(--text-muted);
    }

    .actions {
        justify-content: flex-end;
        padding-top: 0.5rem;
        border-top: 1px solid var(--border-color);
    }

    .actions::before {
        content: "操作";
        margin-right: auto;
        color: var(--text-muted);
        font-weight: 600;
    }

    .action-btn {
        min-width: 42px;
        min-height: 42px;
    }
}

/* Edit State Highlight */
.editing {
    border-color: var(--primary) !important;
    background: rgba(99, 102, 241, 0.1) !important;
    box-shadow: 0 0 0 2px var(--primary);
}

.text-green {
    color: #10b981;
}

.text-red {
    color: #ef4444;
}

[hidden] {
    display: none !important;
}