.rh-panel,
.rh-note,
.rh-more {
    margin: 1.5rem 0;
    padding: clamp(1rem, 3vw, 1.5rem);
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--sidebar);
    color: var(--ink);
}

.rh-panel *,
.rh-note *,
.rh-more * {
    box-sizing: border-box;
}

.rh-panel [hidden] {
    display: none !important;
}

.rh-note p,
.rh-more p {
    margin: 0.8rem 0;
}

.rh-note p:first-child,
.rh-more p:last-child {
    margin-block: 0;
}

.rh-panel .rh-panel-title {
    margin: 0 0 1rem;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.7;
}

.rh-panel .rh-help,
.rh-panel figcaption {
    margin: 0.8rem 0;
    font-size: 0.85rem;
    line-height: 1.7;
    color: var(--muted);
}

.rh-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin: 0.75rem 0;
}

.rh-panel button,
.rh-panel select {
    min-height: 44px;
    max-width: 100%;
    padding: 0.55rem 0.8rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 0.9rem;
    line-height: 1.5;
}

.rh-panel button {
    cursor: pointer;
}

.rh-panel button:hover:not(:disabled) {
    border-color: var(--accent);
}

.rh-panel button:disabled {
    cursor: default;
    opacity: 0.55;
}

.rh-panel :is(button, input, select):focus-visible,
.rh-more summary:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}

.rh-panel label {
    display: block;
    margin-top: 0.9rem;
    font-size: 0.95rem;
}

.rh-panel output {
    margin-left: 0.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.rh-panel input[type="range"] {
    display: block;
    width: 100%;
    min-height: 44px;
    accent-color: #2865a8;
}

.rh-panel .rh-checkbox {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-height: 44px;
}

.rh-checkbox input {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    accent-color: #2865a8;
}

.rh-number-grid {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 4px;
    font-size: clamp(0.75rem, 2vw, 1rem);
    font-variant-numeric: tabular-nums;
}

.rh-number-grid span {
    display: grid;
    place-items: center;
    min-height: 32px;
    border: 2px solid transparent;
    border-radius: 4px;
    background: var(--surface);
    line-height: 1.4;
}

.rh-number-grid .rh-prime {
    border-color: #3275b6;
    font-weight: 800;
}

.rh-number-grid .rh-removed {
    color: var(--muted);
    text-decoration: line-through;
}

.rh-panel .rh-result {
    margin: 1rem 0;
    padding: 0.85rem;
    border-left: 3px solid #3275b6;
    border-radius: 4px;
    background: var(--surface);
    font-size: 0.95rem;
    line-height: 1.8;
    font-variant-numeric: tabular-nums;
}

.rh-panel .rh-chart {
    margin: 1.25rem 0;
}

.rh-chart svg {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 6px;
    background: #fffdf8;
    overflow: visible;
}

.rh-chart-grid path {
    fill: none;
    stroke: #d5dcdf;
    stroke-width: 1;
}

.rh-chart-text {
    fill: #33444e;
    font-size: 20px;
    font-family: system-ui, sans-serif;
}

.rh-actual-path,
.rh-estimate-path {
    fill: none;
    stroke-width: 2.5;
    stroke-linejoin: round;
}

.rh-actual-path {
    stroke: #215b9b;
}

.rh-estimate-path {
    stroke: #a45515;
    stroke-dasharray: 7 5;
}

.rh-legend-actual,
.rh-legend-estimate {
    display: inline-block;
}

.rh-legend-actual::before,
.rh-legend-estimate::before {
    content: '';
    display: inline-block;
    width: 1.4em;
    margin-right: 0.4em;
    border-top: 3px solid #3275b6;
    vertical-align: middle;
}

.rh-legend-estimate::before {
    border-top: 3px dashed #b56d35;
}

.rh-critical-strip {
    fill: #edf3f7;
}

.rh-axis {
    fill: none;
    stroke: #6a7b86;
    stroke-width: 1.5;
}

.rh-critical-line {
    stroke: #a45515;
    stroke-width: 2;
    stroke-dasharray: 7 5;
}

.rh-zero-dots {
    fill: #215b9b;
}

.rh-zero-selection {
    fill: none;
    stroke: #a45515;
    stroke-width: 3;
}

.rh-more summary {
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.8;
}

.rh-more[open] summary {
    margin-bottom: 1rem;
}

.rh-panel table {
    width: 100%;
    font-size: 0.85rem;
    line-height: 1.7;
    font-variant-numeric: tabular-nums;
}

.rh-panel caption {
    padding-bottom: 0.6rem;
    text-align: left;
    color: var(--muted);
    font-size: 0.85rem;
}

@media (max-width: 420px) {
    .rh-number-grid {
        gap: 2px;
    }

    .rh-number-grid span {
        min-height: 28px;
    }
}
