:root {
    --app-ink: #163126;
    --app-muted: #60786b;
    --app-accent: #295f4e;
    --app-accent-2: #9dbdaa;
    --app-highlight: #c16c3b;
    --app-surface: rgba(255, 252, 245, 0.92);
    --app-surface-strong: #fffdf8;
    --app-line: rgba(41, 95, 78, 0.14);
    --app-shadow: 0 18px 60px rgba(28, 63, 50, 0.12);
}

body {
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.8), transparent 28%),
        linear-gradient(135deg, #f3efe5, #dce7d8 58%, #d2dfd3);
    color: var(--app-ink);
    font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

.app-shell {
    min-height: 100vh;
}

.app-topbar,
.navbar.app-topbar {
    background: rgba(22, 49, 38, 0.88) !important;
    backdrop-filter: blur(12px);
    box-shadow: 0 10px 30px rgba(20, 44, 35, 0.16);
    position: relative;
    z-index: 1080;
    overflow: visible;
}

.app-topbar .dropdown,
.app-topbar .dropdown-menu {
    z-index: 1081;
}

.app-topbar .navbar-brand,
.app-topbar .nav-link,
.app-topbar .text-white {
    color: #f7f3ea !important;
}

.app-topbar .nav-link,
.app-nav-link {
    opacity: 0.88;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.app-topbar .nav-link:hover,
.app-nav-link:hover {
    opacity: 1;
    transform: translateY(-1px);
}

.app-page,
.app-main {
    padding-top: 28px;
    padding-bottom: 36px;
}

.app-frame,
.container.app-frame,
.container-fluid.app-frame {
    background: var(--app-surface);
    border: 1px solid var(--app-line);
    border-radius: 24px;
    box-shadow: var(--app-shadow);
}

.app-hero,
.page-header,
.hero,
.status-card {
    background: linear-gradient(135deg, rgba(41, 95, 78, 0.96), rgba(72, 124, 103, 0.92)) !important;
    color: #f7f3ea !important;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 22px !important;
    box-shadow: 0 14px 40px rgba(31, 72, 58, 0.2) !important;
}

.app-hero h1,
.page-header h1,
.hero h1,
.status-card h2,
h1, h2, h3, h4, h5, h6 {
    color: inherit;
}

.panel,
.card,
.search-panel,
.filter-controls,
.config-section,
.result-card,
.step-card,
.detail-section,
.stats-card {
    background: var(--app-surface-strong) !important;
    border: 1px solid var(--app-line) !important;
    border-radius: 18px !important;
    box-shadow: 0 10px 30px rgba(31, 72, 58, 0.06);
}

.card-header,
.filter-section-title,
.detail-section h6 {
    color: var(--app-accent) !important;
}

.btn-primary,
.btn-save,
.btn-start,
.btn-restart,
.btn-success {
    background: linear-gradient(135deg, var(--app-accent), #4d7f68) !important;
    border-color: transparent !important;
    color: #fff !important;
}

.btn-secondary,
.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-dark,
.btn-stop {
    border-radius: 12px !important;
}

.btn-stop {
    background: linear-gradient(135deg, #b44f43, #8e3d35) !important;
    color: #fff !important;
    border-color: transparent !important;
}

.btn,
button {
    border-radius: 12px !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.btn:hover,
button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(28, 63, 50, 0.14);
}

.form-control,
.form-select,
input,
select,
textarea {
    border-radius: 12px !important;
    border: 1px solid var(--app-line) !important;
    background: rgba(255, 255, 255, 0.96) !important;
}

.form-control:focus,
.form-select:focus,
input:focus,
select:focus,
textarea:focus {
    border-color: rgba(41, 95, 78, 0.45) !important;
    box-shadow: 0 0 0 0.2rem rgba(41, 95, 78, 0.12) !important;
}

.table {
    --bs-table-bg: transparent;
}

.table thead th {
    color: var(--app-muted) !important;
    border-bottom-color: var(--app-line) !important;
}

.table tbody tr:hover {
    background: rgba(157, 189, 170, 0.12) !important;
}

.logs-section {
    background: #183028 !important;
    border: 1px solid rgba(255, 255, 255, 0.04) !important;
}

.small-note,
.text-muted,
.stats-card p,
.status-item label {
    color: var(--app-muted) !important;
}

.badge.bg-primary,
.badge.bg-info,
.badge.bg-success,
.score-high,
.score-medium,
.score-low,
.stat-chip {
    border-radius: 999px !important;
}

@media (max-width: 768px) {
    .app-main,
    .app-page {
        padding-top: 18px;
    }

    .app-frame,
    .container.app-frame,
    .container-fluid.app-frame {
        border-radius: 18px;
    }
}

/* Professional Trading Panel Layout */
.trading-panel-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 500px;
    background: #1e222d;
    color: #d1d4dc;
    border-radius: 8px;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Trebuchet MS", Roboto, Ubuntu, sans-serif;
}

.trading-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: #131722;
    border-bottom: 1px solid #2a2e39;
}

.trading-panel-title {
    font-size: 16px;
    font-weight: 600;
    color: #d1d4dc;
    margin: 0;
}

.trading-panel-stats {
    display: flex;
    gap: 16px;
    font-size: 13px;
}

.trading-panel-stats .stat-label {
    color: #787b86;
    margin-right: 4px;
}

.trading-panel-stats .stat-value {
    color: #d1d4dc;
}

.trading-panel-stats .stat-value.up {
    color: #26a69a;
}

.trading-panel-stats .stat-value.down {
    color: #ef5350;
}

.trading-panel-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.trading-panel-sidebar {
    width: 200px;
    background: #131722;
    border-right: 1px solid #2a2e39;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-section {
    padding: 12px;
    border-bottom: 1px solid #2a2e39;
}

.sidebar-section-title {
    font-size: 12px;
    text-transform: uppercase;
    color: #787b86;
    margin-bottom: 8px;
    font-weight: 600;
}

.sidebar-stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-bottom: 6px;
}

.sidebar-stat-row:last-child {
    margin-bottom: 0;
}

.sidebar-stat-row .label {
    color: #787b86;
}

.sidebar-stat-row .value {
    color: #d1d4dc;
    font-family: monospace;
}

.trading-panel-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background: #1e222d;
}

.trading-panel-toolbar {
    display: flex;
    padding: 4px 12px;
    background: #131722;
    border-bottom: 1px solid #2a2e39;
    gap: 8px;
    align-items: center;
}

.indicator-legend {
    display: flex;
    gap: 12px;
    font-size: 12px;
    padding: 6px 12px;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
    background: rgba(30, 34, 45, 0.7);
    border-bottom-right-radius: 4px;
}

.indicator-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.chart-container-main {
    flex: 3;
    position: relative;
    min-height: 300px;
}

.chart-divider {
    height: 4px;
    background: #2a2e39;
    cursor: row-resize;
}

.chart-container-sub {
    flex: 1;
    position: relative;
    min-height: 100px;
}

.trading-panel-tabs {
    display: flex;
    background: #131722;
    border-top: 1px solid #2a2e39;
}

.trading-panel-tab {
    padding: 8px 16px;
    font-size: 12px;
    color: #787b86;
    cursor: pointer;
    border-top: 2px solid transparent;
}

.trading-panel-tab:hover {
    color: #d1d4dc;
}

.trading-panel-tab.active {
    color: #2962ff;
    border-top-color: #2962ff;
    background: #1e222d;
}
