:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #15202b;
  background: #f4f6f8;
  font-synthesis: none;
  --ink: #111c28;
  --yellow: #f4c04b;
  --line: #dce3e8;
  --muted: #677580;
  --paper: #fff;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body { margin: 0; min-width: 320px; }
body.auth-pending > * { visibility: hidden; }
button, input, select { font: inherit; }

.topbar {
  height: 72px;
  padding: 0 clamp(20px, 5vw, 64px);
  display: flex;
  align-items: center;
  gap: 44px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-size: 1.08rem; font-weight: 850; text-decoration: none; }
.brand-mark { width: 38px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--yellow); font-size: .76rem; font-weight: 950; letter-spacing: -.035em; }
.topbar nav { display: flex; gap: 26px; margin-left: auto; }
.topbar nav a { color: #65717c; text-decoration: none; font-size: .9rem; font-weight: 750; }
.topbar nav a.active, .topbar nav a:hover { color: var(--ink); }
.account { display: flex; align-items: center; gap: 10px; padding-left: 18px; border-left: 1px solid var(--line); }
.language-select { appearance: none; border: 1px solid var(--line); border-radius: 8px; background: #f6f8f9; color: var(--ink); padding: 7px 25px 7px 9px; font: inherit; font-size: .74rem; font-weight: 850; cursor: pointer; background-image: linear-gradient(45deg,transparent 50%,var(--ink) 50%),linear-gradient(135deg,var(--ink) 50%,transparent 50%); background-position: calc(100% - 11px) 50%,calc(100% - 7px) 50%; background-size: 4px 4px,4px 4px; background-repeat: no-repeat; }
.language-select:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }
.account span { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; color: var(--muted); font-weight: 750; }
.account button { border: 0; background: none; padding: 5px 0; color: #744d00; font-size: .75rem; font-weight: 850; cursor: pointer; }

.auth-page { min-height: 100vh; background: var(--ink); }
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(440px, 100%); border-radius: 20px; background: #fff; padding: 34px; box-shadow: 0 28px 80px rgba(0,0,0,.3); }
.auth-brand { width: fit-content; margin-bottom: 38px; }
.auth-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 38px; }
.auth-top .auth-brand { margin-bottom: 0; }
.auth-kicker { margin: 0 0 10px; color: #9b6c00; font-size: .73rem; letter-spacing: .11em; font-weight: 900; }
.auth-card h1 { margin: 0; font-size: 2.35rem; letter-spacing: -.05em; }
.auth-intro { margin: 10px 0 26px; color: var(--muted); line-height: 1.5; }
.auth-card form { display: grid; gap: 17px; }
.auth-card label { display: grid; gap: 7px; font-size: .82rem; font-weight: 800; }
.auth-card label small { color: var(--muted); font-weight: 500; }
.auth-card input { width: 100%; border: 1px solid #cfd8df; border-radius: 10px; padding: 12px 13px; outline: 0; font-size: 1rem; }
.auth-card input:focus { border-color: #c88c00; box-shadow: 0 0 0 3px rgba(244,192,75,.25); }
.primary-button { border: 0; border-radius: 10px; padding: 13px 16px; background: var(--yellow); color: var(--ink); font-weight: 900; cursor: pointer; margin-top: 4px; }
.primary-button:disabled { opacity: .55; cursor: wait; }
.auth-message { min-height: 22px; margin: 18px 0 0; color: #a13d32; font-size: .84rem; line-height: 1.45; }

.page { max-width: 1280px; margin: auto; padding: 48px clamp(20px, 4vw, 52px) 72px; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 28px; margin-bottom: 26px; }
.page-head h1 { font-size: clamp(2rem, 4vw, 3.1rem); letter-spacing: -.055em; margin: 0; }
.page-head p { color: var(--muted); margin: 5px 0 0; }
.library-tools { display: flex; gap: 10px; align-items: center; }
.search { display: flex; align-items: center; gap: 8px; background: var(--paper); border: 1px solid var(--line); border-radius: 11px; padding: 10px 14px; min-width: 280px; }
.search input { border: 0; outline: 0; background: transparent; width: 100%; font-size: .9rem; }
.library-tools select { border: 1px solid var(--line); background: #fff; border-radius: 11px; padding: 10px 34px 10px 12px; color: #273542; }

.recipe-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.recipe-card { background: var(--paper); border: 1px solid #dfe5ea; border-radius: 16px; overflow: hidden; box-shadow: 0 10px 28px rgba(17,28,40,.06); position: relative; }
.recipe-open { display: block; width: 100%; border: 0; background: none; padding: 0; text-align: left; cursor: pointer; color: inherit; }
.recipe-image-wrap { height: 260px; overflow: hidden; background: #273340; }
.recipe-card img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.recipe-open:hover img { transform: scale(1.025); }
.save-button { position: absolute; right: 14px; top: 14px; width: 42px; height: 42px; border: 0; border-radius: 12px; background: rgba(17,28,40,.88); color: white; display: grid; place-items: center; cursor: pointer; font-size: 1.3rem; z-index: 2; }
.save-button.saved { background: var(--yellow); color: var(--ink); }
.card-body { padding: 22px 24px 18px; }
.card-kicker { font-size: .74rem; letter-spacing: .1em; font-weight: 900; color: #9b6c00; margin: 0 0 9px; }
.card-body h3 { font-size: 1.5rem; letter-spacing: -.035em; margin: 0 0 7px; }
.card-description { color: var(--muted); margin: 0 0 18px; line-height: 1.45; }
.meta { display: flex; gap: 8px; flex-wrap: wrap; }
.meta span { font-size: .76rem; font-weight: 800; background: #edf1f4; border-radius: 99px; padding: 7px 10px; }
.open-hint { margin-left: auto !important; background: var(--ink) !important; color: #fff !important; }
.card-actions { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid #e6ebef; padding: 14px 24px; }
.rating { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.star { padding: 2px; border: 0; background: none; color: #c8d0d6; cursor: pointer; font-size: 1.2rem; line-height: 1; }
.star.on { color: #e4a700; }
.rating-label { font-size: .74rem; color: #75818a; margin-left: 6px; }
.clear-rating { margin-left: 6px; padding: 2px; border: 0; background: none; color: #7a4c00; cursor: pointer; font-size: .72rem; font-weight: 800; text-decoration: underline; text-underline-offset: 2px; }
.source-mini { font-size: .76rem; color: #53616c; text-decoration: none; font-weight: 800; }

.empty-state, .shopping-empty { border: 1px dashed #cdd6dd; border-radius: 16px; padding: 48px; text-align: center; background: #fff; }
.empty-state strong, .shopping-empty strong { display: block; margin-bottom: 10px; }
.empty-state button, .shopping-empty a, .shopping-footnote button, .selection-actions button { border: 1px solid var(--ink); border-radius: 9px; background: #fff; color: var(--ink); padding: 8px 12px; font-weight: 800; cursor: pointer; text-decoration: none; }

.shopping-page { max-width: 1160px; }
.shopping-title { margin-bottom: 20px; }
.selection-actions { display: flex; gap: 8px; }
.selection-actions button:last-child { border-color: var(--line); color: var(--muted); }
.recipe-picker { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-bottom: 46px; }
.pick-card { display: grid; grid-template-columns: 88px 1fr auto; align-items: center; gap: 14px; width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: #fff; text-align: left; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.pick-card:hover { border-color: #aeb8c0; }
.pick-card.selected { border-color: #d39b16; box-shadow: inset 0 0 0 1px #d39b16; }
.pick-card img { width: 88px; height: 68px; object-fit: cover; border-radius: 9px; }
.pick-copy { display: grid; gap: 4px; }
.pick-copy strong { font-size: .94rem; }
.pick-copy span { color: var(--muted); font-size: .78rem; }
.pick-check { width: 22px; height: 22px; accent-color: #d99c0a; }

.shopping-breakdown { border-top: 1px solid var(--line); padding-top: 34px; }
.breakdown-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.breakdown-head h2 { margin: 0; font-size: clamp(1.55rem, 3vw, 2.25rem); letter-spacing: -.04em; }
.breakdown-head p { margin: 5px 0 0; color: var(--muted); }
.total-card { background: var(--ink); color: white; border-radius: 14px; padding: 15px 18px; min-width: 210px; display: grid; gap: 3px; }
.total-card span, .total-card small { color: #aeb9c3; font-size: .78rem; }
.total-card strong { font-size: 1.45rem; letter-spacing: -.04em; }
.shopping-group { background: #fff; border: 1px solid #d7e0e6; border-radius: 14px; overflow: hidden; margin-bottom: 16px; }
.shopping-group-head { padding: 17px 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #e2e7eb; }
.shopping-group-head h3 { margin: 0; font-size: 1rem; }
.shopping-group-head small { color: #687681; font-weight: 500; }
.subtotal { font-weight: 900; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; min-width: 680px; }
th, td { text-align: left; padding: 12px 20px; border-bottom: 1px solid #edf0f2; font-size: .85rem; }
th { font-size: .7rem; letter-spacing: .09em; color: #73808a; background: #f8fafb; }
tbody tr:last-child td { border-bottom: 0; }
td.price { text-align: right; font-variant-numeric: tabular-nums; font-weight: 750; }
th:last-child { text-align: right; }
.shop-check { width: 18px; height: 18px; accent-color: #d99c0a; }
.store { display: inline-flex; border-radius: 99px; padding: 4px 8px; background: #eef2f4; font-size: .72rem; font-weight: 850; }
.store.aldi { background: #dff0ff; color: #075b99; }
.not-found { color: #a84b3d; font-weight: 750; }
.checked td:not(:first-child) { opacity: .45; text-decoration: line-through; }
.table-note { margin: 0; padding: 12px 20px; background: #f5f7f9; color: #5a6771; font-size: .78rem; line-height: 1.45; }
.shopping-footnote { display: flex; justify-content: space-between; align-items: center; gap: 22px; margin-top: 22px; }
.shopping-footnote p { max-width: 760px; color: #586671; font-size: .83rem; line-height: 1.5; margin: 0; }

.request-layout { display: grid; grid-template-columns: minmax(0,1.65fr) minmax(260px,.75fr); gap: 24px; align-items: start; }
.request-card, .workflow-card, .queue-section { background: #fff; border: 1px solid var(--line); border-radius: 16px; }
.request-card { padding: 26px; }
.request-card h2, .workflow-card h2, .queue-section h2 { margin: 0 0 7px; font-size: 1.25rem; }
.request-card > p, .shared-queue-intro { color: var(--muted); font-size: .86rem; line-height: 1.5; }
.request-card form { display: grid; gap: 15px; margin-top: 22px; }
.request-card label { display: grid; gap: 7px; font-size: .8rem; font-weight: 800; }
.request-card input, .request-card textarea { width: 100%; border: 1px solid #cfd8df; border-radius: 10px; padding: 11px 12px; outline: 0; font: inherit; resize: vertical; }
.request-card input:focus, .request-card textarea:focus { border-color: #c88c00; box-shadow: 0 0 0 3px rgba(244,192,75,.25); }
.request-or { color: #8a959d; font-size: .75rem; font-weight: 800; text-align: center; text-transform: uppercase; }
.request-row { display: grid; grid-template-columns: 150px 1fr; gap: 14px; }
.form-message { min-height: 1.2em; margin: 0; color: #9b3c2f; font-size: .8rem; }
.workflow-card { padding: 24px; background: #182634; color: #fff; border: 0; }
.workflow-card .auth-kicker { color: var(--yellow); }
.workflow-card ol { padding-left: 21px; margin: 18px 0 0; display: grid; gap: 13px; color: #d5dde3; font-size: .84rem; line-height: 1.45; }
.workflow-card li::marker { color: var(--yellow); font-weight: 900; }
.queue-section { margin-top: 28px; overflow: hidden; }
.queue-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 22px 24px; border-bottom: 1px solid var(--line); }
.queue-head h2 { margin-bottom: 3px; }
.queue-head p { margin: 0; color: var(--muted); font-size: .82rem; }
.queue-head button, .request-item-actions button { border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 8px 11px; font-weight: 800; cursor: pointer; }
.request-list { display: grid; }
.request-item { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.request-item:last-child { border-bottom: 0; }
.request-item-main { min-width: 0; }
.request-item-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.request-item-head time { color: var(--muted); font-size: .72rem; }
.request-item h3 { margin: 0; font-size: 1rem; overflow-wrap: anywhere; }
.request-status { display: inline-flex; border-radius: 99px; padding: 4px 8px; font-size: .68rem; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; background: #f2f4f6; color: #596874; }
.status-researching { background: #fff2cc; color: #7b5600; }
.status-ready { background: #dcf3e4; color: #17663a; }
.status-added { background: #e6edf3; color: #3b5366; }
.request-notes { margin: 7px 0 0; color: #53616c; font-size: .82rem; line-height: 1.45; }
.request-meta { margin: 8px 0 0; color: var(--muted); font-size: .74rem; }
.request-item-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.request-item-actions a { color: #6f4b00; font-size: .78rem; font-weight: 850; text-decoration: none; }
.request-item-actions button { color: #9b3c2f; font-size: .74rem; }
.queue-section .shopping-empty { margin: 0; border: 0; border-radius: 0; }

dialog { border: 0; padding: 0; border-radius: 18px; width: min(960px, calc(100vw - 24px)); max-height: calc(100vh - 24px); box-shadow: 0 30px 80px rgba(0,0,0,.35); overflow: hidden; }
dialog::backdrop { background: rgba(8,16,24,.72); backdrop-filter: blur(4px); }
.dialog-shell { background: #fff; max-height: calc(100vh - 24px); overflow: auto; }
.dialog-hero { height: 230px; position: relative; }
.dialog-hero img { width: 100%; height: 100%; object-fit: cover; }
.dialog-close { position: absolute; right: 16px; top: 16px; width: 42px; height: 42px; border: 0; border-radius: 50%; background: rgba(17,28,40,.92); color: #fff; font-size: 1.35rem; cursor: pointer; }
.dialog-body { padding: 28px 32px 34px; }
.dialog-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 22px; }
.dialog-title-row h2 { font-size: 2rem; letter-spacing: -.045em; margin: 0 0 7px; }
.dialog-title-row p { color: var(--muted); margin: 0; }
.source-link { color: var(--ink); font-weight: 850; text-decoration: none; border: 1px solid var(--line); padding: 9px 12px; border-radius: 9px; white-space: nowrap; }
.facts { display: grid; grid-template-columns: repeat(5, 1fr); margin: 24px 0 28px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.fact { padding: 13px; border-right: 1px solid var(--line); }
.fact:last-child { border: 0; }
.fact span { display: block; font-size: .68rem; letter-spacing: .09em; color: #76838d; font-weight: 800; margin-bottom: 4px; }
.fact strong { font-size: .88rem; }
.guide-title { font-size: 1.25rem; margin: 0 0 15px; }
.steps { list-style: none; counter-reset: step; padding: 0; margin: 0; display: grid; gap: 10px; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 38px 1fr; gap: 12px; align-items: start; padding: 13px 15px; border: 1px solid var(--line); border-radius: 11px; line-height: 1.5; font-size: .9rem; }
.steps li::before { content: counter(step); width: 30px; height: 30px; border-radius: 9px; background: var(--yellow); display: grid; place-items: center; font-weight: 900; }
.detail-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; margin-top: 28px; }
.detail-columns h3 { font-size: 1rem; margin: 0 0 10px; }
.ingredient-list { list-style: none; padding: 0; margin: 0; }
.ingredient-list li { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid #edf0f2; font-size: .83rem; }
.ingredient-list li span:last-child { color: var(--muted); text-align: right; }
.detail-note { background: #f3f6f8; border-radius: 10px; padding: 13px; color: #53616c; font-size: .8rem; line-height: 1.5; margin-top: 16px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%,20px); background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 10px; font-size: .82rem; opacity: 0; pointer-events: none; transition: .2s; z-index: 40; }
.toast.show { opacity: 1; transform: translate(-50%,0); }

@media (max-width: 860px) {
  .page-head, .breakdown-head { align-items: stretch; flex-direction: column; }
  .library-tools { width: 100%; }
  .search { flex: 1; min-width: 0; }
  .facts { grid-template-columns: repeat(2,1fr); }
  .fact { border-bottom: 1px solid var(--line); }
  .detail-columns { grid-template-columns: 1fr; }
  .request-layout { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  html { scroll-padding-top: 112px; }
  .topbar { height: auto; min-height: 64px; padding: 10px 14px; gap: 10px; flex-wrap: wrap; }
  .topbar .brand { order: 1; }
  .topbar nav { order: 3; width: 100%; justify-content: space-around; gap: 12px; margin-left: 0; padding-top: 9px; border-top: 1px solid var(--line); }
  .account { order: 2; margin-left: auto; }
  .account { padding-left: 0; border-left: 0; }
  .account span { display: none; }
  .auth-card { padding: 26px 22px; }
  .page { padding-top: 34px; padding-bottom: 54px; }
  .library-tools { flex-direction: column; align-items: stretch; }
  .recipe-grid, .recipe-picker { grid-template-columns: 1fr; }
  .recipe-image-wrap { height: 220px; }
  .card-actions { align-items: flex-start; gap: 10px; flex-direction: column; }
  .pick-card { grid-template-columns: 74px 1fr auto; }
  .pick-card img { width: 74px; height: 58px; }
  .total-card { width: 100%; }
  .shopping-footnote { align-items: flex-start; flex-direction: column; }
  .dialog-hero { height: 180px; }
  .dialog-body { padding: 21px; }
  .dialog-title-row { flex-direction: column; }
  .facts { grid-template-columns: 1fr 1fr; }
  .steps li { grid-template-columns: 34px 1fr; padding: 11px; }
  .request-row { grid-template-columns: 1fr; }
  .request-item { align-items: flex-start; flex-direction: column; gap: 13px; }
  .request-item-actions { width: 100%; justify-content: space-between; }
}
