:root {
  --primary: #4f39f6;
  --primary-hover: #432dd7;
  --ink: #172033;
  --muted: #5e6777;
  --soft: #f6f8fb;
  --line: #dfe5ef;
  --panel: #ffffff;
  --green: #15a86b;
  --amber: #d79318;
  --red: #dd4c4c;
  --blue: #1769d1;
  --shadow: 0 1px 2px rgba(18, 27, 43, 0.08), 0 1px 3px rgba(18, 27, 43, 0.08);
  font-family: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  min-width: 320px;
}

a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

button,
input,
select,
textarea {
  font: inherit;
  line-height: 1.35;
}

button {
  border: 0;
  cursor: pointer;
}

.brand {
  align-items: center;
  color: var(--primary);
  display: inline-flex;
  font-size: 24px;
  font-weight: 800;
  gap: 10px;
  letter-spacing: 0;
}

.brand img {
  height: 44px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
}

.auth-page {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 32px 20px;
}

.auth-shell {
  max-width: 420px;
  width: 100%;
}

.auth-brand {
  display: flex;
  justify-content: center;
  margin-bottom: 34px;
}

.auth-brand .brand img {
  height: 96px;
}

.auth-panel h1 {
  font-size: 24px;
  line-height: 1.2;
  margin: 0 0 30px;
  text-align: center;
}

.field-row {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr 1fr;
}

.field {
  margin-bottom: 18px;
}

.label-line {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

label,
.label-line span {
  color: #2b3446;
  display: block;
  font-size: 14px;
  font-weight: 500;
}

input,
select,
textarea {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: var(--ink);
  min-height: 52px;
  outline: none;
  padding: 13px 16px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
  width: 100%;
}

textarea {
  min-height: 132px;
  resize: vertical;
}

select {
  min-width: 210px;
  padding-right: 40px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 57, 246, 0.14), var(--shadow);
}

.hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  margin: -8px 0 16px;
}

.btn {
  align-items: center;
  border-radius: 6px;
  display: inline-flex;
  font-size: 14px;
  font-weight: 600;
  gap: 8px;
  justify-content: center;
  line-height: 1.35;
  min-height: 42px;
  padding: 10px 16px;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--primary);
  box-shadow: var(--shadow);
  color: #fff;
  width: 100%;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-danger {
  background: #fff;
  border: 1px solid #ffd2d2;
  box-shadow: var(--shadow);
  color: var(--red);
}

.btn-danger:hover {
  background: #fff1f1;
  border-color: #ffbbbb;
}

.btn-secondary {
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  color: #596274;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
}

.divider {
  align-items: center;
  color: #727b8d;
  display: flex;
  font-size: 14px;
  gap: 14px;
  margin: 26px 0 20px;
}

.divider::before,
.divider::after {
  background: var(--line);
  content: "";
  flex: 1;
  height: 1px;
}

.social-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr 1fr;
}

.auth-footer {
  color: var(--muted);
  font-size: 14px;
  margin-top: 28px;
  text-align: center;
}

.check-row {
  align-items: flex-start;
  display: flex;
  gap: 10px;
  margin: 14px 0;
}

.check-row input {
  box-shadow: none;
  flex: 0 0 auto;
  height: 16px;
  margin-top: 2px;
  padding: 0;
  width: 16px;
}

.check-row label {
  color: #2f394b;
  font-size: 14px;
  line-height: 1.4;
}

.preference-title {
  color: #2f394b;
  font-size: 14px;
  font-weight: 500;
  margin: 22px 0 8px;
}

.app-layout {
  background: var(--soft);
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 22px 16px;
  position: sticky;
  top: 0;
}

.sidebar .brand {
  align-items: center;
  display: flex;
  justify-content: center;
  font-size: 22px;
  margin: 0 8px 28px;
  width: calc(100% - 16px);
}

.sidebar .brand img {
  display: block;
  height: 92px;
  max-width: 100%;
  object-fit: contain;
  width: auto;
}

.nav {
  display: grid;
  gap: 5px;
}

.nav button {
  align-items: center;
  background: transparent;
  border-radius: 8px;
  color: #404a5d;
  display: flex;
  font-size: 15px;
  font-weight: 600;
  gap: 12px;
  min-height: 42px;
  padding: 10px 12px;
  text-align: left;
}

.nav button.active,
.nav button:hover {
  background: #eef0ff;
  color: var(--primary);
}

.nav svg,
.icon {
  flex: 0 0 auto;
  height: 18px;
  width: 18px;
}

.sidebar-footer {
  margin-top: auto;
}

.plan-box {
  background: #f4f6fb;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.plan-box strong {
  display: block;
  font-size: 14px;
}

.plan-box span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  line-height: 1.4;
  margin-top: 4px;
}

.main {
  min-width: 0;
}

.topbar {
  align-items: center;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  min-height: 72px;
  padding: 14px 28px;
  position: sticky;
  top: 0;
  z-index: 3;
}

.mobile-brand {
  display: none;
}

.mobile-brand .brand img {
  height: 42px;
}

.search-wrap {
  max-width: 460px;
  position: relative;
  width: 42vw;
}

.search-wrap input {
  height: 42px;
  padding-left: 40px;
}

.search-wrap svg {
  color: #8892a5;
  left: 14px;
  position: absolute;
  top: 12px;
}

.top-actions {
  align-items: center;
  display: flex;
  gap: 10px;
}

.mobile-nav {
  display: none;
}

.avatar {
  align-items: center;
  background: #1f2937;
  border-radius: 999px;
  color: #fff;
  display: flex;
  font-size: 13px;
  font-weight: 800;
  height: 38px;
  justify-content: center;
  width: 38px;
}

.content {
  padding: 28px;
}

.page-head {
  align-items: flex-start;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 24px;
}

.eyebrow {
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-head h1,
.section h2 {
  margin: 6px 0 6px;
}

.page-head h1 {
  font-size: 30px;
  line-height: 1.12;
}

.page-head p {
  color: var(--muted);
  margin: 0;
  max-width: 620px;
}

.inventory-back-btn {
  margin-bottom: 12px;
  width: 150px;
}

.page-actions {
  align-items: center;
  display: flex;
  flex: 1;
  gap: 10px;
  justify-content: flex-end;
  min-width: 260px;
}

.page-actions .btn-primary {
  flex: 1;
  max-width: 100%;
  min-width: 210px;
}

.page-actions .btn-danger {
  flex: 0 0 auto;
  min-width: 126px;
}

.inventory-action-stack {
  display: grid;
  gap: 10px;
  min-width: 210px;
  width: min(100%, 760px);
}

.inventory-action-stack .btn {
  width: 100%;
}

.scan-overlay {
  align-items: center;
  background: rgba(74, 83, 99, 0.72);
  bottom: 0;
  display: flex;
  justify-content: center;
  left: 0;
  padding: 28px;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 40;
}

.scan-dialog {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 22px 70px rgba(18, 27, 43, 0.26);
  max-height: min(92vh, 940px);
  max-width: 760px;
  overflow-y: auto;
  padding: 20px 22px 22px;
  position: relative;
  width: min(780px, 92vw);
}

.scan-dialog h2 {
  font-size: 20px;
  margin: 0 0 6px;
}

.scan-close {
  align-items: center;
  background: transparent;
  color: #9aa3b2;
  display: flex;
  font-size: 42px;
  font-weight: 300;
  height: 46px;
  justify-content: center;
  line-height: 1;
  position: absolute;
  right: 28px;
  top: 24px;
  width: 46px;
}

.scanner-window {
  background: #3d4755;
  border-radius: 8px;
  height: 370px;
  overflow: hidden;
  position: relative;
}

.scan-video {
  height: 100%;
  left: 0;
  object-fit: cover;
  position: absolute;
  top: 0;
  width: 100%;
  z-index: 0;
}

.scanner-window::after {
  background: rgba(20, 25, 32, 0.38);
  content: "";
  inset: 0;
  position: absolute;
  z-index: 1;
}

.scanner-scene {
  background: linear-gradient(145deg, #9aa5b5 0%, #717d8e 48%, #586373 100%);
  height: 100%;
  overflow: hidden;
  position: relative;
  z-index: 0;
}

.scanner-window.is-live .scanner-scene {
  display: none;
}

.shelf-line {
  background: rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  height: 12px;
  position: absolute;
}

.line-a {
  left: 8%;
  top: 42%;
  transform: rotate(-8deg);
  width: 62%;
}

.line-b {
  bottom: 24%;
  left: 0;
  width: 100%;
}

.line-c {
  right: 10%;
  top: 20%;
  transform: rotate(17deg);
  width: 28%;
}

.product-box {
  background: rgba(255, 255, 255, 0.78);
  border-radius: 6px;
  bottom: 23%;
  box-shadow: 0 8px 18px rgba(23, 32, 51, 0.18);
  display: block;
  height: 132px;
  position: absolute;
  width: 96px;
}

.box-a {
  left: 25%;
}

.box-b {
  right: 24%;
}

.product-box i {
  background: repeating-linear-gradient(90deg, #202938 0 3px, transparent 3px 7px);
  display: block;
  height: 34px;
  margin: 54px auto 0;
  width: 58px;
}

.barcode-card {
  background: #f5f6f8;
  border-radius: 4px;
  box-shadow: 0 6px 16px rgba(23, 32, 51, 0.2);
  height: 86px;
  left: 44%;
  position: absolute;
  top: 39%;
  transform: rotate(1deg);
  width: 154px;
}

.barcode-card::after {
  background: repeating-linear-gradient(90deg, #172033 0 3px, transparent 3px 8px, #172033 8px 10px, transparent 10px 14px);
  content: "";
  height: 42px;
  left: 24px;
  position: absolute;
  top: 22px;
  width: 106px;
}

.scan-frame {
  height: 190px;
  left: 50%;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 330px;
  z-index: 2;
}

.scan-frame span {
  border-color: #fff;
  border-style: solid;
  height: 68px;
  position: absolute;
  width: 68px;
}

.scan-frame span:nth-child(1) {
  border-width: 8px 0 0 8px;
  left: 0;
  top: 0;
}

.scan-frame span:nth-child(2) {
  border-width: 8px 8px 0 0;
  right: 0;
  top: 0;
}

.scan-frame span:nth-child(3) {
  border-width: 0 0 8px 8px;
  bottom: 0;
  left: 0;
}

.scan-frame span:nth-child(4) {
  border-width: 0 8px 8px 0;
  bottom: 0;
  right: 0;
}

.scan-dialog h3 {
  color: #4b5567;
  font-size: 20px;
  margin: 28px 0 10px;
  text-align: center;
}

.scan-dialog p {
  color: #747d8e;
  font-size: 16px;
  line-height: 1.5;
  margin: 0 auto 24px;
  max-width: 620px;
  text-align: center;
}

.location-dialog {
  max-width: 860px;
  padding: 28px;
  width: min(900px, 94vw);
}

.location-modal-intro {
  margin: 18px 0 16px;
}

.location-modal-intro h3 {
  color: #44506a;
  font-size: 48px;
  font-weight: 700;
  line-height: 1.05;
  margin: 0 0 8px;
  text-align: left;
}

.location-modal-intro p {
  margin: 0;
  max-width: none;
  text-align: left;
}

.location-modal-form {
  display: grid;
  gap: 12px;
}

.location-modal-form label {
  color: #4b5567;
  font-size: 13px;
  font-weight: 700;
}

.location-modal-form input {
  min-height: 54px;
}

.location-modal-actions {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
  margin-top: 8px;
}

.location-modal-actions .btn {
  min-height: 52px;
}

.scan-cancel {
  width: 100%;
}

.scan-loading {
  margin-top: 8px;
}

.scan-loading-pill {
  align-items: center;
  background: #e8eef9;
  border-radius: 14px;
  color: #274ab7;
  display: flex;
  font-size: 18px;
  gap: 14px;
  min-height: 110px;
  padding: 20px 26px;
}

.scan-spinner {
  animation: spin 900ms linear infinite;
  border: 6px solid #b9d1f3;
  border-radius: 999px;
  border-top-color: #5ea4f6;
  display: inline-block;
  height: 44px;
  width: 44px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.scan-result {
  border-radius: 14px;
  margin-top: 8px;
  padding: 14px;
}

.scan-result-good {
  background: #e8f4ec;
}

.scan-result-head {
  align-items: center;
  color: #0a7b48;
  display: flex;
  font-size: 22px;
  font-weight: 700;
  gap: 10px;
}

.scan-result-icon {
  align-items: center;
  border: 3px solid #00c766;
  border-radius: 999px;
  display: inline-flex;
  font-size: 16px;
  height: 30px;
  justify-content: center;
  width: 30px;
}

.scan-result-image-wrap {
  display: flex;
  justify-content: center;
  margin: 12px 0;
}

.scan-result-image {
  background: #fff;
  border-radius: 16px;
  height: 160px;
  object-fit: contain;
  padding: 10px;
  width: min(240px, 100%);
}

.scan-result-image-empty {
  align-items: center;
  color: #728099;
  display: flex;
  justify-content: center;
}

.scan-result h3 {
  color: #162238;
  font-size: 20px;
  line-height: 1.15;
  margin: 0 0 8px;
  text-align: left;
}

.scan-result-lines {
  color: #39475e;
  font-size: 13px;
  line-height: 1.4;
  margin: 0;
  max-width: none;
  text-align: left;
}

.scan-confirm {
  border: 1px solid #d3d8e3;
  border-radius: 18px;
  margin-top: 18px;
  padding: 18px 18px 16px;
}

.scan-confirm h3 {
  color: #1a2437;
  font-size: 28px;
  margin: 0 0 12px;
}

.scan-confirm-actions {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
}

.scan-yes,
.scan-no {
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  min-height: 46px;
}

.scan-yes {
  background: #05a93e;
  color: #fff;
}

.scan-no {
  background: #fff;
  border: 1px solid #c6cfde;
  color: #384456;
}

.scan-adjust {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.scan-barcode-box {
  align-items: center;
  border: 1px solid #d3d8e3;
  border-radius: 12px;
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 16px;
}

.scan-barcode-box span {
  color: #687487;
  font-size: 14px;
}

.scan-barcode-box strong {
  color: #162238;
  font-size: 17px;
  letter-spacing: 1px;
}

.scan-field-label {
  color: #39475e;
  font-size: 13px;
  font-weight: 700;
  margin-top: 4px;
}

.scan-adjust-actions {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
}

.scan-remove {
  background: #f60013;
  color: #fff;
  font-size: 14px;
  min-height: 46px;
}

.scan-remove:hover {
  background: #d70011;
}

.scan-error {
  background: #fff2f2;
  border: 1px solid #ffd5d5;
  border-radius: 12px;
  margin-top: 8px;
  padding: 16px;
}

.scan-error h3 {
  color: #7a1f1f;
  margin: 0 0 6px;
  text-align: left;
}

.scan-error p {
  margin: 0;
  max-width: none;
  text-align: left;
}

.scan-error-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.grid {
  display: grid;
  gap: 18px;
}

.stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.panel,
.item-card,
.recipe-card,
.metric-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric-card {
  padding: 18px;
}

.metric-card span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  font-weight: 600;
}

.metric-card strong {
  display: block;
  font-size: 30px;
  margin-top: 8px;
}

.metric-card small {
  color: var(--green);
  display: block;
  font-size: 13px;
  margin-top: 8px;
}

.two-col {
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  margin-top: 18px;
}

.dashboard-main {
  display: grid;
  margin-top: 18px;
}

.panel {
  padding: 18px;
}

.panel-head {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 16px;
}

.panel-head h2,
.panel-head h3 {
  font-size: 18px;
  margin: 0;
}

.table {
  border-collapse: collapse;
  width: 100%;
}

.table th,
.table td {
  border-bottom: 1px solid #edf1f7;
  font-size: 14px;
  padding: 13px 8px;
  text-align: left;
  vertical-align: middle;
}

.table th {
  color: #6f7889;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.table-status {
  align-items: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 210px;
}

.item-name {
  align-items: center;
  display: flex;
  gap: 10px;
  font-weight: 700;
}

.food-dot {
  align-items: center;
  border-radius: 7px;
  color: #fff;
  display: flex;
  font-size: 13px;
  font-weight: 800;
  height: 32px;
  justify-content: center;
  width: 32px;
}

.tag {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 9px;
}

.tag.good {
  background: #e9f8f1;
  color: #08794d;
}

.tag.warn {
  background: #fff3dc;
  color: #94610c;
}

.tag.low {
  background: #ffe9e9;
  color: #af3030;
}

.inventory-grid,
.recipe-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.item-card,
.recipe-card {
  overflow: hidden;
}

.recipe-card {
  color: inherit;
  display: block;
  padding: 0;
  text-align: left;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
  width: 100%;
}

.recipe-card:hover {
  border-color: #c9d2e3;
  box-shadow: 0 10px 24px rgba(18, 27, 43, 0.12);
  transform: translateY(-1px);
}

.item-card {
  position: relative;
  padding: 16px;
}

.item-card header {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.card-menu {
  height: 30px;
  margin: -4px 0 4px -6px;
  position: relative;
  width: 34px;
}

.menu-trigger {
  align-items: center;
  background: transparent;
  border-radius: 8px;
  color: #697386;
  display: flex;
  height: 30px;
  justify-content: center;
  width: 30px;
}

.menu-trigger:hover {
  background: #f0f3f8;
  color: var(--ink);
}

.menu-popover {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 34px rgba(23, 32, 51, 0.16);
  left: 0;
  min-width: 132px;
  padding: 6px;
  position: absolute;
  top: 34px;
  z-index: 5;
}

.menu-popover button {
  align-items: center;
  background: transparent;
  border-radius: 6px;
  display: flex;
  font-size: 14px;
  font-weight: 700;
  gap: 8px;
  min-height: 34px;
  padding: 8px 10px;
  width: 100%;
}

.menu-edit {
  color: var(--primary);
}

.menu-delete {
  color: var(--red);
}

.menu-edit:hover {
  background: #eef0ff;
}

.menu-delete:hover {
  background: #fff1f1;
}

.edit-product-page {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
}

.edit-product-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.edit-product-hero {
  align-items: center;
  display: flex;
  gap: 14px;
  margin-bottom: 22px;
}

.edit-product-dot {
  height: 54px;
  width: 54px;
}

.edit-product-image,
.summary-product-image {
  background: #f4f6fb;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
}

.edit-product-image {
  height: 76px;
  width: 76px;
}

.summary-product-image {
  height: 160px;
  margin-bottom: 12px;
  width: 100%;
}

.edit-product-hero h2,
.edit-product-card h2 {
  font-size: 20px;
  margin: 0 0 8px;
}

.edit-form-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.edit-form-grid label {
  color: #4b5567;
  display: grid;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
}

.barcode-field {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) 92px;
}

.barcode-field .btn {
  min-height: 52px;
}

.edit-form-grid input[type="color"] {
  padding: 6px;
}

.edit-form-grid input.is-looking-up {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 57, 246, 0.14), var(--shadow);
}

.summary-list {
  display: grid;
  gap: 12px;
}

.summary-list div {
  border-bottom: 1px solid #edf1f7;
  display: grid;
  gap: 4px;
  padding-bottom: 12px;
}

.summary-list span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.summary-list strong {
  color: var(--ink);
  font-size: 15px;
}

.item-card h3,
.recipe-card h3 {
  font-size: 17px;
  margin: 0;
}

.item-meta {
  color: var(--muted);
  display: grid;
  font-size: 13px;
  gap: 7px;
  margin-top: 16px;
}

.item-meta strong {
  color: #3b4658;
}

.expiry-note {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  justify-self: start;
  padding: 5px 9px;
}

.expiry-note.soon {
  background: #fff3dc;
  color: #94610c;
}

.expiry-note.expired {
  background: #ffe9e9;
  color: #af3030;
}

.quantity-line {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.stepper {
  align-items: center;
  background: #f5f7fb;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: inline-flex;
  flex: 0 0 auto;
  height: 34px;
  overflow: hidden;
}

.stepper button {
  align-items: center;
  background: transparent;
  color: var(--primary);
  display: flex;
  height: 32px;
  justify-content: center;
  width: 34px;
}

.stepper button:hover {
  background: #eceeff;
}

.stepper .icon {
  height: 15px;
  width: 15px;
}

.stepper span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  min-width: 24px;
  text-align: center;
}

.empty-state {
  align-items: center;
  background: #fff;
  border: 1px dashed #cfd7e5;
  border-radius: 8px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: center;
  min-height: 220px;
  padding: 28px;
  text-align: center;
}

.empty-state strong {
  color: var(--ink);
  font-size: 18px;
}

.recipe-image {
  align-items: end;
  background: linear-gradient(135deg, #1a7f58, #f2be5c);
  color: #fff;
  display: flex;
  font-size: 42px;
  font-weight: 800;
  height: 140px;
  padding: 16px;
}

.recipe-card .body {
  padding: 16px;
}

.recipe-card p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  margin: 8px 0 14px;
}

.recipe-uses {
  color: #3f4a5e;
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 12px;
}

[data-back-recipes] .icon {
  transform: rotate(180deg);
}

.recipe-detail {
  display: grid;
  gap: 18px;
}

.recipe-hero {
  align-items: stretch;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: minmax(220px, 34%) 1fr;
  overflow: hidden;
}

.recipe-hero .recipe-image {
  height: 100%;
  min-height: 220px;
}

.recipe-hero > div:last-child {
  align-content: center;
  display: grid;
  gap: 12px;
  padding: 24px;
}

.recipe-hero .tag {
  justify-self: start;
}

.recipe-meta {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.recipe-meta > span:not(.tag),
.source-link {
  background: #f3f6fb;
  border-radius: 999px;
  color: #4e596c;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  padding: 5px 9px;
  width: max-content;
}

a.source-link {
  color: var(--primary);
}

.recipe-hero h2 {
  font-size: 24px;
  margin: 0;
}

.recipe-hero p {
  color: var(--muted);
  margin: 0;
}

.recipe-detail-grid {
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
}

.recipe-list,
.recipe-steps {
  margin: 0;
  padding: 0;
}

.recipe-list {
  display: grid;
  gap: 10px;
  list-style: none;
}

.recipe-list li {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 16px;
  font-weight: 700;
  justify-content: space-between;
  min-height: 44px;
  padding: 10px 0;
}

.recipe-list li:first-child {
  border-top: 0;
}

.recipe-list strong,
.recipe-list small {
  display: block;
}

.recipe-list small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  margin-top: 3px;
}

.recipe-steps {
  color: #344052;
  display: grid;
  gap: 14px;
  list-style: none;
}

.recipe-info-block {
  color: #344052;
  display: grid;
  gap: 12px;
}

.recipe-info-block h3 {
  font-size: 15px;
  margin: 4px 0 0;
}

.recipe-info-block ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
}

.recipe-steps {
  counter-reset: recipe-step;
}

.recipe-steps li {
  background: #f8fafc;
  border: 1px solid #e8edf5;
  border-radius: 8px;
  counter-increment: recipe-step;
  display: grid;
  gap: 6px;
  padding: 14px 16px 14px 52px;
  position: relative;
}

.recipe-steps li::before {
  align-items: center;
  background: var(--primary);
  border-radius: 999px;
  color: #fff;
  content: counter(recipe-step);
  display: flex;
  font-size: 13px;
  font-weight: 800;
  height: 28px;
  justify-content: center;
  left: 14px;
  position: absolute;
  top: 14px;
  width: 28px;
}

.recipe-steps strong {
  color: var(--ink);
}

.recipe-steps span {
  color: #4f5b6e;
  line-height: 1.5;
}

.recipe-checks {
  display: grid;
  gap: 10px;
}

.recipe-checks span {
  background: #f8fafc;
  border: 1px solid #e8edf5;
  border-radius: 8px;
  color: #344052;
  font-weight: 700;
  padding: 12px 14px;
}

.toolbar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.toolbar input,
.toolbar select {
  min-height: 56px;
  width: auto;
}

.toolbar input {
  min-width: 280px;
}

.toolbar select {
  min-width: 210px;
}

.inventory-lists-page {
  margin: -28px;
}

.lists-hero {
  align-items: center;
  background: #fff;
  border-bottom: 1px solid #e6e9ef;
  display: flex;
  justify-content: space-between;
  min-height: 126px;
  padding: 22px 28px;
}

.lists-title {
  align-items: center;
  display: flex;
  gap: 14px;
}

.lists-title h1 {
  font-size: 34px;
  line-height: 1.1;
  margin: 0;
}

.lists-title span {
  background: #f1f2f6;
  border-radius: 999px;
  color: #7a8291;
  font-size: 18px;
  font-weight: 600;
  padding: 8px 14px;
}

.upload-list-btn {
  align-items: center;
  background: #f59e0b;
  border-radius: 8px;
  color: #fff;
  display: flex;
  height: 54px;
  justify-content: center;
  width: 54px;
}

.upload-list-btn .icon {
  height: 26px;
  width: 26px;
}

.inventory-list-card {
  align-items: center;
  background: #fff;
  border: 1px solid #e5e9f0;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(23, 32, 51, 0.1);
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr) auto;
  margin: 8px 28px 0;
  min-height: 116px;
  padding: 26px 28px;
}

.list-main {
  align-items: center;
  background: transparent;
  color: inherit;
  display: flex;
  gap: 18px;
  min-width: 0;
  padding: 0;
  text-align: left;
}

.list-icon {
  align-items: center;
  background: #e8ebff;
  border-radius: 8px;
  color: var(--primary);
  display: flex;
  flex: 0 0 auto;
  height: 78px;
  justify-content: center;
  width: 78px;
}

.list-icon .icon {
  height: 34px;
  width: 34px;
}

.list-copy {
  display: grid;
  gap: 10px;
}

.list-copy strong {
  color: var(--primary);
  font-size: 24px;
  line-height: 1.1;
}

.list-copy span {
  color: #747c8d;
  font-size: 18px;
  line-height: 1.35;
}

.list-copy small {
  color: #687082;
  font-size: 17px;
}

.list-actions {
  align-items: center;
  display: flex;
  gap: 26px;
}

.list-action {
  align-items: center;
  background: transparent;
  display: flex;
  height: 34px;
  justify-content: center;
  padding: 0;
  width: 34px;
}

.list-action .icon {
  height: 24px;
  width: 24px;
}

.list-action.green {
  color: #35a66d;
}

.list-action.purple {
  color: var(--primary);
}

.list-action.red {
  color: #ef2c2c;
}

.list-action.muted {
  color: #a0a7b4;
}

.location-manager {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
  padding: 18px;
}

.sub-location-manager {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
  padding: 20px 22px;
}

.sub-location-manager-head h2 {
  font-size: 18px;
  margin: 0 0 4px;
}

.sub-location-manager-head p {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}

.sub-location-manager-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.empty-state.compact {
  grid-column: 1 / -1;
  min-height: 96px;
}

.sub-location-card {
  border: 1px solid #edf1f7;
  border-radius: 8px;
  display: grid;
  gap: 12px;
  padding: 14px 16px;
}

.sub-location-card-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.sub-location-card-head strong {
  color: var(--ink);
  font-size: 15px;
}

.sub-actions {
  align-items: center;
  display: inline-flex;
  gap: 4px;
}

.sub-actions button {
  align-items: center;
  background: transparent;
  border-radius: 6px;
  color: #6f7889;
  display: inline-flex;
  height: 26px;
  justify-content: center;
  padding: 0;
  width: 26px;
}

.sub-actions button:hover {
  background: #f4f6fb;
  color: var(--primary);
}

.sub-actions .icon {
  height: 15px;
  width: 15px;
}

.sub-actions button[data-delete-section]:hover {
  color: #c93535;
}

.location-manager h2 {
  font-size: 20px;
  margin: 4px 0 4px;
}

.location-manager p {
  color: var(--muted);
  margin: 0;
}

.location-form {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto;
}

.sub-location-manager .location-form {
  grid-template-columns: minmax(220px, 1fr) auto;
}

.location-form input {
  min-height: 52px;
}

.location-list {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.location-card {
  background: #fff;
  border: 1px solid #edf1f7;
  border-radius: 8px;
  color: inherit;
  cursor: pointer;
  padding: 12px;
  text-align: left;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.location-card:hover {
  border-color: #cfd7ff;
  box-shadow: 0 8px 24px rgba(79, 57, 246, 0.1);
  transform: translateY(-1px);
}

.location-card strong {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
}

.location-card small {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 10px;
}

.location-card div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.location-card span {
  background: #eef0ff;
  border-radius: 999px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
}

.location-contents {
  display: grid;
  gap: 18px;
}

.sub-location-section {
  display: grid;
  gap: 12px;
}

.sub-location-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.sub-location-head h2 {
  font-size: 18px;
  margin: 0;
}

.sub-location-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.shopping-layout {
  align-items: start;
  grid-template-columns: minmax(0, 1fr);
}

.shopping-add {
  max-width: 280px;
}

.shopping-head {
  align-items: center;
}

.shopping-title-line {
  align-items: center;
  display: flex;
  gap: 10px;
}

.shopping-title-line h1 {
  margin-right: 0;
}

.shopping-rename {
  align-items: center;
  background: #eef0ff;
  border: 1px solid #d9ddff;
  border-radius: 8px;
  color: var(--primary);
  display: inline-flex;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.shopping-rename:hover {
  background: #e3e7ff;
  border-color: #c9ceff;
}

.shopping-rename .icon {
  height: 17px;
  width: 17px;
}

.shopping-panel {
  padding: 20px;
}

.shopping-panel-head {
  margin-bottom: 8px;
}

.shopping-panel-head > div {
  display: grid;
  gap: 4px;
}

.shopping-panel-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.shop-list {
  display: grid;
}

.shop-row {
  align-items: center;
  border-bottom: 1px solid #edf1f7;
  display: grid;
  gap: 14px;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  min-height: 76px;
  padding: 16px 0;
}

.shop-row:last-child {
  border-bottom: 0;
}

.shop-row input {
  accent-color: var(--primary);
  box-shadow: none;
  cursor: pointer;
  height: 20px;
  min-height: 20px;
  padding: 0;
  width: 20px;
}

.shop-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.shop-copy strong {
  color: #20293a;
  font-size: 15px;
  line-height: 1.25;
}

.shop-copy span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.shop-row.done strong {
  color: #8c95a5;
  text-decoration: line-through;
}

.shop-row.done .shop-copy span {
  color: #9aa3b2;
}

.shopping-empty-state {
  align-items: center;
  border: 1px dashed #cfd7e5;
  border-radius: 8px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: center;
  min-height: 150px;
  padding: 24px;
  text-align: center;
}

.shopping-empty-state strong {
  color: var(--ink);
  font-size: 16px;
}

.shopping-detail-page {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) 320px;
}

.shopping-detail-card,
.shopping-run-summary {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.shopping-form-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.shopping-form-grid label {
  color: #4b5567;
  display: grid;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
}

.shopping-notes {
  grid-column: 1 / -1;
}

.shopping-form-actions {
  border-top: 1px solid #edf1f7;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 18px;
}

.shopping-form-actions .btn {
  min-width: 150px;
}

.shopping-form-actions .btn-primary {
  width: auto;
}

.shopping-history {
  margin-top: 18px;
  padding: 20px;
}

.shopping-history .panel-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.shopping-history-list {
  display: grid;
  gap: 12px;
}

.shopping-history-card {
  border: 1px solid #edf1f7;
  border-radius: 8px;
  padding: 14px;
}

.shopping-history-card > div {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
}

.shopping-history-card strong {
  color: var(--ink);
  font-size: 15px;
}

.shopping-history-card span {
  color: var(--muted);
  font-size: 13px;
}

.shopping-history-card ul {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.shopping-history-card li {
  color: #2b3446;
  display: grid;
  font-size: 14px;
  font-weight: 700;
  gap: 2px;
}

.shopping-history-card li span {
  font-weight: 500;
}

.settings-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.switch-row {
  align-items: center;
  border-top: 1px solid #edf1f7;
  display: flex;
  justify-content: space-between;
  padding: 15px 0;
}

.switch {
  background: #dbe2ed;
  border-radius: 999px;
  height: 24px;
  padding: 3px;
  width: 46px;
}

.switch.on {
  background: var(--primary);
}

.switch::after {
  background: #fff;
  border-radius: 999px;
  content: "";
  display: block;
  height: 18px;
  transform: translateX(0);
  transition: transform 150ms ease;
  width: 18px;
}

.switch.on::after {
  transform: translateX(22px);
}

.toast {
  background: #172033;
  border-radius: 8px;
  bottom: 22px;
  box-shadow: 0 12px 40px rgba(23, 32, 51, 0.22);
  color: #fff;
  font-size: 14px;
  left: 50%;
  opacity: 0;
  padding: 12px 16px;
  pointer-events: none;
  position: fixed;
  transform: translate(-50%, 12px);
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 20;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 980px) {
  .app-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .mobile-brand {
    display: inline-flex;
    font-size: 20px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    justify-content: space-between;
  }

  .content {
    padding-bottom: 96px;
  }

  .mobile-nav {
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid var(--line);
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    left: 0;
    position: fixed;
    right: 0;
    z-index: 6;
  }

  .mobile-nav button {
    align-items: center;
    background: transparent;
    color: #657084;
    display: flex;
    flex-direction: column;
    font-size: 11px;
    font-weight: 700;
    gap: 5px;
    justify-content: center;
    min-height: 68px;
    padding: 8px 4px;
  }

  .mobile-nav button.active {
    color: var(--primary);
  }

  .mobile-nav svg {
    height: 20px;
    width: 20px;
  }

  .search-wrap {
    max-width: none;
    width: 100%;
  }

  .stats,
  .inventory-grid,
  .recipe-grid,
  .two-col,
  .shopping-layout,
  .shopping-detail-page,
  .settings-grid,
  .recipe-detail-grid,
  .edit-product-page,
  .location-list {
    grid-template-columns: 1fr;
  }

  .recipe-hero {
    grid-template-columns: 1fr;
  }

  .recipe-hero .recipe-image {
    min-height: 150px;
  }

  .location-form {
    grid-template-columns: 1fr;
  }

  .inventory-lists-page {
    margin: -24px -16px;
  }

  .lists-hero,
  .inventory-list-card {
    padding-left: 16px;
    padding-right: 16px;
  }

  .lists-title {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .lists-title h1 {
    font-size: 30px;
  }

  .inventory-list-card {
    grid-template-columns: 1fr;
    margin-left: 16px;
    margin-right: 16px;
  }

  .list-actions {
    justify-content: space-between;
    width: 100%;
  }

  .list-copy span {
    font-size: 15px;
  }
}

@media (max-width: 620px) {
  .auth-page,
  .content {
    padding: 24px 16px;
  }

  .field-row,
  .social-grid,
  .shopping-form-grid,
  .edit-form-grid {
    grid-template-columns: 1fr;
  }

  .page-head {
    display: block;
  }

  .page-actions {
    display: grid;
    grid-template-columns: 1fr;
    margin-top: 16px;
    min-width: 0;
  }

  .page-head .btn,
  .page-actions .btn-primary,
  .page-actions .btn-danger {
    margin-top: 16px;
    min-width: 0;
    width: 100%;
  }

  .page-actions .btn {
    margin-top: 0;
  }

  .inventory-action-stack {
    min-width: 0;
    width: 100%;
  }

  .shopping-form-actions {
    display: grid;
  }

  .shopping-form-actions .btn,
  .shopping-form-actions .btn-primary {
    width: 100%;
  }

  .toolbar input,
  .toolbar select,
  .toolbar .btn {
    width: 100%;
  }

  .table-wrap {
    overflow-x: auto;
  }

  .table {
    min-width: 680px;
  }

  .scan-dialog {
    max-height: 94vh;
    padding: 16px 14px;
  }

  .location-dialog {
    padding: 20px 16px;
  }

  .location-modal-intro h3 {
    font-size: 34px;
  }

  .location-modal-actions {
    grid-template-columns: 1fr;
  }

  .scan-result {
    padding: 12px;
  }

  .scan-result h3 {
    font-size: 18px;
  }

  .scan-result-lines {
    font-size: 12px;
  }

  .scan-confirm h3 {
    font-size: 24px;
  }

  .scan-confirm-actions {
    grid-template-columns: 1fr;
  }

  .scan-adjust-actions {
    grid-template-columns: 1fr;
  }
}
