/* Nix4Nix.nl — JetBrains New UI / "Islands" Developer Instrument Theme */

:root {
    /* Light Mode: JetBrains Light / Crisp Engineering Palette */
    --jb-canvas-bg: #F5F6F8;
    --jb-canvas-dot: rgba(0, 0, 0, 0.04);
    --jb-island-bg: #FFFFFF;
    --jb-island-border: #DFE1E5;
    --jb-island-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    --jb-nested-bg: #F8F9FB;
    --jb-nested-border: #EBECF0;
    --jb-input-bg: #F7F8FA;
    --jb-input-border: #DFE1E5;
    --jb-text-primary: #1E1F22;
    --jb-text-heading: #1E1F22;
    --jb-text-muted: #6C707E;
    --jb-accent: #3574F0;
    --jb-accent-hover: #2B62D6;
    --jb-green: #57965C;
    --jb-amber: #E0861F;
    --jb-lavender: #C77DBB;
    --jb-range-track: #DFE1E5;
    --jb-row-hover: rgba(53, 116, 240, 0.04);
}

html.dark {
    /* Dark Mode: JetBrains Dark / "Islands" Palette */
    --jb-canvas-bg: #1E1F22;
    --jb-canvas-dot: rgba(255, 255, 255, 0.035);
    --jb-island-bg: #2B2D30;
    --jb-island-border: #393B40;
    --jb-island-shadow: none;
    --jb-nested-bg: #232528;
    --jb-nested-border: #323438;
    --jb-input-bg: #1E1F22;
    --jb-input-border: #393B40;
    --jb-text-primary: #BCBEC4;
    --jb-text-heading: #FFFFFF;
    --jb-text-muted: #6F737A;
    --jb-accent: #3574F0;
    --jb-accent-hover: #4682FA;
    --jb-green: #57965C;
    --jb-amber: #E0861F;
    --jb-lavender: #C77DBB;
    --jb-range-track: #393B40;
    --jb-row-hover: rgba(255, 255, 255, 0.03);
}

html, body {
    margin: 0;
    padding: 0;
    background-color: var(--jb-canvas-bg);
    color: var(--jb-text-primary);
}

/* 16px × 16px Engineering Dot-Grid Canvas */
.jb-canvas {
    background-color: var(--jb-canvas-bg);
    background-image: radial-gradient(var(--jb-canvas-dot) 1px, transparent 1px);
    background-size: 16px 16px;
    color: var(--jb-text-primary);
}

/* JetBrains "Island" Card Surface */
.jb-island {
    background-color: var(--jb-island-bg);
    border: 1px solid var(--jb-island-border);
    box-shadow: var(--jb-island-shadow);
}

/* Strictly flat islands in Dark Mode (zero blurry drop shadows) */
html.dark .shadow-xs,
html.dark .shadow-sm,
html.dark .shadow-md,
html.dark .jb-island {
    box-shadow: none !important;
}

/* Nested Surface (KPI readout boxes, table headers, <details> formula panels) */
.jb-nested {
    background-color: var(--jb-nested-bg);
    border: 1px solid var(--jb-nested-border);
}

/* Primary KPI Output Card with 3px JetBrains Cobalt Left Accent Border */
.jb-kpi-primary {
    background-color: var(--jb-nested-bg);
    border: 1px solid var(--jb-nested-border);
    border-left: 3px solid var(--jb-accent);
    box-shadow: var(--jb-island-shadow);
}

.jb-kpi-secondary {
    background-color: var(--jb-island-bg);
    border: 1px solid var(--jb-island-border);
    border-left: 3px solid var(--jb-island-border);
    box-shadow: var(--jb-island-shadow);
}

/* Monospace Tabular Numbers */
.font-mono-num,
.tabular-nums {
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-variant-numeric: tabular-nums;
}

/* Crisp 6px Recessed Inputs & Selects with Sharp 2px #3574F0 Focus Ring */
.jb-input-box {
    background-color: var(--jb-input-bg);
    border: 1px solid var(--jb-input-border);
    border-radius: 6px;
    transition: border-color 120ms ease, outline 120ms ease;
}

.jb-input-box:focus-within {
    border-color: var(--jb-accent);
    outline: 2px solid var(--jb-accent);
    outline-offset: -1px;
}

input[type="number"],
select.jb-select {
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-variant-numeric: tabular-nums;
}

select {
    border-radius: 6px;
    background-color: var(--jb-input-bg);
    border: 1px solid var(--jb-input-border);
}

select:focus,
input[type="search"]:focus,
input[type="text"]:focus,
textarea:focus {
    border-color: var(--jb-accent) !important;
    outline: 2px solid var(--jb-accent) !important;
    outline-offset: -1px;
    box-shadow: none !important;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    opacity: 1;
}

/* Sleek 4px Track & Square-Rounded (4px) #3574F0 Thumb for Range Sliders */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: var(--jb-range-track);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
    height: 4px;
    background: var(--jb-range-track);
    border-radius: 2px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 4px;
    background: var(--jb-accent);
    border: 1px solid rgba(255, 255, 255, 0.35);
    margin-top: -5px;
    cursor: pointer;
    transition: background-color 120ms ease, transform 120ms ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: var(--jb-accent-hover);
}

input[type="range"]:focus-visible::-webkit-slider-thumb {
    outline: 2px solid var(--jb-accent);
    outline-offset: 2px;
}

input[type="range"]::-moz-range-track {
    height: 4px;
    background: var(--jb-range-track);
    border-radius: 2px;
}

input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    background: var(--jb-accent);
    border: 1px solid rgba(255, 255, 255, 0.35);
    cursor: pointer;
    transition: background-color 120ms ease;
}

input[type="range"]::-moz-range-thumb:hover {
    background: var(--jb-accent-hover);
}

/* IDE Status-Bar Style 4px-Radius Monospace Pills */
.jb-pill-lavender {
    border-radius: 4px;
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    background-color: rgba(199, 125, 187, 0.12);
    color: #9A4B8E;
    border: 1px solid rgba(199, 125, 187, 0.35);
}

html.dark .jb-pill-lavender {
    background-color: rgba(199, 125, 187, 0.14);
    color: #C77DBB;
    border: 1px solid rgba(199, 125, 187, 0.32);
}

.jb-pill-green {
    border-radius: 4px;
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    background-color: rgba(87, 150, 92, 0.12);
    color: #3B7340;
    border: 1px solid rgba(87, 150, 92, 0.35);
}

html.dark .jb-pill-green {
    background-color: rgba(87, 150, 92, 0.16);
    color: #6AAB73;
    border: 1px solid rgba(87, 150, 92, 0.35);
}

.jb-pill-amber {
    border-radius: 4px;
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    background-color: rgba(224, 134, 31, 0.12);
    color: #B4650E;
    border: 1px solid rgba(224, 134, 31, 0.35);
}

html.dark .jb-pill-amber {
    background-color: rgba(224, 134, 31, 0.16);
    color: #E0861F;
    border: 1px solid rgba(224, 134, 31, 0.35);
}

.jb-pill-cobalt {
    border-radius: 4px;
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    background-color: rgba(53, 116, 240, 0.12);
    color: #2B62D6;
    border: 1px solid rgba(53, 116, 240, 0.32);
}

html.dark .jb-pill-cobalt {
    background-color: rgba(53, 116, 240, 0.18);
    color: #5C92FA;
    border: 1px solid rgba(53, 116, 240, 0.38);
}

/* Breakdown Table Headers & Rows: Nested Header, Crisp 1px Horizontal Hairlines & Hover Highlighting */
div.space-y-2\.5 > h3,
div.space-y-2 > h3,
.jb-table-header {
    background-color: var(--jb-nested-bg);
    border: 1px solid var(--jb-nested-border);
    padding: 0.45rem 0.65rem;
    border-radius: 4px;
    margin-bottom: 0.35rem;
}

.jb-breakdown-table > div.flex.justify-between,
div.space-y-2\.5 > div.flex.justify-between,
div.space-y-2 > div.flex.justify-between {
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid var(--jb-nested-border);
    border-radius: 3px;
    transition: background-color 100ms ease;
}

.jb-breakdown-table > div.flex.justify-between > span:last-child,
div.space-y-2\.5 > div.flex.justify-between > span:last-child,
div.space-y-2 > div.flex.justify-between > span:last-child {
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.jb-breakdown-table > div.flex.justify-between:hover,
div.space-y-2\.5 > div.flex.justify-between:hover,
div.space-y-2 > div.flex.justify-between:hover {
    background-color: var(--jb-row-hover);
}

details > summary {
    list-style: none;
}

details > summary::-webkit-details-marker {
    display: none;
}

#blazor-error-ui {
    background: #fef2f2;
    color: #991b1b;
    bottom: 0;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.15);
    display: none;
    left: 0;
    padding: 0.75rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

.jb-card-clickable {
    position: relative;
    cursor: pointer;
}

.jb-stretched-link::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
}

.jb-card-clickable:hover .jb-stretched-link {
    color: var(--jb-accent);
}

.jb-card-action {
    position: relative;
    z-index: 2;
}
