:root {
    --bg: #0a0e17;
    --bg-2: #0e1420;
    --panel: #111827;
    --panel-2: #0c1119;
    --line: #1e2937;
    --line-2: #263244;
    --text: #e7ecf3;
    --muted: #8290a6;
    --dim: #5b687e;
    --up: #f6465d;      /* 台股：漲紅 */
    --down: #0ecb81;    /* 台股：跌綠 */
    --flat: #8290a6;
    --accent: #4c8dff;
    --radius: 16px;
    --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
    --sans: system-ui, -apple-system, "Segoe UI", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background:
        radial-gradient(1200px 600px at 80% -10%, #16223a 0%, transparent 60%),
        radial-gradient(900px 500px at -10% 10%, #101a2e 0%, transparent 55%),
        var(--bg);
    color: var(--text);
    font-family: var(--sans);
    -webkit-font-smoothing: antialiased;
    min-height: 100dvh;
}

.grain {
    position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .035;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---- topbar ---- */
.topbar {
    position: relative; z-index: 1;
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px clamp(16px, 4vw, 40px);
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(10,14,23,.9), rgba(10,14,23,.6));
    backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand .dot {
    width: 9px; height: 9px; border-radius: 50%; align-self: center;
    background: var(--down); box-shadow: 0 0 12px var(--down);
    animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.35} }
.brand-name { font-weight: 700; letter-spacing: .04em; font-size: 1.05rem; }
.brand-sub { color: var(--muted); font-size: .78rem; letter-spacing: .12em; }
.mkt {
    font-size: .76rem; font-weight: 600; letter-spacing: .05em;
    padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line-2);
    font-family: var(--mono);
}
.mkt--open { color: var(--down); border-color: color-mix(in srgb, var(--down) 45%, transparent); background: color-mix(in srgb, var(--down) 10%, transparent); }
.mkt--closed { color: var(--muted); }
.mkt--unknown { color: var(--dim); }

/* ---- layout ---- */
.wrap {
    position: relative; z-index: 1;
    max-width: 1080px; margin: 0 auto; padding: clamp(16px, 3vw, 28px);
    display: flex; flex-direction: column; gap: 18px;
}

/* ---- symbol tabs ---- */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tabs button {
    font-family: var(--sans); font-size: .9rem; font-weight: 600;
    color: var(--muted); background: var(--panel-2);
    border: 1px solid var(--line); border-radius: 999px;
    padding: 8px 18px; cursor: pointer; transition: all .18s ease;
}
.tabs button:hover { color: var(--text); border-color: var(--line-2); transform: translateY(-1px); }
.tabs button[aria-selected="true"] {
    color: #fff; background: linear-gradient(180deg, #1b2740, #141d30);
    border-color: var(--accent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent), 0 6px 18px -8px var(--accent);
}

/* ---- quote card ---- */
.quote {
    background: linear-gradient(180deg, var(--panel), var(--panel-2));
    border: 1px solid var(--line); border-radius: var(--radius);
    padding: clamp(18px, 3vw, 26px); position: relative; overflow: hidden;
}
.quote::before {
    content: ""; position: absolute; inset: 0 auto 0 0; width: 4px;
    background: var(--flat); transition: background .3s;
}
.quote.is-up::before { background: var(--up); box-shadow: 0 0 24px var(--up); }
.quote.is-down::before { background: var(--down); box-shadow: 0 0 24px var(--down); }
.quote__head { display: flex; align-items: baseline; gap: 12px; }
.quote__name { font-size: clamp(1.15rem, 2.4vw, 1.5rem); margin: 0; font-weight: 700; letter-spacing: .02em; }
.quote__code { font-family: var(--mono); font-size: .8rem; color: var(--dim); }
.quote__price { display: flex; align-items: baseline; gap: clamp(14px, 3vw, 28px); margin-top: 10px; flex-wrap: wrap; }
.value {
    font-family: var(--mono); font-weight: 700; line-height: 1;
    font-size: clamp(2.4rem, 8vw, 3.8rem); letter-spacing: -.01em;
    font-variant-numeric: tabular-nums;
}
.delta { display: flex; flex-direction: column; gap: 2px; font-family: var(--mono); font-weight: 600; }
.delta #qChange { font-size: clamp(1.1rem, 3vw, 1.5rem); }
.delta .pct { font-size: .95rem; opacity: .9; }
.is-up .value, .is-up .delta { color: var(--up); }
.is-down .value, .is-down .delta { color: var(--down); }
.is-flat .value { color: var(--text); }
.is-flat .delta { color: var(--flat); }

.stats {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
    margin: 20px 0 0; padding-top: 18px; border-top: 1px dashed var(--line-2);
}
.stats div { display: flex; flex-direction: column; gap: 4px; }
.stats dt { color: var(--dim); font-size: .72rem; letter-spacing: .08em; margin: 0; }
.stats dd { margin: 0; font-family: var(--mono); font-size: 1rem; font-variant-numeric: tabular-nums; }

/* ---- chart panel ---- */
.panel {
    background: linear-gradient(180deg, var(--panel), var(--panel-2));
    border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.panel__bar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.tf { display: flex; gap: 4px; background: var(--panel-2); padding: 4px; border-radius: 10px; border: 1px solid var(--line); }
.tf button {
    font-family: var(--mono); font-size: .82rem; color: var(--muted);
    background: transparent; border: 0; border-radius: 7px; padding: 5px 12px; cursor: pointer; transition: all .15s;
}
.tf button:hover { color: var(--text); }
.tf button[aria-selected="true"] { color: #fff; background: var(--line-2); }
.updated { font-family: var(--mono); font-size: .74rem; color: var(--dim); }
.chart { height: min(56vh, 460px); width: 100%; }
.msg { padding: 40px 16px; text-align: center; color: var(--up); font-size: .9rem; }

.foot { text-align: center; color: var(--dim); font-size: .74rem; line-height: 1.9; padding: 8px 0 20px; }
.foot strong { color: var(--muted); }
.foot .up { color: var(--up); font-weight: 700; }
.foot .down { color: var(--down); font-weight: 700; }

/* ---- 交易平台 ---- */
.wallet { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; background: linear-gradient(180deg, var(--panel), var(--panel-2)); border: 1px solid var(--line-2); border-radius: 14px; padding: 14px 18px; margin-bottom: 4px; }
.wallet__box { display: flex; align-items: baseline; gap: 10px; }
.wallet__label { color: var(--muted); font-size: .82rem; }
.wallet__bal { font-family: var(--mono); font-size: 1.8rem; font-weight: 700; color: #7ee0ff; }
.wallet__meta { color: var(--dim); font-size: .78rem; }
.wallet__meta b { color: var(--muted); }
.nav__trade { text-decoration: none; color: #7ee0ff; font-weight: 700; font-size: .82rem; padding: 6px 14px; border-radius: 999px; border: 1px solid color-mix(in srgb, #7ee0ff 40%, transparent); }
.nav__trade:hover { background: color-mix(in srgb, #7ee0ff 12%, transparent); }
.ticker { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 4px; }
.tick { background: linear-gradient(180deg, var(--panel), var(--panel-2)); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; display: flex; flex-direction: column; gap: 4px; }
.tick__name { color: var(--muted); font-size: .78rem; }
.tick__px { font-family: var(--mono); font-size: 1.4rem; font-weight: 700; }
.order { padding: 16px; }
.order__row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.order .field { flex: 1 1 150px; }
.order select, .order input { font-family: var(--mono); font-size: 1rem; color: var(--text); background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 11px 13px; width: 100%; }
.order select:focus, .order input:focus { outline: none; border-color: var(--accent); }
.dir { display: flex; gap: 6px; }
.dir__btn { flex: 1; font-family: var(--sans); font-weight: 700; font-size: .95rem; padding: 11px 10px; border-radius: 10px; cursor: pointer; background: var(--panel-2); border: 1px solid var(--line-2); color: var(--muted); transition: all .15s; }
.dir__long.is-on { color: #fff; background: color-mix(in srgb, var(--up) 82%, black); border-color: var(--up); }
.dir__short.is-on { color: #fff; background: color-mix(in srgb, var(--down) 82%, black); border-color: var(--down); }
.order__submit { flex: 1 1 150px; padding: 12px; }
.order__msg { margin-top: 12px; font-size: .88rem; font-family: var(--mono); }
.order__msg.is-ok { color: var(--down); }
.order__msg.is-err { color: var(--up); }

/* ---- 後台 ---- */
.authmsg.is-ok { color: var(--down); background: color-mix(in srgb, var(--down) 12%, transparent); border: 1px solid color-mix(in srgb, var(--down) 35%, transparent); }
.nav__admin { text-decoration: none; color: #ffd479; font-weight: 700; font-size: .82rem; padding: 6px 14px; border-radius: 999px; border: 1px solid color-mix(in srgb, #ffd479 40%, transparent); }
.nav__admin:hover { background: color-mix(in srgb, #ffd479 12%, transparent); }
.page-h1 { font-size: 1.5rem; font-weight: 700; margin: 4px 0 20px; letter-spacing: .02em; }
.page-sub { font-size: .9rem; color: var(--dim); font-weight: 400; margin-left: 8px; }
.hint { color: var(--muted); font-size: .86rem; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 22px; }
.card { background: linear-gradient(180deg, var(--panel), var(--panel-2)); border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.card__label { color: var(--muted); font-size: .8rem; }
.card__num { font-family: var(--mono); font-size: 2rem; font-weight: 700; line-height: 1; }
.admin-links { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.admin-links .authbtn { flex: 0 1 auto; padding: 12px 22px; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filters__input, .filters__sel {
    font-family: var(--sans); font-size: .9rem; color: var(--text); background: var(--panel-2);
    border: 1px solid var(--line-2); border-radius: 10px; padding: 9px 12px;
}
.filters__input:focus, .filters__sel:focus { outline: none; border-color: var(--accent); }
.filters__btn { font-weight: 600; color: #fff; background: linear-gradient(180deg, #2a3a5c, #1b2740); border: 1px solid var(--line-2); border-radius: 10px; padding: 9px 18px; cursor: pointer; }

.admin-table td, .admin-table th { text-align: left; }
.admin-table th.c-act2, .admin-table td.c-act2 { text-align: left; }
.badge { display: inline-block; font-size: .74rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line-2); }
.badge.cat-9 { color: #ffd479; border-color: color-mix(in srgb, #ffd479 45%, transparent); }
.badge.cat-8 { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.badge.cat-1 { color: var(--down); border-color: color-mix(in srgb, var(--down) 40%, transparent); }
.badge.cat-0 { color: var(--muted); }
.badge.st-on { color: var(--down); border-color: color-mix(in srgb, var(--down) 40%, transparent); }
.badge.st-off { color: var(--up); border-color: color-mix(in srgb, var(--up) 40%, transparent); }
.rowacts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.inl { display: inline-flex; gap: 4px; align-items: center; margin: 0; }
.mini { font-size: .76rem; font-weight: 600; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 7px; padding: 5px 10px; cursor: pointer; transition: all .14s; }
.mini:hover { color: var(--text); border-color: var(--accent); }
.mini:disabled { opacity: .4; cursor: not-allowed; }
.mini-on { color: var(--down); border-color: color-mix(in srgb, var(--down) 40%, transparent); }
.mini-off { color: var(--up); border-color: color-mix(in srgb, var(--up) 40%, transparent); }
.mini-inp { font-family: var(--mono); font-size: .78rem; color: var(--text); background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 7px; padding: 5px 8px; width: 84px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 20px; color: var(--muted); font-size: .86rem; }
.pager a { color: var(--accent); text-decoration: none; padding: 6px 12px; border: 1px solid var(--line-2); border-radius: 8px; }
.pager a:hover { background: var(--panel-2); }
.c-chk { width: 34px; text-align: center; }
.c-chk input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent); }
.batchbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; font-size: .86rem; }
.batchbar__count b { font-family: var(--mono); color: var(--accent); }
.batchbar__all { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.batchbar__all input, .c-chk input { accent-color: var(--accent); }
.batchbar__sep { color: var(--dim); }
.batchbar__hint { color: var(--dim); font-size: .78rem; }

/* ---- topbar 右側 + 登入狀態 ---- */
.topbar__right { display: flex; align-items: center; gap: 10px; }
.nav__login, .nav__logout {
    text-decoration: none; font-size: .82rem; font-weight: 600; padding: 6px 14px; border-radius: 999px;
    border: 1px solid var(--line-2); transition: all .16s;
}
.nav__login { color: #fff; background: linear-gradient(180deg, #2a3a5c, #1b2740); }
.nav__login:hover { border-color: var(--accent); box-shadow: 0 6px 16px -8px var(--accent); }
.nav__logout { color: var(--muted); background: transparent; }
.nav__logout:hover { color: var(--up); border-color: color-mix(in srgb, var(--up) 45%, transparent); }
.nav__user {
    text-decoration: none; color: var(--text); font-size: .82rem; font-weight: 600;
    padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2);
}
.nav__user:hover { border-color: var(--accent); color: #fff; }

/* ---- 登入/註冊/會員 卡片 ---- */
.wrap--narrow { max-width: 480px; }
.authcard {
    background: linear-gradient(180deg, var(--panel), var(--panel-2));
    border: 1px solid var(--line); border-radius: var(--radius);
    padding: clamp(22px, 4vw, 34px); margin-top: 10px;
}
.authcard__title { margin: 0 0 20px; font-size: 1.4rem; font-weight: 700; letter-spacing: .02em; }
.authform { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: .82rem; color: var(--muted); font-weight: 600; }
.field > span em { color: var(--dim); font-style: normal; font-size: .72rem; margin-left: 4px; }
.field input {
    font-family: var(--mono); font-size: 1rem; color: var(--text);
    background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 12px 14px;
    transition: border-color .16s, box-shadow .16s;
}
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.authbtn {
    margin-top: 6px; font-family: var(--sans); font-size: 1rem; font-weight: 700; color: #fff;
    background: linear-gradient(180deg, #2a3a5c, #1b2740); border: 1px solid var(--line-2);
    border-radius: 12px; padding: 14px; cursor: pointer; transition: all .16s;
}
.authbtn:hover { transform: translateY(-1px); box-shadow: 0 10px 24px -12px var(--accent); border-color: var(--accent); }
.authbtn--ghost { display: inline-block; text-decoration: none; text-align: center; background: transparent; color: var(--muted); }
.authbtn--ghost:hover { color: var(--up); border-color: color-mix(in srgb, var(--up) 45%, transparent); box-shadow: none; }
.authmsg { padding: 11px 14px; border-radius: 10px; font-size: .88rem; margin-bottom: 16px; }
.authmsg.is-err { color: var(--up); background: color-mix(in srgb, var(--up) 12%, transparent); border: 1px solid color-mix(in srgb, var(--up) 35%, transparent); }
.authalt { text-align: center; color: var(--muted); font-size: .86rem; margin: 18px 0 0; }
.authalt a { color: var(--accent); text-decoration: none; font-weight: 600; }
.authalt a:hover { text-decoration: underline; }
.account { display: flex; flex-direction: column; gap: 0; margin: 0 0 22px; }
.account > div { display: flex; justify-content: space-between; gap: 12px; padding: 13px 2px; border-bottom: 1px solid var(--line); }
.account dt { color: var(--dim); font-size: .84rem; margin: 0; }
.account dd { margin: 0; font-family: var(--mono); font-size: .92rem; text-align: right; }

/* ---- nav (即時/歷史) ---- */
.nav { display: flex; gap: 4px; background: var(--panel-2); padding: 4px; border-radius: 999px; border: 1px solid var(--line); }
.nav__link {
    text-decoration: none; color: var(--muted); font-size: .84rem; font-weight: 600;
    padding: 5px 16px; border-radius: 999px; transition: all .16s;
}
.nav__link:hover { color: var(--text); }
.nav__link.is-active { color: #fff; background: linear-gradient(180deg, #1b2740, #141d30); box-shadow: inset 0 0 0 1px var(--line-2); }

/* ---- history controls ---- */
.panel__bar--wrap { flex-wrap: wrap; row-gap: 10px; }
.ctrls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.modes { display: flex; gap: 4px; background: var(--panel-2); padding: 4px; border-radius: 10px; border: 1px solid var(--line); }
.modes button {
    font-family: var(--sans); font-size: .82rem; font-weight: 600; color: var(--muted);
    background: transparent; border: 0; border-radius: 7px; padding: 6px 14px; cursor: pointer; transition: all .15s;
}
.modes button:hover { color: var(--text); }
.modes button[aria-selected="true"] { color: #fff; background: var(--line-2); }
.datepick { display: flex; align-items: center; gap: 8px; font-size: .78rem; color: var(--muted); font-family: var(--mono); }
.datepick select {
    font-family: var(--mono); font-size: .82rem; color: var(--text);
    background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 10px; cursor: pointer;
}
.chart--tall { height: min(64vh, 540px); }

/* ---- watchlist ---- */
.adder { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.adder__input {
    flex: 1 1 260px; min-width: 0;
    font-family: var(--mono); font-size: 1rem; color: var(--text);
    background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 12px;
    padding: 13px 16px; transition: border-color .16s, box-shadow .16s;
}
.adder__input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.adder__input::placeholder { color: var(--dim); }
.adder__btn {
    font-family: var(--sans); font-size: .92rem; font-weight: 700; color: #fff;
    background: linear-gradient(180deg, #2a3a5c, #1b2740); border: 1px solid var(--line-2);
    border-radius: 12px; padding: 13px 22px; cursor: pointer; transition: all .16s; white-space: nowrap;
}
.adder__btn:hover { transform: translateY(-1px); box-shadow: 0 8px 20px -10px var(--accent); border-color: var(--accent); }
.adder__msg { font-size: .84rem; font-family: var(--mono); }
.adder__msg.is-ok { color: var(--down); }
.adder__msg.is-err { color: var(--up); }

.panel__title { font-weight: 700; letter-spacing: .03em; font-size: .95rem; }

/* 圖表/列表 切換 */
.view { display: flex; gap: 4px; background: var(--panel-2); padding: 4px; border-radius: 10px; border: 1px solid var(--line); }
.view button { font-family: var(--sans); font-size: .82rem; font-weight: 600; color: var(--muted); background: transparent; border: 0; border-radius: 7px; padding: 6px 14px; cursor: pointer; transition: all .15s; }
.view button:hover { color: var(--text); }
.view button[aria-selected="true"] { color: #fff; background: var(--line-2); }

/* 各階段列表 (沿用 .quotes 表格樣式) */
.stages td.c-name { display: table-cell; text-align: left; }
.stages td.c-name b { font-family: var(--mono); font-size: 1rem; }
#stageWrap { max-height: min(56vh, 460px); overflow-y: auto; }

.tablewrap { overflow-x: auto; }
.quotes { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.quotes thead th {
    text-align: right; font-weight: 600; font-size: .72rem; letter-spacing: .06em; color: var(--dim);
    padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--panel-2);
    position: sticky; top: 0;
}
.quotes th.c-name, .quotes td.c-name { text-align: left; }
.quotes th.c-act { width: 40px; }
.quotes tbody td { padding: 13px 14px; border-bottom: 1px solid var(--line); font-family: var(--mono); text-align: right; white-space: nowrap; }
.quotes td.c-name { font-family: var(--sans); display: flex; flex-direction: column; gap: 2px; }
.quotes td.c-name b { font-family: var(--mono); font-size: 1rem; letter-spacing: .02em; }
.quotes td.c-name span { color: var(--muted); font-size: .8rem; }
.quotes td.c-name span.err { color: var(--up); }
.quotes td.price { font-size: 1.1rem; font-weight: 700; }
.quotes tbody tr { transition: background .15s; }
.quotes tbody tr:hover { background: rgba(76,141,255,.05); }
.quotes .up { color: var(--up); }
.quotes .down { color: var(--down); }
.quotes .flat { color: var(--flat); }
.row-up td.price { color: var(--up); }
.row-down td.price { color: var(--down); }
.row-err td.c-name b { color: var(--muted); }
.rm {
    background: transparent; border: 1px solid var(--line); color: var(--dim);
    width: 26px; height: 26px; border-radius: 8px; cursor: pointer; font-size: .8rem; transition: all .15s;
}
.rm:hover { color: var(--up); border-color: color-mix(in srgb, var(--up) 50%, transparent); background: color-mix(in srgb, var(--up) 10%, transparent); }

.c-name.clickable { cursor: pointer; }
.c-name.clickable:hover b { color: var(--accent); }
.c-name.clickable:hover span { color: var(--text); }

/* ---- K線彈窗 ---- */
.modal[hidden] { display: none; }
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(4,7,12,.72); backdrop-filter: blur(4px); }
.modal__card {
    position: relative; z-index: 1; width: min(880px, 100%);
    background: linear-gradient(180deg, var(--panel), var(--panel-2));
    border: 1px solid var(--line-2); border-radius: 18px;
    box-shadow: 0 30px 80px -20px rgba(0,0,0,.7); overflow: hidden; animation: pop .18s ease;
}
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal__head { display: flex; align-items: flex-start; justify-content: space-between; padding: 18px 20px 12px; }
.modal__id { display: flex; flex-direction: column; gap: 2px; }
.modal__title { margin: 0; font-family: var(--mono); font-size: 1.5rem; font-weight: 700; letter-spacing: .02em; }
.modal__sub { color: var(--muted); font-size: .9rem; }
.modal__x { background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); width: 34px; height: 34px; border-radius: 10px; cursor: pointer; font-size: 1rem; transition: all .15s; }
.modal__x:hover { color: var(--text); border-color: var(--line-2); }
.modal__bar { padding: 0 20px 12px; }
.modal__bar .tf { flex-wrap: wrap; }
.modal__chart { height: min(52vh, 420px); width: 100%; padding: 0 8px 10px; }

@media (max-width: 620px) {
    .hide-sm { display: none; }
}
@media (max-width: 520px) {
    .stats { grid-template-columns: repeat(2, 1fr); }
    .brand-sub { display: none; }
    .topbar { flex-wrap: wrap; gap: 8px; }
}
