* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #EAE3D3; --ink: #2B2620; --muted: #82786a;
  --card-bg: #F5F0E4; --card-border: #d8cdb2;
  --accent: #6B1F2A; --accent-ink: #F5F0E4;
  --ok-bg: #E4E9DC; --ok-ink: #4B5D3A;
  --wait-bg: #EFE6D2; --wait-ink: #8A6A2E;
  --warn-bg: #EFDCDA; --warn-ink: #8A2E2E;
  --chip-bg: #ffffffa0;
}

body {
  font-family: 'Georgia', serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}

header.topbar {
  padding: 22px 20px 16px;
  position: sticky; top: 0; z-index: 5;
  background: var(--bg);
}
.topbar .row { display: flex; justify-content: space-between; align-items: flex-end; }
.topbar h1 { font-size: 26px; font-weight: 600; }
.topbar h1::after { content: ''; display: block; width: 40px; height: 2px; background: var(--accent); margin-top: 8px; }
.topbar .sub { font-size: 12px; color: var(--muted); margin-top: 4px; font-family: system-ui, sans-serif; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--chip-bg); color: var(--ink);
  font-size: 18px; border: none; cursor: pointer;
}

.filters { display: flex; gap: 8px; margin-top: 16px; overflow-x: auto; }
.filters button {
  font-size: 11px; font-weight: 600; padding: 6px 12px; border-radius: 4px;
  background: var(--chip-bg); color: var(--muted); border: none; cursor: pointer;
  white-space: nowrap; font-family: system-ui, sans-serif;
}
.filters button.on { background: var(--accent); color: var(--accent-ink); }

.list { padding: 4px 20px 100px; display: flex; flex-direction: column; gap: 10px; }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); font-family: system-ui, sans-serif; }

.card {
  display: flex; align-items: center; gap: 14px; padding: 14px;
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: 2px; position: relative; cursor: pointer;
}
.card::before {
  content: ''; position: absolute; top: 0; right: 0; width: 0; height: 0;
  border-style: solid; border-width: 0 14px 14px 0;
  border-color: transparent var(--card-border) transparent transparent;
}
.thumb {
  width: 44px; height: 44px; border-radius: 4px; flex-shrink: 0;
  background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: white;
}
.info { flex: 1; min-width: 0; }
.info .domaine { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.info .cuvee { font-size: 12.5px; color: var(--muted); margin-top: 2px; font-style: italic; }
.info .meta { display: flex; gap: 6px; align-items: center; margin-top: 7px; font-family: system-ui, sans-serif; }
.badge { font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 100px; }
.badge.ready { background: var(--ok-bg); color: var(--ok-ink); }
.badge.young { background: var(--wait-bg); color: var(--wait-ink); }
.badge.late { background: var(--warn-bg); color: var(--warn-ink); }
.zone { font-size: 10.5px; color: var(--muted); }
.qty { font-size: 12px; color: var(--muted); flex-shrink: 0; font-family: system-ui, sans-serif; }

.fab {
  position: fixed; bottom: 22px; right: calc(50% - 240px + 20px);
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; box-shadow: 0 10px 24px -6px var(--accent);
  border: none; cursor: pointer; z-index: 20;
}
@media (max-width: 480px) { .fab { right: 20px; } }

/* Modal empilé */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(43,38,32,0.5);
  display: flex; align-items: flex-end; z-index: 50;
}
.modal {
  background: var(--bg); width: 100%; max-height: 88vh; overflow-y: auto;
  border-radius: 20px 20px 0 0; padding: 24px 20px 40px;
  animation: slideUp .2s ease-out;
}
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-close {
  position: absolute; top: 16px; right: 16px; background: var(--chip-bg);
  border: none; width: 32px; height: 32px; border-radius: 50%; font-size: 16px; cursor: pointer;
}
.modal h2 { font-size: 22px; margin-bottom: 4px; }
.modal .subtitle { font-style: italic; color: var(--muted); margin-bottom: 16px; }

.field-group { margin-bottom: 14px; }
.field-label { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-family: system-ui, sans-serif; margin-bottom: 4px; display: block; }
.field-editable {
  font-family: system-ui, sans-serif; font-size: 14px; padding: 8px 10px;
  border: 1px solid var(--card-border); border-radius: 6px; background: var(--card-bg);
  width: 100%; color: var(--ink);
}

.btn-primary {
  width: 100%; padding: 14px; border-radius: 8px; border: none;
  background: var(--accent); color: var(--accent-ink); font-size: 15px; font-weight: 600;
  cursor: pointer; font-family: system-ui, sans-serif; margin-top: 8px;
}
.btn-secondary {
  width: 100%; padding: 12px; border-radius: 8px; border: 1px solid var(--card-border);
  background: transparent; color: var(--ink); font-size: 14px; cursor: pointer;
  font-family: system-ui, sans-serif; margin-top: 8px;
}

.confidence { font-size: 10px; padding: 2px 6px; border-radius: 100px; margin-left: 6px; font-family: system-ui, sans-serif; }
.confidence.haute { background: var(--ok-bg); color: var(--ok-ink); }
.confidence.moyenne { background: var(--wait-bg); color: var(--wait-ink); }
.confidence.basse { background: var(--warn-bg); color: var(--warn-ink); }

.spinner { text-align: center; padding: 30px; color: var(--muted); font-family: system-ui, sans-serif; }
