@font-face {
  font-family: "Merriweather Groceries";
  src: url("../fonts/merriweather-400.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Merriweather Groceries";
  src: url("../fonts/merriweather-700.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

.grocery-ledger,
.grocery-ledger * { box-sizing: border-box; }

html:has(.grocery-ledger) { scroll-behavior: smooth; }

body:has(.grocery-ledger),
body.grocery-ledger-active {
  margin: 0;
  overflow-x: hidden;
  background: #fff;
  color: #050505;
}

body:has(.grocery-ledger) .site-footer,
body.grocery-ledger-active .site-footer { display: none; }

.grocery-ledger {
  --sheet-green: #17633c;
  --sheet-green-bright: #1f7a4a;
  --sheet-grey: #e7e7e7;
  --sheet-line: #111;
  --sheet-blue: #0000ee;
  width: 100%;
  min-height: 100vh;
  background: #fff;
  color: #050505;
  font-family: "Merriweather Groceries", Georgia, serif;
}

.grocery-ledger a { color: var(--sheet-blue); }
.grocery-ledger a:visited { color: #551a8b; }

.grocery-workbook {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: 100%;
  height: calc(100vh - 72px);
  height: calc(100dvh - 72px);
  margin-top: 72px;
  min-height: 560px;
  overflow: hidden;
  border-bottom: 2px solid #111;
  background: #fff;
}

.grocery-chrome {
  position: relative;
  z-index: 20;
  border-bottom: 1px solid #858585;
  background: #f4f4f4;
  font-family: Arial, Helvetica, sans-serif;
}

.grocery-chrome__titlebar {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  min-height: 46px;
  padding: 6px 13px;
  background: var(--sheet-green);
  color: #fff;
}

.grocery-chrome__mark {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .8);
  background: #fff;
  color: var(--sheet-green);
  font-size: 17px;
  font-weight: 700;
}

.grocery-chrome__titlebar h1 { margin: 0; }
.grocery-chrome__titlebar h1 { font: 700 15px/1.2 "Merriweather Groceries", Georgia, serif; letter-spacing: .01em; }
.grocery-chrome__titlebar > a {
  border: 2px solid #fff;
  padding: 9px 15px;
  color: var(--sheet-green);
  background: #fff;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .28);
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
}
.grocery-chrome__titlebar > a:hover,
.grocery-chrome__titlebar > a:focus-visible { background: #ffff73; color: #111; outline: 2px solid #111; }

.grocery-chrome__menus {
  display: flex;
  gap: clamp(13px, 2.4vw, 30px);
  align-items: center;
  min-height: 27px;
  border-bottom: 1px solid #c6c6c6;
  padding: 3px 14px;
  color: #242424;
  font-size: 10px;
}

.grocery-formula {
  display: grid;
  grid-template-columns: 72px 33px minmax(0, 1fr);
  min-height: 31px;
  background: #fff;
  font-size: 10px;
}
.grocery-formula > * { display: flex; align-items: center; min-width: 0; border-right: 1px solid #c9c9c9; padding: 4px 9px; }
.grocery-formula > span { justify-content: space-between; font-weight: 700; }
.grocery-formula > b { justify-content: center; color: #686868; font-family: Georgia, serif; font-size: 15px; font-style: italic; }
.grocery-formula output { overflow: hidden; color: #2c2c2c; font-family: "Merriweather Groceries", Georgia, serif; text-overflow: ellipsis; white-space: nowrap; }

.grocery-slides { position: relative; min-height: 0; overflow: hidden; background: #fff; }
.grocery-slide {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  visibility: hidden;
  opacity: 0;
  transform: translateX(18px);
  transition: opacity 260ms ease, transform 260ms ease, visibility 0s linear 260ms;
}
.grocery-slide.is-active { z-index: 2; visibility: visible; opacity: 1; transform: none; transition-delay: 0s; }

.grocery-slide__heading {
  display: flex;
  align-items: center;
  min-height: 51px;
  border-bottom: 2px solid #000;
  padding: 5px 13px;
  background: #050505;
  color: #fff;
}
.grocery-slide__heading h2 { margin: 0; font-size: clamp(19px, 2.1vw, 30px); line-height: 1; }

.grocery-grid {
  position: relative;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: #777 #ededed;
  scrollbar-width: thin;
  background:
    linear-gradient(#fff 23px, transparent 23px) 0 0 / 100% 24px,
    linear-gradient(90deg, transparent 79px, #d5d5d5 80px) 0 0 / 80px 100%,
    #fff;
}
.grocery-grid:focus-visible { outline: 3px solid #26784b; outline-offset: -3px; }

.grocery-sheet {
  width: 100%;
  min-width: 1178px;
  border-spacing: 0;
  table-layout: fixed;
  background: #fff;
  color: #050505;
  font-size: 9px;
  line-height: 1.18;
}

.grocery-sheet col:nth-child(1) { width: 34px; }
.grocery-sheet col:nth-child(2) { width: 240px; }
.grocery-sheet col:nth-child(3) { width: 155px; }
.grocery-sheet col:nth-child(4) { width: 78px; }
.grocery-sheet col:nth-child(5) { width: 92px; }
.grocery-sheet col:nth-child(6) { width: 154px; }
.grocery-sheet col:nth-child(7) { width: 106px; }
.grocery-sheet col:nth-child(8) { width: 94px; }
.grocery-sheet col:nth-child(9) { width: 110px; }
.grocery-sheet col:nth-child(10) { width: 122px; }
.grocery-sheet col:nth-child(11) { width: 72px; }

.grocery-sheet th,
.grocery-sheet td {
  height: 23px;
  overflow: hidden;
  border-right: 1px dotted var(--sheet-line);
  border-bottom: 1px dotted var(--sheet-line);
  padding: 3px 6px;
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap;
}
.grocery-sheet tr > :last-child { border-right: 1px solid #111; }
.grocery-sheet__letters th {
  position: sticky;
  z-index: 8;
  top: 24px;
  height: 21px;
  border-right: 1px solid #b5b5b5;
  border-bottom: 1px solid #999;
  padding: 2px;
  background: #e7e7e7;
  color: #333;
  font: 9px/1 Arial, Helvetica, sans-serif;
  text-align: center;
}
.grocery-sheet__headers th {
  position: sticky;
  z-index: 7;
  top: 45px;
  height: 31px;
  border-right: 1px solid #111;
  border-bottom: 2px solid #111;
  background: #fff;
  color: #050505;
  font-size: 8px;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  white-space: normal;
}
.grocery-sheet__corner,
.grocery-sheet__row-number {
  position: sticky;
  z-index: 6;
  left: 0;
  border-right: 1px solid #999 !important;
  background: #e7e7e7 !important;
  color: #444;
  font: 8px/1 Arial, Helvetica, sans-serif !important;
  text-align: center !important;
}
.grocery-sheet__corner { z-index: 12 !important; }
.grocery-sheet__headers .grocery-sheet__corner { z-index: 11 !important; }
.grocery-sheet tbody tr:hover td { background: #fffbdc; }
.grocery-sheet tbody tr:hover .grocery-sheet__row-number { background: #d7eadf !important; }
.grocery-sheet td:nth-child(3) { text-align: center; }
.grocery-sheet td:nth-child(5),
.grocery-sheet td:nth-child(7),
.grocery-sheet td:nth-child(8),
.grocery-sheet td:nth-child(9),
.grocery-sheet td:nth-child(10) { font-variant-numeric: tabular-nums; text-align: right; }
.grocery-sheet__item { font-weight: 700; text-align: left !important; }
.grocery-sheet__item { color: #111; }

.grocery-sheet__groups th {
  position: sticky;
  z-index: 10;
  top: 0;
  height: 24px;
  border-bottom: 1px solid #999;
  background: #e7e7e7;
  text-align: center;
}
.grocery-sheet__group-toggle {
  min-width: 82px;
  border: 1px solid #777;
  border-radius: 9px;
  padding: 2px 9px;
  color: #222;
  background: #fff;
  font: 700 8px/1.2 Arial, Helvetica, sans-serif;
  cursor: pointer;
}
.grocery-sheet__group-toggle:hover,
.grocery-sheet__group-toggle:focus-visible { background: #ffff73; outline: 1px solid #111; }
.grocery-sheet.is-group-collapsed { min-width: 650px; }
.grocery-sheet.is-group-collapsed col:nth-child(n+6):nth-child(-n+10),
.grocery-sheet.is-group-collapsed tr:not(.grocery-sheet__groups) > :nth-child(n+6):nth-child(-n+10) { display: none; }
.grocery-sheet__vendor { background: #f7f7f7; }
.grocery-sheet__cost { color: #0000ee; }
.grocery-sheet__ocado { background: #edfff0; color: #0000ee; }
.grocery-sheet__difference { background: #ffe8e8; color: #8a0505; }
.grocery-sheet__note { text-align: center !important; }
.grocery-sheet__note a { color: var(--sheet-blue); font: 700 8px/1 Arial, Helvetica, sans-serif; }
.grocery-sheet__mock { background-image: repeating-linear-gradient(135deg, rgba(34, 121, 70, .05) 0 4px, transparent 4px 8px); }
.grocery-sheet__blank { color: #aaa; }
.grocery-sheet__check { text-align: center !important; }
.grocery-sheet__check input { width: 16px; height: 16px; margin: 0; accent-color: var(--sheet-green-bright); cursor: pointer; }
.grocery-sheet tbody tr.is-checked td { color: #777; background: #edf5ef; text-decoration-color: #777; }
.grocery-sheet tbody tr.is-checked .grocery-sheet__item { text-decoration: line-through; }
.grocery-sheet tbody tr.is-deep-linked td { background: #fff6a7; }
.grocery-sheet tfoot th,
.grocery-sheet tfoot td { position: sticky; bottom: 0; border-top: 2px solid #111; background: #eff7f1; font-weight: 700; }
.grocery-sheet tfoot th { padding-right: 12px; text-align: right; text-transform: uppercase; }
.grocery-sheet__subtotal { color: var(--sheet-green); font-size: 11px; text-align: right; }

.grocery-ledger__loading {
  position: absolute;
  z-index: 9;
  inset: 51px 0 0;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, .92);
  font: 700 11px/1.3 Arial, Helvetica, sans-serif;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.grocery-ledger__loading[hidden] { display: none; }
.grocery-ledger__loading.is-error { color: #8a0505; }

.grocery-tabs {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  min-height: 38px;
  border-top: 1px solid #aaa;
  background: #ececec;
  font-family: Arial, Helvetica, sans-serif;
}
.grocery-tabs button,
.grocery-tabs a { font: 700 9px/1 Arial, Helvetica, sans-serif; }
.grocery-tabs__transport { display: flex; align-items: center; border-right: 1px solid #b5b5b5; padding: 4px 7px; }
.grocery-tabs__transport button { min-width: 28px; height: 25px; border: 1px solid transparent; background: transparent; color: #333; cursor: pointer; }
.grocery-tabs__transport button:hover,
.grocery-tabs__transport button:focus-visible { border-color: #777; background: #fff; outline: none; }
.grocery-tabs__transport [data-ledger-pause] { min-width: 49px; }
.grocery-tabs__sheets { display: flex; min-width: 0; align-items: end; overflow-x: auto; padding: 4px 9px 0; }
.grocery-tabs__sheets button,
.grocery-tabs__sheets a {
  min-width: 92px;
  height: 31px;
  border: 0;
  border-bottom: 3px solid transparent;
  padding: 7px 13px 6px;
  background: transparent;
  color: #222;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.grocery-tabs__sheets button[aria-selected="true"] { border-bottom-color: var(--sheet-green-bright); background: #fff; color: #111; }
.grocery-tabs__sheets button[aria-disabled="true"] { color: #777; text-decoration: line-through; }
.grocery-tabs__sheets button:hover,
.grocery-tabs__sheets button:focus-visible,
.grocery-tabs__sheets a:hover,
.grocery-tabs__sheets a:focus-visible { background: #fff; outline: 1px solid #777; outline-offset: -1px; }
.grocery-tabs__status { display: flex; align-items: center; border-left: 1px solid #b5b5b5; padding: 0 13px; color: #555; font-size: 8px; font-weight: 700; letter-spacing: .08em; }

.grocery-notebook {
  min-height: 100vh;
  padding: clamp(32px, 6vw, 84px) clamp(20px, 7vw, 108px) clamp(60px, 8vw, 118px);
  background:
    linear-gradient(90deg, transparent 42px, rgba(68, 125, 86, .13) 43px, transparent 44px),
    linear-gradient(rgba(0, 0, 0, .045) 1px, transparent 1px) 0 0 / 100% 28px,
    #fff;
}
.grocery-notebook__header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  border-top: 12px solid #050505;
  border-bottom: 2px solid #050505;
  padding: 17px 0 15px;
}
.grocery-notebook__header p { grid-column: 1; margin: 0 0 4px; font: 700 9px/1.2 Arial, Helvetica, sans-serif; letter-spacing: .1em; text-transform: uppercase; }
.grocery-notebook__header h2 { grid-column: 1; margin: 0; font-size: clamp(34px, 6vw, 74px); letter-spacing: -.055em; line-height: .95; }
.grocery-notebook__header a { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: 11px; }
.grocery-notebook__intro { max-width: 760px; margin: 25px 0 40px; font-size: 14px; line-height: 1.65; }

.grocery-note-list {
  max-width: 1080px;
  margin: 0;
  border-top: 1px solid #111;
  padding: 0;
  list-style-position: inside;
}
.grocery-note-list > li { border-bottom: 1px dotted #111; padding: 0 5px; }
.grocery-note-list > li::marker { color: var(--sheet-blue); font-size: 13px; }
.grocery-note-list details { display: inline; }
.grocery-note-list summary {
  display: inline-block;
  width: calc(100% - 22px);
  padding: 14px 5px;
  color: var(--sheet-blue);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: pointer;
}
.grocery-note-list summary::-webkit-details-marker { display: none; }
.grocery-note-list summary::after { float: right; content: "+"; color: #111; font-family: Arial, Helvetica, sans-serif; text-decoration: none; }
.grocery-note-list details[open] summary::after { content: "−"; }
.grocery-note-list summary:hover,
.grocery-note-list summary:focus-visible { background: #ffff79; color: #0000ee; outline: 1px solid #111; }
.grocery-note-list__body {
  max-width: 900px;
  margin: 4px 22px 28px;
  border-left: 3px solid var(--sheet-green-bright);
  padding: 4px 0 4px 22px;
  font-size: clamp(14px, 1.45vw, 18px);
  line-height: 1.75;
}
.grocery-note-list__body p { margin: 0; }
.grocery-note-list__loading { padding: 18px 5px !important; font-size: 12px; }

.grocery-access-dialog {
  width: min(360px, calc(100vw - 34px));
  padding: 28px;
  border: 2px solid #111;
  color: #111;
  background: #fffdf2;
  box-shadow: 9px 9px 0 rgba(0,0,0,.28);
  text-align: center;
}
.grocery-access-dialog::backdrop { background: rgba(0,0,0,.34); }
.grocery-access-dialog h2 { margin: 0 0 20px; font-size: 25px; }
.grocery-access-dialog > a { display: inline-block; border: 2px solid #111; padding: 10px 20px; color: #fff; background: var(--sheet-green); font: 700 12px/1 Arial, sans-serif; text-decoration: none; text-transform: uppercase; }
.grocery-access-dialog__close { position: absolute; top: 6px; right: 8px; border: 0; color: #111; background: transparent; font: 24px/1 Arial, sans-serif; cursor: pointer; }

.grocery-live-notes { max-width: 1080px; margin-top: clamp(60px, 8vw, 100px); border-top: 7px solid var(--sheet-green); padding-top: 20px; }
.grocery-live-notes h3 { margin: 0; font-size: clamp(24px, 3.5vw, 42px); }
.grocery-live-notes > p { margin: 8px 0 20px; font-size: 12px; line-height: 1.5; }
.grocery-live-notes ul { margin: 0; padding-left: 22px; }
.grocery-live-notes li { margin: 9px 0; }
.grocery-live-notes li a { font-weight: 700; }
.grocery-live-notes li span { display: block; max-width: 760px; margin-top: 3px; color: #555; font-size: 11px; line-height: 1.45; }
.grocery-live-notes__trips { margin-top: 22px !important; border-top: 1px dotted #111; padding-top: 12px; }
.grocery-live-notes__empty { color: #666; font-style: italic; }

@media (max-width: 720px) {
  .grocery-workbook { min-height: 510px; }
  .grocery-chrome__titlebar { min-height: 42px; padding: 5px 8px; }
  .grocery-chrome__mark { width: 27px; height: 27px; }
  .grocery-chrome__titlebar p { display: none; }
  .grocery-chrome__titlebar h1 { font-size: 13px; }
  .grocery-chrome__titlebar > a { padding: 6px 8px; font-size: 9px; }
  .grocery-chrome__menus { gap: 17px; overflow: hidden; padding-inline: 8px; }
  .grocery-chrome__menus span:nth-child(n+6) { display: none; }
  .grocery-formula { grid-template-columns: 52px 30px minmax(0, 1fr); }
  .grocery-slide__heading { grid-template-columns: minmax(100px, 1fr) auto; gap: 7px; min-height: 49px; padding-inline: 9px; }
  .grocery-slide__heading p { display: none; }
  .grocery-slide__heading span { display: none; }
  .grocery-slide__heading output { font-size: 7px; }
  .grocery-sheet { font-size: 8px; }
  .grocery-sheet col:nth-child(2) { width: 190px; }
  .grocery-sheet col:nth-child(3) { width: 125px; }
  .grocery-sheet col:nth-child(4) { width: 48px; }
  .grocery-tabs { grid-template-columns: auto minmax(0, 1fr); }
  .grocery-tabs__transport [data-ledger-pause] { display: none; }
  .grocery-tabs__sheets { padding-left: 4px; }
  .grocery-tabs__sheets button,
  .grocery-tabs__sheets a { min-width: 75px; padding-inline: 8px; font-size: 8px; }
  .grocery-tabs__status { display: none; }
  .grocery-notebook { padding-inline: 22px; background-position: -21px 0, 0 0; }
  .grocery-notebook__header { grid-template-columns: 1fr; }
  .grocery-notebook__header a { grid-column: 1; grid-row: auto; margin-top: 15px; }
  .grocery-note-list__body { margin-left: 8px; padding-left: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  html:has(.grocery-ledger) { scroll-behavior: auto; }
  .grocery-slide { transition: none; }
}

@media (forced-colors: active) {
  .grocery-ledger,
  .grocery-workbook,
  .grocery-slide,
  .grocery-grid,
  .grocery-sheet,
  .grocery-sheet th,
  .grocery-sheet td,
  .grocery-notebook { background: Canvas; color: CanvasText; }
  .grocery-chrome__titlebar,
  .grocery-slide__heading { background: CanvasText; color: Canvas; }
  .grocery-ledger a,
  .grocery-sheet__cost,
  .grocery-sheet__ocado { color: LinkText; }
}

@media print {
  .grocery-workbook { height: auto; min-height: 0; overflow: visible; }
  .grocery-chrome,
  .grocery-tabs { display: none; }
  .grocery-slides { overflow: visible; }
  .grocery-slide { position: relative; visibility: visible; opacity: 1; transform: none; break-after: page; }
  .grocery-grid { overflow: visible; }
  .grocery-sheet { min-width: 0; font-size: 6px; }
  .grocery-notebook { background: #fff; }
}
