:root {
  color-scheme: light;
  --bg: #f4f7f2;
  --surface: #ffffff;
  --surface-soft: #f0f6ee;
  --text: #1f2a1f;
  --muted: #5d6b5f;
  --accent: #5aa469;
  --accent-dark: #447f50;
  --danger: #d9514e;
  --warning: #f2a93b;
  --success: #48a868;
  --border: #dce6db;
  --shadow: 0 18px 40px rgba(69, 96, 72, 0.12);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: linear-gradient(180deg, #eef5ea 0%, var(--bg) 100%);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(100%, 430px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 20px 16px 32px;
}

.card,
.hero-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 18px;
}

.hero-card {
  background: linear-gradient(180deg, #ffffff 0%, #f5fbf4 100%);
  padding: 16px;
}

.camera-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(12, 18, 13, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.camera-panel {
  width: min(100%, 430px);
  background: #101814;
  color: #fff;
  border-radius: 24px;
  padding: 16px;
}

.camera-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.camera-stage {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  background: #000;
  aspect-ratio: 3 / 4;
}

.camera-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.camera-guide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.camera-guide-line {
  width: min(120px, 32%);
  height: 8px;
  border-radius: 999px;
  background: #ff3b30;
  box-shadow: 0 0 0 2px rgba(255, 59, 48, 0.22), 0 0 18px rgba(255, 59, 48, 0.65);
}

.camera-actions {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-dark);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: 2rem;
}

h2 {
  margin-bottom: 0;
  font-size: 1.25rem;
}

h1,
h2,
h3,
.eyebrow,
.section-kicker,
.helper-text,
.hero-text,
.list-count,
.empty-state,
.auth-message,
.barcode-message,
.usage-text,
.section-intro,
.form-subtitle {
  text-align: center;
}

.hero-text,
.helper-text,
.list-count,
.empty-state,
.meta-line {
  color: var(--muted);
}

.top-account-card {
  padding: 16px 18px;
}

.top-account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.account-email {
  margin: 6px 0 0;
}

.hero-logo {
  display: block;
  width: 100%;
  max-width: 360px;
  margin: 0 auto 12px;
  border-radius: 28px;
  background: #ffffff;
}

.full-width-button {
  width: 100%;
}

.quick-flow {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.quick-flow-item {
  display: grid;
  gap: 8px;
  justify-items: center;
  text-align: center;
  padding: 12px 10px;
  border-radius: 18px;
  background: #f4faf3;
  color: #28402d;
  font-size: 0.87rem;
  font-weight: 700;
}

.quick-flow-number {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--accent-dark);
  color: #fff;
}

.scan-button,
.primary-button,
.secondary-button,
.filter-button,
.delete-button {
  border: 0;
  border-radius: 16px;
  min-height: 52px;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease;
}

.scan-button,
.primary-button {
  display: inline-flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  font-weight: 700;
}

.scan-button,
.primary-button {
  background: var(--accent);
  color: #fff;
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  background: var(--surface-soft);
  color: var(--accent-dark);
  font-weight: 700;
}

.scan-button {
  margin-bottom: 16px;
}

.scan-button:active,
.primary-button:active,
.filter-button:active,
.delete-button:active {
  transform: scale(0.98);
}

.helper-text {
  margin: 12px 0 0;
  font-size: 0.92rem;
  line-height: 1.4;
}

.section-intro {
  max-width: 28ch;
  margin-left: auto;
  margin-right: auto;
}

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.auth-header {
  margin-bottom: 14px;
}

.status-pill {
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--accent-dark);
  font-size: 0.84rem;
  font-weight: 700;
  white-space: nowrap;
}

.photo-preview {
  min-height: 150px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--surface-soft);
  color: var(--muted);
  margin-bottom: 16px;
}

.photo-preview img {
  display: block;
  width: 100%;
  height: 220px;
  object-fit: cover;
}

.photo-preview-empty {
  padding: 24px;
  text-align: center;
}

.product-form {
  display: grid;
  gap: 14px;
}

.product-form label {
  display: grid;
  gap: 8px;
  font-weight: 700;
  text-align: center;
}

.product-form input,
.product-form select {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  background: #fff;
  color: var(--text);
}

.barcode-box {
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  text-align: center;
}

.section-divider {
  height: 1px;
  margin: 18px 0 14px;
  background: linear-gradient(90deg, rgba(90, 164, 105, 0), rgba(90, 164, 105, 0.35), rgba(90, 164, 105, 0));
}

.form-subtitle {
  margin: 0 0 14px;
  font-size: 1.05rem;
}

.advice-box {
  margin-bottom: 18px;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid #cfe5d2;
  background: #f6fbf3;
  text-align: center;
}

.advice-text {
  margin-bottom: 14px;
}

.advice-actions {
  display: grid;
  gap: 10px;
}

.barcode-header {
  margin-bottom: 12px;
}

.inline-field-group {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.barcode-message {
  min-height: 22px;
}

.barcode-message.barcode-found {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-dark);
}

.usage-text {
  min-height: 18px;
  font-size: 0.82rem;
}

.barcode-message.is-error {
  color: #aa2d29;
}

.barcode-message.is-success {
  color: var(--success);
}

.auth-switcher,
.filters {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.auth-switcher {
  margin-bottom: 16px;
}

.filters {
  grid-template-columns: repeat(2, 1fr);
  margin-bottom: 16px;
}

.filter-button {
  background: var(--surface-soft);
  color: var(--text);
  font-weight: 700;
}

.filter-button.active {
  background: var(--accent-dark);
  color: #fff;
}

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

.product-card {
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: #fff;
  padding: 16px;
  box-shadow: 0 12px 28px rgba(49, 85, 56, 0.08);
  text-align: center;
}

.product-top,
.product-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.product-main {
  display: flex;
  align-items: center;
  gap: 12px;
}

.product-thumb {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid var(--border);
  flex: 0 0 auto;
}

.product-top {
  margin-bottom: 12px;
}

.product-name {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.badge {
  min-width: 110px;
  text-align: center;
  padding: 10px 12px;
  border-radius: 999px;
  color: #fff;
  font-weight: 700;
  font-size: 0.84rem;
}

.badge-danger {
  background: var(--danger);
}

.badge-warning {
  background: var(--warning);
}

.badge-success {
  background: var(--success);
}

.delete-button {
  min-width: 96px;
  padding: 0 14px;
  background: #fceaea;
  color: #aa2d29;
  font-weight: 700;
}

.empty-state {
  text-align: center;
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.hidden {
  display: none;
}

.auth-message {
  min-height: 22px;
}

.auth-message.is-error {
  color: #aa2d29;
}

.auth-message.is-success {
  color: var(--success);
}

.photo-note {
  font-size: 0.84rem;
}

@media (max-width: 380px) {
  .inline-field-group {
    grid-template-columns: 1fr;
  }

  .top-account-row,
  .section-header,
  .product-top,
  .product-bottom {
    flex-direction: column;
    align-items: stretch;
  }

  .delete-button,
  .secondary-button {
    width: 100%;
  }
}

@media (min-width: 700px) {
  .app-shell {
    padding-top: 28px;
  }

  body::before {
    content: "Mode test navigateur";
    position: fixed;
    top: 16px;
    right: 16px;
    background: rgba(31, 42, 31, 0.9);
    color: #fff;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 0.82rem;
    z-index: 10;
  }
}
