* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #F7F6F6;
    --bg-secondary: #ffffff;
    --text-primary: #333333;
    --text-secondary: #7f8c8d;
    --text-dark: var(--text-dark);
    --border-color: #ddd;
    --border-light: #e0e0e0;
    --card-bg: #f8f9fa;
    --main-color: #FFFFFF;
    --main-color-bg: #0087E0;
    --off-color: #FFFFFF;
    --off-color-bg: #646778;
    --positive-color: #387C27;
    --positive-color-bg: #F2FAEF;
    --accent-warm: #a9772b;
    --accent-warm-bg: #faf0e1;
    --accent-warm-border: #d9b97a;
    --negative-color: #8a3a2b;
    --negative-color-bg: #f5e6e2;
    --negative-color-border: #c9857a;
    --text-color: var(--text-primary);
    --text-muted: var(--text-secondary);
    --bg-color: var(--bg-secondary);
}

/* ===================== Offline Content ===================== */
.offline-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 16px;
}

.offline-text {
    font-family: 'SF Pro Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: -0.15px;
    white-space: nowrap;
    margin-bottom: 17px;
}

.offline-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 64px;
    background: #ffffff;
    border-radius: 16px;
}

.offline-illustration {
    display: block;
    width: 160px;
    height: 136px;
}

@media (max-width: 480px) {
    .offline-text {
        font-size: 13px;
        white-space: normal;
        text-align: center;
        padding: 0 16px;
    }

    .offline-panel {
        padding: 24px 32px;
    }
}

/* Login Modal Styles */
.login-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.3s ease;
}

.login-modal-content {
    background-color: var(--bg-secondary);
    border-radius: 12px;
    padding: 0;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.login-modal-header {
    padding: 30px 30px 20px;
    border-bottom: 2px solid var(--border-light);
    text-align: center;
}

.login-modal-header h2 {
    color: var(--text-dark);
    font-size: 1.8rem;
    margin: 0;
}

.login-modal-body {
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#loginForm {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.login-form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.login-form-group label {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.95rem;
}

.login-form-group input {
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.3s ease;
}

.login-form-group input:focus {
    outline: none;
    border-color: var(--main-color);
    box-shadow: 0 0 0 3px rgba(91, 65, 58, 0.1);
}

.login-error {
    background-color: var(--negative-color-bg);
    border: 1px solid var(--negative-color-border);
    border-radius: 6px;
    padding: 12px;
    color: var(--negative-color);
    font-size: 0.9rem;
}

.auth-error-message {
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0;
    white-space: pre-line;
}

.login-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}


.login-submit-btn {
    padding: 12px;
    background-color: var(--main-color-bg);
    color: var(--main-color);
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-top: 10px;
}

.login-submit-btn:hover {
    background-color: var(--main-color-bg);
}

.login-submit-btn:active {
    transform: scale(0.98);
}

/* Producer Selection Modal */
.producer-select-info {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 0;
    font-size: 0.95rem;
}

.producer-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.producer-select-btn {
    padding: 16px 20px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.producer-select-btn:hover {
    background-color: var(--main-color);
    color: white;
    border-color: var(--main-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(91, 65, 58, 0.3);
}

.producer-select-btn:active {
    transform: translateY(0);
}

/* Currently active producer in the runtime switch modal */
.producer-select-btn.is-current {
    border-color: var(--main-color);
    box-shadow: inset 0 0 0 1px var(--main-color);
}

.producer-modal-cancel {
    margin-top: 4px;
    padding: 12px 20px;
    background: none;
    color: var(--text-secondary);
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.producer-modal-cancel:hover {
    background-color: var(--bg-primary);
}


/* ===================== Top App Bar ===================== */
.top-app-bar {
    position: relative;
    width: 100%;
    height: 151px;
    overflow: hidden;
    box-shadow: 0px 6px 12px 0px rgba(35, 38, 42, 0.08);
    z-index: 10;
    background-color: var(--main-color); /* fallback while image loads */
}

.top-app-bar-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

/* Landscape (width > height): show horizontal, hide vertical */
@media (orientation: landscape) {
    .top-app-bar-bg--horizontal { display: block; }
    .top-app-bar-bg--vertical   { display: none; }
}

/* Portrait (height >= width): show vertical, hide horizontal */
@media (orientation: portrait) {
    .top-app-bar-bg--horizontal { display: none; }
    .top-app-bar-bg--vertical   { display: block; }
}

.top-app-bar-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    width: 90%;
    margin: 0 auto;
    padding: 44px 20px 0;
}

.top-app-bar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.top-app-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.top-app-bar-title {
    font-family: 'SF Pro Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: white;
    white-space: nowrap;
}

.top-app-bar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.34);
    color: #000000;
    cursor: pointer;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
}

#logoutBtn {
    background: #ffdfd8;
    color: #c4321a;
}

.top-app-bar-btn:hover {
    opacity: 0.85;
}

.top-app-bar-btn svg {
    display: block;
}


body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    width: calc(100% - 32px);
    margin: -42px 16px 16px;
    padding: 20px;
    position: relative;
    z-index: 11;
}



h1 {
    font-size: 2.5rem;
    color: var(--text-dark);
    margin-bottom: 10px;
}

.upload-section {
    background: var(--bg-secondary);
    border-radius: 0 0 12px 12px;
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    transition: background-color 0.3s ease;
    border: 2px solid var(--border-light);
    border-top: none;
}

.file-input-wrapper {
    margin-bottom: 20px;
}

/* Inline field error — appears directly under the upload input's border. */
.field-error {
    display: flex;
    align-items: flex-start;
    gap: 2px;
    margin-top: 4px;
    padding-left: 2px;
    color: var(--negative-color);
    font-family: 'SF Pro Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 12px;
    font-weight: 400;
    line-height: 14px;
}

.field-error-icon {
    flex-shrink: 0;
    color: var(--negative-color);
}

.field-error-text {
    line-height: 14px;
}

/* Inline field warning — appears below the Analyze Menu button. */
.field-warning {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 2px;
    margin: 12px auto 0;
    padding: 0 2px;
    color: var(--accent-warm);
    font-family: 'SF Pro Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 12px;
    font-weight: 400;
    line-height: 14px;
    text-align: center;
}

.field-warning-icon {
    flex-shrink: 0;
    color: var(--accent-warm);
}

.field-warning-text {
    line-height: 14px;
}

/* Session-expiry warning banner — non-blocking strip at the top of #appContent.
   Shown by scheduleExpiryWarning() 15 min before JWT exp. Stays visible until
   user clicks "Log in again", successful re-login, or actual 401. */
.session-expiry-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 10px 16px;
    background-color: var(--accent-warm, #b86e00);
    color: #ffffff;
    font-family: 'SF Pro Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    font-weight: 500;
    line-height: 18px;
    text-align: center;
}

.session-expiry-text {
    flex: 0 1 auto;
}

.session-expiry-btn {
    flex-shrink: 0;
    padding: 6px 14px;
    background-color: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 6px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 120ms ease;
}

.session-expiry-btn:hover {
    background-color: rgba(255, 255, 255, 0.28);
}

.session-expiry-btn:active {
    transform: scale(0.98);
}

#fileInput,
#cameraInput {
    display: none;
}

.file-label {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 8px;
    border: 2px dashed var(--border-color);
    border-radius: 16px;
    text-align: center;
    overflow: hidden;
    background-color: transparent;
    transition: border-color 0.15s ease;
}

.file-label.has-error {
    border-color: var(--negative-color);
}

.file-label::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: repeating-linear-gradient(
        135deg,
        transparent,
        transparent 4px,
        rgba(0, 0, 0, 0.02) 4px,
        rgba(0, 0, 0, 0.02) 8px
    );
    border-radius: 16px;
    pointer-events: none;
}

.upload-action-buttons {
    position: relative;
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.upload-action-separator {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
}

.upload-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background-color: var(--off-color-bg);
    color: var(--off-color);
    border: none;
    border-radius: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro', 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.upload-action-btn:hover {
    opacity: 0.85;
}

.upload-action-btn svg {
    flex-shrink: 0;
}

.form-options {
    margin-bottom: 20px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.95rem;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-dark);
}

.form-group input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.form-group input[type="text"]:focus {
    outline: none;
    border-color: var(--main-color);
}

.consent-notice {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    margin: 24px 0 16px;
}

.ai-disclaimer {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 12px;
    font-weight: 400;
    color: #4d555c;
    margin-bottom: 16px;
}

.ai-disclaimer-icon {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    color: #4d555c;
}

.submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 0 auto;
    padding: 10px 24px;
    background-color: var(--main-color-bg);
    color: var(--main-color);
    border: none;
    border-radius: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro', 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.submit-btn:hover:not(:disabled) {
    opacity: 0.85;
}

.submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.submit-btn svg {
    flex-shrink: 0;
}

.image-preview {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
    text-align: center;
}

.image-preview h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: var(--text-dark);
}

.image-preview img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 0 auto 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: block;
}

#imageInfo {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ===================== Loader Panel ===================== */
.loader-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 32px 64px;
    background: #ffffff;
    border-radius: 16px;
    max-width: 700px;
    margin: 0 auto;
}

.loader-panel-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.loader-spinner {
    display: block;
}

.loader-track {
    fill: none;
    stroke: var(--border-light);
    stroke-width: 8;
}

.loader-arc {
    fill: none;
    stroke: var(--main-color-bg);
    stroke-width: 8;
    stroke-linecap: round;
    /* circumference = 2 * π * 52 ≈ 326.73 */
    stroke-dasharray: 245 81.73; /* ~75% filled, ~25% gap */
    /* The ring spins continuously for the whole analysis — per-stage progress is
     * communicated by the step list below, not by filling this ring. */
    animation: loader-spin 1.2s linear infinite;
    transform-origin: center;
}

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

.loader-text {
    font-family: 'SF Pro Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    font-weight: 500;
    /* Figma: theme/color/text/neutral-strong */
    color: #646778;
    letter-spacing: -0.15px;
    text-align: center;
}

/* Vertical checklist of pipeline stages shown below the spinner (Figma node
 * 479:759). Each step shows an icon before its label: completed steps get a
 * green checkmark + green text; the running and pending steps get a grey
 * status-partly-circle + grey text. The running step's circle spins. */
.analysis-stage-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-self: center;
    text-align: left;
}

.stage-step {
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: 'SF Pro Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 12px;
    line-height: 18px;
    font-weight: 400;
    /* Running and pending stages: Figma color/ui/neutral/50. */
    color: #b2bbc1;
    transition: color 0.3s ease;
}

/* Completed stage: Figma color/palette/green/45. */
.stage-step.is-done {
    color: #3f8b2a;
}

/* Icon slot — fixed 18px box so labels align regardless of which icon shows.
 * Both SVGs are rendered; CSS reveals the one matching the step state and the
 * `currentColor` fill inherits the row colour (green when done, grey otherwise). */
.stage-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
}

.stage-icon svg {
    display: none;
}

/* Done → checkmark; active/pending → partly-circle. */
.stage-step.is-done .stage-icon-check {
    display: block;
}

.stage-step.is-active .stage-icon-pending,
.stage-step.is-pending .stage-icon-pending {
    display: block;
}

/* The running step's circle spins slowly to read as in-progress — subtler and
 * smaller than the main loader ring so the two don't compete. */
.stage-step.is-active .stage-icon-pending {
    animation: stage-icon-spin 2s linear infinite;
    transform-origin: center;
}

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

@media (prefers-reduced-motion: reduce) {
    .stage-step.is-active .stage-icon-pending {
        animation: none;
    }
}

.loader-cancel-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    background-color: var(--off-color-bg);
    color: var(--off-color);
    border: none;
    border-radius: 20px;
    font-family: 'SF Pro Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.15px;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.loader-cancel-btn:hover {
    opacity: 0.85;
}

.error-message {
    background-color: var(--negative-color-bg);
    border: 1px solid var(--negative-color-border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    color: var(--negative-color);
}


.results-section {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s ease;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.results-section h2 {
    color: var(--text-dark);
    margin-bottom: 0;
    font-size: 1.8rem;
}

.analysis-time {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.brand-index {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-secondary) 100%);
    border: 2px solid var(--border-light);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
}


.brand-index h3 {
    color: var(--text-dark);
    margin-bottom: 10px;
}


.brand-index .percentage {
    font-size: 3rem;
    font-weight: bold;
    color: var(--positive-color);
}


.brand-index .details {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 10px;
}

.no-brands-message {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-top: 15px;
    padding: 10px;
    text-align: center;
}

.analysis-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.analysis-card {
    background-color: var(--bg-primary);
    border-radius: 8px;
    padding: 20px;
    border: 1px solid var(--border-light);
}

.analysis-card h3 {
    color: var(--text-dark);
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.analysis-card ul {
    list-style: none;
    padding-left: 0;
}

.analysis-card li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
}

.analysis-card li:last-child {
    border-bottom: none;
}

.analysis-card strong {
    color: var(--text-dark);
}

.venue-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.detail-row {
    display: flex;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row .label {
    font-weight: 600;
    color: var(--text-dark);
    min-width: 140px;
}

.detail-row .value {
    color: var(--text-primary);
}

.producer-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.situation-label {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.situation-list {
    list-style: disc;
    margin-left: 20px;
    color: var(--text-primary);
}

.situation-list li {
    margin-bottom: 8px;
    border-bottom: none;
}

.recommendations {
    margin-top: 20px;
}

.recommendations h3 {
    color: var(--text-dark);
    margin-bottom: 15px;
    font-size: 1.4rem;
    text-align: center;
}

.recommendations-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.recommendation-checkbox-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 15px;
    background-color: var(--bg-primary);
    border-radius: 8px;
    border: 1px solid var(--border-light);
    transition: all 0.3s ease;
}

.recommendation-checkbox-item:hover {
    background-color: var(--bg-secondary);
    border-color: var(--main-color);
}


.recommendation-checkbox-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    cursor: pointer;
    flex-shrink: 0;
}

.recommendation-label {
    flex: 1;
    cursor: pointer;
}

.recommendation-title {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.recommendation-description {
    color: var(--text-primary);
    font-size: 0.95rem;
    margin-bottom: 8px;
    line-height: 1.5;
}

.recommendation-products {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.recommendation-meta {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.confirm-btn {
    width: 100%;
    padding: 12px;
    background-color: var(--text-dark);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 15px;
    transition: background-color 0.3s ease;
}

.confirm-btn:hover {
    background-color: #1a252f;
}


/* Modal styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background-color: var(--bg-secondary);
    border-radius: 12px;
    padding: 0;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-light);
}

.modal-header h2 {
    color: var(--text-dark);
    margin: 0;
    font-size: 1.5rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 1rem;
}

.modal-footer {
    display: flex;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid var(--border-light);
    justify-content: flex-end;
}

.modal-btn-confirm {
    padding: 10px 30px;
    background-color: var(--main-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.modal-btn-confirm:hover {
    background-color: var(--main-color);
}


.change-photo-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 0 auto;
    padding: 10px 24px;
    background-color: var(--main-color-bg);
    color: var(--main-color);
    border: none;
    border-radius: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro', 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.change-photo-btn:hover {
    opacity: 0.85;
}

.change-photo-btn svg {
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
        width: calc(100% - 32px);
        max-width: none;
        margin: -32px 16px 16px;
    }

    .top-app-bar {
        height: 120px;
    }

    .top-app-bar-content {
        width: 100%;
        padding: 28px 10px 0;
    }

    .upload-section {
        padding: 15px;
        margin-bottom: 15px;
    }

    .file-label {
        padding: 20px 8px;
    }

    .submit-btn {
        padding: 10px 20px;
        font-size: 14px;
    }

    .analysis-grid {
        grid-template-columns: 1fr;
    }

    .results-section {
        padding: 15px;
    }

    .results-section h2 {
        font-size: 1.4rem;
    }

    .brand-index .percentage {
        font-size: 2.5rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 8px;
        width: calc(100% - 32px);
        margin: -28px 16px 16px;
    }

    .top-app-bar {
        height: 100px;
    }

    .top-app-bar-content {
        width: 100%;
        padding: 20px 8px 0;
    }

    .top-app-bar-title {
        font-size: 18px;
    }

    .upload-section {
        padding: 12px;
        margin-bottom: 12px;
    }

    .file-label {
        padding: 16px 8px;
    }

    .form-options {
        margin-bottom: 15px;
    }

    .checkbox-label {
        font-size: 0.85rem;
    }

    .submit-btn {
        padding: 8px 16px;
        font-size: 13px;
    }

    .session-expiry-banner {
        flex-direction: column;
        gap: 8px;
        padding: 10px 12px;
        font-size: 13px;
    }

    .loader-panel {
        padding: 24px 32px;
    }

    .analysis-card {
        padding: 15px;
    }

    .analysis-card h3 {
        font-size: 1.1rem;
    }

    .recommendation-item {
        padding: 12px;
    }
}

/* ===================== Tabs Styles ===================== */

/* Tab Navigation */
.tabs-navigation {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 30px;
    padding: 0 20px;
}

.tab-btn {
    padding: 15px 30px;
    border: 2px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: 8px 8px 0 0;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn:hover {
    background: var(--card-bg);
    border-color: var(--main-color);
}

.tab-btn.active {
    background: var(--bg-secondary);
    color: var(--main-color);
    border-color: var(--main-color);
    border-bottom: 2px solid var(--bg-secondary);
    position: relative;
    bottom: -2px;
}


/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ===================== Multipage Section Styles ===================== */

/* Multipage Section */
.multipage-section {
    padding: 30px;
    background: #ffffff;
    border-radius: 16px;
    border: none;
    overflow: hidden;
    /* shadow/down/xl */
    box-shadow: 0 10px 32px 0 rgba(35, 38, 42, 0.13);
}

.section-header {
    text-align: left;
    margin-bottom: 30px;
}

.section-header h2 {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro', 'Segoe UI', Roboto, sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.section-subtitle {
    display: flex;
    align-items: flex-start;
    gap: 2px;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 400;
    line-height: 16px;
}

.section-subtitle-icon {
    flex-shrink: 0;
    /* Icon is 16px tall and the first text line has line-height: 16px,
       so flex-start makes the icon align with the first line of text. */
}

/* Upload Type Switcher */
.upload-type-switcher {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 30px;
}

.switcher-btn {
    padding: 12px 30px;
    border: 2px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.switcher-btn:hover {
    border-color: var(--main-color);
    background: var(--main-color-bg);
}


.switcher-btn.active {
    border-color: var(--main-color);
    background: var(--main-color);
    color: white;
}

/* Pipeline Mode Switcher */
.pipeline-mode-switcher {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 16px;
}

.pipeline-btn {
    padding: 10px 24px;
    border: 2px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pipeline-btn:hover {
    border-color: var(--main-color);
    background: var(--main-color-bg);
}


.pipeline-btn.active {
    border-color: var(--main-color);
    background: var(--main-color);
    color: white;
}

.singleprompt-info {
    background: var(--main-color-bg);
    border: 1px solid var(--main-color);
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 12px;
    color: var(--main-color);
    font-size: 0.88rem;
}


/* Upload Containers */
.upload-container {
    max-width: 700px;
    margin: 0 auto;
}

/* Analyzing state — hide form controls, keep photo previews without delete buttons */
.upload-container.is-analyzing .file-input-wrapper,
.upload-container.is-analyzing .form-options,
.upload-container.is-analyzing .consent-notice,
.upload-container.is-analyzing .submit-btn,
.upload-container.is-analyzing .field-warning {
    display: none;
}

.upload-container.is-analyzing .image-thumbnail-delete {
    display: none;
}

/* Config Details */
.config-details {
    margin: 20px 0;
    padding: 15px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
}

.config-details summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--text-dark);
    padding: 5px;
}

.config-options {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.config-row {
    display: grid;
    grid-template-columns: 150px 1fr 100px 1fr;
    gap: 10px;
    align-items: center;
}

.config-row label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.config-row select,
.config-row input[type="text"] {
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

.config-row select:disabled {
    background-color: var(--card-bg);
    color: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.6;
}

/* Images Previews — per Figma: outer section has no border; each card has its own */
.images-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    margin: 16px 0 0;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
}

.image-thumbnail {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 180px;
    min-height: 32px;
    padding: 16px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    transition: border-color 0.2s ease;
}

.image-thumbnail-image {
    width: 100%;
    height: 90px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
}

.image-thumbnail-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.image-thumbnail-fallback {
    font-size: 12px;
    color: var(--text-primary);
    text-align: center;
    padding: 4px;
    line-height: 14px;
}

/* PDF placeholder shown inside a thumbnail's image container. */
.image-thumbnail-pdf {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--negative-color);
    font-size: 12px;
    font-weight: 600;
    line-height: 14px;
}

.image-thumbnail-pdf svg {
    display: block;
}

.image-thumbnail-label {
    width: 100%;
    font-family: 'SF Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 12px;
    font-weight: 400;
    color: #202427;
    line-height: 18px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-thumbnail-delete {
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--negative-color-bg);
    color: var(--negative-color);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.15s ease, background-color 0.15s ease;
}

.image-thumbnail-delete:hover {
    background-color: var(--negative-color-bg);
}

.image-thumbnail-delete:focus-visible {
    outline: 2px solid var(--negative-color);
    outline-offset: 2px;
}

.image-thumbnail-delete svg {
    display: block;
}

/* Dark mode */
body.dark-mode .image-thumbnail {
    background: #1a252f;
    border-color: #2a3540;
}

body.dark-mode .image-thumbnail-image {
    border-color: #2a3540;
    background: #0f1820;
}

body.dark-mode .image-thumbnail-label {
    color: var(--border-light);
}

/* Results Section */
.multipage-results {
    margin-top: 0;
}

.results-summary {
    padding: 8px 20px 20px;
}

.results-summary h3 {
    font-size: 1.5rem;
    color: var(--text-dark);
    margin-bottom: 15px;
    text-align: center;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--card-bg) 100%);
    border: 2px solid var(--border-light);
    border-radius: 12px;
    padding: 25px 20px;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.summary-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: #4C545D;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.summary-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(76, 84, 93, 0.2);
    border-color: #4C545D;
}

.summary-card:hover::before {
    opacity: 1;
}


.card-label {
    display: block;
    font-size: 0.85rem;
    color: #4C545D;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.card-value {
    display: block;
    font-size: 2.5rem;
    font-weight: 800;
    color: #4C545D;
    line-height: 1.2;
}

/* ===== Perfect Menu KPIs ===== */
.kpi-details {
    margin-bottom: 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.kpi-details[open] {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.kpi-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 25px;
    cursor: pointer;
    user-select: none;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 1.1rem;
    transition: background-color 0.3s ease;
}

.kpi-toggle:hover {
    background-color: var(--card-bg);
}

.kpi-details[open] .toggle-icon {
    transform: rotate(90deg);
}

.kpi-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    padding: 8px 20px 20px;
}

@media (max-width: 900px) {
    .kpi-section { grid-template-columns: 1fr; }
}

.kpi-group-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-secondary);
    margin: 0 0 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-light);
}

.kpi-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: flex-start;
}

.kpi-item {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 10px 14px;
    border: 1px solid var(--border-light);
    transition: box-shadow 0.2s ease;
}

.kpi-item:hover {
    box-shadow: 0 2px 8px rgba(91, 65, 58, 0.15);
}

.kpi-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 6px;
}

.kpi-id {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    background: rgba(91, 65, 58, 0.12);
    color: var(--main-color);
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.kpi-name {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

.kpi-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.kpi-bar {
    flex: 1;
    height: 7px;
    background: var(--border-light);
    border-radius: 4px;
    overflow: hidden;
}

.kpi-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.kpi-fill.green  { background: linear-gradient(90deg, var(--positive-color), var(--positive-color)); }
.kpi-fill.yellow { background: linear-gradient(90deg, var(--accent-warm), var(--accent-warm)); }
.kpi-fill.red    { background: linear-gradient(90deg, var(--negative-color), var(--negative-color)); }
.kpi-fill.na     { background: var(--border-light); }

.kpi-value-text {
    font-size: 0.88rem;
    font-weight: 700;
    min-width: 40px;
    text-align: right;
    color: var(--text-dark);
}

.kpi-fraction {
    font-size: 0.72rem;
    color: var(--text-secondary);
    min-width: 36px;
    text-align: right;
}


/* KPI Gauge (speedometer) */
.kpi-gauge-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 8px 12px;
    background: var(--card-bg);
    border-radius: 10px;
    border: 1px solid var(--border-light);
    width: 170px;
    text-align: center;
    transition: box-shadow 0.2s ease;
}

.kpi-gauge-card:hover {
    box-shadow: 0 2px 10px rgba(91, 65, 58, 0.15);
}

.kpi-gauge-svg {
    width: 150px;
    height: 90px;
    margin: 4px 0;
}

.kpi-gauge-track {
    fill: none;
    stroke: var(--border-light);
}

.kpi-gauge-arc {
    fill: none;
    transition: stroke-dashoffset 0.7s ease;
}

.kpi-gauge-arc--green  { stroke: var(--positive-color); }
.kpi-gauge-arc--yellow { stroke: var(--accent-warm); }
.kpi-gauge-arc--red    { stroke: var(--negative-color); }

.kpi-gauge-value-text {
    font-size: 20px;
    font-weight: 800;
    text-anchor: middle;
    fill: var(--text-dark);
}

.kpi-gauge-fraction-text {
    font-size: 11px;
    text-anchor: middle;
    fill: var(--text-secondary);
}

.kpi-gauge-name {
    font-size: 0.73rem;
    color: var(--text-secondary);
    line-height: 1.35;
    margin-top: 6px;
    max-width: 150px;
}


/* ===== KPI Table Cards (Figma design) ===== */
.kpi-tables-wrapper {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}

.kpi-table-card {
    border: 1px solid var(--border-light);
    border-radius: 16px;
    background: #ffffff;
    overflow: hidden;
}

/* Header row */
.kpi-table-header {
    display: flex;
    align-items: center;
    height: 46px;
    border-bottom: 1px solid var(--border-light);
}

.kpi-table-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 50%;
    min-width: 0;
    padding: 0 16px;
    border-right: 1px solid var(--border-light);
    align-self: stretch;
}

.kpi-table-icon {
    flex-shrink: 0;
    color: var(--text-secondary);
}

body.dark-mode .kpi-table-icon {
    color: var(--text-secondary);
}

.kpi-table-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.kpi-table-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 4px;
    border-radius: 50%;
    background: var(--border-light);
    font-size: 10px;
    font-weight: 700;
    color: var(--text-secondary);
    line-height: 1;
    box-sizing: border-box;
}

.kpi-table-col-header {
    flex: 0 0 25%;
    text-align: center;
    font-size: 14px;
    font-weight: 400;
    color: var(--text-secondary);
    padding: 0 16px;
}

/* Data rows */
.kpi-row {
    display: flex;
    align-items: center;
    height: 54px;
    background: #ffffff;
    border-bottom: 1px solid var(--border-light);
}

.kpi-row--last {
    border-bottom: none;
}

.kpi-row-name {
    flex: 0 0 50%;
    min-width: 0;
    padding: 8px 16px 8px 48px;
    font-size: 14px;
    font-weight: 400;
    color: #202427;
    line-height: 18px;
    border-right: 1px solid var(--border-light);
    align-self: stretch;
    display: flex;
    align-items: center;
}

.kpi-row-result {
    flex: 0 0 25%;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    padding: 0 16px;
    font-family: 'Roboto', sans-serif;
    line-height: 22px;
}

.kpi-row-result--green  { color: var(--positive-color); }
.kpi-row-result--yellow { color: var(--accent-warm); }
.kpi-row-result--red    { color: var(--negative-color); }

.kpi-row-score {
    flex: 0 0 25%;
    text-align: center;
    font-size: 16px;
    padding: 0 16px;
    font-family: 'Roboto', sans-serif;
    line-height: 22px;
}

.kpi-score-num {
    font-weight: 600;
    color: var(--text-primary);
}

.kpi-score-den {
    font-weight: 400;
    color: var(--text-secondary);
}



/* Empty state — per Figma (node 111:2295): 14px SF Pro regular, var(--text-secondary),
   line-height 18px, horizontally centered, with 12px gap between header and text. */
.kpi-row-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    margin-top: 0;
    font-family: 'SF Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    font-weight: 400;
    color: var(--text-secondary);
    line-height: 18px;
    text-align: center;
}

body.dark-mode .kpi-row-empty {
    color: var(--text-secondary);
}


/* ===== Wine KPI Table (Figma node 436:5135) ===== */

/* Card override — Figma card has 16px inner padding */
#wineCard {
    padding: 16px;
    overflow-x: auto;
    overflow-y: visible;
}

/* --- Header (46px) --- */
.wine-header {
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-light);
}

.wine-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    min-width: 0;
    height: 46px;
    padding: 0 16px;
}

.wine-header-left > svg {
    flex-shrink: 0;
}

/* Title + counter badge group */
.wine-header-title-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wine-header-title {
    font-size: 18px;
    font-weight: 600;
    color: #4d555c;
    white-space: nowrap;
    line-height: normal;
}

/* Counter badge — circular, centered */
.wine-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 4px;
    border-radius: 50%;
    background: var(--border-light);
    font-size: 10px;
    font-weight: 700;
    color: var(--text-secondary);
    line-height: 1;
    box-sizing: border-box;
}

/* "All" column header — Figma: 68px, 12px regular, #23242b */
.wine-col-header {
    width: 68px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: stretch;
    padding: 0 12px;
    font-size: 12px;
    font-weight: 400;
    color: #23242b;
}

/* --- Data rows (64px tall) --- */
.wine-row {
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-light);
}

.wine-row:last-child,
.wine-row--last {
    border-bottom: none;
}

/* Left cell — Figma: pl-16 pr-12 py-8, gap-2 default */
.wine-row-left {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
    min-width: 0;
    padding: 8px 12px 8px 16px;
    align-self: stretch;
}

/* "Ours" rows — Figma: gap-12 between logo and name-group */
.wine-row-left--ours {
    gap: 12px;
}

/* Name + chevron sub-group inside "ours" rows — Figma: gap-13 */
.wine-name-group {
    display: flex;
    align-items: center;
    gap: 13px;
}

/* Producer logo — Figma: 15.12×18 */
.wine-row-logo {
    width: 15px;
    height: 18px;
    flex-shrink: 0;
}

.wine-row-name {
    font-size: 14px;
    font-weight: 400;
    color: #202427;
    line-height: 18px;
    white-space: nowrap;
}

.wine-chevron {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

/* Expandable parent rows */
.wine-row--expandable {
    cursor: pointer;
}

/* Active (expanded) chevron: point right + use brand color */
.wine-row--expandable.expanded .wine-chevron {
    transform: rotate(-90deg);
}

.wine-row--expandable.expanded .wine-chevron path {
    fill: var(--main-color-bg);
}

/* Right value cell — Figma: 68px × 64px, border-left, 14px medium #23242b */
.wine-row-value {
    width: 68px;
    height: 64px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-left: 1px solid var(--border-light);
    font-size: 14px;
    font-weight: 500;
    color: #23242b;
    letter-spacing: -0.15px;
}

/* Per-row "All" label — hidden by default */
.wine-val-label {
    display: none;
}

.wine-val-num {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

/* --- When ANY row is expanded (.has-expanded on card) --- */

/* ALL value cells switch to column layout with "All" label visible */
.has-expanded .wine-row-value {
    flex-direction: column;
    padding: 0;
    height: auto;
    min-height: 64px;
    align-self: stretch;
}

/* "All" label on every row — matches .wine-sub-inline-header exactly */
.has-expanded .wine-val-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 28px;
    padding: 0 12px;
    font-size: 12px;
    font-weight: 400;
    color: #23242b;
    letter-spacing: 0;
    line-height: normal;
    border-bottom: 1px solid var(--border-light);
    box-sizing: border-box;
}

/* Value number in column mode — matches .wine-sub-inline-cell */
.has-expanded .wine-val-num {
    padding: 10px 12px;
    font-size: 16px;
    font-weight: 400;
    font-family: 'Roboto', sans-serif;
    line-height: 22px;
    letter-spacing: 0;
    box-sizing: border-box;
}

/* Only expanded rows get the right border (separates "All" from subtypes) */
.wine-row--expandable.expanded .wine-row-value {
    border-right: 1px solid var(--border-light);
}

/* --- Inline subtype columns (Figma 459:3237) — appear to the right of the "All" cell --- */
.wine-sub-inline {
    display: none;
    flex-shrink: 0;
    width: 340px; /* 5 × 68px (red, white, rosé, sparkling, champagne) */
}

.wine-row--expandable.expanded .wine-sub-inline {
    display: flex;
}

/* Each subtype column: header on top, value below */
.wine-sub-inline-col {
    width: 68px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-self: stretch;
}

/* Subtype header (Red / White / Rosé / Sparkling) */
.wine-sub-inline-header {
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    font-size: 12px;
    font-weight: 400;
    line-height: normal;
    border-bottom: 1px solid var(--border-light);
    box-sizing: border-box;
}

/* Subtype value cell (colored background) */
.wine-sub-inline-cell {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    font-size: 16px;
    font-weight: 400;
    font-family: 'Roboto', sans-serif;
    line-height: 22px;
    box-sizing: border-box;
}

/* Last row: ensure no stray borders on children either */
.wine-row--last .wine-row-value {
    border-bottom: none;
}

body.dark-mode .wine-row-name {
    color: var(--text-primary);
}

body.dark-mode .wine-row-value {
    color: var(--text-primary);
}

body.dark-mode .wine-header-title {
    color: var(--text-primary);
}

body.dark-mode .wine-col-header {
    color: var(--text-primary);
}

body.dark-mode .wine-sub-inline-header {
    border-bottom-color: var(--border-light);
}

body.dark-mode .wine-val-label {
    color: var(--text-primary);
    border-bottom-color: var(--border-light);
}

/* Responsive: tighten padding on narrow screens */
@media (max-width: 780px) {
    .kpi-row-name {
        padding-left: 16px;
    }
}

/* Cost Summary Details/Summary */
.cost-summary-details {
    margin-bottom: 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.cost-summary-details[open] {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.cost-summary-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 25px;
    cursor: pointer;
    user-select: none;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 1.1rem;
    transition: background-color 0.3s ease;
}

.cost-summary-toggle:hover {
    background-color: var(--card-bg);
}

.toggle-icon {
    display: inline-block;
    transition: transform 0.3s ease;
    font-size: 0.9rem;
}

.cost-summary-details[open] .toggle-icon {
    transform: rotate(90deg);
}

/* Cost Summary Table */
.cost-summary {
    background: var(--bg-secondary);
    padding: 0 25px 25px 25px;
}

.cost-summary h3 {
    font-size: 1.5rem;
    color: var(--text-dark);
    margin: 20px 0;
    font-weight: 700;
    padding-bottom: 15px;
    border-bottom: 3px solid transparent;
    border-image: linear-gradient(90deg, var(--main-color) 0%, var(--negative-color) 100%);
    border-image-slice: 1;
}

.cost-table {
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    border-radius: 8px;
    overflow: hidden;
}

.cost-table thead {
    background: linear-gradient(135deg, var(--main-color) 0%, var(--main-color) 100%) !important;
}

.cost-table thead th {
    color: white !important;
    font-weight: 600;
    padding: 15px 12px !important;
    text-align: left;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none !important;
}


.cost-table tbody td {
    padding: 14px 12px !important;
    border-bottom: 1px solid var(--border-light) !important;
    color: var(--text-primary);
    font-size: 0.95rem;
    vertical-align: middle;
}

.cost-table tbody tr:nth-child(even) {
    background-color: var(--bg-primary) !important;
}

.cost-table tbody tr:nth-child(odd) {
    background-color: var(--bg-secondary) !important;
}

.cost-table tbody tr:hover {
    background-color: var(--card-bg) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    cursor: pointer;
}


.cost-table tbody td:first-child {
    color: var(--text-dark);
    font-weight: 600;
}

/* ===================== Logo Information Section ===================== */

/* Logo Information Details/Summary */
.logo-info-details {
    margin-bottom: 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.logo-info-details[open] {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.logo-info-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 25px;
    cursor: pointer;
    user-select: none;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 1.1rem;
    transition: background-color 0.3s ease;
}

.logo-info-toggle:hover {
    background-color: var(--card-bg);
}

.logo-info-details[open] .toggle-icon {
    transform: rotate(90deg);
}

/* Logo Info wrapper */
.logo-info {
    background: var(--bg-secondary);
    padding: 0 25px 25px 25px;
}

.logo-info h3 {
    font-size: 1.5rem;
    color: var(--text-dark);
    margin: 25px 0 20px 0;
    font-weight: 700;
}

/* Logo Metrics (above table) */
.logo-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    padding: 0 0 20px 0;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
}

.logo-metric-card {
    padding: 15px 0;
    text-align: center;
}

.metric-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.metric-value {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-dark);
}

/* Metric value colors based on state */
.metric-value.metric-positive {
    color: var(--positive-color);
}

.metric-value.metric-negative {
    color: var(--text-secondary);
}

.metric-value.metric-image {
    color: var(--main-color);
}

.metric-value.metric-text {
    color: var(--main-color);
}


/* Logo Table */
.logo-table-container {
    padding: 0;
}

.logo-table {
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    border-radius: 8px;
    overflow: hidden;
}

.logo-table thead {
    background: linear-gradient(135deg, var(--main-color) 0%, var(--main-color) 100%) !important;
}

.logo-table thead th {
    color: white !important;
    font-weight: 600;
    padding: 15px 12px !important;
    text-align: left;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none !important;
}


.logo-table tbody td {
    padding: 14px 12px !important;
    border-bottom: 1px solid var(--border-light) !important;
    color: var(--text-primary);
    font-size: 0.95rem;
    vertical-align: middle;
}

.logo-table tbody tr:nth-child(even) {
    background-color: var(--bg-primary) !important;
}

.logo-table tbody tr:nth-child(odd) {
    background-color: var(--bg-secondary) !important;
}

.logo-table tbody tr:hover {
    background-color: var(--card-bg) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    cursor: pointer;
}


.logo-table tbody td:first-child {
    color: var(--text-dark);
    font-weight: 600;
}

/* No logos message */
.no-logos-message {
    text-align: center !important;
    color: var(--text-secondary);
    font-style: italic;
    padding: 30px !important;
}

/* Position badge (similar to page-badge) */
.position-badge {
    display: inline-block;
    padding: 3px 8px;
    background: linear-gradient(135deg, var(--main-color) 0%, var(--main-color) 100%);
    color: white;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
}


/* Responsive adjustments */
@media (max-width: 768px) {
    .logo-metrics {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 20px;
    }

    .logo-table-container {
        padding: 0 15px 15px 15px;
        overflow-x: auto;
    }

    .logo-table thead th {
        padding: 12px 8px !important;
        font-size: 0.8rem;
    }

    .logo-table tbody td {
        padding: 10px 8px !important;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .logo-info-toggle {
        padding: 15px 20px;
        font-size: 1rem;
    }

    .logo-metrics {
        padding: 15px;
    }

    .metric-value {
        font-size: 1.1rem;
    }

    .logo-table thead th {
        padding: 10px 6px !important;
        font-size: 0.75rem;
    }

    .logo-table tbody td {
        padding: 8px 6px !important;
        font-size: 0.8rem;
    }

    .position-badge {
        font-size: 0.7rem;
        padding: 2px 6px;
    }
}

/* DataTable Styling */
.results-table-container {
    background: #ffffff;
    border: 1px solid #e6e8ea;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: none;
}

.results-table-container h3 {
    font-size: 1.1rem;
    color: #4C545D;
    margin-bottom: 16px;
    font-weight: 600;
    padding-bottom: 0;
    border-bottom: none;
    display: inline-block;
}

/* DataTable base styling */
#multipageResultsTable {
    /* Do NOT force 100% width — DataTables scrollX sets an explicit pixel width
       on the inner table; overriding it with 100% desynchronises header and body. */
    border-collapse: separate !important;
    border-spacing: 0 !important;
}


/* Explicitly hide the duplicate <thead> DataTables keeps in the scroll body
   for column-width calculations — our custom CSS must not un-hide it. */
div.dataTables_scrollBody thead tr {
    height: 0 !important;
    overflow: hidden !important;
    visibility: hidden !important;
}

/* Table header — target the CLONED header in dataTables_scrollHead.
   #multipageResultsTable lives inside dataTables_scrollBody (the hidden duplicate),
   so selectors using that id do NOT reach the visible cloned header. */
.dataTables_scrollHead thead th {
    background: #ffffff;
    color: #646778 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
    font-weight: 400;
    padding: 0 16px !important;
    height: 48px;
    vertical-align: middle;
    text-align: left;
    font-size: 14px;
    text-transform: none;
    letter-spacing: normal;
    border: none !important;
    border-bottom: 1px solid #e3e6e8 !important;
    white-space: nowrap !important;
    min-width: 150px;
}

.dataTables_scrollHead thead th[title] {
    cursor: help;
}


.dataTables_scrollHead thead th:first-child {
    border-radius: 8px 0 0 0;
}

.dataTables_scrollHead thead th:last-child {
    border-radius: 0 8px 0 0;
}

/* Keep the header visible when the page scrolls vertically.
   Applied via CSS (not JS) so DataTables measures column widths with sticky already in effect,
   avoiding post-init layout shifts that break scrollX alignment. */
.results-table-container .dataTables_scrollHead {
    position: sticky;
    top: 0;
    z-index: 99;
}

/* Sortable columns */
.dataTables_scrollHead thead th.sorting,
.dataTables_scrollHead thead th.sorting_asc,
.dataTables_scrollHead thead th.sorting_desc {
    cursor: pointer;
}

.dataTables_scrollHead thead th.sorting:hover,
.dataTables_scrollHead thead th.sorting_asc:hover,
.dataTables_scrollHead thead th.sorting_desc:hover {
    background: #f4f5f6;
}

/* Table body — single authoritative rule.
   white-space/overflow/ellipsis clip long text visually; DataTables manages column widths. */
#multipageResultsTable tbody td {
    padding: 10px 16px !important;
    border-bottom: 1px solid #eef0f1 !important;
    color: #23262a;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
    font-weight: 500;
    font-size: 14px;
    letter-spacing: -0.15px;
    vertical-align: middle;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 150px;
}

/* All rows — white, no stripes */
#multipageResultsTable tbody tr:nth-child(even),
#multipageResultsTable tbody tr:nth-child(odd) {
    background-color: #ffffff;
}

/* Vertical separator between item name (1st col) and price (2nd col) — body only */
#multipageResultsTable tbody td:first-child {
    border-right: 1px solid #e3e5e8;
}

/* Hover effect */
#multipageResultsTable tbody tr:hover {
    background-color: #f4f5f6 !important;
    box-shadow: none;
    cursor: pointer;
}

/* Flat typography (amvyx parity): lighter item name, plain serving text,
   uniform cell colour (neutralise inline-coloured price/alcohol spans) */
#multipageResultsTable tbody td strong {
    font-weight: 500;
}

#multipageResultsTable tbody td span[style] {
    color: inherit !important;
    font-weight: inherit !important;
}

#multipageResultsTable tbody .serving-badge {
    background: none !important;
    border: none !important;
    padding: 0 !important;
    color: #23262a !important;
    font-weight: 500 !important;
    font-size: 14px !important;
}


/* Highlight target producer rows */
.target-producer-row {
    background-color: var(--positive-color-bg) !important;
    border-left: 4px solid var(--positive-color) !important;
}


.target-producer-row:hover {
    background-color: #dff0d8 !important;
}


/* ============================================================
   FixedColumns — first column pinned with position: sticky
   Each cell needs an explicit solid background; without it the
   sticky cell is transparent and shows scrolled content behind.
   ============================================================ */

/* All rows — white (no stripes) */
#multipageResultsTable tbody tr:nth-child(odd) td.dtfc-fixed-left,
#multipageResultsTable tbody tr:nth-child(even) td.dtfc-fixed-left {
    background-color: #ffffff !important;
}

/* Hover */
#multipageResultsTable tbody tr:hover td.dtfc-fixed-left {
    background-color: #f4f5f6 !important;
}


/* Target-producer rows */
.target-producer-row td.dtfc-fixed-left {
    background-color: var(--positive-color-bg) !important;
}


.target-producer-row:hover td.dtfc-fixed-left {
    background-color: #dff0d8 !important;
}


/* Fixed column header — match the rest of the header */
.dataTables_scrollHead thead th.dtfc-fixed-left {
    background: #ffffff !important;
    z-index: 3;
}

/* Subtle right-border separator between fixed and scrollable area */
td.dtfc-fixed-left,
th.dtfc-fixed-left {
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.06);
}

/* DataTables controls styling */
.dataTables_wrapper {
    padding: 0;
    color: var(--text-primary);
}

.dataTables_wrapper .dataTables_length {
    margin-bottom: 15px;
}

.dataTables_wrapper .dataTables_filter {
    margin-bottom: 15px;
}

.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label {
    color: var(--text-primary);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dataTables_wrapper .dataTables_length select {
    border: 2px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 12px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.dataTables_wrapper .dataTables_length select:focus {
    outline: none;
    border-color: var(--main-color);
    box-shadow: 0 0 0 3px rgba(91, 65, 58, 0.1);
}

.dataTables_wrapper .dataTables_filter input {
    border: 2px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 12px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.95rem;
    min-width: 250px;
    transition: all 0.3s ease;
}

.dataTables_wrapper .dataTables_filter input:focus {
    outline: none;
    border-color: var(--main-color);
    box-shadow: 0 0 0 3px rgba(91, 65, 58, 0.1);
}

/* Pagination */
.dataTables_wrapper .dataTables_paginate {
    margin-top: 20px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border: 2px solid var(--border-color) !important;
    border-radius: 6px !important;
    padding: 8px 14px !important;
    margin: 0 3px !important;
    background: var(--bg-primary) !important;
    color: var(--text-primary) !important;
    font-weight: 500 !important;
    transition: all 0.3s ease !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--main-color) !important;
    color: white !important;
    border-color: var(--main-color) !important;
    box-shadow: 0 2px 4px rgba(91, 65, 58, 0.3) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--main-color) !important;
    color: white !important;
    border-color: var(--main-color) !important;
    box-shadow: 0 2px 8px rgba(91, 65, 58, 0.4) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    opacity: 0.5;
    cursor: not-allowed !important;
}

/* Info text */
.dataTables_wrapper .dataTables_info {
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding-top: 15px;
}

/* Empty state */
.dataTables_wrapper .dataTables_empty {
    color: var(--text-secondary);
    padding: 30px !important;
    text-align: center;
    font-size: 1rem;
}

/* Processing indicator */
.dataTables_wrapper .dataTables_processing {
    background: var(--bg-secondary);
    border: 2px solid var(--main-color);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ===================================================================
   Table badges — shared layout + UXS palette variants
   =================================================================== */

/* Shared layout (all badges) */
.page-badge,
.logo-badge,
.item-type-badge,
.serving-badge {
    display: inline-block;
}

/* Per-badge size & shape */
.page-badge {
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
}

.logo-badge {
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

.item-type-badge,
.serving-badge {
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.8em;
    font-weight: 600;
}

.serving-badge   { font-weight: 500; }


/* Palette variants — grouped by UXS color family */

/* Main (brąz) — type-product (outlined), page-badge (solid) */
.page-badge {
    background: #EEF0F1;
    color: #4C545D;
}

.item-type-badge.type-product {
    background: var(--main-color-bg);
    color: var(--main-color);
    border: 1px solid var(--main-color);
}

/* Positive (zieleń) — type-set */
.item-type-badge.type-set {
    background: var(--positive-color-bg);
    color: var(--positive-color);
    border: 1px solid var(--positive-color);
}

/* Warm accent (bursztyn) — logo-yes, type-cocktail, type-shot */
.logo-badge.logo-yes,
.item-type-badge.type-cocktail,
.item-type-badge.type-shot {
    background: var(--accent-warm-bg);
    color: var(--accent-warm);
    border: 1px solid var(--accent-warm-border);
}

/* Neutral muted — type-other, serving-badge */
.item-type-badge.type-other,
.serving-badge {
    background: var(--card-bg);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

/* Text-only muted — logo-no */
.logo-badge.logo-no {
    color: var(--text-secondary);
}


/* Wine subtype badges — colored pills matching Figma design */
.wine-subtype-badge {
    display: inline-block;
    padding: 7px 12px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 400;
    border: none;
    letter-spacing: -0.15px;
    text-align: center;
    white-space: nowrap;
}
.wine-subtype-badge.wine-white     { background: #f4f5f6; color: #4c545d; }
.wine-subtype-badge.wine-red       { background: #ffdfd8; color: #aa271a; }
.wine-subtype-badge.wine-sparkling { background: #e6f3fe; color: #105991; }
.wine-subtype-badge.wine-rose      { background: #ffcddb; color: #893350; }
.wine-subtype-badge.wine-champagne { background: #fff1d3; color: #714e02; }

/* Boolean true/false/NA icon badges (amvyx circle style — shared across all layouts) */
.bool-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 16px;
}
.bool-icon-yes { background: #e4f5e0; }
.bool-icon-no  { background: #fbdbdb; }
.bool-icon-na  { color: var(--text-secondary); font-weight: 600; }

/* Table responsiveness - DataTables handles scroll internally via scrollX/scrollY */
.results-table-container .dataTables_wrapper {
    overflow-x: visible;
}

/* ============================================================
   Amvyx table — clean Figma design overrides
   ============================================================ */

/* Container */
.amvyx-table {
    background: #ffffff !important;
    border: 1px solid #e6e8ea !important;
    border-radius: 16px !important;
    box-shadow: none !important;
    padding: 16px !important;
}

/* Kill horizontal scroll — amvyx shows only 5 columns, fits in container */
.amvyx-table .dataTables_scrollBody {
    overflow-x: hidden !important;
}

/* Both tables: auto layout lets first column take remaining space;
   columns.adjust() syncs header widths to body after each render */
.amvyx-table .dataTables_scrollHead table,
.amvyx-table .dataTables_scrollBody > table {
    width: 100% !important;
    table-layout: auto !important;
}

/* First column (item name): take remaining space and wrap long text */
.amvyx-table .dataTables_scrollHead thead th:first-child,
.amvyx-table #multipageResultsTable tbody td:first-child {
    width: auto !important;
    white-space: normal !important;
    word-break: break-word !important;
}

/* Other columns: shrink to content, never wrap */
.amvyx-table .dataTables_scrollHead thead th:not(:first-child),
.amvyx-table #multipageResultsTable tbody td:not(:first-child) {
    width: 1% !important;
    white-space: nowrap !important;
}



.amvyx-table h3 {
    display: none;
}

/* Header */
.amvyx-table .dataTables_scrollHead thead th {
    background: #ffffff !important;
    color: #646778 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif !important;
    font-weight: 400 !important;
    font-size: 14px !important;
    border-bottom: 1px solid #e3e6e8 !important;
    border-radius: 0 !important;
    padding: 0 16px !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    min-width: auto !important;
    white-space: nowrap !important;
    height: 48px !important;
    vertical-align: middle !important;
    text-align: center !important;
}

/* Inner wrapper injected by JS — text is the only in-flow child;
   arrow and counter are absolutely positioned so they never shift text centering */
.amvyx-th-inner {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0 !important;
    height: 100%;
    position: relative;
}

/* First column header — left-aligned */
.amvyx-table .dataTables_scrollHead thead th:first-child {
    text-align: left !important;
    border-radius: 0 !important;
}

.amvyx-table .dataTables_scrollHead thead th:last-child {
    border-radius: 0 !important;
}

/* Sort — nuke DataTables default background indicators (all skins use custom arrows) */
.results-table-container .dataTables_scrollHead thead th.sorting,
.results-table-container .dataTables_scrollHead thead th.sorting_asc,
.results-table-container .dataTables_scrollHead thead th.sorting_desc {
    background-image: none !important;
    cursor: pointer;
}

.amvyx-table .dataTables_scrollHead thead th.sorting:hover,
.amvyx-table .dataTables_scrollHead thead th.sorting_asc:hover,
.amvyx-table .dataTables_scrollHead thead th.sorting_desc:hover {
    background: #f4f5f6 !important;
    background-image: none !important;
}

/* Kill ALL DataTables ::before / ::after sort indicators (all skins use custom arrows) */
.results-table-container .dataTables_scrollHead thead th.sorting::after,
.results-table-container .dataTables_scrollHead thead th.sorting_asc::after,
.results-table-container .dataTables_scrollHead thead th.sorting_desc::after,
.results-table-container .dataTables_scrollHead thead th.sorting::before,
.results-table-container .dataTables_scrollHead thead th.sorting_asc::before,
.results-table-container .dataTables_scrollHead thead th.sorting_desc::before {
    content: none !important;
    display: none !important;
}

/* Sort arrow icon (real DOM element injected by JS) — positioned absolutely
   so it never shifts the centered text */
.amvyx-sort-arrow {
    position: absolute;
    right: -16px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 7.5 9.125' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3.747 0c.163 0 .325.072.44.186l3.117 3.123a.63.63 0 01.196.429c0 .343-.243.582-.567.582a.62.62 0 01-.424-.181L5.43 3.075 4.281 1.816l.062 1.082v5.621c0 .362-.243.606-.596.606s-.596-.244-.596-.606V2.899l.062-1.083L2.064 3.075.987 4.138a.63.63 0 01-.424.181C.243 4.32 0 4.081 0 3.738a.63.63 0 01.181-.42L3.309.186A.62.62 0 013.747 0z' fill='%23646778'/%3E%3C/svg%3E");
    opacity: 0;
}

.amvyx-sort-arrow.sort-asc {
    opacity: 1;
}

.amvyx-sort-arrow.sort-desc {
    opacity: 1;
    transform: translateY(-50%) rotate(180deg);
}

/* Item count badge — perfect circle, positioned after text without affecting centering */
.amvyx-item-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e3e6e8;
    color: #646778;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
    font-weight: 700;
    font-size: 10px;
    line-height: 1;
    width: 22px;
    height: 22px;
    padding: 0;
    border-radius: 50%;
    box-sizing: border-box;
    overflow: hidden;
    margin-left: 6px;
}

/* Body rows — white, no stripes, no sort-column highlight.
   DataTables 1.13 uses box-shadow:inset for BOTH striping and column highlight,
   so we must override box-shadow (not just background-color). */
.amvyx-table #multipageResultsTable tbody tr:nth-child(odd),
.amvyx-table #multipageResultsTable tbody tr:nth-child(even),
.amvyx-table #multipageResultsTable tbody tr.odd,
.amvyx-table #multipageResultsTable tbody tr.even {
    background-color: #ffffff !important;
}

/* Kill DataTables inset-box-shadow striping on all cells */
.amvyx-table #multipageResultsTable tbody tr > * {
    box-shadow: none !important;
}

/* Kill DataTables sorted-column vertical highlight (also box-shadow based) */
.amvyx-table #multipageResultsTable tbody td.sorting_1,
.amvyx-table #multipageResultsTable tbody td.sorting_2,
.amvyx-table #multipageResultsTable tbody td.sorting_3 {
    box-shadow: none !important;
}

.amvyx-table #multipageResultsTable tbody tr:hover {
    background-color: #f4f5f6 !important;
    box-shadow: none !important;
}

/* Body cells */
.amvyx-table #multipageResultsTable tbody td {
    color: #23262a !important;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif !important;
    font-weight: 500 !important;
    font-size: 14px !important;
    letter-spacing: -0.15px !important;
    padding: 10px 16px !important;
    border-bottom: none !important;
    text-align: center !important;
}

/* First column body — left-aligned, item name Medium weight (not Bold) */
.amvyx-table #multipageResultsTable tbody td:first-child {
    text-align: left !important;
}

.amvyx-table #multipageResultsTable tbody td strong {
    font-weight: 500 !important;
}

/* Override inline styles on price span */
.amvyx-table #multipageResultsTable tbody td span[style] {
    color: inherit !important;
    font-weight: inherit !important;
}

/* Override serving-badge styling — plain text in amvyx */
.amvyx-table .serving-badge {
    background: none !important;
    border: none !important;
    padding: 0 !important;
    color: #23262a !important;
    font-weight: 500 !important;
    font-size: 14px !important;
}

/* Target producer row — subtle, no heavy green */
.amvyx-table .target-producer-row {
    background-color: #ffffff !important;
}

.amvyx-table .target-producer-row:hover {
    background-color: #f4f5f6 !important;
}

/* Fixed column overrides — match white bg, no shadow */
.amvyx-table #multipageResultsTable tbody tr:nth-child(odd) td.dtfc-fixed-left,
.amvyx-table #multipageResultsTable tbody tr:nth-child(even) td.dtfc-fixed-left,
.amvyx-table #multipageResultsTable tbody tr.odd td.dtfc-fixed-left,
.amvyx-table #multipageResultsTable tbody tr.even td.dtfc-fixed-left {
    background-color: #ffffff !important;
}

.amvyx-table #multipageResultsTable tbody tr:hover td.dtfc-fixed-left,
.amvyx-table #multipageResultsTable tbody tr.odd:hover td.dtfc-fixed-left,
.amvyx-table #multipageResultsTable tbody tr.even:hover td.dtfc-fixed-left {
    background-color: #f4f5f6 !important;
}

.amvyx-table .dataTables_scrollHead thead th.dtfc-fixed-left {
    background: #ffffff !important;
}

.amvyx-table td.dtfc-fixed-left,
.amvyx-table th.dtfc-fixed-left {
    box-shadow: none !important;
    position: static !important;
    width: auto !important;
    min-width: auto !important;
}

/* Hide DataTables controls — no search, no length menu, no pagination, no info */
.amvyx-table .dataTables_wrapper .dataTables_length,
.amvyx-table .dataTables_wrapper .dataTables_filter,
.amvyx-table .dataTables_wrapper .dataTables_paginate,
.amvyx-table .dataTables_wrapper .dataTables_info {
    display: none !important;
}

/* Narrower cells — let content dictate width */
.amvyx-table #multipageResultsTable tbody td {
    min-width: auto !important;
}


/* Responsive adjustments for tabs and multipage section */
@media (max-width: 768px) {
    .tabs-navigation {
        flex-direction: column;
        gap: 10px;
        padding: 0 10px;
    }
    
    .tab-btn {
        width: 100%;
        border-radius: 8px;
        border-bottom: 2px solid var(--border-color);
    }
    
    .tab-btn.active {
        border-radius: 8px;
        border-bottom: 2px solid var(--main-color);
        bottom: 0;
    }
    
    .multipage-section {
        padding: 20px;
        border-radius: 12px;
    }
    
    .upload-section {
        border-radius: 12px;
        border-top: 2px solid var(--border-light);
    }
    
    .section-header h2 {
        font-size: 1.6rem;
    }
    
    .upload-type-switcher {
        flex-direction: column;
        gap: 10px;
    }
    
    .switcher-btn {
        width: 100%;
    }
    
    .config-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .summary-cards {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .card-value {
        font-size: 1.5rem;
    }
    
    .results-table-container {
        padding: 15px;
        overflow-x: auto;
    }
    
    #multipageResultsTable thead th {
        padding: 12px 8px !important;
        font-size: 0.8rem;
    }
    
    #multipageResultsTable tbody td {
        padding: 10px 8px !important;
        font-size: 0.85rem;
    }
    
    .dataTables_wrapper .dataTables_filter input {
        min-width: 200px;
    }
    
    .card-value {
        font-size: 2rem;
    }
    
    .summary-card {
        padding: 20px 15px;
    }
}

@media (max-width: 480px) {
    .tabs-navigation {
        padding: 0 5px;
        gap: 8px;
    }
    
    .tab-btn {
        padding: 12px 20px;
        font-size: 0.9rem;
    }
    
    .multipage-section {
        padding: 15px;
    }
    
    .upload-section {
        padding: 15px;
    }
    
    .section-header h2 {
        font-size: 1.4rem;
    }
    
    .section-subtitle {
        font-size: 0.95rem;
    }
    
    .images-previews {
        gap: 12px;
        padding: 0;
    }

    .image-thumbnail {
        width: 150px;
        padding: 12px;
    }

    .image-thumbnail-image {
        height: 80px;
    }
    
    .summary-cards {
        grid-template-columns: 1fr;
    }
    
    .card-value {
        font-size: 1.8rem;
    }
    
    .card-label {
        font-size: 0.75rem;
    }
    
    #multipageResultsTable thead th {
        padding: 10px 6px !important;
        font-size: 0.75rem;
    }
    
    #multipageResultsTable tbody td {
        padding: 8px 6px !important;
        font-size: 0.8rem;
    }
    
    .page-badge {
        font-size: 0.75rem;
        padding: 3px 6px;
    }
    
    .dataTables_wrapper .dataTables_filter input {
        min-width: 150px;
    }
    
    .dataTables_wrapper .dataTables_paginate .paginate_button {
        padding: 6px 10px !important;
        font-size: 0.85rem !important;
    }
}

/* ===================== Page Image Hover Tooltip ===================== */

#pageImageTooltip {
    position: fixed;
    z-index: 9999;
    display: none;
    pointer-events: none;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-light, #ddd);
    border-radius: 10px;
    padding: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    max-width: 60vh;
}

#pageImageTooltip img {
    display: block;
    max-width: calc(60vh - 20px);
    max-height: 80vh;
    border-radius: 6px;
    object-fit: contain;
}

#pageImageTooltip .tooltip-label {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-secondary, #666);
    margin-top: 6px;
    font-weight: 600;
}

.item-name-preview {
    cursor: default;
}

/* =========================================================
   Ground Truth Comparison Section
   ========================================================= */

.gt-scores-wrapper { padding: 12px 4px; }

.gt-status-badge {
    border-radius: 12px;
    padding: 2px 9px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}
.gt-badge-pass { background: rgba(56, 124, 39,0.15); color: var(--positive-color); border: 1px solid rgba(56, 124, 39,0.33); }
.gt-badge-fail { background: rgba(138, 58, 43,0.15);  color: var(--negative-color); border: 1px solid rgba(138, 58, 43,0.33); }

/* Kontener wielu ikon podglądu */
#gtThumbIcons {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Ikona podglądu zdjęcia w nagłówku */
.gt-thumb-icon {
    cursor: pointer;
    opacity: 0.55;
    transition: opacity 0.15s;
    user-select: none;
    display: inline-flex;
    align-items: center;
    color: var(--text-color);
}
.gt-thumb-icon svg { width: 20px; height: 20px; }
.gt-thumb-icon:hover { opacity: 1; }

/* 2-kolumnowy układ */
.gt-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
}

/* Score Header Card (nagłówek kolumny z gauge) */
.gt-score-header-card {
    display: flex;
    align-items: center;
    gap: 14px;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 10px;
    border: 1px solid;
}
.gt-score-green  { background: rgba(56, 124, 39,0.08);  border-color: rgba(56, 124, 39,0.27); }
.gt-score-yellow { background: rgba(169, 119, 43,0.08); border-color: rgba(169, 119, 43,0.27); }
.gt-score-red    { background: rgba(138, 58, 43,0.08);  border-color: rgba(138, 58, 43,0.27); }

/* Arc gauge (CSS conic-gradient) */
.gt-gauge-wrap { flex-shrink: 0; }
.gt-gauge {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: conic-gradient(currentColor var(--gt-deg), var(--border-color) var(--gt-deg));
    display: flex;
    align-items: center;
    justify-content: center;
}
.gt-score-green  .gt-gauge { color: var(--positive-color); }
.gt-score-yellow .gt-gauge { color: var(--accent-warm); }
.gt-score-red    .gt-gauge { color: var(--negative-color); }
.gt-gauge-inner {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: var(--bg-color, #0f1117);
    display: flex;
    align-items: center;
    justify-content: center;
}
.gt-gauge-pct { font-size: 0.85rem; font-weight: 800; }
.gt-score-green  .gt-gauge-pct { color: var(--positive-color); }
.gt-score-yellow .gt-gauge-pct { color: var(--accent-warm); }
.gt-score-red    .gt-gauge-pct { color: var(--negative-color); }

.gt-score-header-info { display: flex; flex-direction: column; gap: 3px; }
.gt-score-header-title { font-size: 0.82rem; font-weight: 700; color: var(--text-color); }
.gt-score-header-pts   { font-size: 0.72rem; color: var(--text-muted); }

/* Siatki kart */
.gt-summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.gt-kpi-grid     { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }

/* Karta metryki (wspólna) */
.gt-metric-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-left: 3px solid;
    border-radius: 6px;
    padding: 7px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.gt-card-ok   { border-left-color: var(--positive-color); }
.gt-card-warn { border-left-color: var(--accent-warm); }
.gt-card-fail { border-left-color: var(--negative-color); }

.gt-card-header { display: flex; align-items: center; gap: 5px; min-width: 0; }
.gt-card-icon   { font-size: 0.72rem; font-weight: 700; width: 12px; text-align: center; flex-shrink: 0; }
.gt-card-ok   .gt-card-icon { color: var(--positive-color); }
.gt-card-warn .gt-card-icon { color: var(--accent-warm); }
.gt-card-fail .gt-card-icon { color: var(--negative-color); }
.gt-card-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Actual / Expected values */
.gt-card-values { display: flex; flex-direction: column; gap: 2px; }
.gt-val-row     { display: flex; justify-content: space-between; align-items: baseline; gap: 4px; font-size: 0.73rem; }
.gt-val-lbl     { color: var(--text-muted); flex-shrink: 0; }
.gt-val-num     { font-weight: 600; color: var(--text-color); text-align: right; }
.gt-val-cnt     { font-weight: 400; color: var(--text-muted); font-size: 0.68rem; }

/* Mini progress bar */
.gt-mini-bar-track { height: 4px; background: var(--border-color); border-radius: 2px; overflow: hidden; }
.gt-mini-bar-fill  { height: 100%; border-radius: 2px; background: var(--positive-color); transition: width 0.4s ease; }
.gt-card-warn .gt-mini-bar-fill { background: var(--accent-warm); }
.gt-card-fail .gt-mini-bar-fill { background: var(--negative-color); }

.gt-card-footer { display: flex; justify-content: space-between; align-items: center; }
.gt-card-pct    { font-size: 0.82rem; font-weight: 700; color: var(--text-color); }
.gt-card-pts    { font-size: 0.68rem; color: var(--text-muted); }

@media (max-width: 720px) {
    .gt-two-col      { grid-template-columns: 1fr; }
    .gt-summary-grid { grid-template-columns: repeat(2, 1fr); }
    .gt-kpi-grid     { grid-template-columns: repeat(2, 1fr); }
}

/* Ground Truth test runner form (gated via testCaseModeBtn, data-min-view="custom") */
.gt-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.gt-form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.gt-form-control {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
}

.gt-form-control:focus {
    outline: none;
    border-color: var(--main-color);
    box-shadow: 0 0 0 2px rgba(91, 65, 58, 0.15);
}

.gt-load-error {
    color: var(--negative-color);
    font-size: 0.85rem;
    margin: 8px 0;
}

/* ============================================================================
 * Iframe embed mode — activated by ?embed=1 (document.body.classList.embed-mode)
 * Hides standalone-only chrome: logout button, producer selection modal.
 * Top app bar (logo + title) stays visible — in real integrations the parent's
 * own header is separate from the iframe content, and our branding should stay.
 * ========================================================================== */

body.embed-mode #logoutBtn,
body.embed-mode #switchProducerBtn,
body.embed-mode #producerModal {
    display: none !important;
}

/* Waiting-for-host screen shown before postMessage handshake completes */
.embed-waiting {
    position: fixed;
    inset: 0;
    background: var(--main-color-bg, #f5f5f5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.embed-waiting-content {
    text-align: center;
    padding: 24px;
}

.embed-waiting-spinner {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    border: 4px solid var(--main-color-bg, #e3d7d3);
    border-top-color: var(--main-color, #5b413a);
    border-radius: 50%;
    animation: embed-waiting-spin 0.9s linear infinite;
}

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

.embed-waiting-text {
    color: var(--main-color, #5b413a);
    font-size: 1rem;
    font-weight: 500;
}

/* ===== Strategic Insights & Positioning (task 8.7) ===== */

/* result-card: shared card wrapper for #insightsSection, #positioningSection */
.result-card {
    background: var(--bg-secondary);
    border-radius: 16px;
    border: 1px solid #e6e8ea;
    padding: 16px;
    margin-bottom: 20px;
}

.result-card__header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 0 0 0;
    border-bottom: 1px solid #e6e8ea;
    padding-bottom: 4px;
    margin-bottom: 0;
}

.result-card__icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    color: #4d555c;
}

.result-card__title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #4d555c;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
}

.result-card__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 11px;
    background: #e9ecef;
    color: #495057;
    font-size: 0.78rem;
    font-weight: 600;
}

/* result-details: shared wrapper for #insightsDetailsSection */
.result-details {
    background: var(--bg-secondary);
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
}

.result-details__summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    color: #2c3e50;
    user-select: none;
}

.result-details__summary::-webkit-details-marker { display: none; }

.result-details[open] .toggle-icon {
    transform: rotate(90deg);
}

.result-details__body {
    padding: 0 24px 24px;
}

.result-details__section {
    margin-bottom: 16px;
}

.result-details__section h4 {
    font-size: 0.9rem;
    font-weight: 700;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}

.result-details__section p,
.result-details__section li {
    font-size: 0.92rem;
    color: #555;
    line-height: 1.6;
}

.result-details__section ul {
    padding-left: 20px;
}

/* Custom checkbox */
.custom-checkbox {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border: 2px solid #9aa3a8;
    border-radius: 4px;
    cursor: pointer;
    background: #fff;
    transition: border-color 0.15s, background 0.15s;
    outline-offset: 2px;
}

.custom-checkbox:focus-visible {
    outline: 2px solid #d79b72;
}

.custom-checkbox--checked {
    background: #d79b72;
    border-color: #d79b72;
    color: #fff;
}

.custom-checkbox__check {
    width: 12px;
    height: 10px;
    opacity: 0;
    transition: opacity 0.1s;
}

.custom-checkbox--checked .custom-checkbox__check {
    opacity: 1;
}

/* Accordion row */
.accordion-row {
    border-bottom: 1px solid #eee;
}

.accordion-row:last-child {
    border-bottom: none;
}

.accordion-row__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 0;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    color: #2c3e50;
    font-size: 0.95rem;
    font-weight: 600;
    gap: 8px;
}

.accordion-row__header:hover {
    color: #d79b72;
}

.accordion-row__title {
    flex: 1;
}

.accordion-row__chevron {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    transition: transform 0.2s;
    color: #9aa3a8;
}

.accordion-row__header[aria-expanded="true"] .accordion-row__chevron {
    transform: rotate(180deg);
}

.accordion-row__body {
    padding-bottom: 14px;
}

.accordion-row__text {
    font-size: 0.92rem;
    color: #555;
    line-height: 1.6;
}

/* Insights list */
.insights-list {
    display: flex;
    flex-direction: column;
    padding: 12px 12px 4px;
    margin-bottom: 16px;
}

.insights-list__item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

/* Align custom checkbox with the accordion header text (padding: 12px 0 on header) */
.insights-list__item .custom-checkbox {
    flex-shrink: 0;
    margin-top: 13px;
}

.insights-list__item .accordion-row {
    flex: 1;
    border-bottom: none;
}

.initiative-detail {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.initiative-detail__desc {
    font-size: 0.92rem;
    color: #555;
    line-height: 1.6;
}

.initiative-detail__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.initiative-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--accent-warm-bg, #faf0e1);
    color: var(--accent-warm, #a9772b);
    border: 1px solid var(--accent-warm-border, #d9b97a);
    font-size: 0.78rem;
    font-weight: 600;
}

.initiative-detail__products,
.initiative-detail__impact {
    font-size: 0.88rem;
    color: #555;
}

/* Primary CTA button */
.result-card .btn--primary {
    display: block;
    margin: 16px auto 0;
}

.btn--primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 8px;
    background: #d79b72;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
}

.btn--primary:hover:not(:disabled) {
    background: #c07a52;
}

.btn--primary:disabled {
    opacity: 0.45;
    cursor: default;
}

/* Positioning meta-line */
.positioning-meta {
    font-size: 0.95rem;
    color: #555;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.positioning-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    background: #e9ecef;
    color: #495057;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Detected brands pill list */
.positioning-brands {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
    font-size: 0.88rem;
}

.positioning-brands__label {
    color: #7f8c8d;
    font-weight: 600;
    margin-right: 4px;
}

.brand-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    background: var(--accent-warm-bg, #faf0e1);
    color: var(--accent-warm, #a9772b);
    border: 1px solid var(--accent-warm-border, #d9b97a);
    font-size: 0.82rem;
    font-weight: 600;
}

/* Insights save toast notification */
.insights-save-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(16px);
    display: flex;
    align-items: center;
    gap: 10px;
    background: #2c3e50;
    color: #fff;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 0.92rem;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(0,0,0,0.22);
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 9999;
    max-width: 480px;
    text-align: center;
}

.insights-save-toast--visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.insights-save-toast__icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: #d79b72;
}
