:root { font-family: ui-rounded, "SF Pro Rounded", system-ui, sans-serif; color: #27251f; background: #f6f4ed; }
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
.shell { display: flex; flex-direction: column; width: min(100%, 680px); margin: auto; padding: 52px 22px 72px; }
header { order: 1; }
.brand-lockup { display: inline-flex; align-items: center; gap: 9px; margin: 0 0 13px; }
.brand-mark { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 9px; background: #386a2e; color: #d8f4c3; font-size: .9rem; box-shadow: 0 5px 14px #386a2e33; }
.brand-name { margin: 0; color: #1c3120; font-size: 1.08rem; font-weight: 950; letter-spacing: -.055em; line-height: 1; }
.brand-name span { color: #5e9d43; }
h1 { margin: 0; font-size: clamp(2rem, 8vw, 3.35rem); line-height: 1.02; letter-spacing: -.055em; }
.intro { margin: 18px 0 35px; color: #67645b; font-size: 1.05rem; }
h2 { margin: 0; font-size: 1.05rem; }
.food-dialog { width: min(calc(100% - 28px), 620px); max-height: min(88dvh, 760px); padding: 0; border: 0; border-radius: 24px; background: transparent; }
.food-dialog::backdrop { background: #1c2a1ecc; backdrop-filter: blur(4px); }
.add-card { padding: 22px; border: 1px solid #dbe9d1; border-radius: 24px; background: #f0f6eb; box-shadow: 0 18px 60px #0b170d66; }
.dialog-heading { display: flex; align-items: start; justify-content: space-between; gap: 18px; }
.dialog-close { width: 36px; min-height: 36px; padding: 0; border-radius: 50%; background: #dfead8; color: #315d2c; font-size: 1.45rem; line-height: 1; }
.dialog-close:hover { background: #cfe0c5; }
.auth-card { order: 2; margin-bottom: 18px; padding: 22px; border-radius: 22px; background: #e7f1e0; }
.auth-card > p { margin: 9px 0 0; color: #596653; line-height: 1.4; }
.auth-form { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 10px; margin-top: 17px; }
.auth-form button { padding: 0 16px; }
.auth-code-row { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 10px; margin-top: 12px; }
.auth-code-row[hidden] { display: none; }
.auth-code-row button { padding: 0 16px; }
.calendar-setup { margin: 16px 0; padding: 14px; border-radius: 13px; background: #fffdf8; }
.calendar-panel { order: 6; margin-top: 20px; border: 1px solid #dedbd1; }
.calendar-setup > p { margin: 6px 0 10px; }
.calendar-link-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.calendar-link-row input { min-width: 0; font-size: .78rem; }
form { display: grid; gap: 15px; margin-top: 18px; }
label { display: grid; gap: 7px; font-size: .87rem; font-weight: 700; }
.optional { color: #857f73; font-weight: 500; }
input, select { width: 100%; min-width: 0; min-height: 48px; border: 1px solid #dedbd1; border-radius: 11px; padding: 0 13px; background: #fff; color: inherit; font: inherit; }
input:focus { outline: 3px solid #d8ebc9; border-color: #77a358; }
button { min-height: 48px; border: 0; border-radius: 11px; background: #386a2e; color: white; font: inherit; font-weight: 800; cursor: pointer; }
button:hover { background: #285321; }
.secondary-button { width: 100%; background: #e6efdf; color: #315d2c; }
.secondary-button:hover { background: #d8e7ce; }
.barcode-row { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 10px; }
.lookup-button { min-height: 48px; padding: 0 16px; background: #ebe8df; color: #39362e; }
.lookup-button:hover { background: #ddd8cc; }
.details-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.quantity-inputs { display: grid; grid-template-columns: minmax(0, 1fr) 82px; gap: 7px; }
.quantity-inputs select { padding: 0 8px; }
.hint { margin: 8px 0 0; color: #7a7569; font-size: .82rem; line-height: 1.35; }
.section-kicker { margin: 0 0 5px; color: #838074; letter-spacing: .11em; font-size: .68rem; font-weight: 850; }
#scanner { overflow: hidden; margin-top: 13px; border-radius: 13px; background: #20241e; }
#scanner video { display: block; width: 100%; }
.scan-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-top: 10px; }
.scan-control-button { min-height: 36px; padding: 0 12px; background: #2e312c; font-size: .8rem; }
.scan-control-button:hover, .scan-control-button.active { background: #151714; }
.food-list { order: 3; margin-top: 24px; }
.list-heading { display: flex; justify-content: space-between; align-items: center; }
.food-list #list-title { font-size: clamp(1.55rem, 6vw, 2.05rem); letter-spacing: -.04em; }
.food-list #food-count { display: inline-block; margin-left: 5px; color: #8a867c; font-size: .82rem; font-weight: 700; letter-spacing: 0; vertical-align: middle; }
.dashboard-heading { padding-bottom: 2px; }
.add-trigger { order: 4; display: inline-flex; width: 100%; min-height: 54px; align-items: center; justify-content: center; gap: 7px; margin-top: 24px; border-radius: 15px; background: #386a2e; box-shadow: 0 7px 18px #386a2e29; font-size: .95rem; white-space: nowrap; }
.add-trigger[hidden] { display: none; }
.add-trigger span { font-size: 1.15rem; font-weight: 500; line-height: 1; }
.priority-section { margin: 16px 0; padding: 15px 16px; border: 1px solid #f0d7ad; border-radius: 15px; background: #fff6e6; }
.priority-heading { display: flex; align-items: center; gap: 8px; color: #985d12; }
.priority-heading span { font-size: 1.1rem; }
.priority-heading h3 { margin: 0; font-size: .95rem; }
.priority-section p { margin: 7px 0 0; color: #6c5b41; line-height: 1.4; font-size: .9rem; }
.location-filters { display: flex; flex-wrap: wrap; gap: 7px; margin: 16px 0 4px; }
.filter-button { min-height: 36px; padding: 0 12px; border: 1px solid #dedbd1; background: #fffdf8; color: #625e55; font-size: .82rem; }
.filter-button:hover { background: #f1ede4; }
.filter-button.active { border-color: #386a2e; background: #386a2e; color: #fff; }
.text-button { min-height: auto; padding: 0; background: none; color: #7a7569; font-size: .85rem; }
.text-button:hover { background: none; color: #27251f; }
.empty { color: #7a7569; line-height: 1.5; }
ul { display: grid; gap: 10px; margin: 16px 0 0; padding: 0; list-style: none; }
.food-item { display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: 13px; padding: 17px; border: 1px solid #ebe7dd; border-radius: 17px; background: #fffdf8; box-shadow: 0 4px 14px #413b2c08; }
.status-dot { width: 11px; height: 11px; border-radius: 50%; background: #77a358; }
.food-item.soon .status-dot { background: #e69d35; }
.food-item.today .status-dot, .food-item.expired .status-dot { background: #cf4d3d; }
.food-copy { display: grid; gap: 3px; }
.food-copy span { color: #716d63; font-size: .87rem; }
.food-copy .food-meta { color: #386a2e; font-size: .8rem; font-weight: 750; }
.item-actions { display: flex; align-items: center; gap: 9px; }
.quantity-control { display: grid; grid-template-columns: 30px auto 30px; align-items: center; overflow: hidden; min-height: 34px; border: 1px solid #dedbd1; border-radius: 9px; background: #fff; }
.quantity-control span { min-width: 46px; padding: 0 5px; color: #625e55; text-align: center; font-size: .76rem; font-weight: 750; white-space: nowrap; }
.quantity-button { min-height: 32px; border-radius: 0; background: #f3f0e8; color: #4b473d; font-size: 1.05rem; }
.quantity-button:hover { background: #e7e1d6; }
.food-buttons { display: flex; align-items: center; gap: 7px; }
.consume-button { min-height: 36px; padding: 0 12px; border-radius: 10px; background: #386a2e; color: #fff; font-size: .78rem; }
.consume-button:hover { background: #285321; }
.shop-button { min-height: 36px; padding: 0 11px; border: 1px solid #ecd6ad; border-radius: 10px; background: #fffaf0; color: #91580f; font-size: .78rem; }
.shop-button:hover { background: #fff1d8; }
.delete-button { width: 34px; min-height: 34px; padding: 0; border-radius: 50%; background: #eeeae0; color: #777268; font-size: 1.45rem; line-height: 1; }
.delete-button:hover { background: #e3ded3; color: #342f27; }
.shopping-card { order: 5; margin-top: 16px; padding: 22px; border: 1px solid #ebe7dd; border-radius: 22px; background: #fffdf8; box-shadow: 0 8px 30px #413b2c08; }
.shopping-form { display: grid; grid-template-columns: 1fr 48px; align-items: end; gap: 9px; margin-top: 14px; }
.shopping-form button { min-height: 48px; padding: 0; font-size: 1.15rem; font-weight: 500; line-height: 1; }
.shopping-items { margin-top: 13px; }
.shopping-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #ece8de; }
.shopping-item:last-child { border-bottom: 0; }
.shopping-item label { display: flex; grid-template-columns: none; align-items: center; gap: 10px; font-size: .94rem; font-weight: 650; }
.shopping-item input { width: 20px; min-height: 20px; accent-color: #386a2e; }
.shopping-item.done .shopping-label { color: #928d82; text-decoration: line-through; }
.shopping-delete { flex: 0 0 auto; }
.account-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: -14px 0 26px; padding: 10px 12px; border: 1px solid #d9e7d1; border-radius: 12px; background: #f0f6eb; color: #486443; font-size: .78rem; font-weight: 750; }
.account-bar[hidden] { display: none; }
.account-bar > div { display: flex; gap: 13px; }
.account-bar .text-button { color: #486443; font-size: .76rem; }
.danger-button { color: #9a3d31 !important; }
.app-footer { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 6px; padding: 0 22px 30px; color: #908b80; text-align: center; font-size: .78rem; }
.app-footer .text-button { color: #777268; font-size: inherit; text-decoration: underline; text-underline-offset: 2px; }
.privacy-dialog { width: min(calc(100% - 28px), 650px); max-height: min(82dvh, 760px); padding: 0; border: 0; border-radius: 24px; background: transparent; }
.privacy-dialog::backdrop { background: #1c2a1ecc; backdrop-filter: blur(4px); }
.privacy-card { max-height: min(82dvh, 760px); overflow: auto; padding: 23px; border: 1px solid #dbe9d1; border-radius: 24px; background: #fffdf8; box-shadow: 0 18px 60px #0b170d66; }
.privacy-card > p { margin: 10px 0 18px; color: #6f6a60; line-height: 1.5; }
.privacy-card h3 { margin: 20px 0 6px; color: #315d2c; font-size: .92rem; }
.privacy-card h3 + p { margin: 0; color: #59564d; font-size: .91rem; line-height: 1.52; }
.privacy-card a { color: #315d2c; font-weight: 750; }
@media (max-width: 480px) {
  .barcode-row, .auth-form, .auth-code-row, .calendar-link-row { grid-template-columns: 1fr; }
  .barcode-row { grid-template-columns: minmax(0, 1fr) 112px; }
  .barcode-row .lookup-button { width: auto; padding: 0 12px; }
  .details-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .details-row label { min-width: 0; }
  .shopping-form { grid-template-columns: 1fr 44px; gap: 8px; }
  .shopping-form input, .shopping-form button { min-height: 44px; }
  .shopping-form button { font-size: 1.15rem; font-weight: 500; }
  .lookup-button { width: 100%; }
  .food-dialog { width: calc(100% - 20px); max-height: calc(100dvh - 16px); overflow: visible; }
  .add-card { padding: 18px; overflow-x: hidden; }
  #food-form { gap: 10px; margin-top: 12px; }
  .food-dialog input, .food-dialog select { min-height: 44px; }
  .food-dialog #food-form > button[type="submit"] { min-height: 46px; }
  .scan-area .hint { margin-top: 6px; }
  .food-dialog label { min-width: 0; }
  input[type="date"] { width: 100% !important; min-width: 0 !important; max-width: 100% !important; }
  input[type="date"]::-webkit-date-and-time-value { min-width: 0; text-align: left; }
  .food-item { grid-template-columns: 12px minmax(0, 1fr); align-items: start; padding: 16px; }
  .food-copy { min-width: 0; }
  .food-copy strong { overflow-wrap: anywhere; }
  .item-actions { grid-column: 2; display: grid; width: 100%; grid-template-columns: 40px 40px minmax(0, 1fr) minmax(0, 1fr); align-items: stretch; gap: 8px; }
  .quantity-control { display: contents; }
  .quantity-control span { display: none; }
  .quantity-button { min-height: 44px; border-radius: 10px; }
  .food-buttons { grid-column: 3 / -1; display: grid; width: 100%; grid-template-columns: 1fr 1fr; gap: 8px; }
  .food-buttons button { min-width: 0; padding: 0 8px; }
  .consume-button { min-width: 0; }
  .account-bar { align-items: flex-start; flex-direction: column; margin-top: -20px; }
  .account-bar > div { flex-wrap: wrap; gap: 8px 13px; }
  .privacy-dialog { width: calc(100% - 20px); max-height: calc(100dvh - 20px); }
  .privacy-card { max-height: calc(100dvh - 20px); padding: 19px; }
}


/* Formulaire d’ajout : une seule règle mobile cohérente */
.barcode-row > label { display: block; }
.barcode-row > label > input { display: block; margin-top: 7px; }
.details-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.details-row label, #food-form > label { min-width: 0; max-width: 100%; }
.details-row input, .details-row select { padding-inline: 10px; }
.food-dialog, .add-card, #food-form { min-width: 0; max-width: 100%; }
#food-date {
  display: block;
  box-sizing: border-box;
  inline-size: 100%;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: 48px;
  min-height: 48px;
  margin: 0;
  padding-inline: 13px;
  text-align: center;
}

@media (max-width: 480px) {
  .food-dialog { width: calc(100vw - 20px); max-width: calc(100vw - 20px); }
  .add-card { padding: 16px; }
  .details-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .details-row label { font-size: .78rem; }
  .details-row input, .details-row select { min-width: 0; height: 44px; min-height: 44px; padding-inline: 8px; font-size: .86rem; }
  #food-date {
    height: 44px;
    min-height: 44px;
    padding-inline: 10px;
    font-size: 16px;
    text-align: center;
  }
  #food-date::-webkit-date-and-time-value,
  #food-date::-webkit-datetime-edit {
    min-width: 0;
    padding: 0;
    text-align: center;
  }
}
