:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #20231f;
  background: #f5f3ed;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
.app-shell { display: grid; grid-template-columns: 250px minmax(0,1fr); min-height: 100vh; }
.sidebar { background: #1f2820; color: #eef2e9; padding: 26px 18px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 11px; align-items: center; padding: 0 7px 26px; border-bottom: 1px solid rgba(255,255,255,.09); }
.brand-mark { width: 37px; height: 37px; background: #b7d083; color: #24301e; border-radius: 11px; display: grid; place-items: center; font-weight: 900; font-size: 20px; }
.brand strong { display: block; font-size: 14px; }
.brand small { color: #98a498; font-size: 11px; }
nav { display: flex; flex-direction: column; gap: 6px; padding-top: 22px; }
.nav-item { border: 0; color: #b7c0b5; background: transparent; text-align: left; padding: 12px 11px; border-radius: 11px; display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 4px; font-size: 13px; }
.nav-item span { font-size: 10px; color: #6f7b6d; font-weight: 900; }
.nav-item em { font-style: normal; font-size: 9px; padding: 3px 5px; border: 1px solid #4b5749; border-radius: 999px; }
.nav-item.active { color: #fff; background: #2d392d; }
.nav-item:disabled { cursor: default; opacity: .52; }
.sidebar-foot { margin-top: auto; color: #748071; font-size: 10px; padding: 14px 7px 0; border-top: 1px solid rgba(255,255,255,.07); }
main { width: min(1260px, calc(100vw - 250px)); padding: 38px 42px 70px; }
.page-header { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 24px; }
.eyebrow { color: #78816f; letter-spacing: .14em; font-size: 10px; font-weight: 900; margin: 0 0 7px; }
h1,h2,h3,p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(31px, 4vw, 48px); letter-spacing: -.045em; line-height: 1; }
h2 { margin-bottom: 8px; letter-spacing: -.025em; }
.page-header p:last-child, .rules-card > p, .list-toolbar p, .next-card p { color: #747971; margin-bottom: 0; }
.secondary-btn, .primary-btn { text-decoration: none; border-radius: 11px; padding: 11px 15px; font-weight: 750; font-size: 13px; }
.secondary-btn { border: 1px solid #d6d8d0; color: #30372d; background: #fffefa; }
.primary-btn { border: 0; background: #2b3a28; color: #fff; }
.card { background: #fffefa; border: 1px solid #dfded7; box-shadow: 0 14px 38px rgba(41,47,37,.055); border-radius: 18px; }
.hero-grid { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(300px,.8fr); gap: 18px; }
.upload-card { padding: 18px; }
.dropzone { min-height: 355px; border: 2px dashed #bcc1b6; border-radius: 14px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 34px; transition: .18s ease; }
.dropzone.dragging { border-color: #6e845e; background: #f1f5e9; transform: translateY(-1px); }
.upload-symbol { width: 50px; height: 50px; border-radius: 15px; display: grid; place-items: center; background: #e9efd9; font-size: 27px; font-weight: 900; margin-bottom: 17px; }
.dropzone h2 { font-size: 25px; margin-bottom: 8px; }
.dropzone p { color: #777c74; max-width: 440px; margin-bottom: 20px; }
.dropzone small { color: #969a93; margin-top: 12px; }
.rules-card { padding: 25px; }
.rules-card > p { line-height: 1.55; }
.rule { display: grid; grid-template-columns: 32px 1fr; gap: 10px; padding: 14px; margin-top: 14px; border-radius: 12px; }
.rule > span { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; font-weight: 900; }
.rule strong { font-size: 12px; }
.rule p { margin: 3px 0 0; color: #666b63; font-size: 12px; line-height: 1.45; }
.rule.good { background: #eff6e8; }.rule.good > span { background: #dbeccf; color: #396032; }
.rule.bad { background: #faf0ec; }.rule.bad > span { background: #f2d9d1; color: #8a3e32; }
.columns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 19px; }
.columns b { background: #f0eee8; border-radius: 999px; padding: 6px 8px; font-size: 10px; color: #60655d; }
.result-card { margin-top: 18px; padding: 24px; }
.hidden { display: none !important; }
.result-head { display: flex; justify-content: space-between; gap: 20px; align-items: center; }
.file-name { font-size: 21px; margin: 0; }
.status { padding: 7px 9px; border-radius: 999px; font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; }
.status.ok { background: #e4f1df; color: #35602f; }.status.error { background: #f8e2dd; color: #873c32; }
.stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; margin: 18px 0; }
.stats > div { background: #efeee8; border-radius: 12px; padding: 14px; }
.stats strong { display: block; font-size: 24px; letter-spacing: -.03em; }
.stats span { color: #7a7e77; font-size: 11px; }
.issue-box { padding: 14px 16px; border-radius: 12px; margin-top: 11px; }.issue-box.error { background: #fbefec; }.issue-box.warning { background: #fbf5df; }
.issue-box h3 { font-size: 13px; margin-bottom: 9px; }.issue { display: grid; grid-template-columns: 58px 1fr; gap: 10px; padding: 8px 0; border-top: 1px solid rgba(40,40,40,.07); font-size: 12px; }.issue:first-of-type { border-top: 0; }.issue b { color: #6f746c; font-size: 10px; }
.table-wrap { overflow: auto; margin-top: 18px; border: 1px solid #e3e2dc; border-radius: 12px; }
table { width: 100%; border-collapse: collapse; min-width: 750px; } th,td { text-align: left; padding: 11px 12px; border-bottom: 1px solid #eae9e3; font-size: 12px; } th { background: #f4f2ed; color: #747970; text-transform: uppercase; letter-spacing: .04em; font-size: 9px; } tbody tr:last-child td { border-bottom:0; }.ingredient { font-weight: 800; }
.result-actions { display: flex; justify-content: flex-end; margin-top: 17px; }.result-actions button:disabled { opacity: .38; cursor: not-allowed; }
.view { display: none; }.view.active { display: block; }
.list-toolbar { display: flex; justify-content: space-between; gap: 20px; align-items: center; padding: 22px; }
.grocery-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.grocery-item { padding: 15px 17px; display: grid; grid-template-columns: 28px 1fr auto; gap: 11px; align-items: start; }
.check { width: 23px; height: 23px; border: 1.5px solid #b9beb5; border-radius: 7px; background: #fff; }
.grocery-item.checked { opacity: .5; }.grocery-item.checked .item-name { text-decoration: line-through; }.grocery-item.checked .check { background: #2d3d2a; border-color: #2d3d2a; position: relative; }.grocery-item.checked .check:after { content: '✓'; color: white; position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; }
.item-name { font-weight: 800; font-size: 13px; }.item-meta { color: #858981; font-size: 10px; margin-top: 3px; }.item-amount { font-weight: 900; font-size: 13px; white-space: nowrap; }
.next-card { margin-top: 18px; padding: 24px; display: flex; justify-content: space-between; align-items: center; gap: 30px; }.soon { background: #e7edda; color: #42543c; padding: 8px 12px; font-size: 11px; font-weight: 900; border-radius: 999px; }
.loading { opacity: .66; pointer-events: none; }
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }.sidebar { position: static; width: 100%; height: auto; padding: 14px; }.brand { padding-bottom: 13px; }.sidebar nav { flex-direction: row; overflow-x: auto; padding-top: 12px; }.nav-item { min-width: 175px; }.sidebar-foot { display:none; }
  main { width: 100%; padding: 26px 18px 55px; }.hero-grid { grid-template-columns: 1fr; }.grocery-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .page-header { align-items: flex-start; flex-direction: column; }.stats { grid-template-columns: repeat(2,1fr); }.upload-card { padding: 10px; }.dropzone { min-height: 300px; padding: 22px 13px; }.result-card { padding: 16px; }.list-toolbar,.next-card { align-items: flex-start; flex-direction: column; }
}

/* v0.2 folders */
button, input, dialog { font: inherit; }
.muted { color: #747971; line-height: 1.55; }
.folder-layout { display: grid; grid-template-columns: minmax(300px, 390px) minmax(0, 1fr); gap: 22px; align-items: start; }
.folder-upload-panel { padding: 24px; position: sticky; top: 28px; }
.field { display: grid; gap: 7px; margin-top: 15px; }
.field > span { font-size: 10px; color: #747970; text-transform: uppercase; letter-spacing: .07em; font-weight: 900; }
.field input { width: 100%; border: 1px solid #d9dbd3; background: #fff; color: #20231f; border-radius: 10px; padding: 11px 12px; outline: none; }
.field input:focus { border-color: #87977a; box-shadow: 0 0 0 3px rgba(116,139,96,.12); }
.date-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.folder-dropzone { border: 1.5px dashed #bcc1b6; border-radius: 13px; padding: 19px; margin: 18px 0 12px; text-align: center; display: grid; gap: 7px; justify-items: center; background: #faf9f5; }
.folder-dropzone strong { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.folder-dropzone span { font-size: 10px; color: #8b8f88; }
.folder-dropzone .secondary-btn { margin-top: 5px; }
.full-btn { width: 100%; padding: 13px 16px; }
.inline-message { margin-top: 11px; padding: 10px 12px; border-radius: 9px; font-size: 11px; }
.inline-message.error { background: #fbefec; color: #873c32; }
.inline-message.success { background: #eff6e8; color: #396032; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 14px; }
.section-heading h2 { margin-bottom: 5px; }
.section-heading p { margin-bottom: 0; }
.count-pill { background: #e7edda; color: #42543c; padding: 7px 10px; border-radius: 999px; font-size: 10px; font-weight: 900; white-space: nowrap; }
.folder-list { display: grid; gap: 12px; }
.folder-card { padding: 19px; }
.folder-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 15px; }
.folder-store { font-size: 20px; font-weight: 900; letter-spacing: -.025em; }
.folder-period { margin-top: 4px; font-size: 11px; color: #7e837b; }
.folder-actions { display: flex; gap: 7px; align-items: center; }
.secondary-btn.compact { padding: 8px 10px; font-size: 11px; }
.icon-btn { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid #d8dad3; background: #fff; border-radius: 9px; color: #666b63; font-size: 20px; line-height: 1; }
.icon-btn.danger:hover, .mini-delete:hover { color: #9a392f; border-color: #e4bdb6; background: #fff6f4; }
.file-meta { display: flex; flex-wrap: wrap; gap: 7px 14px; margin: 13px 0; padding: 9px 11px; background: #f2f0ea; border-radius: 9px; color: #7c8179; font-size: 10px; }
.offers { display: grid; border-top: 1px solid #e8e7e1; }
.offer-row { display: grid; grid-template-columns: minmax(0,1fr) auto 25px; gap: 12px; align-items: center; padding: 11px 2px; border-bottom: 1px solid #ecebe5; }
.offer-row strong { display: block; font-size: 12px; }
.offer-row small { display: block; color: #858a82; font-size: 10px; margin-top: 3px; }
.offer-row > b { font-size: 13px; }
.mini-delete { width: 24px; height: 24px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: #a1a49e; }
.no-offers { color: #8d918a; font-size: 11px; padding: 14px 2px; }
.add-offer-btn { margin-top: 11px; border: 0; background: transparent; color: #465b40; font-weight: 850; font-size: 11px; padding: 6px 0; }
.empty-state { text-align: center; padding: 52px 24px; color: #787d75; }
.empty-state h3 { color: #373c34; margin-bottom: 6px; }
.empty-state p { max-width: 430px; margin: 0 auto; line-height: 1.55; font-size: 12px; }
.empty-icon { width: 44px; height: 44px; margin: 0 auto 12px; border-radius: 13px; display: grid; place-items: center; background: #ecefe3; color: #53624c; font-size: 22px; }
.offer-dialog { width: min(560px, calc(100vw - 28px)); border: 1px solid #dcded6; border-radius: 17px; padding: 0; background: #fffefa; color: #20231f; box-shadow: 0 24px 80px rgba(30,35,28,.25); }
.offer-dialog::backdrop { background: rgba(24,30,23,.45); backdrop-filter: blur(2px); }
.offer-dialog form { padding: 22px; }
.dialog-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.dialog-head h2 { margin-bottom: 0; }
.offer-fields { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 9px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 19px; }
@media (max-width: 1050px) {
  .folder-layout { grid-template-columns: 1fr; }
  .folder-upload-panel { position: static; }
}
@media (max-width: 620px) {
  .date-grid, .offer-fields { grid-template-columns: 1fr; }
  .section-heading, .folder-card-head { flex-direction: column; }
  .folder-actions { width: 100%; }
  .folder-actions .secondary-btn { flex: 1; text-align: center; }
}

/* v0.2.1 automatic folder recognition */
.analysis-strip { margin: 12px 0 10px; padding: 11px 12px; border-radius: 10px; display: grid; gap: 3px; }
.analysis-strip strong { font-size: 11px; }
.analysis-strip span { font-size: 10px; line-height: 1.4; }
.analysis-strip.ok { background: #edf5e7; color: #3a5c34; }
.analysis-strip.working { background: #eef1e8; color: #5d6657; }
.analysis-strip.warning { background: #fbf5df; color: #785f1f; }
.analysis-strip.error { background: #fbefec; color: #873c32; }
.folder-stat-row { display: flex; gap: 8px; margin: 9px 0 12px; }
.folder-stat-row span { background: #f1f0ea; color: #687066; border-radius: 999px; padding: 6px 9px; font-size: 9px; }
.folder-stat-row span.has-review { background: #fff0dc; color: #885d22; }
.folder-stat-row b { font-size: 10px; }
.offer-details { border-top: 1px solid #e8e7e1; }
.offer-details > summary { cursor: pointer; list-style: none; padding: 12px 2px; font-size: 11px; font-weight: 850; color: #465b40; }
.offer-details > summary::-webkit-details-marker { display: none; }
.offer-details > summary:after { content: '›'; display: inline-block; margin-left: 7px; transition: transform .15s ease; }
.offer-details[open] > summary:after { transform: rotate(90deg); }
.offer-row { grid-template-columns: minmax(0,1fr) auto 25px 25px; }
.offer-row.needs-review { background: #fffaf1; }
.offer-main { min-width: 0; }
.offer-title-line { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.source-badge, .review-badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 5px; font-size: 8px; text-transform: uppercase; letter-spacing: .04em; font-weight: 900; }
.source-badge { background: #e8efe0; color: #4d6446; }
.source-badge.manual { background: #ecebe6; color: #6d706a; }
.review-badge { background: #ffe5bd; color: #865817; }
.offer-price { display: grid; justify-items: end; gap: 2px; white-space: nowrap; }
.offer-price b { font-size: 13px; }
.old-price { color: #999d96; text-decoration: line-through; font-size: 9px; }
.mini-edit { width: 24px; height: 24px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: #7f897a; font-size: 12px; }
.mini-edit:hover { border-color: #cad3c4; background: #f4f7f0; color: #40533b; }
.folder-bottom-actions { display: flex; gap: 12px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.folder-bottom-actions .add-offer-btn { margin-top: 0; }
@media (max-width: 620px) {
  .offer-row { grid-template-columns: minmax(0,1fr) auto 24px; }
  .offer-row .mini-delete { display: none; }
}
