/* ============================================================================
   Future Island Intelligence Suite — v1.5.0-rc.6
   Radical UI Simplification + Command Header / Sidebar Rebuild
   ----------------------------------------------------------------------------
   Loaded LAST (after fiis-rc5-state-ui). Strictly additive. Scoped under
   .ves-wrap.fi-shell so WordPress admin chrome is never touched.

   Goals (RC.6):
     - Rebuild the topbar into a calm Future Island command header.
     - Quiet and de-clutter the sidebar (flat, elegant active state).
     - Remove panel-in-panel beige boxing, heavy shadows and stray borders.
     - Stop the giant default video preview; results read as a premium grid.
     - Premium, editorial report typography.
   The fastest flatten lever is re-grounding the inherited surface tokens, so
   most backgrounds/borders/shadows resolve to a flat, paper-on-ink palette.
   ============================================================================ */

.ves-wrap.fi-shell {
    /* RC.6 palette tokens */
    --fi6-bg: #f3f0e8;
    --fi6-paper: #fffaf0;
    --fi6-ink: #101010;
    --fi6-muted: #6f6a60;
    --fi6-line: rgba(16, 16, 16, .10);
    --fi6-line-soft: rgba(16, 16, 16, .06);
    --fi6-blue: #2458d3;
    --fi6-blue-soft: #e8eeff;
    --fi6-sand: #d8c4a3;
    --fi6-lime: #d8ff55;
    --fi6-orange: #ff5a2f;
    --fi6-radius-sm: 8px;
    --fi6-radius-md: 14px;
    --fi6-radius-lg: 22px;

    /* Re-ground inherited surface tokens used across rc2..rc5 so the whole
       shell flattens to one calm palette in a single move. */
    --fi-rc5-bg: var(--fi6-bg);
    --fi-rc5-paper: var(--fi6-paper);
    --fi-rc5-divider: var(--fi6-line);
    --fi-rc5-shadow: none;
    --fi-rc5-sand: var(--fi6-sand);
    --fi-surface: var(--fi6-paper);
    --fi-surface-soft: #f7f3ea;
    --fi-bg: var(--fi6-bg);
    --card: var(--fi6-paper);
    --raised: var(--fi6-paper);
    --panel: var(--fi6-paper);
    --bdr: var(--fi6-line);
    --border: var(--fi6-line);
    background: var(--fi6-bg);
}

/* ---------------------------------------------------------------------------
   1) COMMAND HEADER (topbar rebuild)
   --------------------------------------------------------------------------- */
.ves-wrap.fi-shell .ves-topbar,
.ves-wrap.fi-shell .fi-topbar {
    background: var(--fi6-paper) !important;
    border-bottom: 1px solid var(--fi6-line) !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    padding: 12px 22px !important;
    gap: 16px !important;
    min-height: 60px;
}

.ves-wrap.fi-shell .ves-topbar-left { gap: 14px !important; min-width: 0; }

/* Brand-first breadcrumb: wordmark never clipped, calm separators. */
.ves-wrap.fi-shell .ves-breadcrumbs,
.ves-wrap.fi-shell .fi-breadcrumb {
    min-width: 0;
    overflow: visible;
    flex-wrap: nowrap;
}
.ves-wrap.fi-shell .ves-breadcrumb-root {
    font-weight: 800 !important;
    letter-spacing: .14em !important;
    text-transform: uppercase;
    font-size: 12.5px !important;
    color: var(--fi6-ink) !important;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
    flex: 0 0 auto;
}
.ves-wrap.fi-shell .ves-breadcrumb-group { color: var(--fi6-muted) !important; font-weight: 600; }
.ves-wrap.fi-shell .ves-breadcrumb-current {
    color: var(--fi6-ink) !important;
    font-weight: 700 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 38vw;
}
.ves-wrap.fi-shell .ves-breadcrumb-sep { color: var(--fi6-line) !important; }

/* The generic SaaS search bar no longer dominates the header: collapse it to a
   single, quiet ⌘K affordance. */
.ves-wrap.fi-shell .ves-topbar-search {
    background: transparent !important;
    border: 1px solid var(--fi6-line) !important;
    border-radius: 999px !important;
    box-shadow: none !important;
    padding: 7px 10px !important;
    gap: 6px;
    color: var(--fi6-muted) !important;
    max-width: 220px;
}
.ves-wrap.fi-shell .ves-topbar-search-label {
    color: var(--fi6-muted) !important;
    font-size: 12.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
@media (max-width: 1180px) {
    .ves-wrap.fi-shell .ves-topbar-search-label { display: none; }
    .ves-wrap.fi-shell .ves-topbar-search kbd { display: none; }
    .ves-wrap.fi-shell .ves-topbar-search { max-width: none; padding: 7px !important; }
}

.ves-wrap.fi-shell .ves-topbar-right { gap: 10px !important; }

/* Quiet icon + pill controls — premium, not bright generic SaaS. */
.ves-wrap.fi-shell .ves-topbar-icon-btn,
.ves-wrap.fi-shell .ves-notif-btn {
    background: transparent !important;
    border: 1px solid var(--fi6-line) !important;
    border-radius: 10px !important;
    box-shadow: none !important;
    color: var(--fi6-muted) !important;
}
.ves-wrap.fi-shell .ves-ui-language-switcher {
    background: transparent !important;
    border: 1px solid var(--fi6-line) !important;
    border-radius: 10px !important;
    color: var(--fi6-ink) !important;
    padding: 4px 8px !important;
}
.ves-wrap.fi-shell .ves-ui-language { color: var(--fi6-ink) !important; background: transparent !important; }

/* Run state pill — clear, calm states (Ready / Running / Completed). */
.ves-wrap.fi-shell .ves-run-state {
    background: var(--fi6-paper) !important;
    border: 1px solid var(--fi6-line) !important;
    border-radius: 999px !important;
    box-shadow: none !important;
    padding: 6px 12px !important;
    font-weight: 600;
    color: var(--fi6-ink) !important;
}
.ves-wrap.fi-shell .ves-run-state .ves-run-state-dot { background: var(--fi6-muted); }
.ves-wrap.fi-shell .ves-run-state.is-running { border-color: rgba(36,88,211,.35) !important; }
.ves-wrap.fi-shell .ves-run-state.is-running .ves-run-state-dot { background: var(--fi6-blue); }
.ves-wrap.fi-shell .ves-run-state.is-success { border-color: rgba(31,143,90,.35) !important; }
.ves-wrap.fi-shell .ves-run-state.is-success .ves-run-state-dot { background: #1f8f5a; }
.ves-wrap.fi-shell .ves-run-state.is-error { border-color: rgba(255,90,47,.45) !important; }
.ves-wrap.fi-shell .ves-run-state.is-error .ves-run-state-dot { background: var(--fi6-orange); }

/* Credits pill — compact, not a primary visual element. */
.ves-wrap.fi-shell .ves-credit-pill {
    background: transparent !important;
    border: 1px solid var(--fi6-line) !important;
    border-radius: 999px !important;
    box-shadow: none !important;
    color: var(--fi6-ink) !important;
    padding: 6px 12px !important;
}
.ves-wrap.fi-shell .ves-credit-pill-value { font-weight: 800; color: var(--fi6-ink) !important; }
.ves-wrap.fi-shell .ves-credit-pill-label { color: var(--fi6-muted) !important; }

.ves-wrap.fi-shell .ves-user-avatar {
    background: var(--fi6-ink) !important;
    border: 0 !important;
    box-shadow: none !important;
    color: var(--fi6-paper) !important;
}
.ves-wrap.fi-shell .ves-user-avatar-initials { color: var(--fi6-paper) !important; font-weight: 700; }

/* ---------------------------------------------------------------------------
   2) SIDEBAR — quieter, premium, de-cluttered
   --------------------------------------------------------------------------- */
.ves-wrap.fi-shell .ves-sidebar,
.ves-wrap.fi-shell .fi-sidebar {
    background: var(--fi6-paper) !important;
    border-right: 1px solid var(--fi6-line) !important;
    box-shadow: none !important;
}
.ves-wrap.fi-shell .ves-sidebar-head {
    padding: 16px 16px 12px !important;
    border-bottom: 1px solid var(--fi6-line-soft) !important;
}
.ves-wrap.fi-shell .ves-workspace-switcher { gap: 10px; }
.ves-wrap.fi-shell .ves-logo {
    background: var(--fi6-ink) !important;
    color: var(--fi6-paper) !important;
    border-radius: 10px !important;
    width: 34px; height: 34px;
    font-weight: 800;
    box-shadow: none !important;
}
/* Brand wordmark must not clip. */
.ves-wrap.fi-shell .ves-workspace-text { min-width: 0; }
.ves-wrap.fi-shell .ves-workspace-text strong {
    display: block;
    font-size: 13.5px;
    font-weight: 800;
    letter-spacing: .01em;
    color: var(--fi6-ink) !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* Project badge — refined, not a raw beige chip. */
.ves-wrap.fi-shell .ves-current-project-pill {
    background: transparent !important;
    border: 1px solid var(--fi6-line) !important;
    border-radius: 999px !important;
    color: var(--fi6-muted) !important;
    font-size: 11px;
    padding: 1px 8px !important;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Nav groups: fewer dividers, calm labels. */
.ves-wrap.fi-shell .ves-nav-group {
    border-bottom: 0 !important;
    padding: 6px 10px !important;
}
.ves-wrap.fi-shell .ves-nav-group + .ves-nav-group { margin-top: 2px; }
.ves-wrap.fi-shell .ves-sidebar-section-label {
    color: var(--fi6-muted) !important;
    letter-spacing: .16em !important;
    font-size: 10.5px !important;
    font-weight: 700;
    opacity: .85;
    padding: 6px 8px 4px !important;
}
.ves-wrap.fi-shell .ves-nav-item {
    border-radius: 10px !important;
    min-height: 36px !important;
    color: var(--fi6-ink) !important;
    font-weight: 500;
    gap: 10px;
}
.ves-wrap.fi-shell .ves-nav-ico-wrap { color: var(--fi6-muted) !important; opacity: .9; }
.ves-wrap.fi-shell .ves-nav-ico { width: 17px; height: 17px; }
.ves-wrap.fi-shell .ves-nav-item:hover { background: rgba(16,16,16,.045) !important; }
/* Elegant active state — ink wash, not a bright SaaS-blue pill. */
.ves-wrap.fi-shell .ves-nav-item.is-active {
    background: rgba(16,16,16,.92) !important;
    color: var(--fi6-paper) !important;
    box-shadow: none !important;
}
.ves-wrap.fi-shell .ves-nav-item.is-active .ves-nav-ico-wrap,
.ves-wrap.fi-shell .ves-nav-item.is-active .ves-nav-label { color: var(--fi6-paper) !important; opacity: 1; }
.ves-wrap.fi-shell .ves-nav-item.is-active::before { display: none !important; }

/* Bottom credits widget — compact and never clipped. */
.ves-wrap.fi-shell .ves-sidebar-credits {
    background: transparent !important;
    border: 1px solid var(--fi6-line) !important;
    border-radius: 12px !important;
    box-shadow: none !important;
    margin: 8px 12px 12px !important;
    padding: 10px 12px !important;
}
.ves-wrap.fi-shell .ves-sidebar-credits-label { color: var(--fi6-muted) !important; }
.ves-wrap.fi-shell .ves-sidebar-credits-value { color: var(--fi6-ink) !important; font-weight: 800; }
.ves-wrap.fi-shell .ves-sidebar-credits-bar { background: rgba(16,16,16,.08) !important; }
.ves-wrap.fi-shell .ves-sidebar-credits-bar > span { background: var(--fi6-blue) !important; }
.ves-wrap.fi-shell .ves-sidebar-foot { border-top: 1px solid var(--fi6-line-soft) !important; }
.ves-wrap.fi-shell .ves-cmdk-btn {
    background: transparent !important;
    border: 1px solid var(--fi6-line) !important;
    box-shadow: none !important;
    color: var(--fi6-muted) !important;
}

/* ---------------------------------------------------------------------------
   3) MAIN CONTENT — remove panel-in-panel boxing
   --------------------------------------------------------------------------- */
.ves-wrap.fi-shell .ves-page-body { background: var(--fi6-bg) !important; }

/* One calm command canvas instead of a heavy beige card with a gradient. */
.ves-wrap.fi-shell .ves-card,
.ves-wrap.fi-shell .ves-command-center-card,
.ves-wrap.fi-shell .fi-command-canvas {
    background: var(--fi6-paper) !important;
    background-image: none !important;
    border: 1px solid var(--fi6-line) !important;
    border-radius: var(--fi6-radius-lg) !important;
    box-shadow: none !important;
}

/* Inner sub-panels become quiet sections, not nested cards. */
.ves-wrap.fi-shell .fi-evidence-drawer,
.ves-wrap.fi-shell .fiis-scan-intro,
.ves-wrap.fi-shell .ves-advanced-panel {
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}
.ves-wrap.fi-shell .fiis-scan-intro,
.ves-wrap.fi-shell .ves-advanced-panel {
    border-top: 1px solid var(--fi6-line-soft) !important;
    padding-top: 14px !important;
}
/* The acquisition-plan preview reads as a subtle strip, not a beige-in-beige box. */
.ves-wrap.fi-shell .fiis-rc4-search-plan-preview,
.ves-wrap.fi-shell .fiis-rc5-acquisition-route {
    background: #f7f3ea !important;
    border: 1px solid var(--fi6-line-soft) !important;
    border-radius: var(--fi6-radius-md) !important;
    box-shadow: none !important;
}
.ves-wrap.fi-shell .fiis-results-region {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
}
.ves-wrap.fi-shell .fiis-eyebrow { color: var(--fi6-muted) !important; letter-spacing: .16em; }

/* ---------------------------------------------------------------------------
   4) RESULTS — premium grid, no giant default video
   --------------------------------------------------------------------------- */
.ves-wrap.fi-shell .ves-result-card {
    background: var(--fi6-paper) !important;
    border: 1px solid var(--fi6-line) !important;
    border-radius: var(--fi6-radius-md) !important;
    box-shadow: none !important;
}
.ves-wrap.fi-shell .ves-items {
    grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)) !important;
    gap: 14px !important;
}
.ves-wrap.fi-shell .ves-item {
    background: var(--fi6-paper) !important;
    border: 1px solid var(--fi6-line) !important;
    border-radius: var(--fi6-radius-md) !important;
    box-shadow: none !important;
    overflow: hidden;
}
.ves-wrap.fi-shell .ves-item:hover { border-color: rgba(16,16,16,.22) !important; }
/* Stop the forced 16/9 giant media; thumbnails stay compact in the card. */
.ves-wrap.fi-shell .ves-item .ves-thumb,
.ves-wrap.fi-shell .ves-item .ves-thumb.has-media {
    aspect-ratio: auto !important;
    height: 150px !important;
    max-height: 150px !important;
    border-radius: 10px !important;
    overflow: hidden;
}
.ves-wrap.fi-shell .ves-item .ves-thumb img,
.ves-wrap.fi-shell .ves-item .ves-thumb video {
    width: 100%; height: 100%;
    object-fit: cover;
}
.ves-wrap.fi-shell .ves-title2 { color: var(--fi6-ink) !important; font-weight: 700; }
.ves-wrap.fi-shell .ves-relevance-badge { box-shadow: none !important; }

/* Batch insight + discard transparency — flat editorial blocks. */
.ves-wrap.fi-shell .fiis-rc5-batch-insight,
.ves-wrap.fi-shell .fiis-rc5-discard-summary {
    background: var(--fi6-paper) !important;
    border: 1px solid var(--fi6-line) !important;
    border-radius: var(--fi6-radius-md) !important;
    box-shadow: none !important;
}
.ves-wrap.fi-shell .fiis-rc5-query-row { border-color: var(--fi6-line-soft) !important; }

/* Selected-item drawer — larger media lives HERE, not in the default grid. */
.ves-wrap.fi-shell .fiis-rc5-detail-drawer,
.ves-wrap.fi-shell .ves-item-panel {
    background: var(--fi6-paper) !important;
    border: 1px solid var(--fi6-line) !important;
    border-radius: var(--fi6-radius-lg) !important;
    box-shadow: 0 18px 44px rgba(16,16,16,.10) !important;
}

/* ---------------------------------------------------------------------------
   5) REPORT — editorial decision memo
   --------------------------------------------------------------------------- */
.ves-wrap.fi-shell .ves-report-container {
    background: var(--fi6-paper) !important;
    border: 1px solid var(--fi6-line) !important;
    border-radius: var(--fi6-radius-lg) !important;
    box-shadow: none !important;
    padding: clamp(20px, 3vw, 36px) !important;
}
.ves-wrap.fi-shell .ves-report-container h1,
.ves-wrap.fi-shell .ves-report-container h2,
.ves-wrap.fi-shell .ves-report-container h3 {
    color: var(--fi6-ink) !important;
    letter-spacing: -.01em;
    line-height: 1.2;
}
.ves-wrap.fi-shell .ves-report-container p,
.ves-wrap.fi-shell .ves-report-container li {
    color: #232323 !important;
    font-size: 15px !important;
    line-height: 1.62 !important;
}
.ves-wrap.fi-shell .ves-report-container hr { border-color: var(--fi6-line) !important; }

/* ---------------------------------------------------------------------------
   6) Buttons — one confident primary, blue reserved for the route/action
   --------------------------------------------------------------------------- */
.ves-wrap.fi-shell .ves-btn-primary {
    background: var(--fi6-blue) !important;
    border: 0 !important;
    box-shadow: none !important;
    color: #fff !important;
}
.ves-wrap.fi-shell .ves-btn-primary:hover { filter: brightness(.96); }
.ves-wrap.fi-shell .ves-btn-secondary {
    background: transparent !important;
    border: 1px solid var(--fi6-line) !important;
    color: var(--fi6-ink) !important;
    box-shadow: none !important;
}
/* Inline-secondary the "Mejorar" refine buttons so fields breathe. */
.ves-wrap.fi-shell .ves-ai-refine-button {
    background: transparent !important;
    border: 1px solid var(--fi6-line) !important;
    color: var(--fi6-muted) !important;
    box-shadow: none !important;
    font-weight: 600;
}

/* Tame stray inner scrollbars created by fixed-height nested panels. */
.ves-wrap.fi-shell .fi-command-canvas,
.ves-wrap.fi-shell .fiis-results-region,
.ves-wrap.fi-shell .ves-results { overflow: visible !important; }

/* ---------------------------------------------------------------------------
   v1.5.0-rc.7 — Run Truth panel (admin-only diagnostics below Results)
   --------------------------------------------------------------------------- */
.ves-wrap.fi-shell .fiis-run-truth {
    margin-top: 14px;
    border: 1px solid var(--fi6-line);
    border-radius: var(--fi6-radius-md);
    background: #faf7f0;
    padding: 12px 14px;
    font-size: 12px;
    color: var(--fi6-ink);
}
.ves-wrap.fi-shell .fiis-run-truth-head {
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    font-size: 11px;
    margin-bottom: 10px;
}
.ves-wrap.fi-shell .fiis-run-truth-head span { color: var(--fi6-muted); font-weight: 600; text-transform: none; letter-spacing: 0; }
.ves-wrap.fi-shell .fiis-run-truth-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}
.ves-wrap.fi-shell .fiis-run-truth-kpi {
    border: 1px solid var(--fi6-line-soft);
    border-radius: 8px;
    background: var(--fi6-paper);
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.ves-wrap.fi-shell .fiis-run-truth-kpi span { color: var(--fi6-muted); font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }
.ves-wrap.fi-shell .fiis-run-truth-kpi strong { font-size: 14px; }
.ves-wrap.fi-shell .fiis-run-truth-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.ves-wrap.fi-shell .fiis-run-truth-table th,
.ves-wrap.fi-shell .fiis-run-truth-table td { text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--fi6-line-soft); }
.ves-wrap.fi-shell .fiis-run-truth-table th { color: var(--fi6-muted); font-weight: 600; }
.ves-wrap.fi-shell .fiis-run-truth-next { margin-top: 8px; color: var(--fi6-blue); font-weight: 600; }
