/* ══════════════════════════════════════════════════════════════════════
   A股分析工作台 — Mobile Web Edition
   Dark financial terminal aesthetic
   ══════════════════════════════════════════════════════════════════════ */

:root {
    --bg: #0c0e14;
    --surface: #1a1d28;
    --surface2: #222633;
    --border: #2a2d3a;
    --text: #e0e2f0;
    --text-secondary: #8b8fa3;
    --text-muted: #6b6f83;
    --accent: #4a7cf7;
    --red: #c62828;
    --red-light: #ef5350;
    --green: #2e7d32;
    --green-light: #43a047;
    --orange: #e65100;
    --purple: #6a1b9a;
    --radius: 10px;
    --font: -apple-system, 'SF Pro Text', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    --font-mono: 'SF Mono', 'Consolas', 'Menlo', monospace;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior: none;
}

/* ── Top bar ──────────────────────────────────────────────────── */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(12px);
}

.topbar-brand {
    font-weight: 700;
    font-size: 16px;
    color: var(--text);
    letter-spacing: 0.5px;
}

.topbar-time {
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* ── Bottom nav ───────────────────────────────────────────────── */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 6px 0 env(safe-area-inset-bottom, 8px);
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 12px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 10px;
    font-weight: 500;
    transition: color 0.15s;
    min-width: 64px;
}

.nav-item.active {
    color: var(--accent);
}

.nav-item svg {
    opacity: 0.7;
}

.nav-item.active svg {
    opacity: 1;
}

/* ── Cards ────────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
}

.card-header {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 8px;
    letter-spacing: 0.6px;
    font-weight: 600;
}

/* ── Grid helpers ─────────────────────────────────────────────── */
.row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
}

/* ── Typography ───────────────────────────────────────────────── */
.data-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.data-value {
    font-size: 14px;
    color: var(--text);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    font-family: var(--font-mono);
}

.price-big {
    font-size: clamp(24px, 5vw, 36px);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    font-family: var(--font-mono);
    letter-spacing: -0.5px;
    color: var(--text);
}

.change-tag {
    font-size: 14px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    font-family: var(--font-mono);
}

.signal-badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 14px;
    color: #fff;
    text-align: center;
    min-width: 120px;
    letter-spacing: 0.5px;
}

/* ── Form elements ────────────────────────────────────────────── */
input, select, textarea {
    background: #12141d;
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 14px;
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
    transition: border-color 0.15s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
}

input[type="checkbox"] {
    width: auto;
    accent-color: var(--accent);
}

label {
    color: var(--text);
    font-size: 14px;
}

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.12s;
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.97);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

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

.btn-danger {
    background: var(--red);
    color: #fff;
}

.btn-green {
    background: var(--green);
    color: #fff;
}

.btn-orange {
    background: var(--orange);
    color: #fff;
}

/* ── Status indicators ────────────────────────────────────────── */
#monitor-status {
    font-size: 12px;
    text-align: center;
    padding: 6px;
    border-radius: 6px;
    margin-bottom: 8px;
    font-family: var(--font-mono);
}

.status-active {
    background: #1a3a1a;
    color: var(--green-light);
}

.status-idle {
    background: #1a1a2e;
    color: var(--text-secondary);
}

/* ── Alerts ───────────────────────────────────────────────────── */
.alert-item {
    font-size: 12px;
    padding: 4px 0;
    border-bottom: 1px solid #1f2230;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    line-height: 1.4;
}

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

/* ── Config toggle ────────────────────────────────────────────── */
.config-collapsed {
    display: none;
}

/* ── Scrollbar ────────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 4px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

/* ── Utility ──────────────────────────────────────────────────── */
#alert-log {
    max-height: 180px;
    overflow-y: auto;
}

#results-area {
    margin-top: 12px;
}

/* ── Desktop tweaks ───────────────────────────────────────────── */
@media (min-width: 768px) {
    body {
        max-width: 520px;
        margin: 0 auto;
    }

    .bottom-nav {
        max-width: 520px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 12px 12px 0 0;
    }

    .topbar {
        max-width: 520px;
        margin: 0 auto;
    }
}
