/* BYR-02d: Bring your recipe, the sheet on Dough. Loaded only when the
   person opens it. Brand modal (modal.css), wide like the Library's
   comparison; two columns from 900px, stacked below. Every rule is scoped
   to the sheet. */
body .brb-modal-shell.byr-sheet-modal {
    width: min(1100px, calc(100vw - 48px));
    max-width: 1100px;
}
body .brb-modal-shell.byr-sheet-modal.byr-unavailable-modal {
    width: min(100%, 468px);
}
.byr-sheet-modal .brb-modal-content.byr-sheet {
    padding: 48px 28px 24px;
}
.byr-sheet-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 12px;
    margin: 0 44px 16px 0;
}
.byr-sheet-title {
    margin: 0;
}
/* The heading takes focus only programmatically (tabindex -1), so screen
   readers start at the sheet's title; it is not a control, so it never shows
   a ring, including when the sheet opens on load from dough.html?import=1.
   Real controls keep their own focus rings. */
.byr-sheet-title:focus,
.byr-sheet-title:focus-visible {
    outline: none;
}
.byr-beta {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border: 1px solid rgba(var(--sage-rgb), .45);
    border-radius: 999px;
    color: var(--sage-deep);
    font-family: var(--font-app);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}
/* The Beta badge and the feedback link, side by side after the title. */
.byr-header-meta {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
}
.byr-feedback {
    color: var(--stone);
    font-family: var(--font-app);
    font-size: 13px;
}
.byr-columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px 28px;
}
@media (min-width: 900px) {
    .byr-columns {
        grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    }
}
.byr-column {
    min-width: 0;
}
.byr-label {
    display: block;
    margin: 0 0 6px;
    color: var(--ink);
    font-family: var(--font-app);
    font-size: 13px;
    font-weight: 700;
}
.byr-sheet .byr-paste {
    width: 100%;
    min-height: 260px;
    resize: vertical;
    font-family: var(--font-app);
    font-size: 15px;
    line-height: 1.5;
}
.byr-count {
    min-height: 1.4em;
    margin: 6px 0 0;
    color: var(--stone);
    font-family: var(--font-app);
    font-size: 13px;
}
.byr-count.is-over {
    color: var(--rust);
}
.byr-helper,
.byr-privacy,
.byr-elapsed,
.byr-long-wait {
    margin: 0 0 12px;
    color: var(--stone);
    font-family: var(--font-app);
    font-size: 14px;
    line-height: 1.5;
}
.byr-message {
    margin: 12px 0 0;
    color: var(--ink);
    font-family: var(--font-app);
    font-size: 14px;
    line-height: 1.5;
}
.byr-message.is-failure,
.byr-message.is-unavailable,
.byr-message.is-decline {
    padding: 10px 12px;
    border-left: 3px solid var(--rust);
    background: rgba(var(--sage-rgb), .08);
}
.byr-reading {
    margin: 8px 0 12px;
}
/* Reading: an indeterminate bar, hidden from screen readers (the live text
   carries it). Under reduced motion it only fades. */
.byr-progress {
    position: relative;
    height: 4px;
    margin: 4px 0 14px;
    overflow: hidden;
    border-radius: 2px;
    background: rgba(var(--sage-rgb), .18);
}
.byr-progress-bar {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 40%;
    border-radius: 2px;
    background: var(--sage);
    animation: byrProgress 1.6s ease-in-out infinite;
}
@keyframes byrProgress {
    from { transform: translateX(-100%); }
    to { transform: translateX(250%); }
}
@keyframes byrProgressFade {
    from { opacity: .35; }
    to { opacity: .85; }
}
@media (prefers-reduced-motion: reduce) {
    .byr-progress-bar {
        width: 100%;
        animation: byrProgressFade 1.6s ease-in-out infinite alternate;
    }
}
/* Text only screen readers hear, such as the comma in "500 g, used". */
.byr-sheet .byr-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}
.byr-reading-status {
    margin: 0 0 8px;
    color: var(--ink);
    font-family: var(--font-app);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    /* Two lines held, so a waiting line that wraps never moves the note under it. */
    min-height: calc(2 * 1.4em);
}
/* The rotating waiting line (ai-waiting-lines.js): it fades out and in,
   or swaps instantly under reduced motion. */
.byr-wait-line { display: block; opacity: 1; transition: opacity .1s ease; }
.byr-wait-line.is-fading { opacity: 0; }
@media (prefers-reduced-motion: reduce) {
    .byr-wait-line { transition: none; }
}
.byr-how-read-privacy { margin: 8px 0 0; }
.byr-how-read-link {
    color: var(--rust);
    text-decoration: underline;
    text-decoration-color: rgba(var(--rust-rgb), .35);
    text-underline-offset: 3px;
}
.byr-how-read-link:hover { text-decoration-color: currentColor; }
.byr-how-read-link:focus-visible { outline: 2px solid var(--rust); outline-offset: 2px; border-radius: 2px; }
.byr-actions {
    flex-wrap: wrap;
}
/* The paste state: one column at every width. */
.byr-paste-column {
    display: flex;
    flex-direction: column;
}
.byr-paste-column .byr-helper {
    margin: 0 0 10px;
}
.byr-paste-column .byr-privacy {
    margin: 8px 0 0;
}
/* BYR-02f: "How your recipe is read", collapsed under the privacy line, with
   Barbaro's own chevron (as on Buffer ›), never the native triangle. */
.byr-how-read {
    margin: 4px 0 0;
    color: var(--stone);
    font-family: var(--font-app);
    font-size: 14px;
    line-height: 1.5;
}
.byr-how-read-toggle {
    display: inline-block;
    list-style: none;
    cursor: pointer;
    color: var(--rust);
    font-weight: 600;
}
.byr-how-read-toggle::-webkit-details-marker { display: none; }
.byr-how-read-toggle::after {
    content: '›';
    content: '›' / '';
    display: inline-block;
    margin-left: 6px;
    font-weight: 400;
    transition: transform .15s ease;
}
.byr-how-read[open] > .byr-how-read-toggle::after { transform: rotate(90deg); }
.byr-how-read-toggle:focus-visible { outline: 2px solid var(--rust); outline-offset: 2px; border-radius: 2px; }
.byr-how-read-list {
    margin: 6px 0 0;
    padding-left: 18px;
}
.byr-how-read-list li + li { margin-top: 4px; }
@media (prefers-reduced-motion: reduce) {
    .byr-how-read-toggle::after { transition: none; }
}
.byr-open-reason {
    flex: 0 1 380px;
    margin: 0;
    color: var(--stone);
    font-family: var(--font-app);
    font-size: 13px;
    text-align: right;
}
/* Edit at the start; Open's reason beside Open. */
.byr-check-actions #byr-edit {
    margin-right: auto;
}
/* The check screen. Marks carry their label as text, never colour alone. */
.byr-check-columns {
    align-items: start;
}
@media (min-width: 900px) {
    .byr-check-columns {
        grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    }
    /* What you pasted stays in view while the baker checks the right
       column, and scrolls on its own when it is taller. */
    .byr-check-left {
        position: sticky;
        top: 0;
        max-height: calc(min(760px, var(--brb-modal-viewport-height, 100vh) - 44px) - 150px);
        overflow-y: auto;
        overscroll-behavior: contain;
    }
}
.byr-section {
    margin: 0 0 20px;
}
.byr-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 8px;
    color: var(--ink);
    font-family: var(--font-app);
    font-size: 15px;
    font-weight: 700;
}
.byr-subtitle {
    margin: 14px 0 6px;
    color: var(--ink);
    font-family: var(--font-app);
    font-size: 14px;
    font-weight: 700;
}
.byr-note-line {
    margin: 0 0 8px;
    color: var(--stone);
    font-family: var(--font-app);
    font-size: 13px;
    line-height: 1.45;
}
.byr-ai {
    padding: 1px 7px;
    border: 1px solid rgba(var(--sage-rgb), .45);
    border-radius: 999px;
    color: var(--sage-deep);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
}
.byr-pasted {
    margin: 0;
    padding: 10px 12px 10px 40px;
    border: 1px solid rgba(var(--sage-rgb), .25);
    border-radius: 8px;
    background: rgba(var(--sage-rgb), .05);
    font-family: var(--font-app);
    font-size: 14px;
    line-height: 1.7;
    overflow-wrap: anywhere;
}
.byr-pasted-line::marker {
    color: var(--stone);
    font-size: 12px;
}
.byr-mark {
    display: inline;
    white-space: nowrap;
    padding: 1px 4px;
    border-radius: 4px;
    background: rgba(var(--sage-rgb), .14);
}
.byr-mark-text {
    font-weight: 700;
}
.byr-mark-label {
    margin-left: 4px;
    color: var(--sage-deep);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.byr-mark.is-unused,
.byr-mark.is-unused_levain,
.byr-mark.is-left_out {
    background: transparent;
    border: 1px dashed rgba(var(--sage-rgb), .5);
}
.byr-mark.is-unused .byr-mark-text,
.byr-mark.is-unused_levain .byr-mark-text,
.byr-mark.is-left_out .byr-mark-text {
    font-weight: 400;
}
/* An amount a correction left unread: its own label, in rust. */
.byr-mark.is-not_read {
    background: transparent;
    border: 1px solid var(--rust);
}
.byr-mark.is-not_read .byr-mark-label,
.byr-not-read {
    color: var(--rust);
}
.byr-amounts {
    margin: 0;
    padding: 0;
    list-style: none;
}
.byr-amount {
    padding: 8px 0;
    border-top: 1px solid rgba(var(--sage-rgb), .2);
}
.byr-amount-head {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    margin: 0 0 6px;
    font-family: var(--font-app);
    font-size: 14px;
}
.byr-amount-text {
    font-weight: 700;
}
.byr-amount-line {
    color: var(--stone);
    font-size: 13px;
}
.byr-amount-grams {
    margin-left: auto;
    font-variant-numeric: tabular-nums;
}
/* Ingredient, stage and whether it counts: three columns on every row where
   they fit, stacked on a phone. The counts column is widest so "Not part of
   the dough" and "A repeat of another line" show whole. */
.byr-amount-controls {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, .9fr) minmax(0, 1.25fr);
    gap: 6px;
}
.byr-amount-controls .byr-select {
    width: 100%;
    min-width: 0;
}
.byr-select,
.byr-input {
    min-height: 40px;
    padding: 6px 8px;
    border: 1px solid rgba(var(--sage-rgb), .45);
    border-radius: 6px;
    background: var(--card-bg);
    color: var(--ink);
    font-family: var(--font-app);
    font-size: 14px;
    max-width: 100%;
}
.byr-select:focus-visible,
.byr-input:focus-visible {
    outline: 2px solid var(--rust);
    outline-offset: 1px;
}
.byr-select:disabled {
    color: var(--stone);
    background: rgba(var(--sage-rgb), .08);
    cursor: not-allowed;
}
.byr-amount-outside {
    margin: 6px 0 0;
}
.byr-question {
    margin: 0 0 14px;
    padding: 10px 12px;
    border: 1px solid rgba(var(--sage-rgb), .35);
    border-radius: 8px;
}
/* Floated, so a long question wraps inside the box instead of crossing
   its top border. */
.byr-question legend {
    float: left;
    width: 100%;
    margin: 0 0 6px;
    padding: 0;
    color: var(--ink);
    font-family: var(--font-app);
    font-size: 14px;
    font-weight: 700;
}
.byr-question legend + * {
    clear: both;
}
.byr-source {
    margin: 2px 0 8px;
    padding-left: 10px;
    border-left: 3px solid rgba(var(--sage-rgb), .45);
    color: var(--stone);
    font-family: var(--font-app);
    font-size: 13px;
    overflow-wrap: anywhere;
}
.byr-choice {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    font-family: var(--font-app);
    font-size: 14px;
}
.byr-choice input[type="radio"] {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--sage);
}
.byr-typed {
    flex-wrap: wrap;
}
.byr-offer {
    margin: 0 0 12px;
    padding: 10px 12px;
    border: 1px solid rgba(var(--sage-rgb), .35);
    border-radius: 8px;
}
.byr-offer-label,
.byr-offer-state {
    margin: 0 0 8px;
    font-family: var(--font-app);
    font-size: 14px;
}
.byr-offer-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
.byr-offer-actions .byr-offer-state {
    margin: 0;
    color: var(--sage-deep);
    font-weight: 700;
}
.byr-sheet .btn.byr-sage {
    min-height: 44px;
    padding: 9px 14px;
    border: 1px solid var(--sage);
    border-radius: 8px;
    background: transparent;
    color: var(--sage-deep);
    cursor: pointer;
    font-family: var(--font-app);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
}
.byr-sheet .btn.byr-sage:hover {
    background: rgba(var(--sage-rgb), .1);
}
.byr-facts {
    margin: 0 0 10px;
    padding-left: 18px;
    font-family: var(--font-app);
    font-size: 14px;
    line-height: 1.5;
}
.byr-formula {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-app);
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}
/* One fill per row, so each band reads across; the header row is one weight. */
.byr-formula th,
.byr-formula td {
    padding: 5px 6px;
    border-bottom: 1px solid rgba(var(--sage-rgb), .2);
    background: transparent;
    text-align: right;
}
.byr-formula th:first-child {
    text-align: left;
}
.byr-formula tbody th {
    font-weight: 400;
}
.byr-formula tbody tr:nth-child(even) {
    background: rgba(var(--sage-rgb), .07);
}
.byr-formula tbody tr:last-child th,
.byr-formula tbody tr:last-child td {
    border-bottom: 0;
}
.byr-formula thead th {
    color: var(--stone);
    font-size: 12px;
    font-weight: 700;
}
/* One row per step (shortest, longest, temperature), so a pair never splits
   across rows at any width or zoom. */
.byr-times {
    display: grid;
    gap: 10px;
}
.byr-time-step {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px 14px;
}
/* Labels on top, inputs on a common line at the bottom of each row, however
   the labels wrap. */
.byr-time {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.byr-time label {
    display: block;
    margin: 0 0 4px;
    color: var(--ink);
    font-family: var(--font-app);
    font-size: 13px;
}
.byr-time-field {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-top: auto;
}
.byr-time .byr-input {
    flex: 1 1 80px;
    width: 100%;
    min-width: 72px;
}
.byr-time-written {
    flex: 0 1 auto;
    padding-bottom: 10px;
    color: var(--stone);
    font-family: var(--font-app);
    font-size: 12px;
    line-height: 1.3;
}
.byr-time-error {
    margin: 0 0 4px;
    color: var(--rust);
    font-family: var(--font-app);
    font-size: 12px;
    line-height: 1.4;
}
.byr-sheet .byr-note {
    width: 100%;
    min-height: 160px;
    font-family: var(--font-app);
    font-size: 14px;
    line-height: 1.5;
}
.byr-check-line {
    margin: 0 0 8px;
    padding: 10px 12px;
    border-left: 3px solid var(--sage);
    background: rgba(var(--sage-rgb), .06);
}
.byr-check-sentence {
    margin: 0 0 6px;
    font-family: var(--font-app);
    font-size: 14px;
    font-weight: 700;
}
.byr-left-out {
    margin: 0;
    padding-left: 18px;
    color: var(--stone);
    font-family: var(--font-app);
    font-size: 13px;
    overflow-wrap: anywhere;
}
.byr-check-actions {
    padding: 12px 0 0;
    background: var(--card-bg);
}
/* On a wide screen the actions stay in reach while the person scrolls the
   check screen; on a phone they sit at the end, never over the content. */
@media (min-width: 900px) {
    .byr-check-actions {
        position: sticky;
        bottom: -24px;
    }
}
@media (max-width: 640px) {
    body .brb-modal-shell.byr-sheet-modal {
        width: calc(100vw - 24px);
    }
    .byr-sheet-modal .brb-modal-content.byr-sheet {
        padding: 48px 16px 18px;
    }
    /* A slightly shorter box than its 14 rows, so Read my recipe and Cancel
       both show without scrolling on a 390 by 844 phone. It still resizes. */
    .byr-sheet .byr-paste {
        min-height: 220px;
        height: 310px;
    }
    .byr-amount-controls {
        grid-template-columns: minmax(0, 1fr);
    }
    /* Each shortest and longest pair side by side; a temperature on its own row. */
    .byr-time-step {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .byr-time.is-temp {
        grid-column: 1 / -1;
    }
    /* Open's reason above the buttons (the modal stacks its actions in
       reverse on a phone, so the highest order shows first). */
    .byr-check-actions .byr-open-reason {
        flex-basis: auto;
        order: 99;
        text-align: left;
    }
}

/* AIUX formula-first review. */
.byr-name { display: grid; gap: 8px; margin-bottom: 20px; }
.byr-name input { width: 100%; }
.byr-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr) auto); gap: 8px 12px; }
.byr-summary dt { color: var(--text-muted, #6d655c); }
.byr-summary dd { margin: 0; font-weight: 600; }
.byr-review-details { border-top: 1px solid rgba(var(--sage-rgb), .3); margin-top: 16px; }
.byr-review-details > summary { min-height: 44px; padding: 12px 0; cursor: pointer; }
.byr-review-details > summary:focus-visible { outline: 2px solid var(--rust); outline-offset: 3px; }
.byr-destinations { font-size: 12px; line-height: 1.6; }
@media (max-width: 650px) { .byr-summary { grid-template-columns: minmax(0, 1fr) auto; } }

/* AIUX-03: isolated help, privacy and close targets. */
.byr-feedback, .byr-how-read-link, .byr-how-read-toggle { min-height: 44px; display: inline-flex; align-items: center; }
.byr-sheet-modal .brb-modal-close { min-width: 44px; min-height: 44px; }

.byr-answer p { margin: 0 0 4px; }
.byr-answer-edit > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; text-decoration: underline; }
.byr-process-values { margin: 6px 0; padding-left: 20px; }
@media (max-width: 899px) {
  .byr-sheet-modal .brb-modal-content.byr-review-content { display: grid; grid-template-rows: minmax(0, 1fr) auto; height: min(756px, calc(var(--brb-modal-viewport-height, 100dvh) - 48px)); box-sizing: border-box; padding-bottom: 12px; }
  .byr-review-body { overflow-y: auto; min-height: 0; padding-right: 4px; scroll-padding-block: 16px; }
  .byr-check-actions { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--sage); }
  .byr-check-actions .byr-open-reason { grid-column: 1 / -1; grid-row: 1; order: 0; margin: 0; }
  .byr-check-actions #byr-edit, .byr-check-actions #byr-open { min-height: 44px; margin: 0; }
}
