/* ================================================================
   CHEZAIQ — Premium Dashboard Design System v2
   Deep-space dark mode · Glassmorphism · Micro-animations
   ================================================================ */

/* --- CSS Custom Properties (Theme Tokens) --- */
:root,
[data-theme="light"] {
  --bg-dark: #f7f6f2;
  --bg-body: #f7f6f2;
  --bg-panel: #fbfbf9;
  --bg-panel-solid: #fbfbf9;
  --bg-panel-hover: #f1eee8;
  --bg-card: #ffffff;
  --bg-inset: rgba(40, 37, 29, 0.05);

  --border: rgba(40, 37, 29, 0.12);
  --border-accent: rgba(1, 105, 111, 0.22);
  --border-glow: rgba(1, 105, 111, 0.35);

  --text-main: #28251d;
  --text-muted: #6f6b63;
  --text-bright: #000000;

  --accent: #01696f;
  --accent-secondary: #015055;
  --accent-glow: rgba(1, 105, 111, 0.18);
  --accent-glow-strong: rgba(1, 105, 111, 0.40);

  --green: #437a22;
  --green-glow: rgba(67, 122, 34, 0.18);
  --red: #a13544;
  --red-glow: rgba(161, 53, 68, 0.18);
  --amber: #a46a18;
  --amber-glow: rgba(164, 106, 24, 0.15);
  --purple: #01696f;
  --purple-glow: rgba(1, 105, 111, 0.18);

  --mono: 'JetBrains Mono', 'Fira Code', monospace;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;

  --radius: 12px;
  --radius-sm: 6px;
  --radius-xs: 4px;

  --glass-blur: 0px;
  --glass-border: 1px solid var(--border);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --duration: 0.2s;
}

[data-theme="dark"] {
  --bg-dark: #171614;
  --bg-body: #171614;
  --bg-panel: #1c1b19;
  --bg-panel-solid: #1c1b19;
  --bg-panel-hover: #252320;
  --bg-card: #201f1c;
  --bg-inset: rgba(205, 204, 202, 0.05);

  --border: rgba(205, 204, 202, 0.14);
  --border-accent: rgba(79, 152, 163, 0.22);
  --border-glow: rgba(79, 152, 163, 0.35);

  --text-main: #e7e3db;
  --text-muted: #a29d94;
  --text-bright: #ffffff;

  --accent: #4f98a3;
  --accent-secondary: #3b747d;
  --accent-glow: rgba(79, 152, 163, 0.18);
  --accent-glow-strong: rgba(79, 152, 163, 0.40);

  --green: #6daa45;
  --green-glow: rgba(109, 170, 69, 0.18);
  --red: #dd6974;
  --red-glow: rgba(221, 105, 116, 0.18);
  --amber: #d29a3a;
  --amber-glow: rgba(210, 154, 58, 0.15);
  --purple: #4f98a3;
  --purple-glow: rgba(79, 152, 163, 0.18);
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 15px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--sans);
    background: var(--bg-dark);
    background-image: var(--bg-body);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.6;
}

/* Subtle grid overlay */
.bg-grid {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
    background-size: 48px 48px;
}

/* --- Layout --- */
.dashboard {
    max-width: 1020px;
    margin: 0 auto;
    padding: 1.5rem 1.2rem 5rem;
}

.hidden {
    display: none !important;
}

.muted {
    color: var(--text-muted);
    font-size: 0.88rem;
}

/* ================================================================
   HEADER — Glassmorphic top bar
   ================================================================ */
.glass-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.1rem 1.5rem;
    margin-bottom: 1.1rem;
    background: var(--bg-panel);
    border: var(--glass-border);
    border-radius: var(--radius);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 8px 32px rgba(0, 0, 0, 0.35);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.logo-area h1 {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 2.5px;
    color: var(--text-bright);
}

.logo-area h1 span {
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Animated pulse dot */
.pulse-ring {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent), 0 0 20px var(--accent-glow);
    animation: pulseDot 2.5s ease-in-out infinite;
}

@keyframes pulseDot {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.35);
        opacity: 0.5;
    }
}

.header-right {
    display: flex;
    gap: 0.55rem;
    align-items: center;
}

/* --- Status Badges --- */
.status-badge {
    font-family: var(--mono);
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.28rem 0.7rem;
    border-radius: 20px;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    transition: all var(--duration) var(--ease-out);
}

.badge-idle {
    background: rgba(91, 104, 130, 0.15);
    color: #7b8ba5;
    border: 1px solid rgba(91, 104, 130, 0.25);
}

.badge-ready {
    background: var(--green-glow);
    color: var(--green);
    border: 1px solid rgba(52, 211, 153, 0.30);
}

.badge-loading {
    background: var(--amber-glow);
    color: var(--amber);
    border: 1px solid rgba(251, 191, 36, 0.30);
    animation: pulseDot 1.5s infinite;
}

.badge-running {
    background: var(--accent-glow);
    color: var(--accent);
    border: 1px solid var(--border-accent);
    animation: pulseDot 1s infinite;
}

.badge-error {
    background: var(--red-glow);
    color: var(--red);
    border: 1px solid rgba(248, 113, 113, 0.30);
}

/* ================================================================
   TABS — underline-style with glow indicator
   ================================================================ */
.tab-bar {
    display: flex;
    gap: 0;
    margin-bottom: 1.3rem;
    border-bottom: 1px solid var(--border);
    position: relative;
}

.tab-btn {
    font-family: var(--sans);
    font-size: 0.84rem;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color var(--duration), border-color var(--duration);
    position: relative;
}

.tab-btn:hover {
    color: var(--text-main);
}

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 20%;
    right: 20%;
    height: 2px;
    border-radius: 2px;
    background: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow-strong);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s var(--ease-out);
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ================================================================
   GLASS PANEL — frosted glass containers
   ================================================================ */
.glass-panel {
    background: var(--bg-panel);
    border: var(--glass-border);
    border-radius: var(--radius);
    padding: 1.4rem 1.6rem;
    margin-bottom: 1.2rem;
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02) inset, 0 4px 24px rgba(0, 0, 0, 0.25);
    transition: border-color var(--duration), box-shadow var(--duration);
}

.glass-panel:hover {
    border-color: rgba(255, 255, 255, 0.09);
}

.section-header {
    margin-bottom: 1.2rem;
}

.section-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-bright);
    margin-bottom: 0.25rem;
}

.section-header p {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.55;
}

/* ================================================================
   BUTTONS — gradient primary, ghost secondary
   ================================================================ */
.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--mono);
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.6rem 1.3rem;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
    color: #000;
    border: none;
    cursor: pointer;
    letter-spacing: 0.5px;
    transition: all var(--duration) var(--ease-out);
    box-shadow: 0 2px 12px var(--accent-glow);
}

.action-btn:hover:not(:disabled) {
    box-shadow: 0 4px 24px var(--accent-glow-strong);
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.action-btn:active:not(:disabled) {
    transform: translateY(0);
}

.action-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    filter: saturate(0.3);
}

.action-btn svg {
    stroke: #000;
}

.wide-btn {
    width: 100%;
    justify-content: center;
    padding: 0.85rem;
    font-size: 0.88rem;
}

.small-btn {
    font-family: var(--mono);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.38rem 0.85rem;
    border-radius: var(--radius-xs);
    border: none;
    cursor: pointer;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    transition: all var(--duration) var(--ease-out);
}

.accent-btn {
    background: var(--accent);
    color: #000;
    box-shadow: 0 1px 8px var(--accent-glow);
}

.accent-btn:hover:not(:disabled) {
    box-shadow: 0 2px 16px var(--accent-glow-strong);
    filter: brightness(1.1);
}

.accent-btn:disabled {
    opacity: 0.30;
    cursor: not-allowed;
}

.ghost-btn {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.ghost-btn:hover {
    color: var(--text-bright);
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.03);
}

/* ================================================================
   FIXTURE BUILDER
   ================================================================ */
.fixture-form {
    display: flex;
    align-items: flex-end;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.team-select-group {
    flex: 1;
    min-width: 200px;
}

.team-select-group label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.9px;
    margin-bottom: 0.4rem;
}

.search-select {
    position: relative;
}

.search-select input {
    width: 100%;
    padding: 0.6rem 0.9rem;
    background: var(--bg-inset);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-bright);
    font-family: var(--sans);
    font-size: 0.88rem;
    outline: none;
    transition: border-color var(--duration), box-shadow var(--duration);
}

.search-select input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.vs-divider {
    font-family: var(--mono);
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--text-muted);
    padding-bottom: 0.5rem;
}

/* Dropdown */
.dropdown-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    max-height: 260px;
    overflow-y: auto;
    background: rgba(13, 18, 32, 0.96);
    border: 1px solid var(--border-accent);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.dd-item {
    padding: 0.55rem 0.85rem;
    font-size: 0.84rem;
    color: var(--text-main);
    cursor: pointer;
    transition: background 0.12s, padding-left 0.2s;
}

.dd-item:hover,
.dd-item.highlighted {
    background: rgba(56, 189, 248, 0.10);
    color: var(--text-bright);
    padding-left: 1.1rem;
}

/* Fixture Queue */
.fixture-queue {
    margin-top: 1.2rem;
}

.queue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
}

.queue-header span {
    font-family: var(--mono);
    font-size: 0.76rem;
    color: var(--text-muted);
}

.queue-header>div {
    display: flex;
    gap: 0.5rem;
}

.queue-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.queue-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.85rem;
    background: var(--bg-inset);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: background var(--duration), border-color var(--duration);
    animation: slideIn 0.25s var(--ease-out);
}

.queue-item:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.10);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-8px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.qi-teams {
    font-size: 0.87rem;
    font-weight: 600;
    color: var(--text-bright);
}

.qi-vs {
    color: var(--text-muted);
    font-weight: 400;
    margin: 0 0.3rem;
}

.qi-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 0.3rem;
    transition: color 0.15s, transform 0.15s;
}

.qi-remove:hover {
    color: var(--red);
    transform: scale(1.2);
}

/* ================================================================
   PREDICTION CARDS
   ================================================================ */
.results-section {
    margin-top: 0.5rem;
}

.results-meta {
    font-family: var(--mono);
    font-size: 0.76rem;
    color: var(--accent);
}

.prediction-cards {
    display: flex;
    flex-direction: column;
    gap: 1.3rem;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.pred-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.3rem 1.5rem;
    position: relative;
    overflow: hidden;
    transition: border-color var(--duration), transform var(--duration), box-shadow var(--duration);
    animation: cardAppear 0.35s var(--ease-out) both;
}

.pred-card:hover {
    border-color: var(--border-accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

@keyframes cardAppear {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Top gradient accent bar */
.pred-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent) 0%, var(--purple) 50%, var(--accent-secondary) 100%);
    opacity: 0.85;
}

.card-error {
    border-color: rgba(248, 113, 113, 0.25);
}

.card-error::before {
    background: var(--red);
}

.card-error-msg {
    color: var(--red);
    font-size: 0.85rem;
    padding: 0.5rem 0;
}

/* Card Header */
.card-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 1rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.card-teams {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-bright);
}

.card-vs {
    color: var(--text-muted);
    font-weight: 400;
    margin: 0 0.25rem;
}

.card-league {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

/* xG Row */
.card-xg-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.xg-cell {
    text-align: center;
}

.xg-value {
    font-family: var(--mono);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-bright);
}

.xg-label {
    font-size: 0.63rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-top: 0.12rem;
}

.score-pill {
    font-family: var(--mono);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--purple);
    padding: 0.4rem 1.1rem;
    background: var(--purple-glow);
    border: 1px solid rgba(167, 139, 250, 0.22);
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(167, 139, 250, 0.10);
}

/* 1X2 Probability Bars */
.card-probs {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.prob-bar-group {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.prob-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.prob-val {
    font-family: var(--mono);
    font-weight: 700;
    color: var(--text-bright);
}

.prob-track {
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
}

.prob-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s var(--ease-out);
}

.home-fill {
    background: linear-gradient(90deg, #22c55e, #34d399);
    box-shadow: 0 0 8px var(--green-glow);
}

.draw-fill {
    background: linear-gradient(90deg, #7b8ba5, #94a3b8);
}

.away-fill {
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.15);
}

/* Verdict */
.card-verdict {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1rem;
    background: var(--bg-inset);
    padding: 0.85rem;
    border-radius: var(--radius-sm);
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.card-verdict>div {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.pick-label,
.conf-label,
.str-label {
    font-size: 0.63rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.pick-tag {
    font-family: var(--mono);
    font-size: 0.82rem;
    font-weight: 700;
    padding: 0.22rem 0.55rem;
    border-radius: 5px;
    display: inline-block;
}

.conf-value {
    font-family: var(--mono);
    font-size: 1rem;
    font-weight: 700;
    color: var(--green);
}

.str-tag {
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.15rem 0.55rem;
    border-radius: 4px;
    display: inline-block;
}

.str-strong {
    background: var(--green-glow);
    color: var(--green);
}

.str-moderate {
    background: var(--amber-glow);
    color: var(--amber);
}

.str-low {
    background: rgba(91, 104, 130, 0.15);
    color: #7b8ba5;
}

/* Markets */
.card-markets {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
}

.market-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.55rem;
    background: var(--bg-inset);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.03);
    transition: border-color var(--duration);
}

.market-cell:hover {
    border-color: rgba(255, 255, 255, 0.08);
}

.ml {
    font-size: 0.63rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.mv {
    font-family: var(--mono);
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-bright);
    margin-top: 0.15rem;
}

/* Gate Weights */
.card-gate {
    margin-bottom: 0.6rem;
}

.gate-title {
    font-size: 0.66rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 0.5rem;
}

.gate-bars {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.gate-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.gate-name {
    font-size: 0.72rem;
    color: var(--text-muted);
    width: 120px;
    flex-shrink: 0;
}

.gate-track {
    flex: 1;
    height: 5px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
}

.gate-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s var(--ease-out);
}

.dc-fill {
    background: var(--green);
    box-shadow: 0 0 6px var(--green-glow);
}

.bp-fill {
    background: var(--accent);
    box-shadow: 0 0 6px var(--accent-glow);
}

.zinb-fill {
    background: var(--purple);
    box-shadow: 0 0 6px var(--purple-glow);
}

.gate-pct {
    font-family: var(--mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    width: 45px;
    text-align: right;
}

/* Meta + Notes */
.card-meta {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.3rem;
    font-family: var(--mono);
    font-size: 0.66rem;
    color: var(--text-muted);
    padding-top: 0.6rem;
    border-top: 1px solid rgba(255, 255, 255, 0.03);
}

.card-notes {
    font-size: 0.74rem;
    color: var(--amber);
    margin-top: 0.4rem;
    padding: 0.4rem 0.65rem;
    background: var(--amber-glow);
    border-radius: var(--radius-sm);
    border-left: 2px solid var(--amber);
}

/* ================================================================
   TERMINAL — macOS-style with enhanced visuals
   ================================================================ */
.terminal-container {
    padding: 0;
    overflow: hidden;
}

.terminal-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.6rem 1rem;
    background: rgba(0, 0, 0, 0.35);
    border-bottom: 1px solid var(--border);
}

.window-dots {
    display: flex;
    gap: 6px;
}

.dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    transition: filter 0.15s;
}

.dot:hover {
    filter: brightness(1.3);
}

.dot.r {
    background: #f87171;
}

.dot.y {
    background: #fbbf24;
}

.dot.g {
    background: #34d399;
}

.terminal-title {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--text-muted);
}

.terminal-body {
    padding: 1rem;
    min-height: 220px;
    max-height: 450px;
    overflow-y: auto;
    font-family: var(--mono);
    font-size: 0.76rem;
    line-height: 1.7;
    background: rgba(0, 0, 0, 0.22);
}

.log-line {
    color: var(--text-muted);
    white-space: pre-wrap;
    word-break: break-all;
}

.log-line.sys {
    color: var(--accent);
}

.log-line.err {
    color: var(--red);
}

/* Pipeline progress bar (injected via JS) */
.pipeline-progress {
    height: 3px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
    margin: 0.6rem 1rem 0;
    overflow: hidden;
}

.pipeline-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
    border-radius: 2px;
    transition: width 0.5s var(--ease-out);
    box-shadow: 0 0 8px var(--accent-glow);
}

/* ================================================================
   SCROLLBAR
   ================================================================ */
::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* ================================================================
   LIVE FIXTURES
   ================================================================ */
.live-fixtures-list {
    max-height: 440px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.lf-league-group {
    margin-bottom: 0.65rem;
}

.lf-league-header {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--accent);
    padding: 0.4rem 0.65rem;
    background: var(--accent-glow);
    border-radius: var(--radius-xs);
    margin-bottom: 0.25rem;
}

.lf-league-count {
    font-weight: 400;
    color: var(--text-muted);
}

.lf-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.42rem 0.65rem;
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-size: 0.82rem;
    transition: background 0.15s, transform 0.15s;
}

.lf-row:hover {
    background: rgba(255, 255, 255, 0.03);
    transform: translateX(2px);
}

.lf-check {
    accent-color: var(--accent);
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    cursor: pointer;
}

.lf-date {
    font-family: var(--mono);
    font-size: 0.69rem;
    color: var(--text-muted);
    min-width: 90px;
}

.lf-time {
    font-family: var(--mono);
    font-size: 0.69rem;
    color: var(--amber);
    min-width: 40px;
}

.lf-home {
    flex: 1;
    text-align: right;
    color: var(--text-bright);
    font-weight: 500;
}

.lf-vs {
    color: var(--text-muted);
    font-size: 0.69rem;
    flex-shrink: 0;
}

.lf-away {
    flex: 1;
    text-align: left;
    color: var(--text-bright);
    font-weight: 500;
}

/* ================================================================
   HISTORY SESSIONS
   ================================================================ */
.history-sessions {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.history-session {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-inset);
    transition: border-color var(--duration);
}

.history-session:hover {
    border-color: rgba(255, 255, 255, 0.10);
}

.hs-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1rem;
    cursor: pointer;
    transition: background 0.15s;
}

.hs-header:hover {
    background: rgba(255, 255, 255, 0.025);
}

.hs-meta {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    min-width: 180px;
}

.hs-time {
    font-family: var(--mono);
    font-size: 0.74rem;
    color: var(--accent);
}

.hs-count {
    font-family: var(--mono);
    font-size: 0.66rem;
    color: var(--text-muted);
}

.hs-fixtures {
    flex: 1;
    font-size: 0.8rem;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hs-toggle {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-left: auto;
    flex-shrink: 0;
    transition: transform 0.2s var(--ease-out);
}

/* ================================================================
   BUSINESS EXPLAINER TOOLTIPS
   ================================================================ */
.business-explainer {
    position: relative;
    cursor: help;
    border-bottom: 1px dotted var(--text-muted);
}

.business-explainer::after {
    content: attr(data-explainer);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    width: max-content;
    max-width: 250px;
    background: var(--bg-panel-solid);
    color: var(--text-bright);
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-family: var(--sans);
    line-height: 1.4;
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 1000;
    pointer-events: none;
    white-space: normal;
}

.business-explainer:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-4px);
}

/* ================================================================
   SQL TERMINAL
   ================================================================ */
.sql-terminal {
    background: #000000;
    border-radius: var(--radius-sm);
    padding: 1rem;
    border: 1px solid var(--border);
}

.sql-input {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--accent);
    font-family: var(--mono);
    font-size: 0.9rem;
    outline: none;
    resize: vertical;
    min-height: 80px;
}

.hs-body {
    padding: 0.6rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    animation: fadeIn 0.3s var(--ease-out);
}

.history-actions {
    margin-bottom: 0.8rem;
}

.history-sessions .queue-header {
    margin-bottom: 0;
}

/* ================================================================
   USER BADGE (storage backend indicator)
   ================================================================ */
.user-badge {
    font-family: var(--mono);
    font-size: 0.6rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    background: rgba(129, 140, 248, 0.12);
    color: var(--accent-secondary);
    border: 1px solid rgba(129, 140, 248, 0.20);
    letter-spacing: 0.3px;
}

/* ================================================================
   CHEZAIQ — Obsidian Bento Design System v3
   The research dashboard uses stateful accents: cyan/purple glow is
   reserved for focus, hover, and live telemetry rather than decoration.
   ================================================================ */
:root,
[data-theme="light"],
[data-theme="dark"] {
    --bg-canvas: #000000;
    --bg-canvas-subtle: #05050A;
    --bg-card: #0D0E15;
    --bg-card-hover: #121420;
    --border-static: #1F2430;
    --text-primary: #FFFFFF;
    --text-secondary: #A0A0A0;
    --text-muted: #6E7681;
    --accent-cyan: #00E5FF;
    --accent-purple: #9D00FF;
    --hud-pulse: #00FFFF;
    --cta-primary: #1B63FF;
    --cta-primary-hover: #144ECD;
    --gradient-accent: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    --radius-card: 16px;
    --radius-pill: 9999px;
    --transition-fast: 0.2s cubic-bezier(0.16, 1, 0.3, 1);

    /* Preserve semantic names used by the existing components. */
    --bg-dark: var(--bg-canvas);
    --bg-body: var(--bg-canvas);
    --bg-panel: var(--bg-card);
    --bg-panel-solid: var(--bg-card);
    --bg-panel-hover: var(--bg-card-hover);
    --bg-inset: rgba(255, 255, 255, 0.035);
    --border: var(--border-static);
    --border-accent: rgba(0, 229, 255, 0.42);
    --border-glow: rgba(0, 229, 255, 0.65);
    --text-main: var(--text-secondary);
    --text-bright: var(--text-primary);
    --accent: var(--accent-cyan);
    --accent-secondary: var(--accent-purple);
    --accent-glow: rgba(0, 229, 255, 0.14);
    --accent-glow-strong: rgba(0, 229, 255, 0.32);
    --purple: var(--accent-purple);
    --purple-glow: rgba(157, 0, 255, 0.16);
    --green: #42E8A4;
    --green-glow: rgba(66, 232, 164, 0.16);
    --red: #FF6B7A;
    --red-glow: rgba(255, 107, 122, 0.16);
    --amber: #F4C15D;
    --amber-glow: rgba(244, 193, 93, 0.16);
    --sans: 'Space Grotesk', 'Inter', system-ui, -apple-system, sans-serif;
    --mono: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
    --radius: var(--radius-card);
    --radius-sm: 10px;
    --radius-xs: 7px;
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --duration: 0.2s;
}

html { background: var(--bg-canvas); }

body {
    background: var(--bg-canvas);
    background-image: radial-gradient(circle at 50% -20%, rgba(0, 229, 255, 0.07), transparent 42%),
                      linear-gradient(180deg, var(--bg-canvas-subtle), var(--bg-canvas));
    color: var(--text-secondary);
}

.dashboard {
    max-width: 1440px;
    padding: 20px 24px 72px;
}

.glass-header,
.glass-panel,
.pred-card,
.history-session,
.bento-card {
    background: var(--bg-card);
    border: 1px solid var(--border-static);
    border-radius: var(--radius-card);
    box-shadow: none;
    transition: background-color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.glass-header:hover,
.glass-panel:hover,
.pred-card:hover,
.history-session:hover,
.bento-card:hover {
    background: var(--bg-card-hover);
    border-color: transparent;
    background-image: linear-gradient(var(--bg-card-hover), var(--bg-card-hover)), var(--gradient-accent);
    background-origin: border-box;
    background-clip: padding-box, border-box;
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.12);
}

.glass-header { padding: 18px 24px; margin-bottom: 16px; }
.glass-panel { padding: 24px; margin-bottom: 0; }

.tab-bar { margin-bottom: 20px; border-bottom-color: var(--border-static); }
.tab-btn { color: var(--text-muted); padding: 12px 18px; }
.tab-btn.active { color: var(--text-primary); border-bottom-color: var(--accent-cyan); }
.tab-btn.active::after { background: var(--gradient-accent); box-shadow: 0 0 14px rgba(0, 229, 255, 0.42); }

/* 12-column bento composition for each workspace. */
.tab-content.active {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 20px;
}
.tab-content.active > * { grid-column: 1 / -1; min-width: 0; }
#predict-tab.active > .glass-panel:first-child { grid-column: span 5; }
#predict-tab.active > .fixture-builder { grid-column: span 7; }
#predict-tab.active > .results-section { grid-column: 1 / -1; }
#history-tab.active > .glass-panel:first-child { grid-column: span 7; }
#history-tab.active > .glass-panel:nth-child(2) { grid-column: span 5; }
#profile-tab.active, #analytics-tab.active { grid-template-columns: repeat(12, minmax(0, 1fr)); }
#profile-tab.active > .glass-panel, #analytics-tab.active > .glass-panel { grid-column: 1 / -1; }

.execution-topbar {
    display: flex;
    flex-wrap: wrap;
    gap: 18px !important;
    align-items: center;
    padding: 10px 14px;
    margin-bottom: 18px !important;
    border: 1px solid var(--border-static);
    border-radius: var(--radius-pill);
    background: rgba(13, 14, 21, 0.72);
}
.execution-topbar > div { color: var(--text-muted) !important; }

.action-btn,
.accent-btn,
.btn-primary {
    background: var(--cta-primary);
    color: var(--text-primary);
    border-radius: var(--radius-pill);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-family: var(--sans);
    letter-spacing: 0.02em;
    box-shadow: 0 6px 18px rgba(27, 99, 255, 0.18);
}
.action-btn:hover:not(:disabled),
.accent-btn:hover:not(:disabled),
.btn-primary:hover:not(:disabled) { background: var(--cta-primary-hover); box-shadow: 0 8px 24px rgba(27, 99, 255, 0.28); transform: translateY(-1px); }
.ghost-btn { border-radius: var(--radius-pill); border-color: var(--border-static); color: var(--text-secondary); }
.ghost-btn:hover { border-color: rgba(255, 255, 255, 0.28); background: rgba(255, 255, 255, 0.06); color: var(--text-primary); }

.status-badge, .user-badge { border-radius: var(--radius-pill); }
.pulse-ring { background: var(--hud-pulse); box-shadow: 0 0 10px var(--hud-pulse), 0 0 24px rgba(0, 255, 255, 0.34); }
.results-meta, .mono, .terminal-title, .log-line { color: var(--accent-cyan); }

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--accent-cyan);
    outline-offset: 3px;
}

@media (max-width: 900px) {
    .tab-content.active { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; }
    #predict-tab.active > .glass-panel:first-child,
    #predict-tab.active > .fixture-builder,
    #history-tab.active > .glass-panel:first-child,
    #history-tab.active > .glass-panel:nth-child(2) { grid-column: 1 / -1; }
}

@media (max-width: 600px) {
    .dashboard { padding: 12px 12px 48px; }
    .glass-header { padding: 16px; }
    .header-right { flex-wrap: wrap; justify-content: flex-end; }
    .tab-bar { overflow-x: auto; }
    .tab-btn { white-space: nowrap; padding-inline: 13px; }
    .tab-content.active { display: block; }
    .tab-content.active > * { margin-bottom: 12px; }
    .glass-panel { padding: 16px; }
    .execution-topbar { border-radius: var(--radius-card); align-items: flex-start; flex-direction: column; gap: 4px !important; }
    .fixture-form { display: grid; grid-template-columns: 1fr; align-items: stretch; }
    .vs-divider { text-align: center; padding: 0; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 768px) {
    .dashboard {
        padding: 1rem 0.8rem 4rem;
    }

    .glass-header {
        padding: 0.9rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .logo-area h1 {
        font-size: 1.1rem;
        letter-spacing: 1.5px;
    }

    .tab-btn {
        padding: 0.6rem 1rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 640px) {
    .fixture-form {
        flex-direction: column;
    }

    .vs-divider {
        text-align: center;
        padding: 0.3rem 0;
    }

    .card-verdict {
        grid-template-columns: 1fr;
    }

    .card-markets {
        grid-template-columns: 1fr;
    }

    .gate-name {
        width: 80px;
    }

    .header-right {
        flex-wrap: wrap;
    }

    .hs-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .hs-fixtures {
        white-space: normal;
    }

    .lf-row {
        font-size: 0.76rem;
        gap: 0.4rem;
    }

    .lf-date {
        min-width: 70px;
        font-size: 0.62rem;
    }
}
