/* Sidebar and UI panel styles */
.sidebar {
    position: fixed;
    left: 0;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
    width: 320px;
    background: rgba(14, 14, 22, 0.95);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(16px);
    z-index: 999;
    transform: translateX(0);
    transition: width 0.3s ease-in-out, background 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}



.sidebar:not(.open) {
    width: 72px;
}

.sidebar.open {
    width: 320px;
}

.sidebar-header {
    flex-shrink: 0;
    height: 80px;
    background: rgba(20, 20, 30, 0.9);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar:not(.open) .sidebar-header,
.sidebar:not(.open) .sidebar-content {
    padding-left: 12px;
    padding-right: 12px;
}

.sidebar-toggle {
    position: fixed;
    left: 16px;
    top: calc(var(--header-height) + 16px);
    width: 44px;
    height: 44px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(20, 20, 30, 0.85);
    backdrop-filter: blur(8px);
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, border-color 0.2s, transform 0.3s;
    z-index: 1000;
    font-size: 20px;
    padding: 0;
}

.sidebar-toggle:hover {
    color: #38b6ff;
    border-color: rgba(56, 182, 255, 0.4);
}

.sidebar-toggle.no-border {
    border: none;
}

.sidebar:not(.open) .sidebar-header,
.sidebar:not(.open) .sidebar-content {
    opacity: 0;
}

.sidebar.open .sidebar-header,
.sidebar.open .sidebar-content {
    opacity: 1;
    transition: opacity 0.05s ease-in 0.25s;
}

.sidebar-content {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
}

.sidebar-title {
    display: block;
    font-size: 1.25rem;
    font-family: 'Roboto';
    font-weight: 600;
    color: #f5f5f5;
    text-align: center;
}

.panel-card {
    background: rgba(16, 20, 30, 0.96);
    border: 1px solid rgba(201, 168, 76, 0.14);
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.24);
    padding: 22px 20px;
    color: #e7e1cf;
}

.panel-card-empty {
    text-align: center;
    opacity: 0.9;
}

.panel-card-name {
    margin-bottom: 12px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: #c9a84c;
}

.panel-card-time {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
    color: #c5b78a;
    font-size: 14px;
}

.panel-card-time span {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

.panel-card-time strong {
    color: #f5e8bc;
    font-weight: 600;
}

.ah-time {
    color: #4caf50;
}

.panel-card-desc {
    margin-bottom: 12px;
    line-height: 1.75;
    color: #d7d4c4;
    font-size: 14px;
}

.panel-section {
    margin-bottom: 16px;
}

.panel-section-label {
    font-size: 0.85rem;
    color: #a89f8a;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 8px;
    font-weight: 600;
}

.panel-links {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.panel-link {
    font-size: 0.9rem;
    color: #b8a67a;
    cursor: pointer;
    transition: color 0.2s;
    font-style: italic;
}

.panel-link:hover {
    color: #f5e8bc;
}

/* ─── What If Analysis Panel ─── */
/*
    Color theory: true gold lives around hsl(42, 80%, 52%).
    To make it read as "precious" rather than "lemon" we:
      1. Use a very dark cool-navy base (#0d0f1a) — cool undertone pushes
         the warm gold further toward amber, away from citrus.
      2. Pair with deep crimson (#8b1a1a range) for the erased/danger
         accents — gold + crimson = imperial, not neon.
      3. Keep supporting text in warm parchment (#c8b89a) rather than
         white, which would desaturate the gold by contrast.
*/

.what-if-analysis {
    background: rgba(10, 11, 20, 0.98);
    border-color: rgba(185, 145, 55, 0.3);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(185, 145, 55, 0.12);
}

.what-if-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(185, 145, 55, 0.18);
}

.what-if-label {
    font-family: 'Courier New', monospace;
    font-size: 9px;
    letter-spacing: 0.22em;
    color: rgba(185, 145, 55, 0.55);
    margin-bottom: 6px;
    font-weight: 700;
    text-transform: uppercase;
}

.what-if-title {
    font-size: 14px;
    font-weight: 600;
    color: #c8b89a;
    line-height: 1.55;
}

.what-if-title em {
    /* True amber-gold — hsl(42, 78%, 56%) */
    color: #c9913a;
    font-style: italic;
    font-weight: 700;
    text-shadow: 0 0 18px rgba(185, 125, 40, 0.45);
}

.impact-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    padding: 11px 14px;
    background: rgba(185, 130, 40, 0.07);
    border-radius: 10px;
    border: 1px solid rgba(185, 130, 40, 0.18);
}

.impact-number {
    font-size: 30px;
    font-weight: 700;
    /* Warm amber, not greenish yellow */
    color: #c9913a;
    line-height: 1;
}

.impact-text {
    font-size: 13px;
    color: #8a7d66;
}

.impact-time {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    font-size: 13px;
    color: #7a7060;
}

.impact-time strong {
    color: #b09060;
    font-weight: 600;
}

.erased-section-label {
    /* Slightly desaturated gold so it doesn't compete with the number */
    color: rgba(185, 145, 65, 0.75) !important;
}

.erased-list-scroll {
    max-height: 220px;
    overflow-y: auto;
    overflow-x: hidden;
    border-radius: 8px;
    padding-right: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(185, 130, 50, 0.25) transparent;
}

.erased-list-scroll::-webkit-scrollbar {
    width: 4px;
}

.erased-list-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.erased-list-scroll::-webkit-scrollbar-thumb {
    background: rgba(185, 130, 50, 0.25);
    border-radius: 2px;
}

.erased-list-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(185, 130, 50, 0.5);
}

.erased-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.erased-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 7px;
    /* Cool dark background keeps the crimson accent vivid */
    background: rgba(120, 20, 20, 0.12);
    border: 1px solid rgba(160, 40, 40, 0.18);
    font-size: 13px;
    transition: background 0.15s;
}

.erased-item:hover {
    background: rgba(120, 20, 20, 0.2);
}

.erased-item.erased-root {
    background: rgba(140, 20, 20, 0.22);
    border-color: rgba(190, 50, 50, 0.32);
}

.erased-bullet {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    /* Deep crimson, not cartoon red */
    background: rgb(185, 55, 55);
    flex-shrink: 0;
    box-shadow: 0 0 5px rgba(185, 55, 55, 0.4);
}

.erased-root .erased-bullet {
    background: rgb(210, 65, 65);
    box-shadow: 0 0 8px rgba(210, 65, 65, 0.6);
}

.erased-name {
    color: #c0ae96;
    flex: 1;
}

.erased-root .erased-name {
    font-weight: 600;
    color: #d4bfa0;
}

.erased-year {
    color: #6a6050;
    font-size: 11px;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.04em;
}

.what-if-reset-btn {
    width: 100%;
    margin-top: 16px;
    padding: 10px;
    border-radius: 10px;
    /* Amber-gold border, cool dark fill */
    border: 1px solid rgba(185, 130, 50, 0.35);
    background: rgba(185, 120, 30, 0.08);
    color: #c9913a;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0.04em;
    transition: background 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
}

.what-if-reset-btn:hover {
    background: rgba(185, 120, 30, 0.16);
    border-color: rgba(185, 130, 50, 0.6);
    color: #d9a550;
    box-shadow: 0 0 12px rgba(185, 120, 30, 0.2);
}
/* ─── Cause / Effect section labels ─────────────────────────────────────────── */
/*
   Colour theory rationale:
   - Base palette: warm gold (#c9a84c), dark navy bg.
   - Causes ("led to this") = origin/past → cool steel blue hsl(210,58%,52%).
     Blue recedes visually, reinforcing the idea of something behind/before.
   - Effects ("rippled into") = consequence/future → teal hsl(178,52%,44%).
     Teal advances slightly, feels active/forward-moving, and bridges the
     cool blue toward the existing gold accent without fighting either.
   Both desaturate slightly from pure hues so they read as *UI chrome*,
   not neon — keeping the dark aesthetic intact.
*/

.panel-section-label--cause {
    color: hsl(210, 58%, 62%) !important;
    letter-spacing: 0.06em;
}

.panel-section-label--effect {
    color: hsl(178, 52%, 52%) !important;
    letter-spacing: 0.06em;
}

.panel-section-icon {
    font-style: normal;
    opacity: 0.7;
    margin-right: 2px;
}

/* Cause links: steel blue */
.panel-link--cause {
    color: hsl(210, 45%, 58%) !important;
    border-left: 2px solid hsla(210, 58%, 52%, 0.3);
    padding-left: 8px;
    border-radius: 0 4px 4px 0;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.panel-link--cause:hover {
    color: hsl(210, 72%, 75%) !important;
    border-left-color: hsla(210, 72%, 62%, 0.7);
    background: hsla(210, 60%, 52%, 0.08);
}

/* Effect links: teal */
.panel-link--effect {
    color: hsl(178, 42%, 52%) !important;
    border-left: 2px solid hsla(178, 52%, 44%, 0.3);
    padding-left: 8px;
    border-radius: 0 4px 4px 0;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.panel-link--effect:hover {
    color: hsl(178, 60%, 68%) !important;
    border-left-color: hsla(178, 60%, 50%, 0.7);
    background: hsla(178, 52%, 44%, 0.08);
}
/* ─── Link Info Panel ─── */
.panel-card-link {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.panel-link-flow {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 4px 0 8px;
    border-bottom: 1px solid rgba(201, 168, 76, 0.12);
}

.panel-link-node {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.18s;
}

.panel-link-node--cause {
    background: hsla(210, 60%, 52%, 0.07);
    border: 1px solid hsla(210, 60%, 52%, 0.2);
}

.panel-link-node--cause:hover {
    background: hsla(210, 60%, 52%, 0.14);
}

.panel-link-node--effect {
    background: hsla(178, 52%, 44%, 0.07);
    border: 1px solid hsla(178, 52%, 44%, 0.2);
}

.panel-link-node--effect:hover {
    background: hsla(178, 52%, 44%, 0.14);
}

.panel-link-arrow-label {
    font-family: 'Courier New', monospace;
    font-size: 0.52rem;
    letter-spacing: 0.18em;
    font-weight: 700;
    text-transform: uppercase;
}

.panel-link-node--cause .panel-link-arrow-label {
    color: hsl(210, 58%, 62%);
}

.panel-link-node--effect .panel-link-arrow-label {
    color: hsl(178, 52%, 52%);
}

.panel-link-node-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: #d4c9ae;
    line-height: 1.3;
}

.panel-link-node-year {
    font-family: 'Courier New', monospace;
    font-size: 0.6rem;
    color: rgba(255,255,255,0.3);
    letter-spacing: 0.05em;
}

.panel-link-connector {
    display: flex;
    align-items: center;
    padding: 6px 18px;
    gap: 0;
}

.panel-link-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, hsl(210,58%,52%), hsl(178,52%,44%));
    opacity: 0.4;
}

.panel-link-arrowhead {
    font-size: 1rem;
    color: #c9a84c;
    margin-left: 4px;
    margin-right: 4px;
    line-height: 1;
    text-shadow: 0 0 8px rgba(201,168,76,0.5);
}

.panel-link-desc-label {
    color: rgba(201, 168, 76, 0.65) !important;
    letter-spacing: 0.1em;
    font-size: 0.75rem;
}