/* ============================================================
   FTF Dashboard — Monochrome Command Center v4
   Goals: full-viewport fit (no scroll), percentage-based rows,
   monochrome grays except status indicators and signal colors.
   ============================================================ */

:root {
    /* Surfaces - monochrome dark */
    --bg:           var(--bg-app);
    --panel:        var(--bg-panel);
    --panel-soft:   var(--bg-elevated);
    --panel-hover:  var(--border);
    --border-soft:  var(--border);

    /* Text - neutral grays */
    --text:         var(--text-primary);
    --muted:        var(--text-muted);
    --muted-soft:   var(--text-disabled);

    /* Accents - kept only for indicators, deltas, and signal lines */
    --accent-soft:  var(--accent-muted);
    --accent-light: var(--info-strong);
    --accent-light-soft: rgba(125, 211, 252, 0.14);
    --accent-green: var(--success);
    --accent-green-soft: rgba(16, 185, 129, 0.12);
    --danger-soft:  rgba(239, 68, 68, 0.12);
    --warning-soft: rgba(245, 158, 11, 0.12);

    /* Effects */
    --radius:       10px;
    --radius-sm:    6px;
    --shadow-card:  0 4px 16px var(--shadow);

    --font-sans:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono:    'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* --- Reset --- */
* { box-sizing: border-box; }
html, body {
    margin: 0; padding: 0;
    height: 100%;
    overflow: hidden;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 13px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.005em;
    display: flex;
    flex-direction: column;
}

/* --- Top bar (7vh) --- */
.ftf-topbar {
    flex: 0 0 8vh;
    min-height: 50px;
    max-height: 80px;
    display: grid;
    grid-template-columns: minmax(220px, auto) 1fr minmax(220px, auto);
    align-items: center;
    gap: 20px;
    padding: 0 18px;
    background: var(--bg);
    border-bottom: 1px solid var(--border-soft);
}
.ftf-brand {
    display: flex; align-items: center; gap: 12px;
    min-width: 0;
    height: 100%;
    padding: 8px 0;
}
.ftf-logo-img {
    height: 100%;
    max-height: 40px;
    width: auto;
    display: block;
    flex-shrink: 0;
    border-radius: 0px;
}
.ftf-brand-text { line-height: 1.2; min-width: 0; }
.ftf-brand-text p {
    margin: 0;
    font-size: 12px;
    color: var(--muted);
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Search --- */
.ftf-search {
    position: relative;
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
}
.ftf-search-input {
    width: 100%;
    padding: 7px 64px 7px 34px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 12.5px;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
    outline: none;
    height: 34px;
}
.ftf-search-input::placeholder { color: var(--muted-soft); }
.ftf-search-input:focus {
    border-color: var(--muted);
    background: var(--panel-soft);
    box-shadow: 0 0 0 3px var(--surface-tint-05);
}
.ftf-search-icon {
    position: absolute; left: 11px; top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
}
.ftf-search-go {
    position: absolute; right: 4px; top: 50%;
    transform: translateY(-50%);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 5px 11px;
    color: var(--text);
    background: var(--panel-hover);
    border: 1px solid var(--border);
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.05s;
}
.ftf-search-go:hover {
    background: var(--text);
    color: var(--bg);
    border-color: var(--text);
}
.ftf-search-go:active { transform: translateY(-50%) scale(0.95); }

/* --- Header right meta --- */
.ftf-header-meta {
    display: flex; align-items: center; gap: 10px;
    justify-content: flex-end;
}
.ftf-status-pill {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 9px;
    background: var(--accent-green-soft);
    color: var(--accent-green);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 999px;
    font-size: 10.5px; font-weight: 500;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.ftf-timestamp {
    font-size: 10.5px; color: var(--muted);
    font-family: var(--font-mono);
    white-space: nowrap;
}

/* --- Body shell — fills remaining 90vh, percentage rows --- */
.ftf-shell {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    /* 4 visible rows: kpi (20), middle (35), modules row 1 (20), modules row 2 (15) */
    grid-template-rows: 14fr 57fr 25fr;
    gap: 8px;
    padding: 0 12px 12px;
}

/* --- Section title (compact, near-invisible) --- */
.ftf-section-title {
    display: flex; align-items: center; justify-content: space-between;
    margin: 0 0 4px;
    font-size: 9.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted-soft);
}
.ftf-section-title .meta {
    font-weight: 400; color: var(--muted-soft);
    text-transform: none; letter-spacing: normal;
    font-size: 10px;
}

/* --- KPI row (Signal Highlights) --- */
.ftf-kpi-row {
    display: flex; flex-direction: column;
    min-height: 0;
}
.ftf-kpi-grid {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    min-height: 0;
}
.ftf-kpi {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 12px;
    position: relative;
    overflow: hidden;
    transition: border-color 0.15s;
    display: flex; flex-direction: column;
    justify-content: space-between;
    min-height: 0;
}
.ftf-kpi:hover { border-color: var(--muted-soft); }
.ftf-kpi-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 2px;
}
.ftf-kpi-label {
    font-size: 10.5px; color: var(--muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.ftf-kpi-icon {
    width: 22px; height: 22px;
    display: grid; place-items: center;
    border-radius: 5px;
    background: var(--accent-light-soft);
    color: var(--accent-light);
}
.ftf-kpi-value {
    font-size: 20px; font-weight: 300;
    color: var(--text-strong);
    letter-spacing: -0.02em;
    line-height: 1;
    margin-bottom: 2px;
}
.ftf-kpi-meta {
    font-size: 11px; color: var(--muted);
}
.ftf-kpi-delta {
    align-self: flex-start;
    display: inline-flex; align-items: center; gap: 3px;
    margin-top: 3px;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px; font-weight: 600;
    font-family: var(--font-mono);
}
.ftf-kpi-delta.up   { background: var(--accent-green-soft); color: var(--accent-green); }
.ftf-kpi-delta.down { background: var(--danger-soft);       color: var(--danger); }
.ftf-kpi-delta.flat { background: var(--panel-hover);       color: var(--muted); }

/* --- Middle row (placeholder, no label) --- */
.ftf-middle-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    min-height: 0;
}
.ftf-middle-right {
    display: grid;
    grid-template-rows: 1fr 1fr;
    gap: 8px;
    min-height: 0;
}
.ftf-placeholder {
    background: var(--panel);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    color: var(--muted-soft);
    font-size: 11px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    min-height: 0;
    transition: border-color 0.15s;
}
.ftf-placeholder:hover { border-color: var(--muted-soft); }

/* --- Modules rows --- */
.ftf-modules-row {
    display: flex; flex-direction: column;
    min-height: 0;
}
.ftf-module-grid {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    min-height: 0;
}
.ftf-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    overflow: hidden;
    transition: border-color 0.15s;
    display: flex; flex-direction: column;
    min-height: 0;
}
.ftf-card:hover { border-color: var(--muted-soft); }
.ftf-card-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 6px;
    flex-shrink: 0;
}
.ftf-card-title {
    display: flex; align-items: center; gap: 8px;
    font-size: 12px; font-weight: 600;
    color: var(--text-strong);
    letter-spacing: -0.01em;
}
.ftf-card-title .icon {
    width: 20px; height: 20px;
    display: grid; place-items: center;
    border-radius: 4px;
    background: var(--accent-light-soft);
    color: var(--accent-light);
}
.ftf-card-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: flex; flex-direction: column;
}

/* --- Status badges --- */
.ftf-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 9.5px; font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.ftf-badge.active   { background: var(--accent-green-soft); color: var(--accent-green); border: 1px solid rgba(16,185,129,0.2); }
.ftf-badge.testing  { background: var(--warning-soft);      color: var(--warning);      border: 1px solid rgba(245,158,11,0.2); }
.ftf-badge.soon     { background: var(--panel-hover);       color: var(--muted);        border: 1px solid var(--border); }
.ftf-badge.beta     { background: var(--panel-hover);       color: var(--text);         border: 1px solid var(--border); }

/* --- Card content --- */
.ftf-card-data {
    background: var(--bg-deep);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    font-size: 11.5px;
    color: var(--text);
    line-height: 1.55;
    font-family: var(--font-mono);
    overflow: auto;
}
.ftf-card-empty {
    flex: 1 1 auto;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    color: var(--muted);
    text-align: center;
    min-height: 0;
}
.ftf-card-empty .icon {
    width: 28px; height: 28px;
    display: grid; place-items: center;
    border-radius: 6px;
    background: var(--panel-hover);
    color: var(--muted);
    margin-bottom: 6px;
}
.ftf-card-empty h4 {
    margin: 0 0 2px;
    font-size: 11.5px; font-weight: 600; color: var(--text);
}
.ftf-card-empty p { margin: 0; font-size: 10.5px; }

/* --- Health card list --- */
.ftf-health-list { list-style: none; padding: 0; margin: 0; flex: 1 1 auto; overflow: auto; }
.ftf-health-list li {
    display: flex; align-items: center; justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid var(--border-soft);
    font-size: 11.5px;
}
.ftf-health-list li:last-child { border-bottom: 0; }
.ftf-health-list .label { color: var(--text); display: flex; align-items: center; gap: 7px; }
/*

/* --- Followers card body --- */
#followers-data {
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 10.5px;
    line-height: 1.5;
    margin-bottom: 4px;
    flex-shrink: 0;
}
#master-tickers-data {
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.55;
}
.ftf-chart-wrap {
    flex: 1 1 auto;
    min-height: 0;
    position: relative;
}
#followers-chart { width: 100% !important; height: 100% !important; }

/* --- Responsive — only at very small widths re-enable scrolling --- */
@media (max-width: 1280px) {
    html, body { overflow: auto; height: auto; }
    .ftf-shell { grid-template-rows: auto auto auto auto; height: auto; }
  .ftf-ticker-chart-wrap { min-height: 600px !important; height: auto !important; }
  #ftf-dash-chart { min-height: 600px; }
  .ftf-ticker-panel { height: auto; }
    .ftf-kpi-grid    { grid-template-columns: repeat(2, 1fr); }
    .ftf-module-grid { grid-template-columns: repeat(2, 1fr); }
    .ftf-middle-row  { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
    .ftf-topbar      { grid-template-columns: 1fr auto; padding: 8px 12px; row-gap: 8px; height: auto; flex: 0 0 auto; }
    .ftf-search      { grid-column: 1 / -1; max-width: none; }
    .ftf-kpi-grid    { grid-template-columns: 1fr 1fr; }
    .ftf-module-grid { grid-template-columns: 1fr; }
}


/* ============================================================
   Ticker Intelligence Panel (center / Panel A)
   ============================================================ */
.ftf-ticker-panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    display: flex; flex-direction: column;
    gap: 14px;
    min-height: 0;
    overflow: hidden;
    transition: border-color 0.15s;
}
.ftf-ticker-panel:hover { border-color: var(--muted-soft); }

/* --- Top row: ticker meta + KPIs --- */
.ftf-ticker-head {
    display: grid;
    grid-template-columns: minmax(140px, max-content) minmax(150px, max-content) 1fr;
    align-items: center;
    gap: 24px;
    flex-shrink: 0;
}
.ftf-ticker-id {
    display: grid;
    grid-template-columns: max-content max-content;
    column-gap: 8px;
    row-gap: 2px;
    align-items: center;
    min-width: 0;
}
.ftf-ticker-id .ftf-ticker-company { grid-column: 1 / -1; }
.ftf-ticker-symbol {
    font-size: 26px;
    font-weight: 300;
    color: var(--text-strong);
    letter-spacing: -0.025em;
    line-height: 1;
}
.ftf-ticker-company {
    font-size: 11.5px;
    color: var(--muted);
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Price block (right side) */
.ftf-ticker-price-wrap {
    display: flex; align-items: baseline; gap: 10px;
    flex-shrink: 0;
}
.ftf-ticker-price {
    font-family: var(--font-sans);
    font-size: 28px; font-weight: 300;
    color: var(--text-strong);
    letter-spacing: -0.02em;
    line-height: 1;
}
.ftf-ticker-change {
    font-family: var(--font-mono);
    font-size: 12px; font-weight: 600;
    padding: 3px 8px;
    border-radius: 5px;
}
.ftf-ticker-change.up   { background: var(--accent-green-soft); color: var(--accent-green); }
.ftf-ticker-change.down { background: var(--danger-soft);       color: var(--danger); }

/* --- Stat strip below header --- */
.ftf-ticker-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    flex-shrink: 0;
}
.ftf-stat {
    background: var(--bg-deep);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
}
.ftf-stat-label {
    font-size: 9.5px;
    color: var(--muted-soft);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 2px;
}
.ftf-stat-value {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text);
    font-weight: 500;
}

/* Sentiment badge (lives inside the .ftf-stat for sentiment) */
.ftf-sentiment-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: var(--font-sans);
    font-size: 11px; font-weight: 600;
    letter-spacing: 0.02em;
}
.ftf-sentiment-badge.bullish  { background: var(--accent-green-soft); color: var(--accent-green); }
.ftf-sentiment-badge.neutral  { background: var(--panel-hover);       color: var(--muted); }
.ftf-sentiment-badge.bearish  { background: var(--danger-soft);       color: var(--danger); }

/* --- Chart area (fills remaining vertical space) --- */
.ftf-ticker-chart-wrap {
    flex: 1 1 auto;
    min-height: 0;
    position: relative;
    background: var(--bg-deep);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    padding: 8px;
}
#ftf-dash-chart { width: 100% !important; height: 100% !important; }

/* Loading state */
.ftf-ticker-panel.is-loading .ftf-ticker-symbol,
.ftf-ticker-panel.is-loading .ftf-ticker-price { opacity: 0.5; }
.ftf-ticker-empty {
    display: flex; align-items: center; justify-content: center;
    height: 100%;
    color: var(--muted-soft);
    font-size: 12px;
}

/* ============================================================
   Panel A — chart-on-top layout v22
   Changes from v21:
   - Panel background = body bg (black) so the chart sits on black,
     and the thin border defines the box.
   - Single bottom row: symbol + company + price + change + stats
     all on one horizontal line. Stats are absolute-positioned to
     the right side of the bottom strip.
   - Ticker symbol weight 600 -> 300 (matches the slim price).
   ============================================================ */
.ftf-ticker-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--bg);                /* black, matches body */
    border: 1px solid var(--border);
    height: 100%;
    min-height: 0;
}

/* Chart fills the remaining space above the bottom strip */
.ftf-ticker-chart-wrap {
    order: 1;
    flex: 1 1 auto;
    min-height: 0;
    position: relative;
    background: transparent;              /* shows panel's black */
    padding: 0;
    overflow: hidden;
}
/* #ticker-chart absolute-fill removed: that id is now used only by Stock Filter (needs in-flow height); dashboard chart uses #ftf-dash-chart. */

/* Crosshair tooltip */
.ftf-chart-tooltip {
    position: absolute;
    z-index: 4;
    pointer-events: none;
    padding: 8px 11px;
    background: var(--surface-overlay-strong);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text);
    line-height: 1.45;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.12s ease;
}
.ftf-chart-tooltip.is-visible { opacity: 1; }
.ftf-chart-tooltip .row { display: flex; align-items: center; justify-content: space-between;
    gap: 4px; gap: 14px; }
.ftf-chart-tooltip .label { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; }
.ftf-chart-tooltip .val { color: var(--text-strong); }
.ftf-chart-tooltip .val.up   { color: var(--accent-green); }
.ftf-chart-tooltip .val.down { color: var(--danger); }
.ftf-chart-tooltip .date { font-size: 10px; color: var(--muted); margin-bottom: 4px; letter-spacing: 0.04em; }

/* Bottom strip: head row holds symbol + company + price + change.
   Stats overlay on the right via absolute positioning. */
.ftf-ticker-head {
    order: 2;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 14px 320px 14px 18px;        /* right padding reserves room for stats overlay */
    background: var(--bg);
    border-top: 1px solid var(--border);
    margin: 0;
    min-height: 60px;
}

.ftf-ticker-id {
    display: flex; flex-direction: column; gap: 1px;
    border: 0; padding: 0;
    flex: 0 0 auto;
}
.ftf-ticker-symbol {
    font-size: 22px;
    font-weight: 300;                      /* slim & airy */
    letter-spacing: -0.015em;
    color: var(--text-strong);
    line-height: 1.05;
}
.ftf-ticker-company {
    font-size: 11px;
    color: var(--muted);
    letter-spacing: 0.01em;
}

.ftf-ticker-price-wrap {
    display: flex; align-items: baseline; gap: 10px;
    flex: 0 0 auto;
    padding: 0; margin: 0;
}
.ftf-ticker-price {
    font-family: var(--font-mono);
    font-size: 22px;
    font-weight: 300;
    letter-spacing: -0.01em;
    color: var(--text-strong);
    line-height: 1;
}
.ftf-ticker-change {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 7px;
    border-radius: 5px;
}
.ftf-ticker-change.up   { color: var(--accent-green); background: var(--accent-green-soft); border: 1px solid rgba(16,185,129,0.2); }
.ftf-ticker-change.down { color: var(--danger);       background: var(--danger-soft);       border: 1px solid rgba(239,68,68,0.2); }
.ftf-ticker-change.flat { color: var(--muted);        background: var(--panel-hover);       border: 1px solid var(--border); }

/* Stats — overlay on right side of the bottom strip, same row as head */
.ftf-ticker-stats {
    position: absolute;
    right: 18px;
    bottom: 0;
    height: auto;
    /* match the head row vertical center */
    top: auto;
    transform: translateY(0);
    display: flex;
    align-items: center;
    gap: 26px;
    padding: 14px 0;
    background: transparent;
    border: 0;
    margin: 0;
    min-height: 60px;
}
.ftf-stat {
    display: flex; flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    background: transparent !important;
    border: 0 !important;
    padding: 0 !important;
    min-width: 0;
}
.ftf-stat-label {
    font-size: 9.5px;
    font-weight: 600;
    color: var(--muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.ftf-stat-value {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-strong);
    font-weight: 500;
}

/* Sentiment badge */
.ftf-sentiment-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: -0.005em;
    font-family: var(--font-mono);
}
.ftf-sentiment-badge.bullish  { color: var(--accent-green); background: var(--accent-green-soft); border: 1px solid rgba(16,185,129,0.2); }
.ftf-sentiment-badge.neutral  { color: var(--muted);        background: var(--panel-hover);       border: 1px solid var(--border); }
.ftf-sentiment-badge.bearish  { color: var(--danger);       background: var(--danger-soft);       border: 1px solid rgba(239,68,68,0.2); }

/* Responsive: at narrower widths stats wrap below head instead of overlaying */
@media (max-width: 1100px) {
    .ftf-ticker-head  { padding-right: 18px; }
    .ftf-ticker-stats {
        position: static;
        bottom: auto; right: auto;
        padding: 4px 18px 14px;
        min-height: 0;
        order: 3;
    }
}

/* ============================================================
   v23 — Header & section-label tightening
   - Logo 25% smaller (40px tall -> 30px tall, width auto)
   - Brand container bottom padding -25%
   - Section-title (Signal Highlights / Modules) vertical pad -40%
   - Tagline becomes 2 lines via <br> in markup; tighten line-height
   ============================================================ */
.ftf-brand {
    padding-top: 8px;
    padding-bottom: 6px;            /* was 8px, -25% */
    gap: 10px;                       /* tighter logo-to-text gap */
}
.ftf-logo-img {
    height: 30px !important;        /* was 40px, -25% */
    width: auto !important;
}
.ftf-brand-text {
    line-height: 1.15;               /* tightens the 2-line tagline */
}
.ftf-brand-text p {
    margin: 0;
    line-height: 1.15;
    font-size: 11px;                 /* slightly more compact */
}

/* Section labels: compress vertical footprint ~40% */
.ftf-section-title {
    margin: 0 0 2px !important;     /* was 0 0 4px */
    line-height: 1 !important;       /* was 1.45 -> reduces total height ~35% */
}

/* ============================================================
   v25 — Bottom strip with 8 stats: 2-column grid in the bottom
   row so head and stats don\u0027t overlap. Chart spans both cols.
   ============================================================ */
.ftf-ticker-panel {
    display: grid !important;
    grid-template-rows: 1fr auto;
    grid-template-columns: auto 1fr;
}
.ftf-ticker-chart-wrap {
    grid-row: 1;
    grid-column: 1 / -1;       /* span both columns */
    flex: none;
}
.ftf-ticker-head {
    grid-row: 2;
    grid-column: 1;
    /* Reset the v22 right-padding-reservation */
    padding: 14px 18px 14px 18px !important;
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: nowrap;
    min-height: 0;
    position: static;
    border-top: 1px solid var(--border);
}
.ftf-ticker-stats {
    grid-row: 2;
    grid-column: 2;
    /* Reset v22 absolute positioning */
    position: static !important;
    right: auto !important;
    bottom: auto !important;
    top: auto !important;
    transform: none !important;
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: flex-end;     /* push to right edge */
    gap: 18px;
    padding: 14px 18px 14px 0;
    background: transparent;
    border-top: 1px solid var(--border);
    margin: 0;
    min-height: 0;
    flex-wrap: nowrap;
    overflow: hidden;              /* let it clip rather than stretch panel */
}
.ftf-stat {
    display: flex; flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    background: transparent !important;
    border: 0 !important;
    padding: 0 !important;
    min-width: 0;
    white-space: nowrap;
}
.ftf-stat-label {
    font-size: 9px;
    font-weight: 600;
    color: var(--muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1;
}
.ftf-stat-value {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-strong);
    font-weight: 500;
    line-height: 1.1;
}

/* At narrower widths the row wraps: stats drop to their own row below head */
@media (max-width: 1100px) {
    .ftf-ticker-panel {
        grid-template-rows: 1fr auto auto;
        grid-template-columns: 1fr;
    }
    .ftf-ticker-head {
        grid-row: 2;
        grid-column: 1;
        padding-bottom: 6px !important;
    }
    .ftf-ticker-stats {
        grid-row: 3;
        grid-column: 1;
        justify-content: space-between;
        padding: 0 18px 12px 18px;
        flex-wrap: wrap;
        gap: 16px;
        border-top: 0;
    }
}


/* === Appended from index.php === */


      /* Freshness badge: "Market data: YYYY-MM-DD" — Task 4 */
      .ftf-freshness-badge {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        margin-left: 12px;
        padding: 4px 10px;
        background: var(--surface-glass-soft);
        border: 1px solid var(--surface-tint-08);
        border-radius: 4px;
        font-family: ui-monospace, Menlo, monospace;
        font-size: 10px;
        letter-spacing: 0.04em;
        color: var(--text-alpha-55);
        white-space: nowrap;
      }
      .ftf-freshness-badge::before {
        content: "";
        display: inline-block;
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: var(--info-strong);  /* cyan = fresh */
      }
      .ftf-freshness-badge.is-stale::before { background: var(--warning); }  /* amber */
      .ftf-freshness-badge.is-missing::before { background: var(--text-muted-strong); } /* gray */
      .ftf-freshness-badge.is-missing { color: var(--text-alpha-35); }
      #ftf-freshness-date { color: var(--text-alpha-78); }
      
      /* Stock Filter button paired with search (Step 12 layout fix) */
      .ftf-search-group {
        display: flex;
        align-items: center;
        gap: 12px;
        min-width: 0;
      }
      .ftf-search-group .ftf-search {
        flex: 1 1 auto;
        min-width: 0;
      }
      .ftf-header-action {
        flex: 0 0 auto;
      }
      /* Stock Filter button in header (added in Step 12) */
      .ftf-header-action {
        display: inline-flex;
        align-items: center;
        padding: 7px 14px;
        /* margin-right removed — spacing now via .ftf-search-group gap */
        background: var(--surface-glass);
        color: var(--text-alpha-85);
        border: 1px solid var(--surface-tint-12);
        border-radius: 6px;
        font-family: ui-sans-serif, system-ui, sans-serif;
        font-size: 12px;
        font-weight: 500;
        letter-spacing: 0.02em;
        text-decoration: none;
        cursor: pointer;
        transition: all 140ms ease;
        white-space: nowrap;
      }
      .ftf-header-action:hover {
        background: var(--info-hover-bg);
        border-color: var(--info-hover-border);
        color: var(--text-heading);
      }
  /* User/login header element (Identity V1) */
  .ftf-header-user-wrap { display:inline-flex; align-items:center; margin-left:10px; }
  .ftf-header-user-btn { display:inline-flex; align-items:center; gap:8px; padding:5px 10px 5px 5px; background:transparent; border:1px solid var(--border-strong); border-radius:20px; color:var(--text-primary); font-size:13px; text-decoration:none; transition:background 0.15s, border-color 0.15s; }
  .ftf-header-user-btn:hover { background:var(--bg-hover); border-color:var(--border-hover); }
  .ftf-header-user-avatar { display:inline-flex; align-items:center; justify-content:center; width:24px; height:24px; border-radius:50%; background:linear-gradient(135deg,var(--accent),#06b6d4); color:var(--text-on-accent); font-weight:600; font-size:11px; flex-shrink:0; }
  .ftf-header-user-name { max-width:140px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .ftf-header-login-btn { display:inline-flex; align-items:center; padding:7px 14px; margin-left:10px; background:var(--accent); border:none; border-radius:6px; color:var(--text-on-accent); font-size:13px; font-weight:500; text-decoration:none; transition:background 0.15s; }
  .ftf-header-login-btn:hover { background:var(--accent-hover); }
  /* Watchlist V1 — star button (used on dashboard & stock filter) */
  .ftf-ticker-id { position: relative; }
  .ftf-watchlist-star { display:inline-flex; align-items:center; justify-content:center; width:24px; height:24px; padding:0; background:transparent; border:none; cursor:pointer; color:var(--text-muted-strong); transition:color 0.15s, transform 0.15s;  }
  .ftf-watchlist-star:hover { color:var(--text-heading); transform:scale(1.08); }
  .ftf-watchlist-star[data-saved="1"] { color:#22d3ee; }
  .ftf-watchlist-star[data-saved="1"] svg path { fill:#22d3ee; }
  .ftf-watchlist-star[data-saved="0"] svg path { fill:transparent; }
  .ftf-watchlist-star:focus { outline:none; }
  .ftf-watchlist-star:focus-visible { outline:2px solid var(--accent); outline-offset:2px; border-radius:4px; }

/* Ticker Tape V1 — inline with section title */
.ftf-kpi-row { min-width: 0; }
.ftf-signal-row-header { display: flex; align-items: center; gap: 16px; margin: 0; width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; }
.ftf-signal-row-header .ftf-section-title { margin: 0; white-space: nowrap; flex-shrink: 0; }
.ftf-ticker-tape { position: relative; flex: 1 1 0; min-width: 0; height: 22px; border: 1px solid var(--border-subtle); border-radius: 4px; background: linear-gradient(180deg, var(--chart-stage-start), var(--bg-deep)); overflow: hidden; display: flex; align-items: center; }
.ftf-ticker-tape::before, .ftf-ticker-tape::after { content: ''; position: absolute; top: 0; bottom: 0; width: 40px; pointer-events: none; z-index: 2; }
.ftf-ticker-tape::before { left: 0;  background: linear-gradient(90deg, var(--chart-stage-start), transparent); }
.ftf-ticker-tape::after  { right: 0; background: linear-gradient(-90deg, var(--chart-stage-start), transparent); }
.ftf-ticker-tape-track { display: inline-flex; align-items: center; white-space: nowrap; animation: ftf-tape-scroll 104s linear infinite; will-change: transform; }
.ftf-ticker-tape:hover .ftf-ticker-tape-track { animation-play-state: paused; }
.ftf-ticker-tape-loading { padding: 0 14px; color: var(--text-disabled); font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: 0.5px; }
.ftf-ticker-tape-item { display: inline-flex; align-items: center; gap: 5px; padding: 0 12px; font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text-body); text-decoration: none; border-right: 1px solid var(--bg-hover); transition: background 0.15s; }
.ftf-ticker-tape-item:hover { background: var(--surface-tint-04); color: var(--text-heading); }
.ftf-ticker-tape-symbol { font-weight: 600; color: var(--text-heading); letter-spacing: 0.3px; }
.ftf-ticker-tape-price { color: var(--text-soft); }
.ftf-ticker-tape-change { display: inline-flex; align-items: center; gap: 2px; padding: 0px 5px; border-radius: 3px; font-size: 10px; font-weight: 600; }
.ftf-ticker-tape-change.up   { color: var(--active); background: rgba(74,222,128,0.08); }
.ftf-ticker-tape-change.down { color: var(--danger-market); background: rgba(248,113,113,0.08); }
.ftf-ticker-tape-change.flat { color: var(--text-muted);    background: rgba(136,136,136,0.06); }
@keyframes ftf-tape-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .ftf-ticker-tape-track { animation: none; } }
@media (max-width: 900px) { .ftf-signal-row-header { flex-wrap: wrap; } .ftf-ticker-tape { width: 100%; flex: 1 1 100%; } }
    

/* Watchlist star sits to the LEFT of the ticker symbol (FTF 2026-06-20) */
.ftf-ticker-id { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: center; column-gap: 8px; row-gap: 2px; }
.ftf-ticker-id .ftf-watchlist-star { order: 1; margin: 0; }
.ftf-ticker-id .ftf-ticker-symbol { order: 2; }
.ftf-ticker-id .ftf-ticker-company { order: 3; flex-basis: 100%; width: 100%; text-align: center; }


/* Watchlist V2 picker dropdown shared by Dashboard and Stock Filter stars. */
.ftf-watchlist-picker {
  position: fixed;
  z-index: 3000;
  min-width: 214px;
  max-width: 280px;
  padding: 8px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--bg-elevated);
  background: color-mix(in srgb, var(--bg-elevated) 94%, transparent);
  color: var(--text-body);
  box-shadow: 0 16px 36px rgba(0,0,0,0.38);
  -webkit-backdrop-filter: blur(12px) saturate(115%);
  backdrop-filter: blur(12px) saturate(115%);
}
.ftf-watchlist-picker[hidden] { display: none; }
.ftf-watchlist-picker-title {
  padding: 3px 6px 8px;
  color: var(--text-muted-strong);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.ftf-watchlist-picker-item {
  width: 100%;
  min-height: 32px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 6px 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text-body);
  cursor: pointer;
  text-align: left;
}
.ftf-watchlist-picker-item:hover { background: var(--surface-tint-04); border-color: var(--border-subtle); }
.ftf-watchlist-picker-item.is-saved { color: var(--text-heading); background: rgba(34,211,238,0.08); border-color: rgba(34,211,238,0.24); }
.ftf-watchlist-picker-item[data-busy="1"] { opacity: 0.6; pointer-events: none; }
.ftf-watchlist-picker-check { width: 18px; color: #22d3ee; font-size: 12px; font-weight: 800; text-align: center; }
.ftf-watchlist-picker-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 600; }
.ftf-watchlist-picker-count { min-width: 22px; height: 18px; padding: 0 6px; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; background: var(--surface-tint-04); color: var(--text-muted-strong); font: 600 10px 'JetBrains Mono', monospace; }
.ftf-watchlist-picker-link {
  display: block;
  margin-top: 6px;
  padding: 7px 8px 4px;
  border-top: 1px solid var(--border-subtle);
  color: var(--active);
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
}
.ftf-watchlist-picker-empty { padding: 8px 7px; color: var(--text-muted); font-size: 12px; }
