/*
 * 大A悄悄话 — Apple Design Language
 * Airy, minimal, generous whitespace, soft cards.
 */

:root {
    --bg:          #faf8f5;
    --card:        #ffffff;
    --text:        #2c2416;
    --text2:       #b0a394;
    --accent:      #8b6914;
    --accent-dim:  #a67c15;
    --border:      #e8e0d5;
    --up:          #c0392b;
    --down:        #27ae60;
    --radius:      18px;
    --radius-sm:   12px;
    --nav-h:       44px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    font-size: 14px;
    line-height: 1.5;
    letter-spacing: -0.01em;
}

/* ─── Nav ─── */
.navbar {
    background: rgba(250,248,245,0.85);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    position: sticky; top: 0; z-index: 100;
    border-bottom: 1px solid var(--border);
}
.nav-inner {
    max-width: 980px; margin: 0 auto;
    display: flex; align-items: center; gap: 32px;
    height: var(--nav-h); padding: 0 24px;
}
.nav-brand {
    font-size: 17px; font-weight: 700; color: var(--text);
    text-decoration: none; letter-spacing: -0.02em;
}
.nav-links { display: flex; gap: 0; }
.nav-links a {
    font-size: 12px; font-weight: 400; color: var(--text);
    text-decoration: none; padding: 8px 12px; border-radius: 6px;
    letter-spacing: 0; transition: background .2s;
}
.nav-links a:hover { background: #f0ebe0; }
.nav-links a.active { background: #e8dfd0; color: #2c3e50; font-weight: 600; }
.nav-more { display: none; }
.nav-search { margin-left: auto; }
.nav-search form { display: flex; align-items: center; gap: 0; position: relative; }
.nav-search input {
    width: 140px; padding: 6px 30px 6px 12px; font-size: 12px;
    border: 1px solid var(--border); border-radius: 20px;
    background: var(--card); outline: none;
    transition: border-color .2s;
}
.nav-search input:focus { border-color: var(--text2); }
.nav-search button {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    background: none; border: none;
    cursor: pointer; font-size: 14px; color: var(--text2);
    padding: 0; line-height: 1;
}

/* ─── Info Strip (Stock Detail) ─── */
.info-strip {
    display: flex; flex-wrap: wrap; gap: 6px 16px;
    background: var(--card); border-radius: var(--radius-sm);
    padding: 12px 18px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    align-items: baseline;
}
.info-strip .kv { font-size: 14px; white-space: nowrap; }
.ma-badge {
    display: inline-block; font-size: 11px; font-weight: 700;
    padding: 1px 6px; border-radius: 4px; margin-left: 2px;
    line-height: 1.4; vertical-align: middle;
}
.ma-badge.up { background: #e8f5e9; color: #2e7d32; }
.ma-badge.down { background: #ffebee; color: #c62828; }

/* ─── Container ─── */
.container { max-width: 980px; margin: 0 auto; padding: 28px 24px 80px; }
h2 { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 8px; }
h3 { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 12px; }

/* ─── Hero Stats ─── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px; margin: 32px 0 48px;
}
.stat-card {
    background: var(--card); border-radius: var(--radius);
    padding: 28px 24px; text-align: center;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 20px rgba(0,0,0,0.06); }
.stat-card.surge { background: linear-gradient(135deg, #fff, #fff8f0); }
.stat-num {
    font-size: 34px; font-weight: 700; letter-spacing: -0.02em;
    line-height: 1.1;
}
.stat-label {
    font-size: 12px; color: var(--text2); margin-top: 4px;
    font-weight: 500; letter-spacing: 0.04em;
}

/* ─── Run Status ─── */
.run-status {
    font-size: 14px; color: var(--text2); margin-bottom: 12px;
    display: flex; gap: 20px; flex-wrap: wrap;
}

/* ─── Tables ─── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); }
.data-table {
    width: 100%; border-collapse: separate; border-spacing: 0;
    background: var(--card); border-radius: var(--radius);
    overflow: hidden; box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    font-size: 14px;
}
.data-table th, .data-table td { padding: 14px 16px; text-align: left; }
.data-table th {
    font-size: 11px; font-weight: 600; color: var(--text2);
    letter-spacing: 0.06em; background: #faf8f5;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}
.data-table td { border-bottom: 1px solid rgba(0,0,0,0.04); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(0,0,0,0.015); }
.clickable-row { cursor: pointer; }

/* ─── Tags ─── */
.tag {
    display: inline-block; padding: 3px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
}
.tag-break { background: #f0ebe0; color: var(--text); }
.tag-surge { background: #fef0d5; color: var(--accent); }
.tag-pullback { background: #f0ebe0; color: var(--text); }
.tag-limit { background: #fce4ec; color: var(--up); }
.tag-score { background: #fef0d5; color: var(--accent); font-weight: 700; font-size: 12px; }

/* ─── Buttons ─── */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 8px 18px; border-radius: 20px; font-size: 13px;
    font-weight: 500; text-decoration: none; border: none;
    cursor: pointer; transition: background .15s;
    min-width: 100px;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dim); }
.btn-secondary { background: #f0ebe0; color: var(--text); }
.btn-secondary:hover { background: #e8dcc8; }
.btn-outline { border: 1px solid var(--border); color: var(--text); background: transparent; }
.btn-outline:hover { background: #f5f0e5; }

/* ─── Flash ─── */
.flash {
    padding: 14px 20px; border-radius: var(--radius-sm); margin-bottom: 20px;
    font-size: 14px;
}
.flash-success { background: #e8f5e9; color: #2e7d32; }
.flash-error { background: #ffebee; color: #c62828; }
.flash-warning { background: #fff8e1; color: #f57f17; }

/* ─── Colors ─── */
.up { color: var(--up); font-weight: 600; }
.down { color: var(--down); font-weight: 600; }

/* ─── Sections ─── */
.section { margin: 48px 0; }
.page-header {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 12px; margin-bottom: 20px;
}
.filter-select {
    padding: 8px 16px; border: 1px solid var(--border);
    border-radius: 20px; font-size: 14px; background: var(--card);
    outline: none;
}
.date-pick-btn {
    font-size: 18px; cursor: pointer; padding: 6px 10px;
    border: 1px solid var(--border); border-radius: 20px;
    background: var(--card); line-height: 1;
}
.date-pick-btn:hover { background: #f5f0e5; }
.date-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px; border-radius: 20px;
    background: #fef0d5; font-size: 13px; font-weight: 500;
}
.date-clear { color: var(--text2); text-decoration: none; font-size: 16px; line-height: 1; }
.date-clear:hover { color: var(--text); }
.pagination {
    margin-top: 24px; display: flex; justify-content: center;
    gap: 20px; font-size: 14px;
}
.pagination a { color: var(--accent); text-decoration: none; font-weight: 500; }
.pagination a:hover { text-decoration: underline; }
.empty { color: var(--text2); font-size: 14px; padding: 48px 0; text-align: center; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 32px; }
.chart-container {
    background: var(--card); border-radius: var(--radius);
    box-shadow: 0 2px 12px rgba(0,0,0,0.04); overflow: hidden; margin: 12px 0 24px;
}
.kline-chart { width: 100%; height: 600px; }
@media (max-width: 768px) { .kline-chart { height: 300px; } }

/* ─── Progress ─── */
@keyframes shimmer { 0% { left: -40%; } 100% { left: 100%; } }
.progress-bar {
    width: 100%; height: 4px; background: #f0ebe0;
    border-radius: 2px; overflow: hidden; position: relative; margin: 32px 0;
}
.progress-bar::after {
    content: ''; position: absolute; top: 0; height: 100%;
    width: 40%; background: var(--accent); border-radius: 2px;
    animation: shimmer 1.5s ease-in-out infinite;
}

/* ─── Footer ─── */
.footer {
    text-align: center; padding: 48px 24px;
    font-size: 12px; color: var(--text2);
    border-top: 1px solid rgba(0,0,0,0.06);
}
.footer a { color: var(--text2); text-decoration: none; }
.footer a:hover { color: var(--accent); }

/* ─── Date Group (History) ─── */
.date-group-title {
    font-size: 15px; font-weight: 600;
    padding: 8px 0 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}
.stock-group {
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--card);
}
.stock-group-header {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 16px;
    background: #faf8f5;
}
.stock-group-header .stock-code {
    font-size: 12px; font-weight: 600; color: var(--text2);
    font-family: "SF Mono", "Menlo", monospace; min-width: 48px;
}
.stock-group-header .stock-name { font-size: 14px; font-weight: 600; flex: 1; }
.stock-group-header .stock-count {
    font-size: 11px; color: var(--text2);
    background: #f0ebe0; padding: 2px 8px; border-radius: 10px;
}
.stock-group-body .data-table { box-shadow: none; border-radius: 0; }
.stock-group-body .data-table th { background: #fff; }

/* ─── Track Mini Dots ─── */
.track-mini { display: flex; gap: 4px; }
.track-dot { font-size: 14px; line-height: 1; }
.track-dot.up { color: var(--up); }
.track-dot.down { color: var(--down); }

/* ─── Timeline ─── */
.timeline {
    position: relative;
    padding-left: 32px;
    margin: 24px 0;
}
.timeline::before {
    content: '';
    position: absolute;
    left: 11px; top: 4px; bottom: 4px;
    width: 2px;
    background: var(--border);
    border-radius: 1px;
}
.timeline-day {
    margin-bottom: 32px;
}
.timeline-day-label {
    font-size: 13px; font-weight: 600; color: var(--text2);
    margin-bottom: 16px; padding-left: 6px;
    letter-spacing: 0.02em;
}
.tl-item {
    position: relative;
    margin-bottom: 16px;
}
.tl-dot {
    position: absolute;
    left: -25px; top: 14px;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--border);
    border: 2px solid var(--bg);
    z-index: 1;
}
.tl-dot.success { background: #27ae60; }
.tl-dot.failed  { background: #c0392b; }
.tl-dot.running { background: #f39c12; animation: pulse-dot 1.5s ease-in-out infinite; }
@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: .5; transform: scale(1.3); }
}
.tl-card {
    background: var(--card);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    box-shadow: 0 1px 8px rgba(0,0,0,0.04);
    display: flex; align-items: flex-start; gap: 12px;
}
.tl-card.fetch  { border-left: 3px solid #e8e0d5; }
.tl-card.analysis { border-left: 3px solid var(--accent); }
.tl-time {
    font-size: 13px; font-weight: 600; color: var(--text);
    white-space: nowrap; min-width: 36px; line-height: 1.6;
}
.tl-body { flex: 1; min-width: 0; }
.tl-label {
    font-size: 13px; font-weight: 600; line-height: 1.6;
}
.tl-label .tl-type {
    display: inline-block; font-size: 10px; font-weight: 600;
    padding: 1px 6px; border-radius: 3px; margin-right: 6px;
    letter-spacing: 0.04em; vertical-align: middle;
}
.tl-type.fetch    { background: #f0ebe0; color: #8b7355; }
.tl-type.analysis { background: #fef0d5; color: var(--accent); }
.tl-source {
    font-size: 11px; color: var(--text2); margin-top: 2px;
}
.tl-meta {
    font-size: 11px; color: var(--text2); margin-top: 4px;
    display: flex; gap: 12px; flex-wrap: wrap;
}
.tl-error {
    font-size: 11px; color: var(--up); margin-top: 4px;
    background: #ffebee; padding: 4px 8px; border-radius: 4px;
}
.tl-dur {
    color: var(--text2);
}
.tl-dur::before { content: "⏱ "; }

/* ─── Modal (macOS style) ─── */
.modal-overlay {
    position: fixed; inset: 0; z-index: 999;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0; visibility: hidden;
    transition: opacity .2s, visibility .2s;
}
.modal-overlay.show { opacity: 1; visibility: visible; }
.modal-card {
    position: fixed; top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    z-index: 1000;
    background: var(--card);
    border-radius: 16px;
    padding: 28px 32px 20px;
    width: 380px; max-width: 90vw;
    text-align: center;
    box-shadow: 0 8px 40px rgba(0,0,0,0.15);
    opacity: 0; visibility: hidden;
    transition: opacity .2s, transform .2s, visibility .2s;
}
.modal-card.show {
    opacity: 1; visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}
.modal-icon {
    font-size: 32px; margin-bottom: 8px;
}
.modal-title {
    font-size: 15px; font-weight: 700; margin-bottom: 6px;
}
.modal-body {
    font-size: 13px; color: var(--text2); margin-bottom: 12px;
}
.modal-file {
    font-size: 11px; color: var(--text2);
    background: #f8f5f0; padding: 6px 12px;
    border-radius: 6px; margin-bottom: 20px;
    word-break: break-all; font-family: "SF Mono", monospace;
}
.modal-actions {
    display: flex; gap: 10px; justify-content: center;
}
.btn-danger {
    background: #c0392b; color: #fff;
    border: none; padding: 8px 20px; border-radius: 20px;
    font-size: 13px; font-weight: 500; cursor: pointer;
    transition: background .15s;
}
.btn-danger:hover { background: #a93226; }

/* ─── Table action icons ─── */
.td-actions { white-space: nowrap; }
.btn-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 6px;
    font-size: 16px; text-decoration: none; cursor: pointer;
    border: none; background: transparent; color: var(--text2);
    transition: background .15s, color .15s;
    vertical-align: middle;
}
.btn-icon:hover { background: #f0ebe0; color: var(--text); }
.btn-del:hover { background: #ffebee; color: #c0392b; }

/* ─── Mobile ─── */
@media (max-width: 768px) {
    .nav-inner { padding: 0 12px; gap: 10px; }
    .nav-brand { font-size: 16px; flex-shrink: 0; }
    .nav-links a { font-size: 11px; padding: 6px 7px; white-space: nowrap; }
    .nav-links .nav-more-item { display: none; }
    .nav-more { display: inline-flex; position: relative; }
    .nav-more-btn { font-size: 11px; padding: 6px 7px; border: none; background: none; color: var(--text); cursor: pointer; border-radius: 6px; font-family: inherit; }
    .nav-more-btn:hover { background: #f0ebe0; }
    .nav-more-drop { display: none; position: absolute; top: 100%; right: 0; background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.1); min-width: 120px; z-index: 200; padding: 4px; }
    .nav-more-drop a { display: block; padding: 8px 12px; font-size: 13px; border-radius: 4px; text-decoration: none; color: var(--text); white-space: nowrap; }
    .nav-more-drop a:hover { background: #f5f0e5; }
    .nav-more:hover .nav-more-drop,
    .nav-more:focus-within .nav-more-drop { display: block; }
    .nav-search { flex-shrink: 0; }
    .nav-search input { width: 90px; }
    .container { padding: 32px 16px 64px; }
    h2 { font-size: 32px; }
    h3 { font-size: 20px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card { padding: 20px 16px; }
    .stat-num { font-size: 36px; }
    .section { margin: 32px 0; }
    .btn { padding: 8px 16px; font-size: 14px; }
    .data-table { font-size: 14px; }
    .data-table th, .data-table td { padding: 10px 12px; }
    .top3-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .top3-grid { grid-template-columns: 1fr; }
    h2 { font-size: 28px; }
    h3 { font-size: 18px; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .stat-num { font-size: 28px; }
    .stat-card { padding: 16px 12px; }
    .container { padding: 24px 12px; }
    .data-table { font-size: 13px; }
    .data-table th, .data-table td { padding: 8px 10px; }
}
