@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600&family=Special+Elite&display=swap');

:root {
    --bb-surface-50: #ffffff;
    --bb-surface-100: #f5f7fb;
    --bb-surface-200: #edf2f8;
    --bb-surface-300: #dbe3ef;
    --bb-surface-500: #b9c4d8;
    --bb-text-900: #1f2937;
    --bb-text-700: #334155;
    --bb-text-500: #64748b;
    --bb-accent-700: #4250af;
    --bb-accent-600: #5b69d6;
    --bb-accent-300: #ffb74d;
    --bb-accent-200: #ffd166;
    --bb-space-1: 0.25rem;
    --bb-space-2: 0.5rem;
    --bb-space-3: 0.75rem;
    --bb-space-4: 1rem;
    --bb-space-6: 1.5rem;
    --bb-space-8: 2rem;
    --bb-radius-sm: 0.375rem;
    --bb-radius-md: 0.5rem;
    --bb-radius-lg: 1rem;
    --bb-radius-xl: 1.25rem;
    --bb-radius-pill: 999px;
    --bb-shadow-sm: 0 1px 2px rgba(39, 24, 10, 0.08);
    --bb-shadow-md: 0 4px 10px rgba(39, 24, 10, 0.12);
    --bb-shadow-lg: 0 10px 24px rgba(255, 167, 81, 0.32);
    --bb-grid-gap: 0.875rem;
    --bb-artisan-paper: #fbf8f1;
    --bb-artisan-ink: #272018;
    --bb-artisan-muted: #7d7468;
    --bb-artisan-line: rgba(84, 76, 61, 0.22);
    --bb-artisan-accent: #aca284;
    --bb-artisan-display: 'Cormorant Garamond', serif;
    --bb-artisan-typewriter: 'Special Elite', 'Courier New', Courier, monospace;
}

html, body {
    font-family: 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', Georgia, serif;
    background:
        radial-gradient(circle at top left, rgba(210, 184, 140, 0.24), transparent 24%),
        linear-gradient(180deg, #faf4e8 0%, #f1e8d7 100%);
    background-attachment: fixed;
    color: var(--bb-text-900);
}

.bb-card {
    background: #fff;
    border: 1px solid rgba(60, 36, 21, 0.08);
    border-radius: var(--bb-radius-lg);
    box-shadow: var(--bb-shadow-sm);
}

.bb-grid {
    display: grid;
    gap: var(--bb-grid-gap);
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.bb-panel {
    border-radius: var(--bb-radius-xl);
    background: linear-gradient(180deg, #fff 0%, var(--bb-surface-50) 100%);
    border: 1px solid rgba(60, 36, 21, 0.08);
    box-shadow: var(--bb-shadow-md);
}

.btn-bakery {
    background-color: var(--bb-accent-700);
    border-color: var(--bb-accent-700);
    color: #FFF8F0;
    border-radius: var(--bb-radius-md);
    padding: var(--bb-space-2) var(--bb-space-6);
    font-weight: 500;
}
.btn-bakery:hover {
    background-color: var(--bb-accent-600);
    border-color: var(--bb-accent-600);
    color: #FFF8F0;
}
.btn-bakery-outline {
    background-color: transparent;
    border-color: var(--bb-accent-700);
    color: var(--bb-accent-700);
    border-radius: var(--bb-radius-md);
}
.btn-bakery-outline:hover {
    background-color: var(--bb-accent-700);
    color: #FFF8F0;
}

.card-bakery {
    border: 1px solid var(--bb-surface-500);
    border-radius: var(--bb-radius-md);
    background-color: #FFF8F0;
    box-shadow: var(--bb-shadow-sm);
}
.card-bakery .card-header {
    background-color: var(--bb-surface-300);
    border-bottom: 1px solid var(--bb-surface-500);
    color: var(--bb-text-700);
    font-weight: 600;
}

.form-control:focus, .form-select:focus {
    border-color: var(--bb-accent-600);
    box-shadow: 0 0 0 0.2rem rgba(139, 69, 19, 0.25);
}

h1, h2, h3, h4, h5 {
    font-family: var(--bb-artisan-display);
    color: var(--bb-text-700);
}

.result-record-evidence-grid {
    display: grid;
    gap: 1rem;
}

.result-record-sheet {
    border: 1px solid var(--bb-artisan-line);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(249, 243, 231, 0.92)),
        var(--bb-artisan-paper);
    box-shadow: 0 14px 26px rgba(39, 24, 10, 0.08);
    padding: 1rem 1.1rem;
}

.result-record-sheet-kicker,
.result-record-sheet-label,
.result-record-sheet-badge,
.community-cabinet-kicker,
.community-record-code {
    font-family: var(--bb-artisan-typewriter);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.result-record-sheet-kicker {
    font-size: 0.74rem;
    color: var(--bb-artisan-muted);
    margin-bottom: 0.25rem;
}

.result-record-sheet-title {
    margin: 0;
    font-size: clamp(1.35rem, 3vw, 1.9rem);
    color: var(--bb-artisan-ink);
}

.result-record-sheet-copy {
    margin: 0.5rem 0 0.9rem;
    color: var(--bb-artisan-muted);
}

.result-record-sheet-headline-row {
    display: flex;
    gap: 0.75rem;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
}

.result-record-sheet-badge {
    display: inline-flex;
    align-items: center;
    min-height: 1.8rem;
    padding: 0.15rem 0.5rem;
    border: 1px solid var(--bb-artisan-line);
    background: rgba(255, 255, 255, 0.7);
    font-size: 0.68rem;
}

.result-record-sheet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0;
    margin-top: 0.85rem;
    border-top: 1px solid var(--bb-artisan-line);
    border-left: 1px solid var(--bb-artisan-line);
}

.result-record-sheet-row {
    display: grid;
    gap: 0.2rem;
    padding: 0.8rem;
    border-right: 1px solid var(--bb-artisan-line);
    border-bottom: 1px solid var(--bb-artisan-line);
    background: rgba(255, 255, 255, 0.42);
}

.result-record-sheet-row-span {
    grid-column: 1 / -1;
}

.result-record-sheet-label {
    font-size: 0.68rem;
    color: var(--bb-artisan-muted);
}

.result-record-sheet-row strong {
    color: var(--bb-artisan-ink);
    line-height: 1.25;
}

.result-record-photo-gallery {
    min-height: 112px;
    align-items: flex-start;
}

.result-record-photo-empty {
    display: grid;
    gap: 0.3rem;
    width: 100%;
    padding: 0.95rem;
    border: 1px dashed var(--bb-artisan-line);
    background: rgba(255, 255, 255, 0.44);
    text-align: center;
}

.result-record-upload {
    border-color: rgba(92, 51, 23, 0.24);
    background: rgba(255, 255, 255, 0.72);
}

.result-record-share-toggle {
    padding-top: 0.85rem;
    border-top: 1px solid var(--bb-artisan-line);
}

.community-cabinet-shell.card {
    border: 1px solid var(--bb-artisan-line);
    background:
        radial-gradient(circle at top left, rgba(159, 124, 83, 0.12), transparent 26%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(246, 239, 226, 0.95)),
        var(--bb-artisan-paper);
    box-shadow: 0 18px 34px rgba(39, 24, 10, 0.1);
}

.community-cabinet-header {
    border-bottom: 1px solid var(--bb-artisan-line);
    background: rgba(226, 214, 189, 0.34);
}

.community-cabinet-kicker {
    font-size: 0.74rem;
    color: var(--bb-artisan-muted);
    margin-bottom: 0.2rem;
}

.community-cabinet-body {
    background-image: linear-gradient(180deg, transparent 0, transparent 31px, rgba(84, 76, 61, 0.08) 32px);
    background-size: 100% 32px;
}

.community-filter-row .form-label {
    font-family: var(--bb-artisan-typewriter);
    text-transform: uppercase;
    font-size: 0.76rem;
    letter-spacing: 0.04em;
}

.community-record-card {
    border: 1px solid rgba(84, 76, 61, 0.22);
    border-radius: 0;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(247, 241, 230, 0.96)),
        var(--bb-artisan-paper);
    box-shadow: 0 8px 18px rgba(39, 24, 10, 0.08);
    position: relative;
}

.community-record-card::before {
    content: "";
    position: absolute;
    top: -1px;
    left: 1rem;
    width: 92px;
    height: 12px;
    background: #d2bea0;
    border: 1px solid rgba(84, 76, 61, 0.22);
    border-bottom: 0;
}

.community-record-thumb-wrap {
    padding: 0.9rem 0.9rem 0 0.9rem;
}

.community-record-thumb {
    border: 1px solid var(--bb-artisan-line);
    border-radius: 0;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.community-record-body {
    padding: 0.9rem;
}

.community-record-code {
    font-size: 0.7rem;
    color: var(--bb-artisan-muted);
    margin-bottom: 0.45rem;
}

.community-record-tabs {
    min-height: 2rem;
}

.community-record-actions .btn {
    border-radius: 0;
    font-family: var(--bb-artisan-typewriter);
    font-size: 0.74rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

@media (min-width: 992px) {
    .result-record-evidence-grid {
        grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
        align-items: start;
    }
}

@media (max-width: 699px) {
    .result-record-sheet,
    .community-record-body {
        padding: 0.85rem;
    }

    .result-record-sheet-grid {
        grid-template-columns: 1fr;
    }
}

.wizard-step {
    border-left: 4px solid #D2B48C;
    padding-left: 1rem;
    margin-bottom: 1rem;
}
.wizard-step.active {
    border-left-color: #8B4513;
}

.validation-message {
    color: #dc3545;
    font-size: 0.875rem;
}

.progress-bar-bakery {
    background-color: var(--bb-accent-700);
}

/* Confidence badges */
.badge-confidence {
    font-size: 0.8rem;
    padding: 0.3rem 0.7rem;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.bg-orange {
    background-color: #e67e22;
}

/* Assumption list */
.assumption-item {
    border-left: 3px solid #D2B48C;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
    background: #FFF8F0;
    border-radius: 0 4px 4px 0;
}
.assumption-item.critical {
    border-left-color: #dc3545;
    background: #fff5f5;
}
.assumption-field {
    font-weight: 600;
    color: #5C3317;
}
.assumption-value {
    color: #8B4513;
}
.assumption-impact {
    font-size: 0.85rem;
    color: #1f3b73;
}
.assumption-explanation {
    color: #1f3b73;
}

/* Photo gallery */
.gallery { display: flex; flex-wrap: wrap; gap: 8px; }
.gallery-item { position: relative; width: 80px; height: 80px; overflow: visible; }
.gallery-link { display: block; width: 100%; height: 100%; text-decoration: none; background: transparent; border: 0; padding: 0; }
.gallery-thumb { width: 80px; height: 80px; object-fit: cover; border-radius: 6px; border: 1px solid #c4a882; cursor: pointer; display: block; }
.gallery-preview { display: none; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); z-index: 100; max-width: 360px; max-height: 360px; border-radius: 8px; border: 2px solid #8B4513; box-shadow: 0 4px 16px rgba(0,0,0,0.25); background: #fff; }
.gallery-item:hover .gallery-preview, .gallery-item:focus-within .gallery-preview { display: block; }
.gallery-modal-backdrop { position: fixed; inset: 0; z-index: 1050; display: flex; align-items: center; justify-content: center; padding: 1rem; background: rgba(20, 12, 8, 0.82); }
.gallery-modal { position: relative; max-width: min(92vw, 960px); max-height: 92vh; padding: 0.75rem; border-radius: 1rem; background: #fffaf4; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35); }
.gallery-modal-image { display: block; max-width: 100%; max-height: calc(92vh - 4rem); border-radius: 0.75rem; }
.gallery-modal-caption { padding-top: 0.5rem; text-align: center; font-size: 0.95rem; color: #5C3317; }
.gallery-modal-close { position: absolute; top: 0.25rem; right: 0.35rem; width: 2rem; height: 2rem; border: 0; border-radius: 999px; background: rgba(92, 51, 23, 0.12); color: #5C3317; font-size: 1.5rem; line-height: 1; }

@media (max-width: 768px) {
    .gallery-preview { display: none !important; }
    .gallery-modal { width: min(94vw, 38rem); padding: 0.5rem; }
}

/* Missing fields prompt */
.missing-fields-prompt {
    background: linear-gradient(135deg, #fff8f0 0%, #fff3e0 100%);
    border: 1px solid #e67e22;
    border-radius: 8px;
    padding: 1rem;
}
.missing-fields-prompt h6 {
    color: #e67e22;
    margin-bottom: 0.5rem;
}
.missing-fields-prompt .field-link {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    margin: 0.2rem;
    background: white;
    border: 1px solid #D2B48C;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #5C3317;
    text-decoration: none;
    transition: all 0.15s;
}
.missing-fields-prompt .field-link:hover {
    background: #8B4513;
    color: white;
    border-color: #8B4513;
}

/* Provenance badges */
.provenance-badge {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 600;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.3;
}
.provenance-userprovided { background: #e8f5e9; color: #2e7d32; }
.provenance-profiledefault { background: #e3f2fd; color: #1565c0; }
.provenance-lanedefault { background: #f3e5f5; color: #7b1fa2; }
.provenance-recipedefault { background: #e0f2f1; color: #00695c; }
.provenance-hardcodeddefault { background: #f5f5f5; color: #616161; }
.provenance-computed { background: #fff3e0; color: #e65100; }
.provenance-unknown { background: #fce4ec; color: #c62828; }

.assumption-item:last-child {
    border-bottom: none !important;
}

.bb-plan-hero {
    margin-bottom: 1.25rem;
}

.bb-plan-shell {
    border-radius: 1.5rem;
    border: 1px solid rgba(66, 80, 175, 0.18);
    background:
        radial-gradient(circle at top left, rgba(255, 183, 77, 0.18), transparent 32%),
        linear-gradient(180deg, #ffffff 0%, #f7f9fd 100%);
    box-shadow: 0 18px 40px rgba(37, 44, 97, 0.12);
    padding: 1rem;
}

.bb-plan-topbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.bb-plan-chip {
    display: inline-flex;
    align-items: center;
    min-height: 2rem;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    background: rgba(66, 80, 175, 0.1);
    color: var(--bb-accent-700);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.bb-plan-chip-muted {
    background: rgba(100, 116, 139, 0.12);
    color: var(--bb-text-700);
}

.bb-plan-feedback-link {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.2rem;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    background: #1f2937;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
}

.bb-plan-feedback-link:hover {
    color: #fff;
    background: #111827;
}

.bb-plan-header {
    display: grid;
    gap: 0.9rem;
    margin-bottom: 0.85rem;
}

.bb-plan-kicker {
    color: var(--bb-accent-700);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 0.4rem;
}

.bb-plan-title {
    margin: 0;
    font-size: clamp(1.65rem, 5vw, 2.5rem);
    line-height: 1.02;
    color: #162033;
}

.bb-plan-subtitle {
    margin-top: 0.45rem;
    color: var(--bb-text-500);
    font-size: 0.92rem;
}

.bb-plan-strapline {
    margin: 0 0 1rem;
    color: var(--bb-text-500);
    font-style: italic;
}

.bb-plan-state-card {
    display: grid;
    gap: 0.2rem;
    padding: 0.9rem 1rem;
    border-radius: 1rem;
    background: #172554;
    color: #fff;
}

.bb-plan-state-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.72);
}

.bb-plan-priority-grid {
    display: grid;
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.bb-plan-priority-card {
    display: grid;
    gap: 0.18rem;
    padding: 1rem;
    border-radius: 1.15rem;
    background: #eef2ff;
    border: 1px solid rgba(66, 80, 175, 0.14);
}

.bb-plan-priority-card-primary {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: #fff;
    box-shadow: 0 14px 28px rgba(22, 163, 74, 0.24);
}

.bb-plan-priority-label {
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.bb-plan-priority-time {
    font-size: clamp(2rem, 9vw, 3.5rem);
    line-height: 0.95;
    letter-spacing: -0.04em;
}

.bb-plan-priority-note {
    font-size: 0.84rem;
    opacity: 0.92;
}

.bb-plan-tracker-scroll {
    overflow-x: auto;
    padding-bottom: 0.3rem;
    margin-bottom: 1rem;
}

.bb-plan-tracker {
    display: inline-flex;
    min-width: 100%;
    gap: 0.35rem;
}

.bb-plan-gate {
    min-width: 104px;
    flex: 1 0 104px;
    display: grid;
    gap: 0.12rem;
    padding: 0.65rem 0.7rem 0.65rem 0.85rem;
    clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%, 12px 50%);
    background: #dbe3ef;
    color: #475569;
}

.bb-plan-gate:first-child {
    clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%);
}

.bb-plan-gate:last-child {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 12px 50%);
}

.bb-plan-gate.is-complete {
    background: #1e3a8a;
    color: #fff;
}

.bb-plan-gate.is-active {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: #fff;
    box-shadow: 0 8px 22px rgba(22, 163, 74, 0.24);
}

.bb-plan-gate-step {
    font-size: 0.8rem;
    font-weight: 800;
}

.bb-plan-gate-label {
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.05;
}

.bb-plan-gate small {
    font-size: 0.72rem;
    opacity: 0.86;
}

.bb-plan-glance-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
}

.bb-plan-glance-item {
    display: grid;
    gap: 0.16rem;
    padding: 0.8rem 0.85rem;
    background: rgba(255, 255, 255, 0.84);
    border: 1px solid rgba(66, 80, 175, 0.1);
    border-radius: 1rem;
}

.bb-plan-glance-item span {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--bb-text-500);
}

.bb-plan-glance-item strong {
    font-size: 0.98rem;
    color: #172033;
}

@media (min-width: 768px) {
    .bb-plan-shell {
        padding: 1.4rem;
    }

    .bb-plan-header {
        grid-template-columns: minmax(0, 1.3fr) minmax(260px, 0.7fr);
        align-items: start;
    }

    .bb-plan-priority-grid {
        grid-template-columns: 1.25fr 1fr;
    }

    .bb-plan-glance-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
