/* RazorCharts. Chart colors are --rc-* variables. Most map to the host's theme variables, with the
   portal's light values as fallbacks, so charts follow light and dark mode with the page. */

:root {
    --rc-primary: var(--color-primary, #00857c);
    --rc-good: var(--color-success, #22a06b);
    --rc-poor: var(--color-error, #de350b);
    --rc-warn: var(--color-warning, #c27b00);
    --rc-muted: var(--color-text-muted, #6b8382);
    --rc-text: var(--color-text-primary, #1a2e2d);
    --rc-text-secondary: var(--color-text-secondary, #4a6463);
    --rc-grid: var(--color-border-light, #e8eeee);
    --rc-axis: var(--color-text-muted, #6b8382);
    --rc-surface: var(--color-bg-surface, #ffffff);
    --rc-band: var(--color-bg-muted, #f1f5f5);
    --rc-accent: #3b6ea8;
    --rc-neutral: #9fb3b1;
    --rc-purple: #7a5195;
    /* Chrome around charts: cards, menus, panes, tooltips. */
    --rc-elevated: var(--color-bg-elevated, #ffffff);
    --rc-border: var(--color-border, #d4e0df);
    --rc-hover: var(--color-bg-muted, #f1f5f5);
    --rc-shadow: 0 6px 20px rgba(0, 0, 0, .18);
}

[data-theme="dark"] {
    --rc-accent: #6b9be0;
    --rc-neutral: #7f9896;
    --rc-purple: #b48ad6;
}

.rc-chart {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
}

.rc-chart svg {
    display: block;
}

.rc-chart .rc-mk {
    cursor: pointer;
}

/* Labels drawn over bars must not catch the pointer meant for the bar under them. */
.rc-chart svg text:not(.rc-mk) {
    pointer-events: none;
}

.rc-chart-message {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--rc-muted);
    font-size: 13px;
}

.rc-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--rc-grid);
    border-top-color: var(--rc-primary);
    border-radius: 50%;
    animation: rc-spin 0.8s linear infinite;
}

@keyframes rc-spin {
    to { transform: rotate(360deg); }
}

/* Tooltip (one per page, on body) */
.rc-tip {
    position: fixed;
    z-index: 1100;
    pointer-events: none;
    display: none;
    min-width: 150px;
    padding: 8px 10px;
    background: var(--rc-elevated);
    color: var(--rc-text);
    border: 1px solid var(--rc-border);
    border-radius: 8px;
    box-shadow: var(--rc-shadow);
    font-size: 12.5px;
}

.rc-tip-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.rc-tip-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.rc-tip-row span:last-child {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.rc-tip-sw {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 2px;
    margin-right: 6px;
}

.rc-tip-foot {
    margin-top: 4px;
    color: var(--rc-muted);
    font-size: 11.5px;
}

/* Buttons */
.rc-icon-btn {
    border: 0;
    background: transparent;
    color: var(--rc-muted);
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    cursor: pointer;
}

.rc-icon-btn:hover {
    background: var(--rc-hover);
    color: var(--rc-text);
}

/* Menus */
.rc-menu {
    position: fixed;
    z-index: 1060;
    min-width: 210px;
    padding: 5px 0;
    background: var(--rc-elevated);
    color: var(--rc-text);
    border: 1px solid var(--rc-border);
    border-radius: 8px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, .2);
    font-size: 13.5px;
}

.rc-menu-item {
    padding: 6px 14px;
    display: flex;
    gap: 10px;
    align-items: center;
    cursor: pointer;
}

.rc-menu-item:hover {
    background: var(--rc-hover);
}

.rc-menu-item.disabled {
    opacity: .45;
    pointer-events: none;
}

.rc-menu-item i {
    width: 16px;
    color: var(--rc-muted);
}

.rc-menu-sep {
    height: 1px;
    background: var(--rc-border);
    margin: 5px 0;
}

.rc-menu-header {
    padding: 4px 14px 6px;
    margin-bottom: 4px;
    font-size: 12px;
    color: var(--rc-muted);
    border-bottom: 1px solid var(--rc-border);
}

/* Modals */
.rc-overlay {
    position: fixed;
    inset: 0;
    z-index: 1050;
    background: rgba(10, 20, 19, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.rc-modal {
    background: var(--rc-surface);
    color: var(--rc-text);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
    width: min(560px, 100%);
    max-height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
}

.rc-modal-lg {
    width: min(1100px, 100%);
}

.rc-modal-max {
    width: min(1500px, 94vw);
    height: 88vh;
}

.rc-modal-h {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--rc-border);
}

.rc-modal-h h5 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rc-modal-b {
    padding: 16px 18px;
    overflow: auto;
    flex: 1;
    min-height: 0;
}

.rc-modal-f {
    padding: 12px 18px;
    border-top: 1px solid var(--rc-border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Chips (click filters) */
.rc-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 10px;
}

.rc-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 6px 3px 10px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--rc-primary) 12%, transparent);
    color: var(--rc-primary);
    border: 1px solid color-mix(in srgb, var(--rc-primary) 30%, transparent);
    font-size: 12.5px;
}

.rc-chip button {
    border: 0;
    background: transparent;
    color: inherit;
    padding: 0 4px;
    line-height: 1;
    cursor: pointer;
}

.rc-chips-clear {
    border: 0;
    background: transparent;
    color: var(--rc-primary);
    font-size: 12.5px;
    padding: 0 4px;
    cursor: pointer;
}

.rc-chips-clear:hover {
    text-decoration: underline;
}

/* Cards */
.rc-card {
    background: var(--rc-surface);
    color: var(--rc-text);
    border: 1px solid var(--rc-border);
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(16, 40, 38, .06), 0 2px 8px rgba(16, 40, 38, .05);
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100%;
    position: relative;
}

.rc-card-h {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 8px 4px 14px;
    min-height: 36px;
}

.rc-card-title {
    font-weight: 600;
    font-size: 13.5px;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rc-crumbs {
    font-size: 12px;
    color: var(--rc-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rc-crumbs a {
    color: var(--rc-primary);
    cursor: pointer;
    text-decoration: none;
}

.rc-tag {
    font-size: 10.5px;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--rc-band);
    color: var(--rc-muted);
}

.rc-card-b {
    flex: 1;
    min-height: 0;
    padding: 2px 10px 8px;
    position: relative;
}

.rc-max-body {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 8px 6px;
}

.rc-max-body .rc-chart {
    flex: 1;
}

/* Type tiles (Format pane and builder) */
.rc-types {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.rc-type-tile {
    width: 86px;
    border: 1px solid var(--rc-border);
    border-radius: 8px;
    padding: 8px 4px 6px;
    text-align: center;
    cursor: pointer;
    background: var(--rc-surface);
    color: var(--rc-text-secondary);
    font-size: 12px;
}

.rc-type-tile i {
    font-size: 20px;
    display: block;
    margin-bottom: 3px;
}

.rc-type-tile:hover {
    border-color: var(--rc-primary);
}

.rc-type-tile.sel {
    border-color: var(--rc-primary);
    background: color-mix(in srgb, var(--rc-primary) 12%, transparent);
    color: var(--rc-primary);
    font-weight: 600;
}

/* Format pane */
.rc-pane {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 320px;
    max-width: 100vw;
    z-index: 1040;
    background: var(--rc-surface);
    color: var(--rc-text);
    border-left: 1px solid var(--rc-border);
    box-shadow: -10px 0 30px rgba(0, 0, 0, .12);
    display: flex;
    flex-direction: column;
}

@media (max-width: 575.98px) {
    .rc-pane {
        width: 100vw;
    }
}

.rc-pane-h {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--rc-border);
}

.rc-pane-h > i {
    color: var(--rc-muted);
}

.rc-pane-title {
    font-weight: 600;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rc-pane-b {
    flex: 1;
    overflow: auto;
    padding: 4px 0 30px;
}

.rc-pane details {
    border-bottom: 1px solid var(--rc-grid);
}

.rc-pane summary {
    padding: 10px 14px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rc-pane summary::-webkit-details-marker {
    display: none;
}

.rc-pane summary::before {
    content: "\F285";
    font-family: bootstrap-icons;
    font-size: 11px;
    color: var(--rc-muted);
    transition: transform .15s;
}

.rc-pane details[open] summary::before {
    transform: rotate(90deg);
}

.rc-sec {
    padding: 2px 14px 12px 34px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 10px;
    align-items: center;
}

.rc-sec label {
    font-size: 12.5px;
    color: var(--rc-text-secondary);
}

.rc-full {
    grid-column: 1 / -1;
}

.rc-pane .rc-types {
    margin: 0;
}

.rc-pane .rc-type-tile {
    width: 72px;
    padding: 6px 2px 4px;
    font-size: 11px;
}

.rc-pane .rc-type-tile i {
    font-size: 17px;
}

.rc-series-row {
    display: flex;
    align-items: center;
    gap: 8px;
    grid-column: 1 / -1;
    font-size: 12.5px;
}

.rc-series-name {
    flex: 1;
    min-width: 0;
    color: var(--rc-text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rc-sw-btn {
    width: 26px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid var(--rc-border);
    cursor: pointer;
    padding: 0;
    flex: none;
}

/* Builder */
.rc-builder {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 18px;
}

@media (max-width: 860px) {
    .rc-builder {
        grid-template-columns: 1fr;
    }
}

.rc-fld-lbl {
    font-size: 12px;
    color: var(--rc-muted);
    margin: 10px 0 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.rc-fld-lbl:first-child {
    margin-top: 0;
}

.rc-narrow {
    max-width: 115px;
}

.rc-preview {
    border: 1px solid var(--rc-border);
    border-radius: 8px;
    height: 300px;
    padding: 8px;
    background: var(--rc-surface);
}

.rc-kind-ico {
    display: inline-block;
    width: 18px;
    text-align: center;
    color: var(--rc-muted);
}

.rc-filter-vals {
    max-height: 150px;
    overflow: auto;
    border: 1px solid var(--rc-border);
    border-radius: 6px;
    padding: 6px 10px;
}

/* Color picker */
.rc-cp {
    position: fixed;
    z-index: 1070;
    width: 420px;
    max-width: calc(100vw - 16px);
    background: var(--rc-elevated);
    color: var(--rc-text);
    border: 1px solid var(--rc-border);
    border-radius: 12px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .3);
    padding: 14px;
    font-size: 12.5px;
}

.rc-cp-top {
    display: flex;
    gap: 14px;
}

.rc-cp-wheel {
    position: relative;
    width: 168px;
    height: 168px;
    flex-shrink: 0;
    cursor: crosshair;
    touch-action: none;
}

.rc-cp-wheel canvas {
    width: 168px;
    height: 168px;
    border-radius: 50%;
    display: block;
}

.rc-cp-dot {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .5);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.rc-cp-side {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.rc-cp-sl {
    display: grid;
    grid-template-columns: 14px 1fr;
    align-items: center;
    gap: 6px;
}

.rc-cp-sl b {
    color: var(--rc-muted);
    font-weight: 600;
}

.rc-cp input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    height: 12px;
    border-radius: 6px;
    width: 100%;
    border: 1px solid var(--rc-border);
    margin: 0;
}

.rc-cp input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #333;
}

.rc-cp input[type=range]::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #333;
}

.rc-cp-checker {
    background-size: 100% 100%, 10px 10px, 10px 10px, 10px 10px, 10px 10px;
    background-position: 0 0, 0 0, 0 5px, 5px -5px, -5px 0;
}

.rc-cp-nums {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    margin-top: 12px;
}

.rc-cp-nums label {
    font-size: 11px;
    color: var(--rc-muted);
    display: block;
    text-align: center;
}

.rc-cp-nums input {
    width: 100%;
    text-align: center;
    font-size: 12.5px;
    padding: 3px 2px;
}

.rc-cp-hex {
    grid-column: span 2;
}

.rc-cp-mid {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

.rc-cp-cmp {
    display: flex;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--rc-border);
}

.rc-cp-cmp div {
    width: 52px;
    height: 28px;
}

.rc-cp-orig {
    cursor: pointer;
}

.rc-cp-contrast {
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 12px;
}

.rc-cp-good {
    color: var(--rc-good);
    background: color-mix(in srgb, var(--rc-good) 18%, transparent);
}

.rc-cp-warn {
    color: var(--rc-warn);
    background: color-mix(in srgb, var(--rc-warn) 22%, transparent);
}

.rc-cp-poor {
    color: var(--rc-poor);
    background: color-mix(in srgb, var(--rc-poor) 18%, transparent);
}

.rc-cp-sw-lbl {
    font-size: 11px;
    color: var(--rc-muted);
    margin: 10px 0 4px;
    text-transform: uppercase;
    letter-spacing: .5px;
    font-weight: 600;
}

.rc-cp-sws {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.rc-cp-sws button {
    width: 22px;
    height: 22px;
    border-radius: 5px;
    border: 1px solid var(--rc-border);
    padding: 0;
    cursor: pointer;
}

.rc-cp-f {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 14px;
}

