/* ===================================================================
   SIZING CALCULATOR DRAWER - STYLES
   Based on Discovery Assistant pattern with sizing-specific enhancements
   =================================================================== */

/* --- Trigger Button --- */
.sizing-drawer-trigger {
    position: fixed;
    right: 0;
    top: calc(50% + 55px); /* Below Community Pulse */
    transform: translateY(-50%);
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 8px 0 0 8px;
    padding: 0.75rem;
    cursor: pointer;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    box-shadow: -2px 2px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    z-index: 999;
    width: 48px; /* Icon only width */
    overflow: hidden;
}

.sizing-drawer-trigger:hover {
    width: auto;
    padding-right: 1rem;
    transform: translateY(-50%);
    box-shadow: -4px 4px 15px rgba(0, 0, 0, 0.3);
}

.sizing-drawer-trigger svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    stroke: white;
}

.sizing-trigger-text {
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sizing-drawer-trigger:hover .sizing-trigger-text {
    opacity: 1;
}

/* --- Overlay --- */
.sizing-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sizing-drawer-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* --- Drawer Panel --- */
.sizing-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 1100px;
    max-width: 90vw;
    height: 100vh;
    background: white;
    box-shadow: none;
    z-index: 9999;
    transform: translateX(100%);
    /* Closed, the drawer is visibility: hidden so Tab skips its controls. The
       delay lets the 0.3s slide-out play before it hides; every opener adds
       .open (DrawerManager or not), so the rule covers them all. */
    visibility: hidden;
    transition: transform 0.3s ease-in-out, box-shadow 0.3s ease, visibility 0s linear 0.3s;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sizing-drawer.open {
    transform: translateX(0);
    box-shadow: -4px 0 15px rgba(0, 0, 0, 0.2);
    visibility: visible;
    transition: transform 0.3s ease-in-out, box-shadow 0.3s ease, visibility 0s;
}

/* --- Header --- */
.sizing-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 2px solid #e9ecef;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    gap: 0.75rem;
}

.sizing-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    margin-right: 12px;
}

.sizing-drawer-header .sizing-export-actions {
    margin-bottom: 0;
}

.sizing-drawer-header .sizing-export-btn {
    padding: 8px 14px;
    font-size: 13px;
}

.sizing-drawer-header .sizing-export-btn svg {
    width: 14px;
    height: 14px;
}

/* Upload Sizing: round icon button matching the help icon, sitting right after it.
   Hidden by default; only partner pages unhide it (the upload endpoint is
   @portal_access_required), mirroring .sizing-help-btn. */
.sizing-upload-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.35);
    cursor: pointer;
    padding: 0;
    margin-left: 8px;
    flex-shrink: 0;
    transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.sizing-upload-btn:hover {
    background: rgba(255, 255, 255, 0.32);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.sizing-upload-btn:focus-visible {
    outline: 2px solid white;
    outline-offset: 2px;
}

.sizing-upload-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.sizing-upload-btn svg {
    pointer-events: none;
}

body[data-is-partner="true"] .sizing-upload-btn {
    display: inline-flex;
}

/* Read-only sizings can't be edited, so hide the prefill action (overrides the
   partner-visible rule above via specificity + source order). */
body[data-is-partner="true"] .sizing-read-only .sizing-upload-btn {
    display: none;
}

.sizing-drawer-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.sizing-drawer-title svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

.sizing-drawer-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sizing-drawer-close {
    background: transparent;
    border: none;
    cursor: pointer !important;
    padding: 6px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
    position: relative;
    z-index: 10;
    flex-shrink: 0;
    pointer-events: auto !important;
}

.sizing-drawer-close:hover {
    background: rgba(255, 255, 255, 0.2) !important;
}

.sizing-drawer-close svg {
    pointer-events: none;
}

/* --- Body (Two Column Layout) --- */
.sizing-drawer-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 16px;
    overflow-y: auto;
    flex: 1;
    background: #f9fafb;
}

.sizing-left-column,
.sizing-right-column {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* --- Form Sections --- */
.sizing-form-section {
    background: white;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.sizing-form-section h3 {
    font-size: 15px;
    font-weight: 600;
    color: #161616;
    margin: 0 0 12px 0;
}

/* --- Backup Schedule Grid --- */
.backup-schedule-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.backup-header-row {
    display: grid;
    grid-template-columns: 1fr 1.5fr 1.5fr;
    gap: 12px;
    font-size: 14px;
    color: #525252;
    font-weight: 500;
    margin-bottom: 8px;
}

.backup-header-label {
    /* Empty first column for labels */
}

.backup-header-input {
    text-align: center;
}

.backup-input-row {
    display: grid;
    grid-template-columns: 1fr 1.5fr 1.5fr;
    gap: 12px;
    align-items: center;
}

.backup-input-error {
    grid-column: 1 / -1;
    flex-basis: 100%;
    width: 100%;
    color: #dc3545;
    font-size: 0.8rem;
    margin-top: 2px;
    padding: 6px 10px;
    background-color: #fff5f5;
    border: 1px solid #f5c2c7;
    border-radius: 4px;
    box-sizing: border-box;
    animation: errorFadeIn 0.3s ease forwards;
}

.backup-input-error.hiding {
    animation: errorFadeOut 0.4s ease forwards;
}

@keyframes errorFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes errorFadeOut {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(-4px); }
}

/* Informational note (e.g. deduplication ratio recommendation) — distinct from errors */
.sizing-input-note {
    grid-column: 1 / -1;
    flex-basis: 100%;
    width: 100%;
    color: #6b5400;
    font-size: 12px;
    margin-top: 2px;
    padding: 6px 10px;
    background-color: #fff8e6;
    border: 1px solid #ffe08a;
    border-radius: 4px;
    box-sizing: border-box;
    animation: errorFadeIn 0.3s ease forwards;
}

.backup-input-row label {
    font-size: 13px;
    font-weight: 500;
    color: #161616;
}

/* --- Form Rows --- */
.sizing-form-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 12px;
}

.sizing-form-row label:not(.sizing-toggle) {
    font-size: 13px;
    color: #525252;
    flex: 1;
}

.sizing-form-row select,
.sizing-form-row input[type="number"] {
    flex: 1;
}

/* --- Input Styles --- */
.sizing-drawer input[type="number"],
.sizing-drawer select {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #E0E0E0;
    border-radius: 6px;
    font-size: 13px;
    background: #FDFDFD;
    transition: all 0.2s ease;
    font-family: 'IBM Plex Sans', sans-serif;
    box-sizing: border-box;
}

.sizing-drawer select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
    cursor: pointer;
}

.sizing-drawer select:invalid,
.sizing-drawer select option[value=""] {
    color: #A8A8A8;
}

/* A field that does not apply yet greys out instead of leaving the page, so
   nothing moves under the user mid-form. Cloud Provider does this until a site
   is in the cloud, and greys the single options no chosen platform allows. */
.sizing-drawer select:disabled {
    background-color: #F4F4F4;
    color: #A8A8A8;
    cursor: not-allowed;
    opacity: 1; /* Safari otherwise fades the control and its arrow together */
}

.sizing-form-row:has(select:disabled) label {
    color: #A8A8A8;
}

.sizing-drawer select option:not([value=""]) {
    color: #333;
}

/* Must outrank the rule above, which carries the same specificity and would
   otherwise paint an unselectable option in full black. */
.sizing-drawer select option:not([value=""]):disabled {
    color: #A8A8A8;
}

.sizing-drawer input[type="number"]:focus,
.sizing-drawer select:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(15, 98, 254, 0.1);
}

.sizing-drawer input[type="number"]::placeholder {
    color: #A8A8A8;
}

/* --- Toggle Switch --- */
.sizing-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    cursor: pointer;
    flex: none;
}

.sizing-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.sizing-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #A8A8A8;
    transition: 0.4s;
    border-radius: 24px;
}

.sizing-toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

.sizing-toggle input:checked + .sizing-toggle-slider {
    background-color: #10b981;
}

.sizing-toggle input:checked + .sizing-toggle-slider:before {
    transform: translateX(20px);
}

/* --- Range Sliders --- */
.sizing-slider-container {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.sizing-drawer input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #E0E0E0;
    outline: none;
    -webkit-appearance: none;
}

.sizing-drawer input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #10b981;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sizing-drawer input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 0 4px rgba(15, 98, 254, 0.2);
}

.sizing-drawer input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #10b981;
    cursor: pointer;
    border: none;
}

.sizing-slider-value {
    font-weight: 600;
    color: #161616;
    min-width: 45px;
    text-align: right;
}

/* --- Summary Cards --- */
.sizing-summary-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.sizing-summary-card {
    background: white;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    text-align: center;
}

.sizing-card-label {
    font-size: 12px;
    color: #525252;
    margin-bottom: 6px;
}

.sizing-card-value {
    font-size: 22px;
    font-weight: 700;
    color: #161616;
}

.sizing-savings-card .sizing-card-value {
    color: #198038;
}

.sizing-capacity-notice {
    margin-top: 12px;
    padding: 12px 14px;
    background: #fff1f1;
    border-left: 4px solid #DA1E28;
    border-radius: 4px;
    color: #750e13;
    font-size: 13px;
    line-height: 1.4;
    font-weight: 500;
}

.sizing-export-btn:disabled,
.sizing-export-btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(0.4);
}

/* --- Chart Containers --- */
.sizing-chart-container {
    background: white;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.sizing-chart-container h4 {
    font-size: 14px;
    font-weight: 600;
    color: #161616;
    margin: 0 0 12px 0;
}

.sizing-chart-caption {
    font-size: 12px;
    color: #525252;
    line-height: 1.45;
    margin: -8px 0 12px 0;
}

.sizing-chart-container canvas {
    max-height: 200px;
}

/* --- Capacity Breakdown (Custom Stacked Bar) --- */
#sizing-capacity-breakdown {
    margin-top: 16px;
}

.sizing-capacity-bar-wrapper {
    margin-bottom: 12px;
}

.sizing-capacity-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    margin-bottom: 8px;
}

.sizing-capacity-bar-label-left {
    color: #525252;
}

.sizing-capacity-bar-label-right {
    font-weight: 600;
    color: #161616;
}

.sizing-capacity-dedupe-label {
    font-size: 12px;
    color: #525252;
    margin: -4px 0 8px 0;
}

.sizing-capacity-bar {
    display: flex;
    width: 100%;
    height: 12px;
    border-radius: 6px;
    overflow: hidden;
    background: #F0F0F0;
}

.sizing-capacity-segment {
    transition: width 0.3s ease;
}

.sizing-capacity-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 16px;
    font-size: 12px;
}

.sizing-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sizing-legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

/* --- Blurred Section --- */
.sizing-blurred-section {
    position: relative;
    background: white;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    grid-column: 1 / -1;
}

.sizing-blurred-section .sizing-tables-grid {
    filter: blur(8px);
    pointer-events: none;
    transition: filter 0.3s ease;
}

.sizing-blurred-section.unlocked .sizing-tables-grid {
    filter: none;
    pointer-events: auto;
}

.sizing-blur-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    background: transparent;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sizing-blurred-section.unlocked .sizing-blur-overlay {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.sizing-blur-overlay-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
    text-align: center;
    max-width: 360px;
    backdrop-filter: blur(4px);
}

.sizing-blur-overlay-content svg {
    color: #10b981;
    margin-bottom: 12px;
    width: 40px;
    height: 40px;
}

.sizing-blur-overlay-content h3 {
    font-size: 16px;
    font-weight: 600;
    color: #161616;
    margin: 0 0 8px 0;
}

.sizing-blur-overlay-content p {
    font-size: 13px;
    color: #525252;
    margin: 0 0 16px 0;
}

.sizing-reveal-button {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    padding: 8px 24px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sizing-reveal-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* Greyed rather than hidden: the control stays where the user expects it.
   Without this the gradient would keep looking clickable while disabled. */
.sizing-reveal-button:disabled {
    background: #d1d5db;
    color: #6b7280;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* --- Two-column Table Grid --- */
.sizing-tables-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 16px;
    min-height: 300px;
}

/* --- Data Tables --- */
.sizing-table-container {
    margin-bottom: 0;
}

/* Explanatory line under a results table (e.g. what Tier3-GB covers) */
.sizing-table-footnote {
    color: #6F6F6F;
    font-size: 12px;
    font-style: italic;
    margin: 8px 0 0 0;
}

.sizing-table-container h4 {
    font-size: 14px;
    font-weight: 600;
    color: #161616;
    margin: 0 0 10px 0;
}

.sizing-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.sizing-data-table thead {
    background: #F4F4F4;
}

.sizing-data-table th {
    padding: 8px;
    text-align: left;
    font-weight: 600;
    color: #161616;
    border-bottom: 2px solid #E0E0E0;
}

.sizing-data-table td {
    padding: 8px;
    border-bottom: 1px solid #F0F0F0;
    color: #161616;
}

.sizing-data-table tr:hover {
    background: #F9F9F9;
}

.sizing-data-table td:last-child {
    text-align: right;
}

/* Cloud breakdown: every column reads left, under its header, including the
   last (Repository License - TB), whose wide header otherwise leaves the
   right-aligned value stranded at the far edge */
#sizing-pvs-table td:last-child {
    text-align: left;
}

/* --- Footer: Contact Form --- */
.sizing-drawer-footer {
    background: white;
    border-top: 1px solid #E0E0E0;
    padding: 20px;
    flex-shrink: 0;
    display: none; /* Hidden by default */
}

.sizing-drawer-footer.visible {
    display: block;
}

.sizing-drawer-footer h3 {
    font-size: 16px;
    font-weight: 600;
    color: #161616;
    margin: 0 0 6px 0;
}

.sizing-drawer-footer p {
    font-size: 13px;
    color: #525252;
    margin: 0 0 16px 0;
}

.sizing-contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.sizing-contact-grid input {
    padding: 8px 12px;
    border: 1px solid #E0E0E0;
    border-radius: 6px;
    font-size: 13px;
    background: #FDFDFD;
    transition: all 0.2s ease;
    font-family: 'IBM Plex Sans', sans-serif;
}

.sizing-contact-grid input:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.1);
}

.sizing-submit-button {
    width: 100%;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.sizing-submit-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.sizing-submit-button:active {
    transform: translateY(0);
}

/* --- Contact Success Message --- */
.sizing-contact-success {
    text-align: center;
    padding: 20px;
}

.sizing-contact-success svg {
    color: #198038;
    margin-bottom: 16px;
}

.sizing-contact-success h4 {
    font-size: 20px;
    font-weight: 600;
    color: #161616;
    margin: 0 0 8px 0;
}

.sizing-contact-success p {
    font-size: 14px;
    color: #525252;
    margin: 0;
}

/* --- Responsive Design --- */
@media (max-width: 1024px) {
    /* Rows are content-height because Driver.js (driver.css) forces
       overflow: hidden on the parent of the element a tour step highlights.
       In this one-column layout that parent is a column, and an auto row
       would then shrink it to zero, hiding the column under the next one
       while the tour points at empty space. */
    .sizing-drawer-body {
        grid-template-columns: 1fr;
        grid-auto-rows: max-content;
    }

    .sizing-drawer {
        width: 100%;
    }

    .sizing-tables-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sizing-drawer-trigger {
        right: 0;
        width: 44px;
        padding: 0.65rem;
    }

    .sizing-drawer-trigger:hover {
        width: auto;
    }

    .sizing-drawer-body {
        padding: 20px;
        gap: 20px;
    }

    .sizing-drawer-header {
        padding: 16px 20px;
    }

    .sizing-drawer-footer {
        padding: 20px;
    }

    .sizing-contact-grid {
        grid-template-columns: 1fr;
    }

    .backup-header-row,
    .backup-input-row {
        grid-template-columns: 30% 35% 35%;
    }

    .sizing-summary-cards {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .sizing-drawer-header h2 {
        font-size: 18px;
    }

    .backup-schedule-grid {
        font-size: 12px;
    }

    .sizing-blur-overlay-content {
        padding: 24px;
    }
}

/* --- Loading State --- */
.sizing-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #525252;
}

.sizing-loading-spinner {
    border: 3px solid #F0F0F0;
    border-top: 3px solid #10b981;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: sizing-spin 1s linear infinite;
}

@keyframes sizing-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- Error State --- */
.sizing-error {
    background: #FEF2F2;
    border: 1px solid #FCA5A5;
    border-radius: 8px;
    padding: 16px;
    color: #991B1B;
    font-size: 14px;
    margin-bottom: 16px;
}

/* --- Export Actions ---
   Always laid out; the buttons themselves are disabled until the sizing is
   complete. They used to be hidden entirely, which left people unable to see
   that exporting was an option at all. */
.sizing-export-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
    padding: 0;
}

.sizing-export-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.sizing-export-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
    transform: translateY(-1px);
}

.sizing-export-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.sizing-export-btn:disabled {
    background: #9CA3AF;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.sizing-export-btn svg {
    width: 16px;
    height: 16px;
}

/* --- Export split button (Export | v -> PDF / CSV / Email) --- */
.sizing-export-split {
    position: relative;
    display: inline-flex;
}

/* The two halves must read as one control: square the seam, and suppress the
   lift-on-hover the standalone button uses so they never shift apart. */
.sizing-export-split .sizing-export-main {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.sizing-export-split .sizing-export-caret {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    padding-left: 10px;
    padding-right: 10px;
    gap: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.4);
}

.sizing-export-split .sizing-export-btn:hover,
.sizing-export-split .sizing-export-btn:active {
    transform: none;
}

.sizing-export-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 10;
    min-width: 210px;
    padding: 4px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(16, 24, 40, 0.12);
    text-align: left;
}

/* Self-sufficient: not every host that renders the drawer ships a global
   .hidden utility. */
.sizing-export-menu.hidden {
    display: none;
}

.sizing-export-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 9px 12px;
    background: transparent;
    border: 0;
    border-radius: 6px;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    color: #111827;
    text-align: left;
    cursor: pointer;
}

.sizing-export-item:hover {
    background: #f3f4f6;
}

.sizing-export-item:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.sizing-export-item svg {
    width: 16px;
    height: 16px;
    flex: none;
}

/* --- Email Modal --- */
.sizing-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sizing-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.sizing-modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modal-slide-up 0.3s ease;
}

@keyframes modal-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sizing-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px;
    border-bottom: 1px solid #E5E7EB;
}

.sizing-modal-header h3 {
    margin: 0;
    color: #161616;
    font-size: 20px;
    font-weight: 600;
}

.sizing-modal-close {
    background: none;
    border: none;
    color: #525252;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.sizing-modal-close:hover {
    background: #F3F4F6;
    color: #161616;
}

.sizing-modal-body {
    padding: 24px;
}

.sizing-form-group {
    margin-bottom: 20px;
}

.sizing-form-group label {
    display: block;
    margin-bottom: 8px;
    color: #161616;
    font-size: 14px;
    font-weight: 600;
}

.sizing-form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.sizing-form-group input:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.sizing-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

.sizing-btn-primary,
.sizing-btn-secondary {
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.sizing-btn-primary {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.sizing-btn-primary:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
    transform: translateY(-1px);
}

.sizing-btn-primary:disabled {
    background: #9CA3AF;
    cursor: not-allowed;
    transform: none;
}

.sizing-btn-secondary {
    background: white;
    color: #525252;
    border: 1px solid #D1D5DB;
}

.sizing-btn-secondary:hover {
    background: #F9FAFB;
    border-color: #9CA3AF;
}

.sizing-btn-secondary:disabled,
.sizing-btn-secondary:disabled:hover {
    background: #F3F4F6;
    color: #9CA3AF;
    border-color: #E5E7EB;
    cursor: not-allowed;
}

/* --- Loading State --- */
#sizing-drawer.loading .sizing-drawer-content {
    opacity: 0.5;
    pointer-events: none;
}

#sizing-drawer.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: #10b981;
    border-radius: 50%;
    animation: sizing-spinner 0.8s linear infinite;
}

@keyframes sizing-spinner {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

body:has(.sizing-drawer.open) .pp-toast-container,
body:has(.sizing-drawer.open) .toast-container {
    z-index: 10050 !important;
}
/* --- Help Button (partner-only) --- */
.sizing-help-btn {
    display: none; /* hidden by default; partner pages unhide via body[data-is-partner="true"] */
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.35);
    cursor: pointer;
    padding: 0;
    transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    margin-left: auto;
    flex-shrink: 0;
}

.sizing-help-btn:hover {
    background: rgba(255, 255, 255, 0.32);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.sizing-help-btn:focus-visible {
    outline: 2px solid white;
    outline-offset: 2px;
}

.sizing-help-btn svg {
    pointer-events: none;
}

body[data-is-partner="true"] .sizing-help-btn {
    display: inline-flex;
}

/* When the help button is visible, the export-actions container shouldn't claim
   the auto margin — the help button already pushed itself away from the title. */
body[data-is-partner="true"] .sizing-drawer-header .sizing-header-actions {
    margin-left: 0;
}

/* The tour highlights the whole export block and blocks interaction with it, so
   never leave the dropdown hanging open underneath the overlay. */
body.sizing-tour-active .sizing-export-menu {
    display: none !important;
}

/* --- Help Chooser Modal --- */
.sizing-help-modal {
    z-index: 10001;
}

.sizing-help-modal-content {
    max-width: 720px;
    width: 90%;
}

.sizing-help-modal-subtitle {
    color: #525252;
    font-size: 14px;
    margin: 0 0 20px;
}

.sizing-help-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.sizing-help-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 24px;
    background: white;
    border: 1.5px solid #E5E7EB;
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
    font-family: inherit;
}

.sizing-help-card:hover {
    border-color: #10b981;
    background: #f0fdf4;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.18);
}

.sizing-help-card:focus-visible {
    outline: 2px solid #10b981;
    outline-offset: 2px;
}

.sizing-help-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    margin-bottom: 8px;
}

.sizing-help-card-title {
    font-size: 16px;
    font-weight: 600;
    color: #161616;
}

.sizing-help-card-subtitle {
    font-size: 13px;
    color: #525252;
    line-height: 1.4;
}

.sizing-help-card[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: 0.55;
    background: #F9FAFB;
}

.sizing-help-card[aria-disabled="true"]:hover {
    border-color: #E5E7EB;
    background: #F9FAFB;
    transform: none;
    box-shadow: none;
}

.sizing-help-card[aria-disabled="true"] .sizing-help-card-icon {
    background: linear-gradient(135deg, #9CA3AF 0%, #6B7280 100%);
}

.sizing-help-card-disabled-note {
    display: none;
    margin-top: 6px;
    font-size: 12px;
    color: #6B7280;
    font-style: italic;
    line-height: 1.4;
}

.sizing-help-card[aria-disabled="true"] .sizing-help-card-disabled-note {
    display: block;
}

/* --- Video Modal --- */
.sizing-video-modal {
    z-index: 10002;
    /* Override the parent flex centering — when the video content is taller than
       the viewport, align-items: center clips the top and you can't scroll up.
       Anchor to the top and let the modal itself scroll. */
    align-items: flex-start;
    overflow-y: auto;
    padding: 24px 12px;
}

.sizing-video-modal-content {
    max-width: 1100px;
    width: 90%;
    /* Remove the inherited max-height: 90vh / overflow: auto so the natural
       16:9 height isn't clipped — the parent .sizing-video-modal scrolls instead. */
    max-height: none;
    overflow: visible;
    margin: 0 auto;
    background: #0b1d2c;
    color: white;
}

.sizing-video-modal-content .sizing-modal-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    gap: 12px;
}

.sizing-video-modal-title {
    margin: 0;
    flex: 1;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: white;
}

/* Beats .sizing-modal-header h3, which would make it near-black on the dark header. */
.sizing-video-modal-content .sizing-video-modal-title {
    color: white;
}

.sizing-video-modal-content .sizing-modal-close {
    color: rgba(255, 255, 255, 0.85);
}

.sizing-video-modal-content .sizing-modal-close:hover {
    background: rgba(255, 255, 255, 0.12);
    color: white;
}

.sizing-video-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
    font-family: inherit;
}

.sizing-video-back-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.sizing-video-back-btn svg {
    pointer-events: none;
}

.sizing-video-modal-body {
    padding: 0;
}

.sizing-video-aspect {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background: black;
}

.sizing-video-aspect video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
}

/* --- Driver.js theme override (emerald). Shared with OpportunityCreateTour and onboarding-demo-modal --- */
.driver-popover.sizing-tour-popover {
    background: #ffffff;
    color: #161616;
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
    border: 1px solid #d1fae5;
}

.driver-popover.sizing-tour-popover .driver-popover-title {
    color: #047857;
    font-weight: 600;
}

.driver-popover.sizing-tour-popover .driver-popover-description {
    color: #161616;
    line-height: 1.5;
}

.driver-popover.sizing-tour-popover .driver-popover-progress-text {
    color: #6B7280;
}

.driver-popover.sizing-tour-popover .driver-popover-navigation-btns button {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 14px;
    font-weight: 600;
    text-shadow: none;
    box-shadow: 0 1px 2px rgba(16, 185, 129, 0.2);
}

.driver-popover.sizing-tour-popover .driver-popover-navigation-btns button:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.driver-popover.sizing-tour-popover .driver-popover-prev-btn {
    background: white !important;
    color: #525252 !important;
    border: 1px solid #D1D5DB !important;
    box-shadow: none !important;
}

.driver-popover.sizing-tour-popover .driver-popover-prev-btn:hover {
    background: #F9FAFB !important;
}

/* Driver.js sets outline:0 on its footer buttons; keep a keyboard focus ring. */
.driver-popover.sizing-tour-popover .driver-popover-navigation-btns button:focus-visible {
    outline: 2px solid #047857;
    outline-offset: 2px;
}

.driver-popover.sizing-tour-popover .driver-popover-close-btn {
    color: #6B7280;
}

/* Both OpportunityCreateTour and SizingCalcTour use allowClose: false to
 * prevent click-outside dismissal — users editing form inputs frequently
 * click chrome / labels / scroll outside the highlighted region, and that
 * shouldn't kill the tour. Driver.js v1 hides the close button inline when
 * allowClose is false, and its public showButtons filter can't add it back
 * (see opportunity-create-tour.js for the full explanation). Force the X
 * visible so users have an explicit escape hatch on every step. Both tours
 * share the 'sizing-tour-popover' class, so this rule covers both. */
.driver-popover.sizing-tour-popover .driver-popover-close-btn {
    display: block !important;
}

.driver-popover.sizing-tour-popover .driver-popover-arrow-side-top.driver-popover-arrow {
    border-top-color: #ffffff;
}

.driver-popover.sizing-tour-popover .driver-popover-arrow-side-bottom.driver-popover-arrow {
    border-bottom-color: #ffffff;
}

.driver-popover.sizing-tour-popover .driver-popover-arrow-side-left.driver-popover-arrow {
    border-left-color: #ffffff;
}

.driver-popover.sizing-tour-popover .driver-popover-arrow-side-right.driver-popover-arrow {
    border-right-color: #ffffff;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .sizing-help-cards {
        grid-template-columns: 1fr;
    }

    .sizing-video-modal-content {
        width: 96%;
        max-width: none;
    }
}

/* ── Opportunity Combobox ── */
.opp-combo-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
    min-height: 38px;
    transition: border-color 0.15s;
    user-select: none;
}
.opp-combo-trigger:hover,
.opp-combo-trigger:focus {
    border-color: var(--pp-primary, #0d9488);
    outline: none;
}
.opp-combo-trigger .opp-combo-placeholder { color: #9ca3af; }

/* Sizing-tour validation feedback — applied by SizingCalcTour.isStepValid
 * when the user tries to advance past the opp-picker step without a pick. */
.opp-combo-trigger.tour-invalid {
    border-color: #ef4444 !important;
    animation: opp-picker-shake 0.4s ease-in-out;
}

/* Post-Reveal lockdown: once the user clicks Reveal on step 9, the action
 * is irreversible (SizingSession persisted server-side, button consumed).
 * Hiding Previous on every subsequent popover keeps users from navigating
 * back to a step they can't re-trigger. Body class is added by
 * sizing-calculator-tour.js's reveal handler and cleared on tour destroy. */
body.sizing-tour-reveal-locked .driver-popover-prev-btn {
    display: none !important;
}
@keyframes opp-picker-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-5px); }
    40% { transform: translateX(5px); }
    60% { transform: translateX(-3px); }
    80% { transform: translateX(3px); }
}

.opp-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,.12);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    max-height: 370px;
}
.opp-dropdown.hidden { display: none; }

/* Sizing tour + open opportunity dropdown: drawer's transform + z-index:9999
 * traps descendants below Driver.js's overlay (10000). Lift the drawer, then
 * re-dim everything inside it except the picker stack via an inner pseudo. */
body.driver-active .sizing-drawer:has(.opp-dropdown:not(.hidden)) {
    z-index: 10010 !important;
}
body.driver-active .sizing-drawer:has(.opp-dropdown:not(.hidden))::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    pointer-events: none;
    z-index: 999;
}
body.driver-active .sizing-drawer:has(.opp-dropdown:not(.hidden)) #sizingOppPicker {
    position: relative;
    z-index: 1001;
}
/* Hide "+ Create New" while the dropdown-open dim is active: the picker is
 * lifted above the ::after overlay, but the button's transparent fill lets
 * the dim show through while its 1px border and green text render solid on
 * top — making border + text stand out as a "leftover" rectangle against
 * the dimmed area. Visibility:hidden preserves layout (no flex reflow). */
body.driver-active .sizing-drawer:has(.opp-dropdown:not(.hidden)) #oppCreateNewBtn {
    visibility: hidden;
}

.opp-dropdown-search {
    padding: 8px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}
.opp-dropdown-search input {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 5px;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
}
.opp-dropdown-search input:focus {
    border-color: var(--pp-primary, #0d9488);
}

.opp-dropdown-list {
    overflow-y: auto;
    flex: 1;
    /* Always-visible scrollbar */
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}
.opp-dropdown-list::-webkit-scrollbar { width: 8px; }
.opp-dropdown-list::-webkit-scrollbar-track { background: transparent; }
.opp-dropdown-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.opp-dropdown-list::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

.opp-section-header {
    padding: 8px 12px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #0d9488;
    background: #f0fdfa;
    border-bottom: 2px solid #ccfbf1;
    border-top: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 1;
}
#oppRecentSection .opp-section-header { border-top: none; }

.opp-dropdown-item {
    display: flex;
    flex-direction: column;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.1s;
    border-bottom: 1px solid #f3f4f6;
}
.opp-dropdown-item:hover,
.opp-dropdown-item.active {
    background: #f0fdfa;
}
.opp-dropdown-item-name {
    font-size: 13px;
    font-weight: 500;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.opp-dropdown-item-account {
    font-size: 12px;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.opp-scroll-loader,
.opp-dropdown-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    font-size: 12px;
    color: #9ca3af;
}
.opp-scroll-loader.hidden,
.opp-dropdown-loading.hidden { display: none; }

.opp-dropdown-empty {
    padding: 16px;
    text-align: center;
    font-size: 13px;
    color: #9ca3af;
}
.opp-dropdown-empty.hidden { display: none; }

.opp-combo-trigger.has-value #oppComboLabel { color: #111827; font-weight: 500; }

.opp-combo-clear {
    background: transparent;
    border: none;
    padding: 2px;
    margin: 0 6px 0 8px;
    cursor: pointer;
    color: #9ca3af;
    border-radius: 4px;
    display: none;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.opp-combo-clear:hover {
    background: #f3f4f6;
    color: #4b5563;
}
.opp-combo-trigger.has-value .opp-combo-clear {
    display: inline-flex;
}

/* Initial loading state */
.opp-combo-trigger.loading { opacity: 0.6; pointer-events: none; }

/* ============================================
   Revision Timeline (partner sizings view-mode drawer + opp-detail drawer)
   Base styles from admin's sizing_dashboard.html (inline) so partner UX matches.
   Additional rules layer a11y improvements on top — buttons (not divs),
   focus-visible, hover-safe contrast, and responsive ordering.
   ============================================ */
.revision-timeline {
    position: relative;
    padding-left: 24px;
}
.revision-timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e5e7eb;
}

/* The clickable items are <button> elements (a11y) — strip the native
   user-agent button styles so they look like the original admin <div>
   list items. */
.revision-item {
    position: relative;
    padding-bottom: 16px;
    /* Button reset */
    background: none;
    border: 0;
    width: 100%;
    text-align: left;
    font: inherit;
    color: inherit;
    cursor: default;
    display: block;
}
.revision-item:last-child {
    padding-bottom: 0;
}
.revision-item::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    /* Inactive dot — gray-500. Computed contrast ratios:
       - vs hover bg #f9fafb: ~4.49 : 1 — passes WCAG 1.4.11 (3:1).
       - vs base white #ffffff: ~4.68 : 1 — passes.
       gray-400 (#9ca3af) computed to ~2.42:1 / ~2.61:1 and failed AA
       non-text contrast; gray-200 (#e5e7eb) gave ~1.1:1 on hover,
       effectively invisible. */
    background: #6b7280;
    border: 2px solid white;
}
.revision-item.active::before {
    background: #1f3b6a;
}

/* Non-color cue for the active state — a left-edge accent bar on the
   content block. Color alone (the dot) fails WCAG 1.4.1 (Use of Color)
   for color-blind users; the bar is a redundant visual signal that
   does not rely on hue. */
.revision-item.active .revision-content {
    border-left: 3px solid #1f3b6a;
    padding-left: 9px;
}

.revision-item.clickable {
    cursor: pointer;
}
.revision-item.clickable:hover .revision-content {
    background: #f9fafb;
}
/* Keyboard focus indicator — without this, focused buttons get no
   visible outline since we removed the user-agent default in the
   button reset above. */
.revision-item.clickable:focus {
    outline: none;
}
.revision-item.clickable:focus-visible .revision-content {
    background: #f9fafb;
    outline: 2px solid #1f3b6a;
    outline-offset: 2px;
}

.revision-content {
    padding: 8px 12px;
    border-radius: 6px;
    transition: background 0.15s ease;
}

/* Respect user preference for reduced motion (WCAG best practice; the
   150ms transition is below photosensitivity thresholds but consistent
   with the broader a11y baseline). */
@media (prefers-reduced-motion: reduce) {
    .revision-content { transition: none; }
}

/* Note: no `.revision-item:not(.active) .revision-content { padding-left: 12px; }`
   rule is needed to "compensate for the 3px accent bar" — the base
   `.revision-content { padding: 8px 12px; }` above already sets
   `padding-left: 12px` for every item; the `.active` override at
   `padding-left: 9px` is the only deviation. */

/* Visually-hidden status region for aria-live announcements. Same
   technique Tailwind's `sr-only` uses; declared here so we don't have
   to depend on Tailwind utility-class resolution on pages that don't
   load Tailwind. Scoped to `.sizing-drawer` and `#sizingRevisionTimeline`
   so the higher-specificity selector wins over Tailwind's bare
   `.sr-only` regardless of CSS load order. */
.sizing-drawer .sr-only,
#sizingRevisionTimeline .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Narrow viewports — push the timeline below the results so the user
   sees the savings number first, not history first. `.sizing-right-column`
   is already `display: flex; flex-direction: column;` from the existing
   rule at sizing-calculator.css:191 — no need to redeclare. flex-order
   moves the timeline last without changing the DOM order (so SR + Tab
   order keep narrative top-to-bottom). */
@media (max-width: 1024px) {
    #sizingRevisionTimeline {
        order: 99;
        margin-top: 24px;
    }
}

/* --- Import Data Confirmation Modal --- */
.sizing-import-modal-content {
    width: 92%;
    max-width: 860px;
}

/* Environment Configuration lays out as two columns so the extra
   detail fits without making the modal excessively tall. */
.sizing-import-env-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 640px) {
    .sizing-import-env-grid {
        grid-template-columns: 1fr;
    }
}

.sizing-import-subtitle {
    margin: 0 0 14px 0;
    color: #6B7280;
    font-size: 13px;
}

.sizing-import-section-title {
    margin: 18px 0 8px 0;
    font-size: 13px;
    font-weight: 600;
    color: #161616;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.sizing-import-data-grid {
    display: grid;
    gap: 8px;
    margin-bottom: 14px;
}

.sizing-import-data-row {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 12px;
    padding: 10px 12px;
    background: #F9FAFB;
    border-radius: 6px;
    border: 1px solid #E5E7EB;
}

.sizing-import-label {
    font-weight: 600;
    color: #161616;
    font-size: 13px;
    display: flex;
    align-items: center;
}

.sizing-import-values {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.sizing-import-value-pair {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sizing-import-value-label {
    color: #6B7280;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sizing-import-value {
    font-size: 15px;
    font-weight: 600;
    color: #10b981;
    font-family: 'Monaco', 'Courier New', monospace;
}

.sizing-import-note {
    margin: 0;
    padding: 8px 10px;
    background: #ECFDF5;
    border-radius: 6px;
    color: #065F46;
    font-size: 12px;
    border-left: 3px solid #10b981;
}

.sizing-import-modal-content .sizing-modal-actions {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #E5E7EB;
    margin-bottom: 14px;
    margin-right: 14px;
}

/* --- Additional LPARs (v14) ------------------------------------------------ */
.sizing-lpar-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.sizing-lpar-button {
    padding: 6px 12px;
    font-size: 13px;
}

.sizing-lpar-summary {
    font-size: 13px;
    color: #525252;
}

/* The modal is appended to <body>, and thomas.css sets body text to white
   (--text-color), so anything here without its own color vanishes on pipeline
   pages. */
.sizing-lpar-modal-content {
    color: #161616;
    max-width: 1100px;
    width: 95%;
    display: flex;
    flex-direction: column;
}

.sizing-lpar-modal-content .sizing-modal-body {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* The actions sit outside the body here (so they stay put while the table
   scrolls), which means they miss the body's padding the other modals rely on.
   The body's bottom padding already supplies the gap above them. */
.sizing-lpar-modal-content .sizing-modal-actions {
    margin-top: 0;
    padding: 0 24px 24px;
}

.sizing-lpar-hint {
    margin: 0 0 12px;
    font-size: 13px;
    color: #525252;
}

.sizing-lpar-table-wrap {
    overflow: auto;
    max-height: 55vh;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
}

.sizing-lpar-table {
    color: #161616;
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

/* The whole two-row header sticks as one block, so no row needs a
   hard-coded offset for the height of the row above it. */
.sizing-lpar-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

.sizing-lpar-table th {
    background: #F4F4F4;
    font-weight: 600;
    padding: 6px;
    text-align: center;
    white-space: nowrap;
}

.sizing-lpar-table thead tr:nth-child(2) th {
    font-weight: 500;
    color: #525252;
}

/* A divider before each Size/# pair and before Raw, so each "#" reads as
   belonging to its group. An inset shadow rather than a border: under
   border-collapse a sticky header cell's borders scroll away with the body.
   Scoped to the modal because the import preview reuses .sizing-lpar-table
   with different columns. */
.sizing-lpar-modal .sizing-lpar-table thead tr:first-child th:not(:first-child):not(:last-child),
.sizing-lpar-modal .sizing-lpar-table thead tr:nth-child(2) th:nth-child(odd),
.sizing-lpar-modal .sizing-lpar-table td:is(:nth-child(2), :nth-child(4), :nth-child(6), :nth-child(8), :nth-child(10)) {
    box-shadow: inset 1px 0 0 #E0E0E0;
}

/* The name column stays put while the ~750px table scrolls sideways, so a
   partner on a narrow screen can still tell which LPAR a row is. Only the
   first header row's first cell: LPAR spans both header rows, so the second
   row's first cell is Daily Size. The header goes above the column (z-index 2
   vs 1) or the names would paint over it on vertical scroll, and the cells
   need a solid background or the inputs show through as they slide under.
   The divider is a shadow for the same reason as the ones above. */
.sizing-lpar-modal .sizing-lpar-table thead {
    z-index: 2;
}

.sizing-lpar-modal .sizing-lpar-table thead tr:first-child th:first-child,
.sizing-lpar-modal .sizing-lpar-table tbody td:first-child {
    position: sticky;
    left: 0;
    box-shadow: inset -1px 0 0 #E0E0E0;
}

.sizing-lpar-modal .sizing-lpar-table tbody td:first-child {
    z-index: 1;
    background: #fff;
}

.sizing-lpar-table input.sizing-lpar-invalid {
    border-color: #dc3545;
    background-color: #fff5f5;
}

.sizing-lpar-error {
    margin-top: 10px;
}

.sizing-lpar-table td {
    padding: 4px;
    border-top: 1px solid #F0F0F0;
}

.sizing-lpar-table input {
    width: 100%;
    min-width: 64px;
    padding: 4px 6px;
    border: 1px solid #D1D5DB;
    border-radius: 4px;
    font-size: 13px;
}

.sizing-lpar-table input.sizing-lpar-name {
    min-width: 110px;
}

.sizing-lpar-raw {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    padding-right: 8px;
}

/* Viewing a saved sizing's LPARs: the rows are readable but inert. Matches the
   0.7 / not-allowed treatment setReadOnly() gives the main form fields, and
   flattens the inputs so a table of disabled boxes reads as figures. */
.sizing-lpar-modal-read-only .sizing-lpar-table input:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    background: #F8F8F8;
    color: #161616;
}

/* The .sizing-btn-* rules above set `display: inline-flex`, which outranks the
   user-agent `[hidden] { display: none }` — so the buttons read-only mode hides
   (Save, + Add LPAR, and the LPAR button itself) need `hidden` honored here or
   they stay on screen. */
.sizing-btn-primary[hidden],
.sizing-btn-secondary[hidden],
.sizing-lpar-remove[hidden] {
    display: none !important;
}

.sizing-lpar-remove {
    border: none;
    background: none;
    font-size: 18px;
    line-height: 1;
    color: #6F6F6F;
    cursor: pointer;
    padding: 2px 6px;
}

.sizing-lpar-remove:hover {
    color: #DA1E28;
}

.sizing-lpar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
    font-size: 13px;
}

.sizing-lpar-total {
    color: #525252;
    font-variant-numeric: tabular-nums;
}

/* --- Phones (below the 768px tablet breakpoint) ---
   The drawer takes the whole screen and every side-by-side layout collapses to
   one column. Grid tracks use minmax(0, 1fr) because a plain 1fr track grows to
   its widest child, which pushed the retention inputs and the header tools past
   the drawer's right edge where overflow: hidden cut them off. Every tour anchor
   (#sizingOppPicker, .backup-schedule-grid, #sizing-env-section,
   #sizing-secondary-platform, #sizing-growth-slider, .sizing-summary-cards,
   .sizing-right-column, #sizing-reveal-btn, .sizing-export-actions) keeps its
   markup; only its layout changes here. */
@media (max-width: 767px) {
    .sizing-drawer {
        max-width: 100vw;
        height: 100dvh;
    }

    /* Header: title and close share the first line, the tools wrap to a second
       line (help and upload on the left, Export on the right). */
    .sizing-drawer-header {
        flex-wrap: wrap;
        row-gap: 10px;
        padding: 12px 16px;
    }

    .sizing-drawer-header > * {
        order: 2;
    }

    .sizing-drawer-title {
        order: 0;
        flex: 1 1 calc(100% - 48px);
    }

    .sizing-drawer-close {
        order: 1;
    }

    .sizing-drawer-header h2 {
        white-space: normal;
    }

    .sizing-help-btn {
        margin-left: 0;
    }

    .sizing-help-btn,
    .sizing-upload-btn {
        width: 36px;
        height: 36px;
    }

    .sizing-drawer-header .sizing-header-actions,
    body[data-is-partner="true"] .sizing-drawer-header .sizing-header-actions {
        margin-left: auto;
        margin-right: 0;
    }

    .sizing-drawer-body {
        grid-template-columns: minmax(0, 1fr);
        padding: 12px;
        gap: 12px;
    }

    .sizing-left-column,
    .sizing-right-column {
        gap: 12px;
        min-width: 0;
    }

    /* Opportunity picker: the Reuse button drops under the heading when the
       line is full; the combobox shrinks so "+ Create New" stays on screen. */
    #sizingOppPicker > div:first-child {
        flex-wrap: wrap;
        gap: 8px;
    }

    #sizing-reuse-btn {
        min-height: 36px;
    }

    #oppPickerEditable .opp-combobox,
    #oppLockedName {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    /* Retention table: each row is its own grid, so the label column is a fixed
       width to keep the rows lined up under the two column headings. */
    .backup-header-row,
    .backup-input-row {
        grid-template-columns: 64px minmax(0, 1fr) minmax(0, 1fr);
        gap: 8px;
    }

    .backup-header-row {
        font-size: 13px;
    }

    /* Fields keep their 13px desktop size rather than the 16px that stops iOS
       Safari zooming on tap: at 16px they looked oversized next to the 13px
       labels and cut LPAR names short, and review preferred the zoom.
       clarity.css forces 16px !important on every partner-portal field on
       phones, with a selector carrying one ID (its :not(#globalSearchInput)),
       so these need !important and two IDs to win regardless of load order.
       :is() takes its most specific argument, so #oppSearchInput supplies the
       second ID for the whole list. The LPAR modal hangs off <body>, outside
       the drawer, hence its own selector. */
    #sizing-drawer :is(input[type="number"], select, #oppSearchInput),
    #sizing-lpar-modal #sizing-lpar-table input {
        font-size: 13px !important;
    }

    /* Label above its field, field full width. */
    .sizing-drawer .sizing-form-row {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .sizing-drawer .sizing-form-row > *,
    .sizing-drawer .sizing-form-row > label {
        flex: none;
    }

    .sizing-capacity-bar-label {
        gap: 8px;
    }

    .sizing-capacity-legend {
        flex-wrap: wrap;
        gap: 8px 16px;
    }

    .sizing-blur-overlay-content {
        max-width: calc(100% - 24px);
    }

    /* Results tables scroll inside their own box with the row label pinned. */
    .sizing-table-container {
        overflow-x: auto;
    }

    .sizing-data-table th:first-child,
    .sizing-data-table td:first-child {
        position: sticky;
        left: 0;
        z-index: 1;
        background: #ffffff;
    }

    .sizing-data-table thead th:first-child {
        background: #F4F4F4;
    }

    .sizing-import-data-row {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* --- Phone results strip (includes/sizing_drawer.html) ---
   Shown only below 768px (phone block below). It deliberately uses none of
   the tour anchor classes (.sizing-summary-cards, .sizing-right-column). */
.sizing-results-strip {
    display: none;
}

/* --- Sizings list "Filter" button (clarity/partner_sizings.html) ---
   clarity.css's .sizings .tb-cols would show it at every width; its phone
   rule (.toolbar.has-filter-toggle .tb-filter-toggle) outranks this one. */
.sizings .tb-filter-toggle {
    display: none;
}

/* --- Phones: opportunity picker, results strip, pop-up sheets, tour --- */
@media (max-width: 767px) {
    /* Opportunity picker: the list spans the whole picker row (combobox and
       "+ Create New") instead of the narrowed combobox, and names wrap to two
       lines so deals with the same prefix can be told apart. The combobox's
       inline position: relative needs !important. */
    #oppPickerEditable > .flex {
        position: relative;
    }

    #oppPickerEditable .opp-combobox {
        position: static !important;
    }

    #oppPickerEditable .opp-dropdown-item {
        padding: 10px 12px;
    }

    #oppPickerEditable .opp-dropdown-item-name {
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow-wrap: anywhere;
    }

    .opp-combo-trigger,
    #oppCreateNewBtn {
        min-height: 40px;
    }

    /* Results strip: Repository size and Monthly savings stay on screen
       while the form is filled in; a tap scrolls to the full results. It
       hides (.is-covered) once the summary cards are on screen or scrolled
       past, and during the tour. */
    .sizing-results-strip {
        display: flex;
        align-items: center;
        gap: 16px;
        flex-shrink: 0;
        width: 100%;
        min-height: 52px;
        padding: 8px 16px calc(8px + env(safe-area-inset-bottom, 0px));
        border: 0;
        border-top: 1px solid #E5E7EB;
        background: #ffffff;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.06);
        font: inherit;
        text-align: left;
        cursor: pointer;
    }

    .sizing-results-strip.is-covered,
    body.sizing-tour-active .sizing-results-strip {
        display: none;
    }

    .sizing-strip-item {
        display: flex;
        flex-direction: column;
        min-width: 0;
    }

    .sizing-strip-label {
        font-size: 12px;
        color: #525252;
    }

    .sizing-strip-value {
        font-size: 16px;
        font-weight: 700;
        color: #161616;
        white-space: nowrap;
    }

    .sizing-strip-savings {
        color: #198038;
    }

    .sizing-strip-go {
        margin-left: auto;
        display: inline-flex;
        align-items: center;
        gap: 2px;
        font-size: 13px;
        font-weight: 600;
        color: var(--pp-primary, #0d9488);
        white-space: nowrap;
    }

    /* Sizing pop-ups (email, how-to chooser, video, import) as full-screen
       sheets: the header stays, the body scrolls. They still open and close
       through style.display. */
    .sizing-modal {
        align-items: stretch;
        padding: 0;
    }

    .sizing-modal .sizing-modal-content {
        width: 100%;
        max-width: none;
        height: 100vh;
        height: 100dvh;
        max-height: none;
        margin: 0;
        border-radius: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .sizing-modal .sizing-modal-header {
        flex-shrink: 0;
        padding: 12px 16px;
    }

    .sizing-modal .sizing-modal-header h3 {
        font-size: 18px;
    }

    .sizing-modal .sizing-modal-body {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        padding: 16px;
    }

    .sizing-modal .sizing-video-modal-body {
        padding: 0;
    }

    .sizing-modal .sizing-modal-actions {
        flex-shrink: 0;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    /* The LPAR actions sit outside the body, so the rule above would drop
       their bottom gap to the safe-area inset alone. Sides match the 16px
       mobile body padding so the buttons line up with the table. */
    .sizing-modal .sizing-lpar-modal-content .sizing-modal-actions {
        padding: 0 16px calc(16px + env(safe-area-inset-bottom, 0px));
    }

    .sizing-modal .sizing-modal-close {
        min-width: 40px;
        min-height: 40px;
    }

    /* Reuse picker as a full-screen sheet; its layout is inline style, so
       these need !important. It still opens and closes with .hidden. */
    #sizingReusePickerOverlay {
        padding: 0 !important;
        align-items: stretch !important;
    }

    #sizingReusePickerOverlay > .pp-card {
        max-width: none !important;
        height: 100vh !important;
        height: 100dvh !important;
        max-height: none !important;
        border-radius: 0 !important;
    }

    #sizingReusePickerClose {
        min-height: 40px;
    }

    /* Sizing tour: the box docks to the bottom of the screen so it does not
       cover the opportunity list or the field it points at. Scoped to
       body.sizing-tour-active because the create-opportunity tour and the
       onboarding demo's menu pointer share .sizing-tour-popover. */
    body.sizing-tour-active .driver-popover.sizing-tour-popover {
        position: fixed !important;
        left: 12px !important;
        right: 12px !important;
        top: auto !important;
        bottom: calc(12px + env(safe-area-inset-bottom, 0px)) !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        margin: 0 !important;
        transform: none !important;
    }

    body.sizing-tour-active .driver-popover.sizing-tour-popover .driver-popover-arrow {
        display: none;
    }

    /* Keeps the open opportunity list above the docked tour box. */
    body.sizing-tour-active #oppPickerEditable .opp-dropdown {
        max-height: min(370px, 45vh);
    }
}

/* --- BRMS zip import: one row per system ----------------------------------- */
.sizing-import-modal-content.sizing-import-modal-wide {
    max-width: 1000px;
}

.sizing-import-systems-table tfoot td {
    font-weight: 600;
    border-top: 1px solid #E5E7EB;
}

.sizing-import-systems-table td {
    white-space: nowrap;
}

.sizing-import-systems-note {
    margin: 8px 0;
    font-size: 13px;
    color: #525252;
}

.sizing-import-systems-warning {
    margin: 8px 0 0;
    padding: 6px 10px;
    font-size: 13px;
    color: #8a5300;
    background: #fff8e6;
    border: 1px solid #f1c21b;
    border-radius: 4px;
}

/* --- LPAR modal on phones, either way up ---
   A landscape phone is wider than 767px, so the phone rules above never reach
   it. It got the desktop modal, and at ~390px tall the header, hint and
   buttons left the table ~60px: its two header rows and no LPARs. Below
   500px tall the modal becomes a full-screen sheet with tighter padding, the
   hint goes, and the table takes every pixel the header and buttons leave. */
@media (max-height: 500px) {
    .sizing-lpar-modal .sizing-lpar-modal-content {
        width: 100%;
        max-width: none;
        height: 100vh;
        height: 100dvh;
        max-height: none;
        border-radius: 0;
        overflow: hidden;
    }

    .sizing-lpar-modal .sizing-modal-header {
        flex-shrink: 0;
        padding: 8px 16px;
    }

    .sizing-lpar-modal .sizing-modal-header h3 {
        font-size: 18px;
    }

    .sizing-lpar-modal .sizing-modal-body {
        flex: 1 1 auto;
        overflow: hidden;
        padding: 8px 16px;
    }

    .sizing-lpar-modal .sizing-lpar-hint {
        display: none;
    }

    .sizing-lpar-modal .sizing-lpar-table-wrap {
        flex: 1 1 auto;
        min-height: 0;
        max-height: none;
    }

    .sizing-lpar-modal .sizing-lpar-footer {
        margin-top: 8px;
    }

    .sizing-lpar-modal .sizing-lpar-modal-content .sizing-modal-actions {
        flex-shrink: 0;
        padding: 0 16px calc(8px + env(safe-area-inset-bottom, 0px));
    }
}
