/* ==========================================================================
   Sparkline Market Dashboard — Dense 2-Column Layout
   ========================================================================== */

/* ---- Reset ---- */
#sd-dashboard *,
#sd-dashboard *::before,
#sd-dashboard *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ---- Container ---- */
.sd-dashboard {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 12px;
    line-height: 1.4;
    max-width: 1400px;
    margin: 0 auto;
    padding: 12px 12px 4px;
    transition: background-color 0.2s, color 0.2s;
}

/* ---- Themes ---- */
.sd-theme-dark  { background-color: #0f1117; color: #e1e4ea; }
.sd-theme-light { background-color: #f8f9fb; color: #1a1d27; }

/* ---- Header ---- */
.sd-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    padding-bottom: 8px;
}
.sd-theme-dark  .sd-header { border-bottom: 1px solid #2a2d3a; }
.sd-theme-light .sd-header { border-bottom: 1px solid #e5e7eb; }

.sd-title { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }

.sd-controls { display: flex; align-items: center; gap: 10px; }
.sd-updated  { font-size: 10px; opacity: 0.45; }

.sd-btn {
    border: none; background: transparent; cursor: pointer;
    font-size: 16px; line-height: 1; padding: 2px 6px;
    border-radius: 3px; transition: background 0.15s;
}
.sd-theme-dark  .sd-btn { color: #e1e4ea; }
.sd-theme-light .sd-btn { color: #1a1d27; }
.sd-btn:hover { background: rgba(128,128,128,0.15); }

/* ---- 2-Column Grid ---- */
.sd-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 16px;
    align-items: start;
}

/* ---- Section ---- */
.sd-section { margin-bottom: 4px; }

.sd-section-title {
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.05em;
    margin-bottom: 3px; padding-left: 2px;
}
.sd-theme-dark  .sd-section-title { color: #9ca3af; }
.sd-theme-light .sd-section-title { color: #6b7280; }

/* ---- Table ---- */
.sd-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.sd-table thead th {
    font-size: 10px; font-weight: 500;
    text-transform: uppercase; letter-spacing: 0.04em;
    padding: 3px 4px; text-align: left; white-space: nowrap;
}
.sd-theme-dark  .sd-table thead th { color: #6b7280; border-bottom: 1px solid #2a2d3a; }
.sd-theme-light .sd-table thead th { color: #9ca3af; border-bottom: 1px solid #e5e7eb; }

/* Right-align headers to match data */
.sd-table thead th.sd-col-price,
.sd-table thead th.sd-col-chg { text-align: right; }
.sd-table thead th.sd-col-spark { text-align: center; }

.sd-table tbody tr { transition: background 0.1s; }
.sd-theme-dark  .sd-table tbody tr:hover { background: rgba(255,255,255,0.03); }
.sd-theme-light .sd-table tbody tr:hover { background: rgba(0,0,0,0.02); }

.sd-table tbody td {
    padding: 2px 4px;
    vertical-align: middle;
    white-space: nowrap;
}
.sd-theme-dark  .sd-table tbody td { border-bottom: 1px solid rgba(255,255,255,0.03); }
.sd-theme-light .sd-table tbody td { border-bottom: 1px solid rgba(0,0,0,0.03); }

/* Column widths — compact */
.sd-col-label { width: 34%; }
.sd-col-price { width: 17%; text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.sd-col-spark { width: 20%; text-align: center; }
.sd-col-chg   { width: 14.5%; text-align: right; font-variant-numeric: tabular-nums; }

/* ---- Ticker & name ---- */
.sd-ticker { font-weight: 600; font-size: 11px; margin-right: 4px; }
.sd-theme-dark  .sd-ticker { color: #c4b5fd; }
.sd-theme-light .sd-ticker { color: #6d28d9; }

.sd-sep  { font-size: 11px; opacity: 0.3; margin: 0 3px; }
.sd-name { font-size: 11px; opacity: 0.55; }

/* ---- Percentage colours ---- */
.sd-up   { color: #22c55e; }
.sd-down { color: #ef4444; }
.sd-theme-light .sd-up   { color: #16a34a; }
.sd-theme-light .sd-down { color: #dc2626; }

/* ---- Sparkline container (compact) ---- */
.sd-spark-container {
    display: inline-block;
    width: 90px;
    height: 28px;
    vertical-align: middle;
}
.sd-spark-container > div {
    width: 100% !important;
    height: 100% !important;
}

/* ---- Footer ---- */
.sd-footer {
    text-align: center;
    padding: 8px 0 4px;
    font-size: 10px;
    opacity: 0.35;
}
.sd-footer a { color: inherit; text-decoration: underline; }

/* ---- Loading ---- */
.sd-loading {
    text-align: center;
    padding: 30px 0;
    opacity: 0.5;
    font-size: 13px;
    grid-column: 1 / -1;
}

/* ---- Responsive: single column on small screens ---- */
@media (max-width: 900px) {
    .sd-sections { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .sd-dashboard { font-size: 11px; padding: 8px 6px; }
    .sd-col-spark { display: none; }
    .sd-col-label { width: 38%; }
    .sd-col-price { width: 24%; }
    .sd-col-chg   { width: 19%; }
    .sd-name { display: none; }
}
