/* Mi Farm AI Dashboard — Styles */
/* Refactored: 2026-03-30 — CSS custom properties for centralized color palette */

:root {
    /* ── Brand & Semantic Colors ── */
    --c-accent: #c8922a;       /* Gold — brand accent, headers, borders */
    --c-success: #4ade80;      /* Green — positive values, good status */
    --c-alert: #f87171;        /* Red — negative values, warnings, urgent */
    --c-info: #60a5fa;         /* Blue — informational, neutral highlight */
    --c-purple: #a78bfa;       /* Purple — protect/insurance context */
    --c-yellow: #fbbf24;       /* Yellow — Farm Bill tags, jokes */

    /* ── Text Colors ── */
    --c-text: #c8d0d8;         /* Default body text */
    --c-text-bright: #ddd;     /* Brighter text for emphasis */
    --c-text-white: #fff;      /* White text for values */
    --c-text-dim: #8899aa;     /* Dimmed text, secondary info */
    --c-text-muted: #5a6a7a;   /* Muted text, metadata */
    --c-text-faint: #4a5a6a;   /* Faintest text, labels */
    --c-text-ghost: #3a4a5a;   /* Ghost text, timestamps */
    --c-text-analysis: #b0b8c0;/* Analysis body text */
    --c-text-strong: #e8e8e8;  /* Strong/bold text in analysis */

    /* ── Background Colors ── */
    --c-bg-body: #0a1017;      /* Body background */
    --c-bg-card: #111b25;      /* Card background */
    --c-bg-inset: #0d1520;     /* Inset/recessed background */
    --c-bg-hover: #111b28;     /* Action item hover */

    /* ── Border Colors ── */
    --c-border: #1a2535;       /* Default borders */
    --c-border-dim: #141e28;   /* Subtle borders (table rows) */
    --c-border-bright: #2a3545;/* Brighter borders */

    /* ── Header-specific ── */
    --c-header-start: #0d1f0d; /* Header gradient start */
    --c-header-end: #1a3520;   /* Header gradient end */
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'IBM Plex Sans', -apple-system, 'Segoe UI', Roboto, sans-serif; background: var(--c-bg-body); color: var(--c-text); font-size: 13px; font-variant-numeric: tabular-nums; }

.header { background: linear-gradient(135deg, var(--c-header-start) 0%, var(--c-header-end) 100%); padding: 10px 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 2px solid var(--c-accent); }
.header h1 { font-size: 20px; color: var(--c-text-white); } .header h1 span { color: var(--c-accent); }
.header .meta { font-size: 11px; color: rgba(255,255,255,0.5); }
.header .live { color: var(--c-success); font-weight: 700; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

.ticker { background: var(--c-bg-inset); padding: 8px 20px; display: flex; gap: 24px; border-bottom: 1px solid var(--c-border); overflow-x: auto; font-size: 12px; }
.t-item { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.t-label { color: var(--c-text-muted); text-transform: uppercase; letter-spacing: 1px; font-weight: 600; font-size: 10px; }
.t-price { color: var(--c-text-white); font-weight: 700; font-size: 16px; }
.t-chg { font-weight: 600; font-size: 11px; }
.up { color: var(--c-success); } .down { color: var(--c-alert); } .neutral { color: var(--c-text-dim); }

.nav { background: var(--c-bg-inset); padding: 0; display: flex; gap: 0; border-bottom: 1px solid var(--c-border); }
.nav button { background: none; border: none; color: var(--c-text-muted); padding: 14px 0; font-size: 22px; font-weight: 700; cursor: pointer; border-bottom: 3px solid transparent; font-family: inherit; text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap; flex: 1; text-align: center; }
.nav button:hover { color: var(--c-accent); } .nav button.active { color: var(--c-accent); border-bottom-color: var(--c-accent); }

.container { max-width: 1600px; margin: 0 auto; padding: 10px; }
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.g3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.g4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.g5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 8px; }

.card { background: var(--c-bg-card); border: 1px solid var(--c-border); border-radius: 6px; padding: 10px 14px; }
.card h3 { font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--c-text-faint); margin-bottom: 6px; font-weight: 700; }
.card.gold { border-left: 3px solid var(--c-accent); } .card.green { border-left: 3px solid var(--c-success); } .card.red { border-left: 3px solid var(--c-alert); } .card.blue { border-left: 3px solid var(--c-info); }

.m { text-align: center; padding: 4px; }
.m .v { font-size: 24px; font-weight: 700; color: var(--c-text-white); }
.m .v.gold { color: var(--c-accent); } .m .v.green { color: var(--c-success); } .m .v.red { color: var(--c-alert); } .m .v.blue { color: var(--c-info); }
.m .l { font-size: 9px; color: var(--c-text-faint); margin-top: 3px; text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }
.m .s { font-size: 11px; margin-top: 2px; }

.gauge { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
.gauge.bull { background: var(--c-success); } .gauge.bear { background: var(--c-alert); } .gauge.neutral { background: var(--c-accent); }

.proj { background: var(--c-bg-inset); border-radius: 4px; padding: 12px; text-align: center; }
.proj .label { font-size: 9px; text-transform: uppercase; letter-spacing: 1px; font-weight: 700; margin-bottom: 4px; }
.proj .price { font-size: 20px; font-weight: 700; color: var(--c-text-white); }
.proj .prob { font-size: 10px; color: var(--c-text-muted); margin-top: 2px; }

.chart-box { height: 360px; margin-top: 6px; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 6px 8px; font-size: 9px; text-transform: uppercase; letter-spacing: 1px; color: var(--c-text-faint); border-bottom: 1px solid var(--c-border); font-weight: 700; }
td { padding: 6px 8px; border-bottom: 1px solid var(--c-border-dim); }
tr:hover { background: rgba(200,146,42,0.03); }

.tab-content { display: none; } .tab-content.active { display: block; }
.loading { text-align: center; padding: 20px; color: var(--c-text-ghost); }
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.section-head h2 { font-size: 14px; color: var(--c-text-bright); font-weight: 600; }
.section-head .ts { font-size: 10px; color: var(--c-text-ghost); }

/* Action items */
.action-item { background: var(--c-bg-inset); border-radius: 6px; padding: 10px 14px; margin-bottom: 6px; border-left: 3px solid var(--c-accent); cursor: pointer; transition: background 0.15s; }
.action-item:hover { background: var(--c-bg-hover); }
.action-item.sell { border-left-color: var(--c-success); }
.action-item.hold { border-left-color: var(--c-info); }
.action-item.protect { border-left-color: var(--c-purple); }
.action-item.fix { border-left-color: var(--c-alert); }
.action-item.save { border-left-color: var(--c-yellow); }
.action-item.deadline { border-left-color: var(--c-alert); }
.action-head { display: flex; justify-content: space-between; align-items: center; }
.action-title { font-size: 14px; font-weight: 700; color: var(--c-text-white); }
.action-value { font-size: 16px; font-weight: 700; color: var(--c-success); }
.action-reason { font-size: 12px; color: var(--c-text-dim); margin-top: 4px; line-height: 1.4; }
.action-meta { font-size: 10px; color: var(--c-text-ghost); margin-top: 4px; display: flex; gap: 12px; }
.action-tag { padding: 2px 6px; border-radius: 3px; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.tag-today { background: #f8717133; color: var(--c-alert); }
.tag-week { background: #c8922a33; color: var(--c-accent); }
.tag-month { background: #60a5fa33; color: var(--c-info); }

/* Score bar */
.score-bar { height: 6px; background: var(--c-border); border-radius: 3px; overflow: hidden; margin: 6px 0; }
.score-fill { height: 100%; border-radius: 3px; transition: width 0.5s; }

/* Bin visualization */
.bin-bar { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.bin-fill-bg { flex: 1; height: 20px; background: var(--c-border); border-radius: 3px; overflow: hidden; }
.bin-fill { height: 100%; border-radius: 3px; transition: width 0.5s; }
.bin-fill.corn { background: linear-gradient(90deg, var(--c-accent), #e5a830); }
.bin-fill.soy { background: linear-gradient(90deg, var(--c-success), #6ee7a0); }
.bin-label { min-width: 120px; font-size: 11px; color: var(--c-text-bright); font-weight: 600; }
.bin-pct { min-width: 50px; font-size: 11px; color: var(--c-text-dim); text-align: right; }

/* Sub-panel expand */
.sub-panel { display: none; margin-top: 8px; }
.sub-panel.open { display: block; }
.sub-toggle { display: inline-block; padding: 6px 12px; border-radius: 4px; border: 1px solid var(--c-border); background: var(--c-bg-card); color: var(--c-text-dim); cursor: pointer; font-family: inherit; font-size: 11px; font-weight: 600; margin: 3px; }
.sub-toggle:hover { border-color: var(--c-accent); color: var(--c-accent); }
.sub-toggle.active { background: var(--c-accent); color: #000; border-color: var(--c-accent); }

/* Field profitability colors */
.field-profit { color: var(--c-success); font-weight: 700; }
.field-loss { color: var(--c-alert); font-weight: 700; }
.field-marginal { color: var(--c-accent); font-weight: 700; }

/* Verdict box */
.verdict { background: var(--c-bg-inset); border-radius: 4px; padding: 8px 14px; margin: 6px 0; border-left: 3px solid var(--c-accent); }
.verdict-text { font-size: 14px; color: var(--c-text-bright); font-weight: 600; line-height: 1.5; }
.verdict .math { font-size: 11px; color: var(--c-text-dim); margin-top: 6px; }

/* Weather grid */
.wx { padding: 5px 0; border-bottom: 1px solid var(--c-border-dim); display: flex; justify-content: space-between; align-items: center; font-size: 12px; }
.wx:last-child { border: none; }
.wx .rg { font-weight: 600; color: var(--c-text-bright); min-width: 160px; }
.wx .tmp { color: var(--c-accent); font-weight: 600; }
.wx .prc { min-width: 70px; text-align: right; }
.wx .prc.wet { color: var(--c-info); font-weight: 600; }
.wx .prc.dry { color: var(--c-alert); }

.analysis { line-height: 1.45; color: var(--c-text-analysis); font-size: 14px; }
.analysis h1,.analysis h2,.analysis h3 { color: var(--c-accent); margin: 8px 0 4px; }
.analysis p { margin: 4px 0; }
.analysis strong { color: var(--c-text-strong); }

/* Alert badge */
.alert-badge { display: inline-block; background: var(--c-alert); color: var(--c-text-white); font-size: 9px; font-weight: 700; padding: 1px 5px; border-radius: 8px; margin-left: 4px; }

/* Market indices */
.idx-card { background: var(--c-bg-card); border: 1px solid var(--c-border); border-radius: 6px; padding: 12px; }
.idx-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--c-border); }
.idx-name { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--c-text-dim); }
.idx-price { font-size: 18px; font-weight: 700; color: var(--c-text-white); }
.idx-change { font-size: 12px; font-weight: 600; }
.idx-stock { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--c-border-dim); font-size: 11px; }
.idx-stock:last-child { border-bottom: none; }
.idx-stock .stk-name { color: var(--c-text-bright); font-weight: 600; min-width: 55px; }
.idx-stock .stk-co { color: var(--c-text-muted); font-size: 9px; flex: 1; padding: 0 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.idx-stock .stk-price { color: var(--c-text-white); font-weight: 600; min-width: 55px; text-align: right; }
.idx-stock .stk-chg { min-width: 80px; text-align: right; font-weight: 600; }
.custom-stock-bar { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.custom-stock-bar input { background: var(--c-bg-inset); border: 1px solid var(--c-border); color: var(--c-text-bright); padding: 5px 8px; border-radius: 4px; font-family: inherit; font-size: 11px; width: 100px; }
.custom-stock-bar input::placeholder { color: var(--c-text-ghost); }
.custom-stock-bar button { background: var(--c-border); border: 1px solid var(--c-border-bright); color: var(--c-text-dim); padding: 5px 10px; border-radius: 4px; cursor: pointer; font-family: inherit; font-size: 10px; font-weight: 600; }
.custom-stock-bar button:hover { border-color: var(--c-accent); color: var(--c-accent); }

/* Coffee Shop news items */
.news-item { padding: 8px 12px; border-bottom: 1px solid var(--c-border); }
.news-item:last-child { border-bottom: none; }
.news-item:hover { background: rgba(200,146,42,0.03); }
.news-item .news-headline { font-size: 13px; font-weight: 600; color: var(--c-text-bright); line-height: 1.4; }
.news-item .news-headline a { color: var(--c-text-bright); text-decoration: none; }
.news-item .news-headline a:hover { color: var(--c-accent); text-decoration: underline; }
.news-item .news-summary { font-size: 11px; color: var(--c-text-dim); margin-top: 4px; line-height: 1.5; }
.news-item .news-meta { font-size: 9px; color: var(--c-text-ghost); margin-top: 4px; display: flex; gap: 8px; align-items: center; }
.news-item.farm-bill { border-left: 3px solid var(--c-yellow); background: rgba(251,191,36,0.04); padding-left: 12px; }
.news-item.farm-bill .fb-tag { display: inline-block; background: #fbbf2433; color: var(--c-yellow); font-size: 8px; font-weight: 700; padding: 1px 5px; border-radius: 3px; text-transform: uppercase; letter-spacing: 0.5px; margin-left: 6px; vertical-align: middle; }

/* ═══ INTELLIGENCE CALLOUTS ═══ */
/* Visually distinct from data cards — "the system is thinking for you" */

.intel {
    background: linear-gradient(135deg, #0f1a12 0%, #111b25 100%);
    border: 2px solid #2aad4a;
    border-left: 5px solid #2aad4a;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 12px;
    position: relative;
    box-shadow: 0 0 12px rgba(42,173,74,0.15);
}
.intel-label {
    font-size: 8px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #2aad4a;
    font-weight: 700;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.intel-label::before {
    content: '\u25C6';
    font-size: 10px;
}
.intel-call {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    line-height: 1.4;
    margin-bottom: 10px;
}
.intel-chain {
    font-size: 13px;
    color: var(--c-accent);
    line-height: 1.6;
    margin-bottom: 12px;
}
.intel-chain .arrow { color: #2aad4a; font-weight: 700; padding: 0 4px; }
.intel-stakes {
    display: flex;
    gap: 10px;
}
.intel-stake {
    flex: 1;
    background: #0a1017;
    border: 1px solid #1a2535;
    border-radius: 4px;
    padding: 10px;
    text-align: center;
}
.intel-stake .stake-val {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
}
.intel-stake .stake-val.positive { color: var(--c-success); }
.intel-stake .stake-val.negative { color: var(--c-alert); }
.intel-stake .stake-val.urgent { color: var(--c-accent); }
.intel-stake .stake-lbl {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--c-text-muted);
    margin-top: 4px;
    font-weight: 600;
}

/* Command Bar — persistent above tabs */
.command-bar {
    background: linear-gradient(135deg, #0d1f0d 0%, #0f1a12 50%, #111b25 100%);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #1a3520;
    cursor: pointer;
}
.command-bar:hover { background: linear-gradient(135deg, #102510 0%, #121f15 50%, #131f2a 100%); }
.cmd-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.cmd-diamond {
    color: #2aad4a;
    font-size: 14px;
}
.cmd-count {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
}
.cmd-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--c-success);
}
.cmd-cost {
    font-size: 12px;
    color: var(--c-alert);
    font-weight: 600;
}
.cmd-deadlines {
    font-size: 12px;
    color: var(--c-accent);
    font-weight: 600;
}

/* Field P&L live card */
.field-pnl {
    background: var(--c-bg-inset);
    border-radius: 4px;
    padding: 10px 14px;
    margin-bottom: 6px;
    border-left: 3px solid var(--c-success);
}
.field-pnl.losing { border-left-color: var(--c-alert); }
.field-pnl.marginal { border-left-color: var(--c-accent); }
.field-pnl-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.field-pnl-name {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
}
.field-pnl-profit {
    font-size: 16px;
    font-weight: 700;
}
.field-pnl-profit.positive { color: var(--c-success); }
.field-pnl-profit.negative { color: var(--c-alert); }
.field-pnl-detail {
    font-size: 11px;
    color: var(--c-text-dim);
    margin-top: 4px;
    line-height: 1.5;
}
.field-pnl-trend {
    font-size: 11px;
    margin-top: 4px;
    font-weight: 600;
}
.field-pnl-trend.up { color: var(--c-success); }
.field-pnl-trend.down { color: var(--c-alert); }
.field-pnl-trend.flat { color: var(--c-text-dim); }

/* Cost of Inaction Clock */
.inaction-clock {
    background: linear-gradient(135deg, #1a0d0d 0%, #111b25 100%);
    border: 1px solid #351a1a;
    border-left: 4px solid var(--c-alert);
    border-radius: 6px;
    padding: 14px 18px;
    margin-bottom: 10px;
}
.inaction-total {
    font-size: 28px;
    font-weight: 800;
    color: var(--c-alert);
    text-align: center;
}
.inaction-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--c-text-muted);
    text-align: center;
    margin-top: 4px;
}
.inaction-breakdown {
    display: flex;
    gap: 12px;
    margin-top: 10px;
    justify-content: center;
}
.inaction-item {
    text-align: center;
}
.inaction-item .ia-val {
    font-size: 14px;
    font-weight: 700;
    color: var(--c-text-bright);
}
.inaction-item .ia-lbl {
    font-size: 9px;
    color: var(--c-text-muted);
    margin-top: 2px;
}

/* FSA Program cards */
.fsa-card {
    background: var(--c-bg-inset);
    border-radius: 4px;
    padding: 12px 14px;
    margin-bottom: 8px;
    border-left: 3px solid var(--c-info);
}
.fsa-verdict {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 6px;
}
.fsa-math {
    font-size: 12px;
    color: var(--c-text-dim);
    line-height: 1.5;
}
.fsa-deadline {
    font-size: 11px;
    color: var(--c-alert);
    font-weight: 600;
    margin-top: 6px;
}

/* This Changes Everything alert */
.alert-critical {
    background: linear-gradient(135deg, #1a0d0d 0%, #1a1520 100%);
    border: 2px solid var(--c-alert);
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 12px;
    animation: alert-pulse 3s infinite;
}
@keyframes alert-pulse {
    0%, 100% { border-color: var(--c-alert); }
    50% { border-color: #ff4444; box-shadow: 0 0 12px rgba(248,113,113,0.2); }
}
.alert-critical-header {
    font-size: 12px;
    font-weight: 700;
    color: var(--c-alert);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 8px;
}
.alert-critical-body {
    font-size: 14px;
    color: #fff;
    font-weight: 600;
    line-height: 1.5;
}
.alert-critical-move {
    background: #0a1017;
    border-radius: 4px;
    padding: 10px 14px;
    margin-top: 10px;
    border-left: 3px solid var(--c-success);
}
.alert-critical-move .move-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--c-success);
    font-weight: 700;
    margin-bottom: 4px;
}
.alert-critical-move .move-text {
    font-size: 14px;
    color: #fff;
    font-weight: 600;
    line-height: 1.4;
}

@media (max-width: 1000px) { .g2,.g3,.g4,.g5 { grid-template-columns: 1fr; } .intel-stakes { flex-direction: column; } }
