/* Bet-Watcher — Tokyo Night Dark + Pastel design */
:root {
    --bg-page:       #1a1b26;
    --bg-card:       #24283b;
    --bg-header:     #1f2335;
    --bg-row-alt:    #1f2231;
    --bg-row-hover:  #2a2e44;
    --bg-deep:       #16161e;
    --border:        #414868;
    --border-light:  #2a2e44;

    --text:          #c0caf5;
    --text-muted:    #9aa5ce;
    --text-dim:      #6b7394;

    --pastel-cyan:   #7dcfff;
    --pastel-mint:   #9ece6a;
    --pastel-peach:  #e0af68;
    --pastel-red:    #f7768e;
    --pastel-lilac:  #bb9af7;
    --pastel-blue:   #a9b1d6;

    --shadow: 0 4px 24px rgba(0,0,0,0.45);
}

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

html, body {
    height: 100%;
    overflow-x: hidden;
}
/* Admin oldal: NINCS browser-szintű scroll, csak a táblázat-container görget */
body.admin-page,
html:has(body.admin-page) { overflow: hidden; height: 100vh; }
body.admin-page { display: flex; flex-direction: column; }
body.admin-page .topbar { flex-shrink: 0; }
body.admin-page .admin-main {
    flex: 1;
    height: auto;   /* a flex számítja a magasságát */
    min-height: 0;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-page);
    color: var(--text);
    font-size: 14px;
    line-height: 1.45;
}

/* ============ Topbar (header + tab-nav sticky) ============ */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg-card);
    box-shadow: 0 2px 10px rgba(0,0,0,0.35);
}

header {
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}
.header-content h1 {
    font-size: 18px;
    font-weight: 600;
    color: var(--pastel-cyan);
}
.subtitle {
    color: var(--text-muted);
    font-size: 12.5px;
    margin-top: 2px;
}
.header-actions { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.stats-badge {
    background: var(--bg-header);
    border: 1px solid var(--border);
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 12.5px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* ============ Tab nav ============ */
.tab-nav {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    display: flex;
    gap: 4px;
}
.tab-btn {
    background: transparent;
    color: var(--text-muted);
    border: none;
    padding: 11px 18px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
    font-family: inherit;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
    color: var(--pastel-cyan);
    border-bottom-color: var(--pastel-cyan);
    font-weight: 600;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ============ Admin oldal layout (watchlist.html) ============ */
.admin-main {
    width: 92%;
    max-width: 2200px;
    margin: 12px auto;
    padding: 0;
    /* Viewport magasságához igazítva, csak a táblázat-frame görget */
    height: calc(100vh - 90px);
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: hidden;
}
.admin-main .card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 0;
    box-shadow: var(--shadow);
    flex-shrink: 0;
}
.admin-main .watchlist-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}
.admin-main .watchlist-card h2 { flex-shrink: 0; }

/* Split: balra a watchlist-tábla, jobbra az API-usage panel.
   Keskeny ablakon (<1400px) a panel a tábla alá ugrik. */
.watchlist-with-panel {
    flex: 1;
    display: flex;
    flex-direction: row;
    gap: 12px;
    min-height: 0;
    overflow: hidden;
}
.watchlist-with-panel .watchlist-scroll { flex: 1; min-width: 0; }
.api-usage-panel {
    width: 320px;
    flex-shrink: 0;
    padding: 12px 14px;
    background: var(--bg-header);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.api-usage-panel h3 {
    margin: 0 0 4px;
    font-size: 13px;
    color: var(--pastel-cyan);
    font-weight: 600;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 6px;
}
.api-source-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 5px;
    padding: 8px 10px;
}
.api-source-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 5px;
}
.api-source-name {
    font-family: 'JetBrains Mono', Menlo, Consolas, monospace;
    font-weight: 700;
    font-size: 12px;
}
.api-yahoo .api-source-name      { color: #bb9af7; }
.api-kraken .api-source-name     { color: #7dcfff; }
.api-twelvedata .api-source-name { color: #e0af68; }
.api-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    font-size: 11px;
}
.api-stats > div { display: flex; flex-direction: column; }
.api-stats b { font-variant-numeric: tabular-nums; color: var(--text); font-size: 12px; }
.api-credit {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed var(--border-light);
}
.api-credit-bar {
    height: 8px;
    background: var(--bg-deep, var(--bg-page));
    border: 1px solid var(--border-light);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 3px;
}
.api-credit-fill {
    height: 100%;
    background: linear-gradient(90deg, #9ece6a, #7dcfff);
    transition: width 0.3s ease;
}
.api-credit-fill.warn { background: linear-gradient(90deg, #e0af68, #ff9e64); }
.api-credit-fill.crit { background: linear-gradient(90deg, #ff9e64, #f7768e); }
.api-credit-label {
    font-size: 10.5px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    text-align: right;
}
/* TwelveData kártya — kiemelt szegély (a fizetős forrás miatt fokozott figyelés) */
.api-source-card.api-twelvedata {
    border-color: rgba(224,175,104,0.4);
    background: linear-gradient(180deg, var(--bg-card), rgba(224,175,104,0.04));
}
.api-sparkline-row {
    display: grid;
    grid-template-columns: 38px 1fr auto;
    align-items: center;
    gap: 6px;
    margin-top: 5px;
    font-size: 10px;
}
.api-sparkline-label, .api-sparkline-max {
    font-variant-numeric: tabular-nums;
}
.api-sparkline-max { color: var(--text-muted); }
.api-sparkline {
    width: 100%;
    height: 24px;
    display: block;
    background: rgba(0,0,0,0.15);
    border: 1px solid var(--border-light);
    border-radius: 3px;
}
.api-uptime {
    text-align: center;
    padding-top: 4px;
    border-top: 1px solid var(--border-light);
    font-size: 10.5px;
}

/* ============ Login page ============ */
body.login-page {
    background: var(--bg-page);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}
.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 28px 24px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.login-card h1 {
    margin: 0 0 4px;
    color: var(--pastel-cyan);
    font-size: 22px;
    text-align: center;
}
.login-card .muted {
    text-align: center;
    margin: 0 0 24px;
    font-size: 13px;
}
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-field { display: flex; flex-direction: column; gap: 4px; }
.login-field label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.login-field input {
    padding: 9px 12px;
    background: var(--bg-header);
    color: var(--text);
    border: 1px solid var(--border-light);
    border-radius: 5px;
    font-family: inherit;
    font-size: 14px;
}
.login-field input:focus {
    outline: none;
    border-color: var(--pastel-cyan);
    box-shadow: 0 0 0 2px rgba(125,207,255,0.15);
}
.login-form .btn {
    margin-top: 6px;
    padding: 10px;
    font-size: 14px;
    font-weight: 600;
}
.login-error {
    min-height: 18px;
    color: var(--pastel-red);
    font-size: 12.5px;
    text-align: center;
}

/* ============ AI features (search / info / similar) ============ */
.ai-btn {
    background: linear-gradient(135deg, rgba(187,154,247,0.18), rgba(125,207,255,0.18));
    border-color: rgba(187,154,247,0.5);
}
.ai-btn:hover {
    background: linear-gradient(135deg, rgba(187,154,247,0.28), rgba(125,207,255,0.28));
}

/* AI search modal input + result-table */
.ai-search-input-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}
.ai-search-input-row input {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-header);
    color: var(--text);
    border: 1px solid var(--border-light);
    border-radius: 5px;
    font-family: inherit;
    font-size: 13px;
}
.ai-search-input-row input:focus {
    outline: none;
    border-color: var(--pastel-cyan);
    box-shadow: 0 0 0 2px rgba(125,207,255,0.15);
}
.ai-results {
    max-height: 60vh;
    overflow: auto;
    border: 1px solid var(--border-light);
    border-radius: 5px;
}
.ai-results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}
.ai-results-table th {
    background: var(--bg-header);
    color: var(--text-muted);
    padding: 6px 10px;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 10.5px;
    letter-spacing: 0.4px;
    position: sticky;
    top: 0;
    z-index: 2;
}
.ai-results-table td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: top;
}
.ai-results-table tr:hover td { background: var(--bg-row-hover); }
.ai-result-sym {
    font-family: 'JetBrains Mono', Menlo, Consolas, monospace;
    color: var(--pastel-cyan);
    font-weight: 600;
}
.ai-reason { max-width: 360px; }

/* Detail-panel AI-gombok (ℹ + 💡) */
.detail-ai-btn {
    background: linear-gradient(135deg, rgba(187,154,247,0.15), rgba(125,207,255,0.15));
    border: 1px solid rgba(187,154,247,0.4);
    color: var(--text);
    padding: 2px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.12s;
}
.detail-ai-btn:hover {
    background: linear-gradient(135deg, rgba(187,154,247,0.3), rgba(125,207,255,0.3));
    border-color: rgba(187,154,247,0.7);
}

/* AI Info modal — szöveges válasz */
.ai-info-content {
    white-space: pre-wrap;
    line-height: 1.5;
    font-size: 13.5px;
    color: var(--text);
    background: var(--bg-header);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    padding: 14px 16px;
}

/* ============ Profile modal ============ */
.profile-section {
    background: var(--bg-header);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    padding: 12px 14px;
    margin-bottom: 12px;
}
.profile-section h4 {
    margin: 0 0 8px;
    color: var(--pastel-cyan);
    font-size: 13px;
    font-weight: 600;
}
.profile-section h5 {
    margin: 8px 0 6px;
    color: var(--text-muted);
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.profile-row { display: flex; gap: 10px; font-size: 12.5px; margin-bottom: 3px; }
.profile-label { color: var(--text-muted); width: 70px; }
.profile-value { color: var(--text); font-family: 'JetBrains Mono', Menlo, Consolas, monospace; }
.profile-form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 6px;
}
.profile-form-row input[type=text], .profile-form-row input[type=password], .profile-form-row input[type=email] {
    flex: 1;
    min-width: 140px;
    padding: 6px 8px;
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border-light);
    border-radius: 5px;
    font-family: inherit;
    font-size: 12.5px;
}
.profile-checkbox { display: flex; align-items: center; gap: 5px; font-size: 12px; cursor: pointer; }
.profile-msg { font-size: 12px; min-height: 18px; margin-top: 4px; }
.profile-msg.ok  { color: var(--pastel-mint); }
.profile-msg.err { color: var(--pastel-red); }
.profile-admin-section { border-color: rgba(187,154,247,0.4); }
.profile-users-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin-bottom: 8px;
}
.profile-users-table th, .profile-users-table td {
    padding: 4px 8px;
    border-bottom: 1px solid var(--border-light);
    text-align: left;
}
.profile-users-table th {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 10.5px;
    letter-spacing: 0.4px;
}

/* Alert-history panel — az api-usage-panel alatt */
.alert-history-row {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 5px;
    padding: 6px 8px;
    margin-bottom: 5px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2px 6px;
    align-items: baseline;
}
.alert-history-head {
    display: flex;
    align-items: center;
    gap: 6px;
    grid-column: 1 / 2;
}
.alert-history-symbol {
    font-family: 'JetBrains Mono', Menlo, Consolas, monospace;
    font-weight: 700;
    font-size: 11.5px;
    color: var(--pastel-cyan);
}
.alert-history-type {
    font-size: 9.5px;
    padding: 1px 6px;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.alert-history-type.type-over  { color: var(--pastel-mint, #9ece6a); background: rgba(158,206,106,0.12); }
.alert-history-type.type-under { color: var(--pastel-peach, #e0af68); background: rgba(224,175,104,0.12); }
.alert-history-type.type-pct   { color: var(--pastel-lilac, #bb9af7); background: rgba(187,154,247,0.12); }
.alert-history-type.type-test  { color: var(--pastel-cyan, #7dcfff); background: rgba(125,207,255,0.12); }
.alert-history-desc {
    grid-column: 1 / 2;
    font-variant-numeric: tabular-nums;
}
.alert-history-ts {
    grid-column: 2 / 3;
    grid-row: 1 / 3;
    align-self: center;
    font-size: 10px;
}
.alert-sent-fail { color: var(--pastel-red, #f7768e); }

/* Alert-gomb a watchlist táblában — mindig 🔔, csak a szín változik
   AKTÍV (alerts_enabled + van config) → élénk sárga (peach)
   INAKTÍV (nincs config vagy ki van kapcsolva) → halvány sárga */
.watchlist-table .btn-alert {
    margin-right: 4px;
}
.watchlist-table .btn-alert.alert-idle {
    background: rgba(224,175,104,0.05);
    border-color: rgba(224,175,104,0.25);
    opacity: 0.45;
}
.watchlist-table .btn-alert.alert-idle:hover { opacity: 0.85; }
.watchlist-table .btn-alert.alert-active {
    background: rgba(224,175,104,0.22);
    border-color: rgba(224,175,104,0.75);
    box-shadow: 0 0 0 1px rgba(224,175,104,0.25);
}

/* Alert modal — push-trigger konfig */
.alert-modal-note { margin-bottom: 12px; }
.alert-modal-toggle {
    padding: 10px;
    background: var(--bg-header);
    border: 1px solid var(--border-light);
    border-radius: 5px;
    margin-bottom: 12px;
}
.alert-toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
}
.alert-toggle-label input[type=checkbox] {
    width: 16px; height: 16px;
    accent-color: var(--pastel-cyan);
    cursor: pointer;
}
.alert-modal-fields {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}
.alert-field { display: flex; flex-direction: column; gap: 3px; }
.alert-field label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.alert-field input {
    padding: 6px 8px;
    background: var(--bg-header);
    color: var(--text);
    border: 1px solid var(--border-light);
    border-radius: 5px;
    font-family: inherit;
    font-size: 13px;
}
.alert-field input:focus {
    outline: none;
    border-color: var(--pastel-cyan);
    box-shadow: 0 0 0 2px rgba(125,207,255,0.15);
}
.alert-modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}
.alert-modal-msg {
    margin-top: 10px;
    font-size: 12.5px;
    min-height: 18px;
}

/* Browse modal — táblázatos szimbólum-lista */
.browse-toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
}
.browse-toolbar input {
    flex: 1;
    padding: 6px 10px;
    background: var(--bg-header);
    color: var(--text);
    border: 1px solid var(--border-light);
    border-radius: 5px;
    font-family: inherit;
    font-size: 13px;
}
.browse-toolbar input:focus {
    outline: none;
    border-color: var(--pastel-cyan);
    box-shadow: 0 0 0 2px rgba(125,207,255,0.15);
}
.browse-table-wrap {
    max-height: 60vh;
    overflow: auto;
    border: 1px solid var(--border-light);
    border-radius: 5px;
}
.browse-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}
.browse-table th {
    background: var(--bg-header);
    color: var(--text-muted);
    padding: 6px 10px;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 10.5px;
    letter-spacing: 0.4px;
    position: sticky;
    top: 0;
    z-index: 2;
    border-bottom: 1px solid var(--border-light);
}
.browse-table td {
    padding: 4px 10px;
    border-bottom: 1px solid var(--border-light);
}
.browse-row { cursor: pointer; }
.browse-row:hover td { background: var(--bg-row-hover); }
.browse-row .browse-sym {
    font-family: 'JetBrains Mono', Menlo, Consolas, monospace;
    color: var(--pastel-cyan);
    font-weight: 600;
}
@media (max-width: 1400px) {
    .watchlist-with-panel { flex-direction: column; }
    .api-usage-panel { width: 100%; }
}

.watchlist-scroll {
    flex: 1;
    overflow: auto;
    min-height: 0;
    border: 1px solid var(--border-light);
    border-radius: 6px;
}
/* Sticky thead a táblázatban (a scroll-container felső szegélyéhez ragad) */
.watchlist-scroll .watchlist-table thead th {
    position: sticky;
    top: 0;
    background: var(--bg-header);
    z-index: 5;
}
.admin-main .card h2 {
    font-size: 15px;
    font-weight: 600;
    color: var(--pastel-cyan);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
}
/* Card-header sor a "Új ticker hozzáadása" cím-hez Back gombbal balra, cím középre */
.admin-main .card .card-header-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
}
.admin-main .card .card-header-row .btn {
    justify-self: start;
    min-width: 120px;
    padding: 7px 18px;
    font-size: 13px;
    line-height: 1.3;
}
.admin-main .card .card-header-row .card-header-left {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-self: start;
}
/* Az inner-gombok ne kapják a justify-self: start-ot (a flex layout-ban szabadon elférnek) */
.admin-main .card .card-header-row .card-header-left .btn {
    justify-self: auto;
}
.admin-main .card .card-header-row h2 {
    justify-self: center;
    margin: 0;
    padding: 0;
    border: none;
    font-size: 15px;
    font-weight: 600;
    color: var(--pastel-cyan);
}
.admin-main .card .card-header-row .card-header-spacer { justify-self: end; }

/* ============ Main split layout: sidebar + detail-panel ============ */
.main-layout {
    display: grid;
    grid-template-columns: 420px minmax(0, 1fr);
    gap: 14px;
    padding: 10px 16px 10px 8px;
    max-width: 2400px;
    margin: 0;
    align-items: stretch;
}

.sidebar {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 70px;
    align-self: start;
    max-height: calc(100vh - 100px);
    display: flex;
    flex-direction: column;
}
.sidebar-header {
    display: flex;
    justify-content: flex-start;
    align-items: baseline;
    gap: 18px;
    margin-bottom: 0;
    padding-left: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
}
.sidebar-header h2 {
    font-size: 14px;
    font-weight: 600;
    color: var(--pastel-cyan);
    margin: 0;
    cursor: pointer;
    transition: color 0.15s;
}
.sidebar-header h2:hover { color: #5cb1e0; }

.detail-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 18px 22px;
    box-shadow: var(--shadow);
    min-height: 0;
    max-height: calc(100vh - 100px);
    height: calc(100vh - 100px);
    display: flex;
    flex-direction: column;
}

.detail-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.detail-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 500px;
    color: var(--text-dim);
    font-size: 15px;
    text-align: center;
}
.detail-empty-icon {
    font-size: 48px;
    opacity: 0.4;
    margin-bottom: 12px;
}

/* Sidebar source-status — egy sorban, "Kra (3) 30s · Yah (16) 1m" formátum.
   Az admin oldali #sourceStatus (flex column) szabályát override-oljuk
   #sourceStatus.source-status-line selector-specifikussággal. */
.source-status-line,
#sourceStatus.source-status-line {
    display: inline-flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: baseline;
    gap: 16px;
    white-space: nowrap;
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1;
    padding: 0;
    margin: 0;
}
.source-status-line span { padding: 0; margin: 0; white-space: nowrap; }
.source-status-line .ok { color: var(--pastel-mint); }
.source-status-line .err { color: var(--pastel-red); }

/* ============ Sidebar compact list ============ */
.quote-list-compact {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    flex: 1;
}

.quote-row-compact {
    display: grid;
    /* drag | info | chart | numbers — numbers 80px (BTC-USD "$63 738,08" 10 char
       épp belefér), chart 100px */
    grid-template-columns: 28px 1fr 100px 80px;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--bg-row-alt);
    border: 1px solid transparent;
    border-left: 3px solid transparent;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}
.quote-row-compact:hover {
    background: var(--bg-row-hover);
}
.quote-row-compact.selected {
    background: linear-gradient(90deg, rgba(125,207,255,0.18) 0%, rgba(125,207,255,0.07) 100%);
    border-color: rgba(125,207,255,0.35);
    border-left: 4px solid var(--pastel-cyan);
    box-shadow: 0 0 0 1px rgba(125,207,255,0.25), 0 2px 8px rgba(125,207,255,0.15);
    padding-left: 9px;   /* kompenzálja a 4 px-es bal-csíkot (eredeti 3 px-rel volt 10 px) */
}
.quote-row-compact.selected .compact-symbol {
    color: var(--pastel-cyan);
    font-weight: 600;
    text-shadow: 0 0 8px rgba(125,207,255,0.4);
}
.quote-row-compact.selected:hover {
    background: linear-gradient(90deg, rgba(125,207,255,0.24) 0%, rgba(125,207,255,0.10) 100%);
}
.quote-row-compact.stale {
    opacity: 0.75;
    background: rgba(224,175,104,0.05);
    border-left-color: rgba(224,175,104,0.55);
}
/* Stale-warning ikon a symbol elé — sárga ⚠ */
.compact-stale-warn {
    display: inline-block;
    color: var(--pastel-peach, #e0af68);
    font-size: 13px;
    margin-right: 4px;
    cursor: help;
}

.compact-drag-handle {
    display: inline-block;
    color: var(--text-dim);
    font-size: 18px;
    line-height: 1;
    text-align: center;
    padding: 4px 6px;
    cursor: grab;
    user-select: none;
    transition: color 0.12s;
    border-radius: 4px;
}
.compact-drag-handle:hover {
    color: var(--pastel-cyan);
    background: var(--bg-deep);
}
.compact-drag-handle:active { cursor: grabbing; }

.compact-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}
.compact-symbol {
    font-weight: 600;
    color: var(--text);
    font-family: 'JetBrains Mono', Menlo, Consolas, monospace;
    font-size: 12.5px;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    min-width: 0;
}
.compact-name {
    font-size: 10.5px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}
/* compact-name + market-cap egy sorban, market-cap jobbra-igazítva, halvány */
.compact-name-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}
.compact-mcap {
    font-family: 'JetBrains Mono', Menlo, Consolas, monospace;
    font-size: 10px;
    color: var(--text-dim);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    flex-shrink: 0;
    cursor: help;
}

.compact-chart {
    height: 30px;
    width: 100%;
    position: relative;
}
.compact-chart canvas {
    width: 100% !important;
    height: 30px !important;
}

.compact-numbers {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}
.compact-price {
    font-family: 'JetBrains Mono', Menlo, Consolas, monospace;
    font-size: 12.5px;
    color: var(--text);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.compact-change {
    font-family: 'JetBrains Mono', Menlo, Consolas, monospace;
    font-size: 10.5px;
    font-variant-numeric: tabular-nums;
    padding: 1px 5px;
    border-radius: 3px;
    white-space: nowrap;
}
.compact-change.up   { color: var(--pastel-mint); background: rgba(158,206,106,0.10); }
.compact-change.down { color: var(--pastel-red);  background: rgba(247,118,142,0.10); }
.compact-change.flat { color: var(--text-dim);    background: transparent; }

/* Price flash a compact-row-ra */
.quote-row-compact.flash-up   { animation: flashUp   0.6s ease; }
.quote-row-compact.flash-down { animation: flashDown 0.6s ease; }

/* ============ Detail panel ============ */
.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 12px;
}
.detail-title { display: flex; flex-direction: column; gap: 4px; flex: 1 1 0; min-width: 0; }
.detail-header .period-tabs {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
    flex: 0 0 auto;
    justify-content: center;
}
.detail-price-block { flex: 1 1 0; text-align: right; min-width: 0; }
.detail-symbol {
    font-family: 'JetBrains Mono', Menlo, Consolas, monospace;
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
}
.detail-name {
    font-size: 14px;
    color: var(--text-muted);
}
.detail-price-block { text-align: right; }
.detail-price {
    font-family: 'JetBrains Mono', Menlo, Consolas, monospace;
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.detail-change {
    font-family: 'JetBrains Mono', Menlo, Consolas, monospace;
    font-size: 15px;
    padding: 4px 11px;
    border-radius: 5px;
    display: inline-block;
    margin-top: 6px;
    font-variant-numeric: tabular-nums;
}
.detail-change.up   { color: var(--pastel-mint); background: rgba(158,206,106,0.15); }
.detail-change.down { color: var(--pastel-red);  background: rgba(247,118,142,0.15); }
.detail-change.flat { color: var(--text-dim);    background: var(--bg-row-alt); }

.detail-chart-container {
    flex: 1;
    min-height: 280px;
    position: relative;
    width: 100%;
    min-width: 0;
}
.detail-price {
    cursor: pointer;
    user-select: none;
    transition: color 0.12s;
}
.detail-price:hover { color: var(--pastel-cyan); }

/* Marker + price: egy sorban, baseline-igazítással, jobbra-rendezve */
.detail-price-row {
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 24px;
}

/* Marker érték (referencia-ár) a price ELŐTT — kattintással beállítható.
   A vízszintes hely a price-tól a .detail-price-row gap-jéből jön (24px). */
.detail-marker {
    font-family: 'JetBrains Mono', Menlo, Consolas, monospace;
    font-size: 18px;
    font-weight: 600;
    color: rgba(220,180,100,0.7);
    cursor: pointer;
    user-select: none;
    transition: color 0.12s;
    font-variant-numeric: tabular-nums;
}
.detail-marker:hover { color: rgba(245,184,0,1); }

/* Marker rejtve állapot — halványabb + áthúzott */
.detail-marker.marker-off {
    color: rgba(220,180,100,0.35);
    text-decoration: line-through;
}
.detail-marker.marker-off:hover { color: rgba(245,184,0,0.7); }

/* Alert-toggle a header-ben (a marker-label-től balra) — egy 🔔/🔕 ikon, kattintható */
.detail-alert-toggle {
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    user-select: none;
    padding: 2px 6px;
    border-radius: 6px;
    border: 1px solid transparent;
    transition: all 0.12s;
    margin-right: -16px;   /* részben fed a 24px gap-be, hogy ne tolja a többit */
}
.detail-alert-toggle.alert-on {
    background: rgba(224,175,104,0.18);
    border-color: rgba(224,175,104,0.6);
}
.detail-alert-toggle.alert-on:hover {
    background: rgba(224,175,104,0.28);
}
.detail-alert-toggle.alert-off {
    opacity: 0.4;
}
.detail-alert-toggle.alert-off:hover {
    opacity: 0.9;
}

/* Debug-tabla — az adott ticker összes tárolt mintája */
.detail-table-container {
    flex: 1;
    min-height: 280px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.detail-table-header {
    padding: 4px 0 10px 0;
    font-size: 12.5px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 8px;
}
.detail-table-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 6px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.detail-table-scroll::-webkit-scrollbar { width: 8px; }
.detail-table-scroll::-webkit-scrollbar-track { background: var(--bg-deep); border-radius: 4px; }
.detail-table-scroll::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--border) 0%, var(--border-light) 100%);
    border-radius: 4px;
}
.detail-table-scroll::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--pastel-cyan) 0%, var(--pastel-blue) 100%);
}
.detail-data-table {
    border-collapse: collapse;
    font-family: 'JetBrains Mono', Menlo, Consolas, monospace;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    line-height: 1.25;
}
.detail-data-table thead {
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 1;
}
.detail-data-table th {
    text-align: left;
    padding: 4px 12px 4px 6px;
    color: var(--pastel-cyan);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.detail-data-table td {
    padding: 2px 12px 2px 6px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
    white-space: nowrap;
}
/* Ár-cella kattintható — visszavált chart-módra */
.detail-data-table td.price-cell {
    cursor: pointer;
}
.detail-data-table td.price-cell:hover {
    color: var(--pastel-cyan);
    text-decoration: underline;
}
/* Per-nap háttérszín — 2 napos blokkok váltakoznak. A border-collapse:collapse
   miatt a tr-szintű background nem mindig renderelődik → td-re alkalmazzuk. */
/* Sötét, kontrasztos napi háttérszínek (Tokyo Night palettán) */
.detail-data-table tr.day-a   > td { background-color: #1a2738; }  /* mély kékes */
.detail-data-table tr.day-b   > td { background-color: #2a1f3c; }  /* mély lila */
.detail-data-table tr.day-sat > td { background-color: #3a2d18; }  /* mély narancs (szombat) */
.detail-data-table tr.day-sun > td { background-color: #3a1f28; }  /* mély vörös (vasárnap) */

/* Napváltás szeparátor — külön sor, középre rendezett gradiens-vonal a
   táblázat ~70%-án, mindkét vége elhalványodva. */
.detail-data-table tr.day-separator > td {
    padding: 0;
    background: transparent !important;
    border: none;
}
.detail-data-table tr.day-separator:hover > td {
    background: transparent !important;
}
.detail-data-table .day-sep-line {
    height: 1px;
    width: 70%;
    margin: 10px auto;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(125,207,255,0.45) 25%,
        rgba(125,207,255,0.45) 75%,
        transparent 100%);
}

.detail-data-table tbody tr:hover > td {
    background-color: var(--bg-row-hover) !important;
}
.detail-data-table .num { text-align: right; }
.detail-data-table .row-idx { color: var(--text-dim); text-align: right; }
.detail-data-table .price-cell { text-align: left; }
.detail-chart-container canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

/* Loading overlay a chart-on (history fetch alatt) */
.chart-loading-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(26, 27, 38, 0.35);
    z-index: 10;
    pointer-events: none;
    backdrop-filter: blur(0.5px);
}
.chart-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(125, 207, 255, 0.18);
    border-top-color: rgba(125, 207, 255, 0.85);
    border-radius: 50%;
    animation: chart-spin 0.7s linear infinite;
}
@keyframes chart-spin { to { transform: rotate(360deg); } }

.detail-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}
.detail-stat {
    background: var(--bg-row-alt);
    padding: 10px 14px;
    border-radius: 6px;
}
.detail-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.detail-stat-value {
    font-family: 'JetBrains Mono', Menlo, Consolas, monospace;
    font-size: 14px;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

/* ============ Quote list — egyetlen-lista mini-chart-tal ============ */
.quote-list-grid { display: flex; flex-direction: column; gap: 6px; }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
}
.card-header h2 { margin: 0; padding: 0; border: none; }
.source-status-line { font-size: 12px; color: var(--text-muted); }
.source-status-line .ok { color: var(--pastel-mint); }
.source-status-line .err { color: var(--pastel-red); }

.quote-row {
    display: grid;
    grid-template-columns: 40px minmax(160px, 1fr) 1fr 120px 90px;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: var(--bg-row-alt);
    border: 1px solid transparent;
    border-radius: 6px;
    transition: background 0.12s, border-color 0.12s;
}
.quote-row:hover {
    background: var(--bg-row-hover);
    border-color: var(--border-light);
}
.quote-row.stale { opacity: 0.7; }

.quote-arrows {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.quote-arrow {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-muted);
    cursor: pointer;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-family: inherit;
    line-height: 1.2;
    transition: all 0.12s;
}
.quote-arrow:hover:not(:disabled) {
    color: var(--pastel-cyan);
    border-color: var(--pastel-cyan);
}
.quote-arrow:disabled { opacity: 0.3; cursor: not-allowed; }

.quote-symbol {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    cursor: pointer;
}
.quote-symbol-line {
    font-weight: 600;
    color: var(--text);
    font-family: 'JetBrains Mono', Menlo, Consolas, monospace;
    font-size: 13.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.quote-name {
    font-size: 11.5px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.quote-mini-chart {
    height: 36px;
    position: relative;
}
.quote-mini-chart canvas {
    width: 100% !important;
    height: 36px !important;
}
.quote-source-tag {
    display: inline-block;
    padding: 1px 6px;
    font-size: 10px;
    border-radius: 3px;
    background: var(--bg-header);
    color: var(--text-dim);
    margin-left: 6px;
    text-transform: uppercase;
}
.quote-source-tag.kraken     { color: var(--pastel-lilac); }
.quote-source-tag.yahoo      { color: var(--pastel-peach); }
.quote-source-tag.twelvedata { color: var(--pastel-cyan); }

.quote-price {
    font-family: 'JetBrains Mono', Menlo, Consolas, monospace;
    font-size: 14.5px;
    color: var(--text);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    text-align: right;
}
.quote-change {
    font-family: 'JetBrains Mono', Menlo, Consolas, monospace;
    font-size: 12.5px;
    padding: 3px 9px;
    border-radius: 4px;
    font-variant-numeric: tabular-nums;
    text-align: center;
    white-space: nowrap;
}
.quote-change.up   { color: var(--pastel-mint); background: rgba(158,206,106,0.10); }
.quote-change.down { color: var(--pastel-red);  background: rgba(247,118,142,0.10); }
.quote-change.flat { color: var(--text-dim);    background: transparent; }

/* Price flash */
.flash-up   { animation: flashUp   0.6s ease; }
.flash-down { animation: flashDown 0.6s ease; }
@keyframes flashUp   { 0% { background: rgba(158,206,106,0.4); } 100% { background: var(--bg-row-alt); } }
@keyframes flashDown { 0% { background: rgba(247,118,142,0.4); } 100% { background: var(--bg-row-alt); } }

/* Empty / loading state */
.quote-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
}

/* ============ Global interval picker (header) ============ */
.global-interval {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px;
    background: var(--bg-header);
    border: 1px solid var(--border);
    border-radius: 6px;
}
.interval-label {
    color: var(--text-muted);
    font-size: 11.5px;
    padding: 0 6px;
}
.interval-btn {
    background: transparent;
    color: var(--text-muted);
    border: none;
    padding: 3px 9px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.12s;
}
.interval-btn:hover { color: var(--text); background: var(--bg-row-hover); }
.interval-btn.active {
    background: var(--pastel-cyan);
    color: var(--bg-page);
}

/* ============ Source status ============ */
#sourceStatus { display: flex; flex-direction: column; gap: 10px; }
.source-row {
    display: grid;
    grid-template-columns: 100px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg-row-alt);
    border-radius: 6px;
    font-size: 13px;
}
.source-row .source-name {
    color: var(--pastel-cyan);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
}
.source-row .source-info {
    font-family: 'JetBrains Mono', Menlo, Consolas, monospace;
    color: var(--text-muted);
    font-size: 12px;
}
.source-row.ok    .source-name { color: var(--pastel-mint); }
.source-row.error .source-name { color: var(--pastel-red); }
.source-status-dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--text-dim);
}
.source-row.ok    .source-status-dot { background: var(--pastel-mint); box-shadow: 0 0 6px var(--pastel-mint); }
.source-row.error .source-status-dot { background: var(--pastel-red);  box-shadow: 0 0 6px var(--pastel-red); }

/* ============ Buttons ============ */
.btn {
    border: 1px solid var(--border);
    background: var(--bg-header);
    color: var(--text);
    padding: 6px 14px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
    display: inline-flex;
    align-items: center;
}
.btn:hover, .btn:focus { text-decoration: none; }
.btn:hover { background: var(--bg-row-hover); border-color: var(--pastel-cyan); }
.btn-sm { padding: 2px 8px; font-size: 11.5px; line-height: 1.3; }
.btn-primary {
    background: var(--pastel-cyan);
    color: var(--bg-page);
    border-color: var(--pastel-cyan);
    font-weight: 600;
}
.btn-primary:hover { background: #5cb1e0; border-color: #5cb1e0; }
.btn-danger {
    background: var(--pastel-red);
    color: var(--bg-page);
    border-color: var(--pastel-red);
    font-weight: 600;
}
.btn-danger:hover { background: #e05670; border-color: #e05670; }
.btn-secondary { /* default */ }
.btn-loading {
    opacity: 0.6;
    cursor: wait;
}

/* ============ Modal ============ */
.modal {
    display: none;
    position: fixed; inset: 0;
    background: rgba(10,10,20,0.7);
    backdrop-filter: blur(2px);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal.active { display: flex; }
.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}
.modal-content-wide { max-width: 900px; }
.modal-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h3 { margin: 0; color: var(--pastel-cyan); font-size: 15px; }
.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}
.modal-close:hover { color: var(--pastel-red); }
.modal-body { padding: 16px 18px; color: var(--text); overflow: auto; }

/* ============ DB Admin modal ============ */
.db-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px 16px;
    padding: 10px 12px;
    background: var(--bg-deep, var(--bg-page));
    border: 1px solid var(--border-light);
    border-radius: 6px;
    margin-bottom: 14px;
}
.db-stat-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; }
.db-stat-label { color: var(--text-muted); }
.db-stat-value { color: var(--pastel-cyan); font-variant-numeric: tabular-nums; font-weight: 600; }
.db-action-section {
    border: 1px solid var(--border-light);
    border-radius: 6px;
    padding: 12px 14px;
    margin-bottom: 10px;
    background: rgba(255,255,255,0.015);
}
.db-action-section h4 { margin: 0 0 4px; color: var(--pastel-cyan); font-size: 13.5px; font-weight: 600; }
.db-action-desc { color: var(--text-muted); font-size: 11.5px; margin-bottom: 10px; }
.db-action-desc.warning { color: var(--pastel-yellow, #e0af68); }
.db-action-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.db-selected-file { font-size: 11.5px; color: var(--text-muted); font-family: "JetBrains Mono", Consolas, monospace; }
.db-action-section.db-danger { border-color: rgba(247,118,142,0.35); }
.db-message { margin-top: 10px; font-size: 12.5px; min-height: 18px; }

.period-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 8px;
}
.period-tab {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-light);
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 12.5px;
    transition: all 0.15s;
}
.period-tab:hover { color: var(--text); border-color: var(--pastel-cyan); }
.period-tab.active {
    background: var(--pastel-cyan);
    color: var(--bg-page);
    border-color: var(--pastel-cyan);
    font-weight: 600;
}

.chart-container { height: 420px; position: relative; }

/* ============ Watchlist admin ============ */
.watchlist-table { width: 100%; max-width: 1500px; border-collapse: collapse; font-size: 13px; table-layout: auto; }
.watchlist-table th {
    background: var(--bg-header);
    color: var(--text-muted);
    padding: 6px 8px;
    text-align: left;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.watchlist-table td {
    padding: 3px 8px;
    border-bottom: 1px solid var(--border-light);
}
.watchlist-table tr:hover td { background: var(--bg-row-hover); }

/* Oszlop-szélességek szűkítve — Név a maradékot kapja */
.watchlist-table .col-idx      { width: 32px; text-align: right; }
.watchlist-table .col-symbol   { width: 110px; white-space: nowrap; }
.watchlist-table .col-hist     { width: 100px; white-space: nowrap; }
.watchlist-table .col-market   { width: 60px; }
.watchlist-table .col-source   { width: 90px; }
.watchlist-table .col-currency { width: 60px; }
.watchlist-table .col-added    { width: 95px; white-space: nowrap; }
.watchlist-table .col-total    { width: 80px; }
.watchlist-table .col-today    { width: 60px; }
.watchlist-table .col-latest   { width: 130px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.watchlist-table .col-latest.latest-stale { opacity: 0.4; }
.watchlist-table .col-actions  { width: 1%; white-space: nowrap; text-align: right; }

/* Hist gomb (külön oszlopban) — 80px fix szélesség */
.watchlist-table .btn-hist { min-width: 80px; }

/* Drag-handle az admin tábla sorain */
.drag-handle-cell {
    width: 32px;
    text-align: center;
    padding: 0 !important;
}
.drag-handle {
    display: inline-block;
    color: var(--text-dim);
    font-size: 20px;
    line-height: 1;
    padding: 8px 10px;
    cursor: grab;
    user-select: none;
    transition: color 0.12s;
}
.drag-handle:hover { color: var(--pastel-cyan); }
.drag-handle:active { cursor: grabbing; }

/* SortableJS — drag-állapotok */
.sortable-ghost {
    opacity: 0.35;
    background: var(--bg-row-alt) !important;
}
.sortable-ghost td { background: var(--bg-row-alt) !important; }

.sortable-chosen {
    background: var(--bg-row-hover) !important;
}

.sortable-drag {
    background: var(--bg-card) !important;
    box-shadow: 0 8px 24px rgba(0,0,0,0.6) !important;
    opacity: 1 !important;
}
.sortable-drag td { background: var(--bg-card) !important; }

/* ============ Autocomplete dropdown ============ */
.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.5);
    max-height: 320px;
    overflow-y: auto;
    z-index: 100;
    margin-top: 4px;
}
.search-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.12s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--bg-row-hover); }
.search-item-main { flex: 1; min-width: 0; overflow: hidden; }
.search-item-symbol {
    font-family: 'JetBrains Mono', Menlo, Consolas, monospace;
    color: var(--pastel-cyan);
    font-size: 13px;
    font-weight: 600;
}
.search-item-name {
    color: var(--text);
    font-size: 12px;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.search-item-meta {
    color: var(--text-muted);
    font-size: 11px;
    margin-top: 1px;
}
.search-item-source {
    flex-shrink: 0;
    font-family: 'JetBrains Mono', Menlo, Consolas, monospace;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.search-item-source.src-yahoo      { color: #bb9af7; background: rgba(187,154,247,0.15); border: 1px solid rgba(187,154,247,0.4); }
.search-item-source.src-kraken     { color: #7dcfff; background: rgba(125,207,255,0.15); border: 1px solid rgba(125,207,255,0.4); }
.search-item-source.src-twelvedata { color: #e0af68; background: rgba(224,175,104,0.15); border: 1px solid rgba(224,175,104,0.4); }
.search-empty {
    padding: 16px;
    text-align: center;
    color: var(--text-dim);
    font-style: italic;
    font-size: 12px;
}

/* Toast-üzenet (fixen a képernyő jobb-alsó sarkában) */
#formMessage {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--pastel-cyan);
    padding: 12px 18px;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    z-index: 200;
    max-width: 360px;
    font-size: 13px;
    color: var(--text);
    text-align: left;
    font-style: normal;
    animation: toastSlideIn 0.25s ease-out;
}
@keyframes toastSlideIn {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* Verify status indicator */
.verify-status {
    margin-top: 8px;
    padding: 10px 14px;
    border-radius: 5px;
    font-size: 13px;
    font-family: 'JetBrains Mono', Menlo, Consolas, monospace;
    display: none;
    font-weight: 500;
}
.verify-status.checking {
    display: block;
    background: rgba(125,207,255,0.10);
    color: var(--pastel-cyan);
    border-left: 3px solid var(--pastel-cyan);
    animation: pulseCheck 1.2s ease-in-out infinite;
}
@keyframes pulseCheck {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.55; }
}
.verify-status.valid {
    display: block;
    background: rgba(158,206,106,0.10);
    color: var(--pastel-mint);
    border-left: 3px solid var(--pastel-mint);
}
.verify-status.invalid {
    display: block;
    background: rgba(247,118,142,0.10);
    color: var(--pastel-red);
    border-left: 3px solid var(--pastel-red);
}
.watchlist-table .num, .watchlist-table td.num {
    font-family: 'JetBrains Mono', Menlo, Consolas, monospace;
    font-variant-numeric: tabular-nums;
}

/* Sor 1 — szűrők (Forrás · Piac · Pénznem) + Böngészés gomb
   Pénznem keskeny (0.6fr); Yahoo-mód bekapcsolva extra "Téma" oszlop nyílik. */
.filter-row {
    display: grid;
    grid-template-columns: 1fr 1fr 0.6fr auto;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px dashed var(--border-light);
    align-items: end;
}
.filter-row.has-yahoo-topic {
    /* Forrás · Piac · Yahoo téma · Pénznem · gomb */
    grid-template-columns: 1fr 1fr 1.4fr 0.6fr auto;
}
.filter-browse-wrap { display: flex; flex-direction: column; align-items: stretch; }
.filter-browse-wrap .btn { padding: 6px 14px; white-space: nowrap; }
.filter-row > div { min-width: 0; }
.filter-row label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 3px;
}
.filter-row select {
    width: 100%;
    min-width: 0;
    padding: 6px 8px;
    background: var(--bg-header);
    color: var(--text);
    border: 1px solid var(--border-light);
    border-radius: 5px;
    font-family: inherit;
    font-size: 13px;
}
.filter-row select:focus {
    outline: none;
    border-color: var(--pastel-cyan);
    box-shadow: 0 0 0 2px rgba(125,207,255,0.15);
}

/* Sor 2 — kiválasztott találat adatai (szerkeszthető) */
.form-row {
    display: grid;
    /* Default: 5 oszlop (Symbol · Név · Forrás · Pénznem · Hozzáad) */
    grid-template-columns: 1fr 2fr 1fr 1fr auto;
    gap: 10px;
    margin-bottom: 16px;
    align-items: end;
}
/* TD-mode: a MIC-cella 4. oszlopként beékelődik → 6 oszlop */
.form-row.has-mic {
    grid-template-columns: 1fr 2fr 1fr 1fr 1fr auto;
}
.form-row label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 3px;
}
.form-row > div { min-width: 0; }   /* megakadályozza a grid-cell auto-tágulását */
.form-row input, .form-row select {
    width: 100%;
    min-width: 0;
    padding: 6px 8px;
    background: var(--bg-header);
    color: var(--text);
    border: 1px solid var(--border-light);
    border-radius: 5px;
    font-family: inherit;
    font-size: 13px;
}
.form-row input:focus, .form-row select:focus {
    outline: none;
    border-color: var(--pastel-cyan);
    box-shadow: 0 0 0 2px rgba(125,207,255,0.15);
}
.form-row select option { background: var(--bg-card); color: var(--text); }

/* ============ Responsive ============ */
@media (max-width: 1100px) {
    .main-layout {
        grid-template-columns: 320px 1fr;
        padding: 12px;
    }
}
@media (max-width: 900px) {
    .main-layout {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: static;
        max-height: 400px;
    }
    .market-cols { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr 1fr; }
    main { padding: 12px; }
}
@media (max-width: 600px) {
    .form-row { grid-template-columns: 1fr; }
    .detail-chart-container { height: 320px; }
}

/* ============ Scrollbars (modern) ============ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--pastel-blue); }
