/* ─────────────────────────────────────────────────────────────────────────────
READABILITY SYSTEM — Restaurant Food Cost Calculator
───────────────────────────────────────────────────────────────────────────── */
#rfc-root *, #rfc-root *::before, #rfc-root *::after {
    box-sizing: border-box; margin: 0; padding: 0;
}

#rfc-root {
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --bg-input: #f8fafc;
    --bg-row-alt: #f1f5f9;
    --bg-highlight: #f1f5f9;
    --border: #e2e8f0;
    --border-hi: #cbd5e1;
    --border-focus: #0891b2;
    --amber: #d97706;
    --amber-lt: #b45309;
    --amber-bg: rgba(217,119,6,0.08);
    --amber-border: rgba(217,119,6,0.25);
    --cyan: #0891b2;
    --cyan-lt: #0369a1;
    --cyan-bg: rgba(8,145,178,0.08);
    --cyan-border: rgba(8,145,178,0.25);
    --green: #059669;
    --green-bg: rgba(5,150,105,0.08);
    --green-border: rgba(5,150,105,0.25);
    --red: #ef4444;
    --red-bg: rgba(239,68,68,0.08);
    --red-border: rgba(239,68,68,0.25);
    --violet: #7c3aed;
    --violet-bg: rgba(124,58,237,0.08);
    --violet-border: rgba(124,58,237,0.25);
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-tertiary: #64748b;
    font-family: 'Source Sans 3', sans-serif;
    font-size: 18px;
    line-height: 1.7;
    background: var(--bg);
    color: var(--text-primary);
    padding: 60px 28px 100px;
    -webkit-font-smoothing: antialiased;
}

#rfc-root a { text-decoration: none; color: inherit; }

.rfc-wrap { max-width: 1100px; margin: 0 auto; }

/* HEADER */
.rfc-header { margin-bottom: 56px; }
.rfc-eyebrow { display: inline-flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.rfc-eyebrow-rule { width: 36px; height: 3px; background: var(--amber); border-radius: 2px; }
.rfc-eyebrow-text { font-family: 'DM Mono', monospace; font-size: 13px; font-weight: 600; color: var(--amber); letter-spacing: 0.16em; text-transform: uppercase; }
.rfc-h1 { font-family: 'Lora', serif; font-size: clamp(38px, 5vw, 58px); font-weight: 700; line-height: 1.15; color: var(--text-primary); margin-bottom: 20px; letter-spacing: -0.01em; }
.rfc-h1 em { font-style: italic; color: var(--amber); font-weight: 700; }
.rfc-lead { font-size: 20px; font-weight: 400; color: var(--text-secondary); max-width: 560px; line-height: 1.75; }

/* RECIPE NAME BAR */
.rfc-recipe-bar { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.rfc-recipe-name-wrap { flex: 1; min-width: 240px; display: flex; align-items: stretch; background: var(--bg-card); border: 2px solid var(--border-hi); border-radius: 12px; overflow: hidden; transition: border-color 0.2s, box-shadow 0.2s; min-height: 52px; }
.rfc-recipe-name-wrap:focus-within { border-color: var(--amber); box-shadow: 0 0 0 4px rgba(217,119,6,0.10); }
.rfc-recipe-name-adorn { padding: 0 16px; font-size: 15px; font-weight: 700; color: var(--amber); background: var(--amber-bg); border-right: 2px solid var(--border-hi); display: flex; align-items: center; white-space: nowrap; letter-spacing: 0.04em; text-transform: uppercase; }
#rfc-recipe-name { flex: 1; border: none; outline: none; background: transparent; padding: 0 18px; font-family: 'Lora', serif; font-size: 20px; font-weight: 600; color: var(--text-primary); font-style: italic; }
#rfc-recipe-name::placeholder { color: var(--text-tertiary); font-style: italic; }
.rfc-templates { display: flex; gap: 8px; flex-wrap: wrap; }
.rfc-tpl-btn { padding: 8px 16px; border: 1.5px solid var(--border-hi); border-radius: 30px; background: var(--bg-card); cursor: pointer; font-size: 14px; font-weight: 600; color: var(--text-tertiary); transition: all 0.18s; white-space: nowrap; }
.rfc-tpl-btn:hover { border-color: var(--amber); color: var(--amber); }

/* MAIN LAYOUT */
.rfc-layout { display: grid; grid-template-columns: 1.55fr 1fr; gap: 28px; margin-bottom: 36px; align-items: start; }
@media (max-width: 860px) { .rfc-layout { grid-template-columns: 1fr; } }

/* CARDS */
.rfc-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03); }
.rfc-card + .rfc-card { margin-top: 24px; }
.rfc-card-head { padding: 24px 28px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 14px; }
.rfc-card-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 19px; flex-shrink: 0; }
.rfc-card-title { font-family: 'Lora', serif; font-size: 21px; font-weight: 700; color: var(--text-primary); line-height: 1.3; }
.rfc-card-subtitle { font-size: 14px; color: var(--text-tertiary); font-weight: 500; margin-top: 2px; }
.rfc-card-body { padding: 28px; }

/* INGREDIENT TABLE */
.rfc-ing-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
.rfc-ing-table thead th { padding: 10px 10px; background: var(--bg-highlight); font-size: 12px; font-weight: 700; color: var(--text-tertiary); letter-spacing: 0.10em; text-transform: uppercase; text-align: left; border-bottom: 2px solid var(--border-hi); white-space: nowrap; }
.rfc-ing-table thead th.col-cost { text-align: right; }
.rfc-ing-table thead th.col-del { width: 36px; }
.rfc-ing-table tbody tr { border-bottom: 1px solid var(--border); transition: background 0.12s; }
.rfc-ing-table tbody tr:hover { background: var(--bg-row-alt); }
.rfc-ing-table tbody td { padding: 8px 6px; vertical-align: middle; }
.rfc-cell-input { width: 100%; border: 1.5px solid transparent; border-radius: 7px; background: transparent; padding: 7px 10px; font-family: 'Source Sans 3', sans-serif; font-size: 16px; font-weight: 500; color: var(--text-primary); transition: border-color 0.18s, background 0.18s, box-shadow 0.18s; outline: none; }
.rfc-cell-input:hover { background: var(--bg-highlight); border-color: var(--border-hi); }
.rfc-cell-input:focus { background: var(--bg-card); border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(8,145,178,0.10); }
.rfc-cell-input.mono { font-family: 'DM Mono', monospace; font-size: 16px; }
.rfc-cell-input[type=number]::-webkit-inner-spin-button, .rfc-cell-input[type=number]::-webkit-outer-spin-button { opacity: 0; }
.rfc-unit-select { border: 1.5px solid transparent; border-radius: 7px; background: transparent; padding: 7px 28px 7px 10px; font-family: 'DM Mono', monospace; font-size: 14px; font-weight: 600; color: var(--text-secondary); cursor: pointer; outline: none; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; transition: border-color 0.18s, background 0.18s; white-space: nowrap; }
.rfc-unit-select:hover { background-color: var(--bg-highlight); border-color: var(--border-hi); }
.rfc-unit-select:focus { background-color: var(--bg-card); border-color: var(--border-focus); }
.rfc-yield-wrap { position: relative; display: flex; align-items: center; }
.rfc-yield-wrap .rfc-cell-input { padding-right: 24px; }
.rfc-yield-pct { position: absolute; right: 10px; font-family: 'DM Mono', monospace; font-size: 12px; font-weight: 600; color: var(--text-tertiary); pointer-events: none; }
td.col-cost { text-align: right; font-family: 'DM Mono', monospace; font-size: 17px; font-weight: 600; color: var(--amber); padding-right: 10px; white-space: nowrap; }
td.col-cost.zero { color: var(--text-tertiary); }
.rfc-del-btn { width: 28px; height: 28px; border-radius: 6px; border: none; background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--text-tertiary); font-size: 16px; line-height: 1; transition: all 0.15s; }
.rfc-del-btn:hover { background: var(--red-bg); color: var(--red); }
.rfc-ing-total { display: flex; justify-content: space-between; align-items: center; padding: 14px 10px 14px 10px; border-top: 2px solid var(--border-hi); background: var(--bg-highlight); border-radius: 0 0 10px 10px; margin-top: -1px; }
.rfc-ing-total-label { font-size: 15px; font-weight: 700; color: var(--text-secondary); letter-spacing: 0.04em; text-transform: uppercase; }
.rfc-ing-total-val { font-family: 'DM Mono', monospace; font-size: 22px; font-weight: 600; color: var(--amber); }
.rfc-add-btn { display: inline-flex; align-items: center; gap: 9px; padding: 11px 22px; border: 2px dashed var(--border-hi); border-radius: 10px; background: transparent; cursor: pointer; font-family: 'Source Sans 3', sans-serif; font-size: 16px; font-weight: 600; color: var(--text-tertiary); transition: all 0.18s; width: 100%; justify-content: center; margin-top: 12px; }
.rfc-add-btn:hover { border-color: var(--amber); color: var(--amber); background: var(--amber-bg); }
.rfc-add-icon { font-size: 20px; line-height: 1; }

/* RIGHT COLUMN FIELDS */
.rfc-fields { display: flex; flex-direction: column; gap: 24px; }
.rfc-field { display: flex; flex-direction: column; gap: 9px; }
.rfc-label { font-size: 15px; font-weight: 600; color: var(--text-primary); letter-spacing: 0.02em; display: flex; justify-content: space-between; align-items: center; }
.rfc-label-value { font-family: 'DM Mono', monospace; font-size: 15px; font-weight: 600; color: var(--amber); background: var(--amber-bg); border: 1px solid var(--border); padding: 3px 12px; border-radius: 20px; }
.rfc-label-value.cyan { color: var(--cyan-lt); background: var(--cyan-bg); }
.rfc-label-value.green { color: var(--green); background: var(--green-bg); }
.rfc-input-row { display: flex; align-items: stretch; background: var(--bg-input); border: 2px solid var(--border-hi); border-radius: 10px; overflow: hidden; transition: border-color 0.2s, box-shadow 0.2s; min-height: 56px; }
.rfc-input-row:focus-within { border-color: var(--border-focus); box-shadow: 0 0 0 4px rgba(8,145,178,0.12); }
.rfc-adorn { padding: 0 16px; font-family: 'DM Mono', monospace; font-size: 18px; font-weight: 600; color: var(--text-tertiary); background: var(--bg-highlight); border-right: 2px solid var(--border-hi); display: flex; align-items: center; flex-shrink: 0; user-select: none; }
.rfc-adorn-r { border-right: none; border-left: 2px solid var(--border-hi); }
.rfc-input-row input, .rfc-input-row select { flex: 1; border: none; outline: none; background: transparent; padding: 0 18px; font-family: 'DM Mono', monospace; font-size: 20px; font-weight: 600; color: var(--text-primary); min-width: 0; appearance: none; }
.rfc-input-row select { cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 18px center; padding-right: 48px; }
.rfc-input-row input[type=number]::-webkit-inner-spin-button, .rfc-input-row input[type=number]::-webkit-outer-spin-button { opacity: 0; }
.rfc-slider-wrap { padding: 6px 0 0; }
input[type=range].rfc-slider { appearance: none; width: 100%; height: 6px; background: var(--border-hi); border-radius: 3px; outline: none; cursor: pointer; }
input[type=range].rfc-slider::-webkit-slider-thumb { appearance: none; width: 26px; height: 26px; background: var(--bg-card); border: 3px solid var(--amber); border-radius: 50%; box-shadow: 0 2px 5px rgba(0,0,0,0.15); transition: transform 0.15s, box-shadow 0.15s; }
input[type=range].rfc-slider::-webkit-slider-thumb:hover { transform: scale(1.18); box-shadow: 0 0 14px rgba(217,119,6,0.30); }
.rfc-slider-labels { display: flex; justify-content: space-between; margin-top: 8px; font-family: 'DM Mono', monospace; font-size: 13px; color: var(--text-tertiary); font-weight: 600; }
.rfc-type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rfc-type-btn { padding: 11px 10px; border: 2px solid var(--border-hi); border-radius: 10px; background: var(--bg-input); cursor: pointer; font-size: 14px; font-weight: 600; color: var(--text-secondary); text-align: center; transition: all 0.18s; line-height: 1.35; }
.rfc-type-btn:hover { border-color: var(--amber); color: var(--amber-lt); }
.rfc-type-btn.active { background: var(--amber-bg); border-color: var(--amber); color: var(--amber-lt); }
.rfc-type-sub { font-size: 11px; font-weight: 500; display: block; color: var(--text-tertiary); margin-top: 2px; }
.rfc-type-btn.active .rfc-type-sub { color: var(--amber); }
.rfc-hint { font-size: 15px; color: var(--text-tertiary); font-style: italic; line-height: 1.6; padding: 6px 0 0 2px; }

/* RESULTS PANEL */
.rfc-results { background: var(--bg-card); border: 1px solid var(--border); border-radius: 20px; overflow: hidden; box-shadow: 0 10px 25px -5px rgba(0,0,0,0.05); }
.rfc-verdict { padding: 36px 44px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 32px; flex-wrap: wrap; background: #f8fafc; }
.rfc-verdict-label { font-family: 'DM Mono', monospace; font-size: 13px; font-weight: 600; color: var(--text-tertiary); letter-spacing: 0.14em; text-transform: uppercase; margin-bottom: 10px; }
.rfc-verdict-title { font-family: 'Lora', serif; font-size: 28px; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.rfc-verdict-sub { font-size: 18px; color: var(--text-secondary); margin-top: 6px; line-height: 1.6; }
.rfc-cost-badge { flex-shrink: 0; text-align: center; padding: 18px 32px; border-radius: 14px; min-width: 170px; }
.rfc-cost-badge-label { font-family: 'DM Mono', monospace; font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 8px; }
.rfc-cost-badge-amount { font-family: 'Lora', serif; font-size: clamp(40px, 5vw, 56px); font-weight: 700; line-height: 1; letter-spacing: -0.02em; }
.rfc-cost-badge-sub { font-size: 15px; font-weight: 500; margin-top: 6px; }
.rfc-stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--border); }
@media (max-width: 680px) { .rfc-stat-grid { grid-template-columns: 1fr 1fr; } }
.rfc-stat { padding: 28px 24px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.rfc-stat:nth-child(4n) { border-right: none; }
.rfc-stat-last { border-bottom: none; }
.rfc-stat-label { font-size: 13px; font-weight: 700; color: var(--text-tertiary); letter-spacing: 0.07em; text-transform: uppercase; margin-bottom: 10px; line-height: 1.4; }
.rfc-stat-value { font-family: 'DM Mono', monospace; font-size: 26px; font-weight: 600; color: var(--text-primary); letter-spacing: -0.02em; line-height: 1.1; margin-bottom: 4px; transition: all 0.25s ease; }
.rfc-stat-sub { font-size: 13px; color: var(--text-tertiary); line-height: 1.5; font-weight: 500; }
.rfc-breakdown { padding: 0; border-bottom: 1px solid var(--border); }
.rfc-breakdown-head { padding: 18px 32px; background: var(--bg-highlight); border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.rfc-breakdown-title { font-size: 15px; font-weight: 700; color: var(--text-secondary); letter-spacing: 0.06em; text-transform: uppercase; }
.rfc-breakdown-total { font-family: 'DM Mono', monospace; font-size: 15px; font-weight: 600; color: var(--amber); }
.rfc-breakdown-body { padding: 20px 32px 24px; display: flex; flex-direction: column; gap: 14px; }
.rfc-bar-row { display: grid; grid-template-columns: 140px 1fr 72px 72px; gap: 14px; align-items: center; }
@media (max-width: 600px) { .rfc-bar-row { grid-template-columns: 100px 1fr 60px 60px; gap: 8px; } }
.rfc-bar-name { font-size: 15px; font-weight: 600; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rfc-bar-track { height: 10px; background: var(--border-hi); border-radius: 5px; overflow: hidden; }
.rfc-bar-fill { height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--amber-lt), var(--amber)); transition: width 0.4s cubic-bezier(0.4,0,0.2,1); }
.rfc-bar-pct { font-family: 'DM Mono', monospace; font-size: 14px; font-weight: 600; color: var(--amber); text-align: right; }
.rfc-bar-cost { font-family: 'DM Mono', monospace; font-size: 14px; font-weight: 600; color: var(--text-secondary); text-align: right; }
.rfc-compare { width: 100%; border-collapse: collapse; border-bottom: 1px solid var(--border); }
.rfc-compare thead th { padding: 18px 28px; font-size: 13px; font-weight: 700; color: var(--text-secondary); letter-spacing: 0.08em; text-transform: uppercase; text-align: right; background: var(--bg-highlight); border-bottom: 2px solid var(--border-hi); }
.rfc-compare thead th:first-child { text-align: left; }
.rfc-compare tbody td { padding: 20px 28px; font-size: 18px; font-weight: 500; color: var(--text-secondary); text-align: right; border-bottom: 1px solid var(--border); vertical-align: middle; line-height: 1.4; }
.rfc-compare tbody tr:last-child td { border-bottom: none; }
.rfc-compare tbody td:first-child { text-align: left; font-weight: 600; color: var(--text-primary); }
.rfc-compare tbody tr:hover td { background: var(--bg-row-alt); }
.rfc-compare .td-mono { font-family: 'DM Mono', monospace; font-size: 18px; font-weight: 600; }
.rfc-compare tr.active-row td { background: var(--amber-bg); }
.rfc-compare tr.active-row td:first-child { color: var(--amber-lt); }
.rfc-win-chip { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; vertical-align: middle; margin-left: 8px; }
.rfc-reverse { padding: 32px 40px; border-bottom: 1px solid var(--border); background: var(--bg-highlight); }
.rfc-reverse-title { font-family: 'Lora', serif; font-size: 20px; font-weight: 700; color: var(--text-primary); margin-bottom: 20px; line-height: 1.3; }
.rfc-reverse-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 600px) { .rfc-reverse-grid { grid-template-columns: 1fr; } }
.rfc-price-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; text-align: center; transition: border-color 0.18s, box-shadow 0.18s; }
.rfc-price-card:hover { border-color: var(--amber); box-shadow: 0 4px 12px rgba(217,119,6,0.10); }
.rfc-price-card-pct { font-family: 'DM Mono', monospace; font-size: 13px; font-weight: 600; color: var(--text-tertiary); letter-spacing: 0.10em; text-transform: uppercase; margin-bottom: 8px; }
.rfc-price-card-val { font-family: 'Lora', serif; font-size: 34px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; margin-bottom: 6px; transition: all 0.25s ease; }
.rfc-price-card-sub { font-size: 13px; font-weight: 500; color: var(--text-tertiary); line-height: 1.5; }
.rfc-takeaway { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--border); }
@media (max-width: 640px) { .rfc-takeaway { grid-template-columns: 1fr; } }
.rfc-take-col { padding: 32px 36px; border-right: 1px solid var(--border); }
.rfc-take-col:last-child { border-right: none; }
.rfc-take-heading { font-family: 'Lora', serif; font-size: 19px; font-weight: 700; margin-bottom: 18px; line-height: 1.3; }
.rfc-take-item { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.rfc-take-arrow { font-size: 19px; font-weight: 700; line-height: 1.65; flex-shrink: 0; }
.rfc-take-text { font-size: 16px; color: var(--text-secondary); line-height: 1.7; font-weight: 500; }
.rfc-footnote { padding: 26px 40px; border-top: 1px solid var(--border); font-size: 15px; color: var(--text-tertiary); line-height: 1.7; font-style: italic; background: var(--bg); }

/* ANIMATIONS */
@keyframes rfc-up { from { opacity:0; transform:translateY(18px); } to { opacity:1; transform:translateY(0); } }
.rfc-header { animation: rfc-up 0.5s ease both 0.05s; }
.rfc-recipe-bar { animation: rfc-up 0.5s ease both 0.10s; }
.rfc-layout { animation: rfc-up 0.5s ease both 0.15s; }
.rfc-results { animation: rfc-up 0.5s ease both 0.22s; }

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,600;0,700;1,400;1,600&family=Source+Sans+3:wght@400;500;600;700&family=DM+Mono:wght@400;500;600&display=swap');
/* ─────────────────────────────────────────────────────────────────────────────
   MOBILE RESPONSIVE (v1.1)
   ───────────────────────────────────────────────────────────────────────────── */

@media (max-width: 860px) {
    /* Reduce base font size on mobile */
    #rfc-root {
        font-size: 16px;
        padding: 40px 16px 60px;
    }
    
    /* Header adjustments */
    .rfc-h1 {
        font-size: 32px !important;
        line-height: 1.2;
    }
    
    .rfc-lead {
        font-size: 18px;
    }
    
    /* Recipe bar stacks on mobile */
    .rfc-recipe-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .rfc-templates {
        justify-content: center;
        margin-top: 12px;
    }
    
    .rfc-tpl-btn {
        font-size: 13px;
        padding: 6px 12px;
    }
    
    /* Layout becomes single column */
    .rfc-layout {
        grid-template-columns: 1fr !important;
    }
    
    /* Card padding reduced */
    .rfc-card-body {
        padding: 20px !important;
    }
    
    .rfc-card-head {
        padding: 20px !important;
    }
}

@media (max-width: 680px) {
    /* Stat grid: 2 columns on tablet, 1 on phone */
    .rfc-stat-grid {
        grid-template-columns: 1fr 1fr !important;
    }
    
    .rfc-stat {
        padding: 20px 16px !important;
    }
    
    .rfc-stat-value {
        font-size: 20px !important;
    }
    
    .rfc-stat-label {
        font-size: 12px;
    }
    
    .rfc-stat-sub {
        font-size: 12px;
    }
    
    /* Verdict section stacks */
    .rfc-verdict {
        flex-direction: column;
        text-align: center;
        padding: 28px 20px !important;
    }
    
    .rfc-cost-badge {
        width: 100%;
        padding: 20px !important;
    }
    
    /* Ingredient table becomes horizontally scrollable */
    .rfc-ing-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }
    
    .rfc-ing-table thead,
    .rfc-ing-table tbody,
    .rfc-ing-table tr {
        display: table;
        width: 100%;
        table-layout: fixed;
    }
    
    .rfc-ing-table {
        min-width: 700px; /* Force minimum width for scroll */
    }
    
    /* Restaurant type grid: single column */
    .rfc-type-grid {
        grid-template-columns: 1fr !important;
    }
    
    /* Reverse pricing: single column */
    .rfc-reverse-grid {
        grid-template-columns: 1fr !important;
    }
    
    /* Takeaway: single column */
    .rfc-takeaway {
        grid-template-columns: 1fr !important;
    }
    
    .rfc-take-col {
        border-right: none !important;
        padding: 24px 20px !important;
    }
    
    /* Benchmark table: make scrollable */
    .rfc-compare {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        min-width: 600px;
    }
    
    /* Breakdown bars: adjust for mobile */
    .rfc-bar-row {
        grid-template-columns: 80px 1fr 55px 55px !important;
        gap: 10px;
    }
    
    .rfc-bar-name {
        font-size: 13px;
    }
    
    .rfc-bar-pct,
    .rfc-bar-cost {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    /* Extra small phones */
    #rfc-root {
        padding: 30px 12px 50px;
    }
    
    .rfc-h1 {
        font-size: 28px !important;
    }
    
    .rfc-lead {
        font-size: 16px;
    }
    
    .rfc-card-title {
        font-size: 18px !important;
    }
    
    .rfc-stat-grid {
        grid-template-columns: 1fr !important;
    }
    
    .rfc-stat:nth-child(4n) {
        border-right: 1px solid var(--border);
    }
    
    .rfc-stat:nth-child(2n) {
        border-right: none;
    }
    
    .rfc-stat-last {
        border-bottom: 1px solid var(--border);
    }
    
    .rfc-stat:last-child {
        border-bottom: none;
    }
    
    /* Buttons full width */
    .rfc-add-btn,
    .rfc-tpl-btn {
        width: 100%;
        justify-content: center;
    }
    
    .rfc-templates {
        flex-direction: column;
    }
    
    /* Input rows adjust */
    .rfc-input-row {
        min-height: 50px;
    }
    
    .rfc-input-row input,
    .rfc-input-row select {
        font-size: 18px !important;
    }
    
    .rfc-adorn {
        font-size: 16px !important;
        padding: 0 12px;
    }
    
    /* Footer adjustments */
    .rfc-footnote {
        padding: 20px !important;
        font-size: 14px;
    }
}

/* Fix for iOS Safari viewport issues */
@supports (-webkit-touch-callout: none) {
    .rfc-ing-table {
        overflow-x: scroll;
    }
    
    .rfc-compare {
        overflow-x: scroll;
    }
}

/* Ensure tables don't break layout */
.rfc-ing-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Touch-friendly targets */
@media (pointer: coarse) {
    .rfc-cell-input,
    .rfc-unit-select,
    .rfc-del-btn,
    .rfc-type-btn,
    .rfc-tpl-btn,
    .rfc-add-btn {
        min-height: 44px;
    }
    
    .rfc-del-btn {
        width: 44px;
        height: 44px;
    }
}