/* Printr — ambiance « papier chaud » : fond crème, encre douce, corail pour l'action. */

:root {
  --bg: #f6f1e9;
  --surface: #fffdf9;
  --surface-2: #f1ebe1;
  --ink: #1f1b16;
  --ink-2: #4a433b;
  --muted: #8a8076;
  --line: #e7dfd3;
  --line-strong: #d6ccbe;
  --accent: #e2600e;
  --accent-ink: #ffffff;
  --accent-soft: #fde6d4;
  --ok: #3b8a52;
  --ok-soft: #e1f1e5;
  --warn: #b7791f;
  --warn-soft: #fbefd7;
  --danger: #c2412d;
  --danger-soft: #f9e0db;
  --paper: #ffffff;
  --paper-ink: #151515;
  --shadow-1: 0 1px 2px rgb(60 40 20 / 6%), 0 1px 1px rgb(60 40 20 / 4%);
  --shadow-2: 0 6px 20px -6px rgb(60 40 20 / 18%), 0 2px 6px rgb(60 40 20 / 6%);
  --shadow-3: 0 24px 60px -12px rgb(40 25 10 / 35%);
  --radius: 18px;
  --radius-sm: 12px;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --tabbar-h: 68px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15120f;
    --surface: #1f1b17;
    --surface-2: #29241f;
    --ink: #f4ede3;
    --ink-2: #d2c8bb;
    --muted: #9c9186;
    --line: #322b24;
    --line-strong: #43392f;
    --accent: #f47a22;
    --accent-soft: #3f2412;
    --ok: #6cc184;
    --ok-soft: #1d3324;
    --warn: #e0a548;
    --warn-soft: #3a2c14;
    --danger: #f07a66;
    --danger-soft: #3d1e19;
    --paper: #fbfaf7;
    --shadow-1: 0 1px 2px rgb(0 0 0 / 30%);
    --shadow-2: 0 8px 24px -8px rgb(0 0 0 / 55%);
    --shadow-3: 0 24px 60px -12px rgb(0 0 0 / 70%);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; border-radius: 8px; }

.boot { min-height: 100dvh; display: grid; place-items: center; }

/* ---------- Structure ---------- */

.shell { display: flex; min-height: 100dvh; }
.sidebar {
  display: none;
  width: 248px;
  flex-shrink: 0;
  padding: 22px 16px;
  border-right: 1px solid var(--line);
  position: sticky;
  top: 0;
  height: 100dvh;
  flex-direction: column;
  gap: 4px;
}
.main { flex: 1; min-width: 0; overflow-x: clip; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 24px); }
.page { max-width: 1180px; margin: 0 auto; padding: 18px 16px 24px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar h1 { font-size: 20px; margin: 0; letter-spacing: -0.01em; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: -0.02em; padding: 4px 10px 18px; }
.brand img { width: 40px; height: 40px; object-fit: contain; }

.navlink {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 12px;
  color: var(--ink-2); text-decoration: none; font-weight: 600;
  transition: background .15s, color .15s;
}
.navlink:hover { background: var(--surface-2); }
.navlink.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.navlink.active svg { color: var(--accent); }
.sidebar .spacer { flex: 1; }

.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(160%) blur(16px);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-top: 1px solid var(--line);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); text-decoration: none; font-size: 11.5px; font-weight: 700;
  transition: color .15s;
}
.tab svg { width: 24px; height: 24px; transition: transform .2s; }
.tab.active { color: var(--accent); }
.tab.active svg { transform: translateY(-1px) scale(1.06); }

@media (min-width: 900px) {
  .sidebar { display: flex; }
  .tabbar { display: none; }
  .main { padding-bottom: 32px; }
  .page { padding: 26px 32px 40px; }
  .topbar { padding-left: 32px; padding-right: 32px; }
  .topbar .me { display: none; }
}

/* ---------- Éléments de base ---------- */

.icon { width: 20px; height: 20px; flex-shrink: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px;
  border: 1px solid transparent; border-radius: 999px;
  background: var(--surface); color: var(--ink);
  font-weight: 700; font-size: 15px; cursor: pointer;
  box-shadow: var(--shadow-1);
  transition: transform .12s, box-shadow .15s, background .15s, opacity .15s;
  white-space: nowrap; user-select: none;
}
.btn:hover { box-shadow: var(--shadow-2); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: default; transform: none; box-shadow: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 18px -6px color-mix(in srgb, var(--accent) 70%, transparent); }
.btn.secondary { background: var(--surface-2); box-shadow: none; }
.btn.ghost { background: transparent; box-shadow: none; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: var(--danger-soft); color: var(--danger); box-shadow: none; }
.btn.block { width: 100%; }
.btn.big { min-height: 54px; font-size: 17px; padding: 0 22px; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 13.5px; }
.iconbtn {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: 12px;
  border: 0; background: transparent; color: var(--ink-2); cursor: pointer;
  transition: background .15s, color .15s, transform .12s;
}
.iconbtn:hover { background: var(--surface-2); color: var(--ink); }
.iconbtn:active { transform: scale(.92); }
.iconbtn:disabled { opacity: .3; cursor: default; }
.iconbtn.danger:hover { background: var(--danger-soft); color: var(--danger); }

.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid color-mix(in srgb, currentColor 20%, transparent);
  border-top-color: currentColor;
  animation: spin .8s linear infinite;
}
.btn .spinner { width: 18px; height: 18px; border-width: 2.5px; }
@keyframes spin { to { transform: rotate(360deg); } }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-1); border: 1px solid var(--line); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2);
  font-size: 12.5px; font-weight: 700; white-space: nowrap;
}
.chip svg { width: 14px; height: 14px; }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.danger { background: var(--danger-soft); color: var(--danger); }

.avatar {
  display: inline-grid; place-items: center; flex-shrink: 0;
  width: 34px; height: 34px; border-radius: 50%;
  color: #fff; font-weight: 800; font-size: 15px;
  box-shadow: inset 0 0 0 2px rgb(255 255 255 / 25%);
}
.avatar.small { width: 22px; height: 22px; font-size: 11px; }
.avatar.large { width: 76px; height: 76px; font-size: 30px; }

.muted { color: var(--muted); }
.section-title { font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 26px 2px 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

/* ---------- Formulaires ---------- */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label, .label { font-size: 13.5px; font-weight: 700; color: var(--ink-2); }
.field .help { font-size: 12.5px; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; min-height: 44px; padding: 10px 14px;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea.input { resize: vertical; min-height: 96px; line-height: 1.5; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
select.input { appearance: none; padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238a8076' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; }
.fields-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 12px; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch .track { position: relative; width: 46px; height: 28px; border-radius: 999px; background: var(--line-strong); transition: background .2s; flex-shrink: 0; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-1); transition: transform .2s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(18px); }

.segmented { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 14px; overflow-x: auto; scrollbar-width: none; }
.segmented button {
  flex: 1; min-height: 36px; padding: 0 12px; border: 0; border-radius: 10px;
  background: transparent; color: var(--ink-2); font-weight: 700; font-size: 14px; cursor: pointer; white-space: nowrap;
  transition: background .15s, color .15s, box-shadow .15s;
}
.segmented button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }

.listedit .item { display: flex; gap: 6px; margin-bottom: 6px; }
.listedit .item .input { min-height: 40px; padding: 8px 12px; }

/* ---------- Accueil : presets ---------- */

.hero { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 8px; }
.action-card {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between; gap: 18px;
  min-height: 128px; padding: 16px; border-radius: var(--radius);
  text-decoration: none; color: var(--ink); cursor: pointer; border: 0; text-align: left;
  box-shadow: var(--shadow-1); transition: transform .15s, box-shadow .2s;
}
.action-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.action-card:active { transform: scale(.98); }
.action-card .big-emoji { font-size: 34px; line-height: 1; }
.action-card strong { font-size: 17px; display: block; }
.action-card span { display: block; margin-top: 2px; font-size: 13px; line-height: 1.35; color: var(--ink-2); }
.action-card.coral { background: linear-gradient(135deg, #ffd9c9, #ffc1aa); }
.action-card.sky { background: linear-gradient(135deg, #d6ecf6, #bfe0ef); }
.action-card.mint { background: linear-gradient(135deg, #dcf1df, #c4e8ca); }
/* Troisième carte : pleine largeur et en ligne sur téléphone, en colonne sur grand écran. */
.action-card.wide { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: flex-start; min-height: 0; gap: 14px; }
@media (min-width: 720px) {
  .hero { grid-template-columns: 1fr 1fr 1fr; }
  .action-card.wide { grid-column: auto; flex-direction: column; align-items: stretch; justify-content: space-between; min-height: 128px; gap: 18px; }
}
@media (prefers-color-scheme: dark) {
  .action-card.mint { background: linear-gradient(135deg, #17331d, #1c3f24); }
  .action-card.coral { background: linear-gradient(135deg, #4a2418, #5b2a1b); }
  .action-card.sky { background: linear-gradient(135deg, #17323d, #1b3e4b); }
}

.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.preset {
  display: flex; flex-direction: column; gap: 12px;
  padding: 16px; transition: transform .15s, box-shadow .2s;
}
.preset:hover { box-shadow: var(--shadow-2); }
.preset-head { display: flex; gap: 12px; align-items: flex-start; }
.preset-icon {
  display: grid; place-items: center; flex-shrink: 0;
  width: 50px; height: 50px; border-radius: 15px;
  background: var(--surface-2); font-size: 26px;
}
.preset h3 { margin: 2px 0 4px; font-size: 17px; line-height: 1.25; }
.preset .meta { display: flex; flex-wrap: wrap; gap: 6px; }
.preset .blocks-line { font-size: 13px; color: var(--muted); line-height: 1.4; }
.preset-actions { display: flex; gap: 8px; align-items: center; margin-top: auto; }

.empty {
  text-align: center; padding: 48px 20px; border: 2px dashed var(--line-strong);
  border-radius: var(--radius); color: var(--ink-2);
}
.empty .big-emoji { font-size: 46px; margin-bottom: 8px; }
.empty h3 { margin: 6px 0; color: var(--ink); }

/* ---------- Composer ---------- */

.composer { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; align-items: start; }
@media (min-width: 1100px) { .composer { grid-template-columns: minmax(0, 1fr) 380px; } }
.preview-col { display: none; position: sticky; top: 84px; }
@media (min-width: 1100px) { .preview-col { display: block; } }

.blocklist { display: flex; flex-direction: column; gap: 10px; }
.block {
  overflow: hidden; transition: box-shadow .2s, transform .2s, border-color .2s;
  animation: pop .22s ease-out;
}
.block.open { box-shadow: var(--shadow-2); border-color: var(--line-strong); }
.block.error { border-color: color-mix(in srgb, var(--danger) 50%, var(--line)); }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.99); } }
.block-head { display: flex; align-items: center; gap: 10px; padding: 10px 8px 10px 12px; cursor: pointer; user-select: none; }
.block-emoji { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--surface-2); font-size: 21px; flex-shrink: 0; }
.block-title { font-weight: 800; font-size: 15.5px; }
.block-summary { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.block-tools { display: flex; gap: 0; }
.block-body { padding: 4px 16px 14px; border-top: 1px solid var(--line); animation: fade .2s; }
.block-body .first { margin-top: 12px; }
.block-error { margin: 0 16px 12px; padding: 8px 12px; border-radius: 10px; background: var(--danger-soft); color: var(--danger); font-size: 13px; font-weight: 600; }
@keyframes fade { from { opacity: 0; } }

.add-block {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 60px; border: 2px dashed var(--line-strong); border-radius: var(--radius);
  background: transparent; color: var(--ink-2); font-weight: 800; font-size: 15px; cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.add-block:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.actionbar {
  position: sticky; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px); z-index: 10;
  display: flex; gap: 8px; align-items: center;
  margin-top: 18px; padding: 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-2); border: 1px solid var(--line);
}
@media (min-width: 900px) { .actionbar { bottom: 18px; } }
.actionbar .btn.primary { flex: 1; }
.preview-fab { display: inline-flex; }
@media (min-width: 1100px) { .preview-fab { display: none; } }

.ticket-settings { padding: 14px 16px; margin-top: 10px; }
.spacing-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-top: 6px; }
@media (max-width: 480px) { .spacing-row .segmented { width: 100%; } }
.actionbar .btn { min-width: 0; }
@media (max-width: 420px) {
  .actionbar .btn:not(.primary) { padding: 0 13px; }
  .actionbar .btn:not(.primary) .lbl { display: none; }
}

/* Catalogue des blocs */
.catalog-search { position: sticky; top: 0; z-index: 2; padding-bottom: 10px; background: var(--surface); }
.catalog-group h4 { margin: 18px 2px 8px; font-size: 12.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.catalog { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.catalog button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left;
  padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface);
  cursor: pointer; transition: border-color .15s, transform .12s, box-shadow .15s;
}
.catalog button:hover { border-color: var(--accent); box-shadow: var(--shadow-1); }
.catalog button:active { transform: scale(.97); }
.catalog .emoji { font-size: 24px; }
.catalog strong { font-size: 14.5px; }
.catalog span { font-size: 12.5px; color: var(--muted); line-height: 1.3; }
.catalog .badge { font-size: 10.5px; font-weight: 800; color: var(--warn); background: var(--warn-soft); border-radius: 6px; padding: 1px 6px; }

/* ---------- Aperçu : ruban de papier thermique ---------- */

.paper-wrap { container-type: inline-size; width: 100%; max-width: 380px; margin: 0 auto; }
.paper {
  --cols: 42;
  position: relative;
  background: var(--paper); color: var(--paper-ink);
  padding: 22px 6.5% 34px;
  font-family: var(--mono);
  font-size: calc(87cqw / var(--cols) / 0.6);
  line-height: 1.32;
  box-shadow: var(--shadow-2);
  border-radius: 4px 4px 0 0;
  transition: opacity .2s;
  /* Bord dentelé du bas, comme une coupe de ticket. */
  -webkit-mask: linear-gradient(#000 0 0) top / 100% calc(100% - 9px) no-repeat,
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / 14px 9px repeat-x;
          mask: linear-gradient(#000 0 0) top / 100% calc(100% - 9px) no-repeat,
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / 14px 9px repeat-x;
}
.paper.loading { opacity: .55; }
.paper .ln { white-space: pre; overflow: hidden; min-height: 1.32em; }
.paper .ln.small { font-size: 75%; line-height: 1.76; }
.paper .ln.b { font-weight: 800; }
.paper .ln.u span { text-decoration: underline; text-underline-offset: 2px; }
.paper .ln.r span { background: var(--paper-ink); color: var(--paper); }
.paper .ln.flip { transform: rotate(180deg); }
.paper .ln.c { text-align: center; }
.paper .ln.rt { text-align: right; }
.paper .feed { height: 1.32em; }
.paper .img { width: 100%; margin: 2px 0; image-rendering: pixelated; }
.paper-meta { display: flex; justify-content: space-between; gap: 8px; margin: 12px 4px 0; font-size: 12.5px; color: var(--muted); }
.paper-empty { padding: 36px 12px; text-align: center; color: #9a9a9a; font-family: var(--font); font-size: 14px; }

/* ---------- Message rapide ---------- */

.message { max-width: 620px; margin: 0 auto; }
.photo-drop {
  position: relative; display: grid; place-items: center; gap: 8px;
  min-height: 210px; border-radius: var(--radius); overflow: hidden;
  border: 2px dashed var(--line-strong); background: var(--surface-2);
  color: var(--ink-2); cursor: pointer; text-align: center; padding: 20px;
  transition: border-color .15s, background .15s;
}
.photo-drop:hover { border-color: var(--accent); }
.photo-drop .big-emoji { font-size: 40px; }
.photo-drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-drop .remove { position: absolute; top: 10px; right: 10px; background: rgb(0 0 0 / 55%); color: #fff; }
.photo-drop.has-photo { border-style: solid; border-color: transparent; }
.pictos { display: flex; gap: 8px; flex-wrap: wrap; }
.pictos button {
  width: 52px; height: 52px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface);
  font-size: 24px; cursor: pointer; transition: border-color .15s, transform .12s, background .15s;
}
.pictos button.on { border-color: var(--accent); background: var(--accent-soft); transform: scale(1.06); }

@media (min-width: 1100px) { .message-preview, .message .section-title { display: none !important; } }

/* ---------- Historique ---------- */

.history-day { margin: 22px 2px 8px; font-weight: 800; color: var(--ink-2); }
.history-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; }
.history-item + .history-item { border-top: 1px solid var(--line); }
.history-time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; width: 44px; flex-shrink: 0; padding-top: 1px; }
.history-errors { margin: 6px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--danger); }

/* ---------- Planification ---------- */

.schedule { padding: 12px; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; background: var(--surface); }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days button {
  width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--line-strong); background: var(--surface);
  font-weight: 800; font-size: 14px; cursor: pointer; color: var(--ink-2);
  transition: background .15s, color .15s, border-color .15s, transform .12s;
}
.days button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.days button:active { transform: scale(.92); }
.quick-days { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.time-picker {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 4px 6px; border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface);
  font-variant-numeric: tabular-nums; font-weight: 800; font-size: 20px;
}
.time-picker:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.time-picker select {
  appearance: none; border: 0; background: transparent; padding: 6px 8px; border-radius: 8px;
  font: inherit; color: var(--ink); cursor: pointer; text-align: center; text-align-last: center;
}
.time-picker select:hover { background: var(--surface-2); }
.time-picker select:focus { outline: none; background: var(--accent-soft); }
.time-picker span { color: var(--muted); font-size: 16px; }
.icon-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.icon-picker button { width: 44px; height: 44px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); font-size: 21px; cursor: pointer; }
.icon-picker button.on { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- Fenêtres ---------- */

.overlay {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgb(20 14 8 / 42%);
  animation: fade .2s;
}
.sheet {
  width: 100%; max-height: 92dvh; overflow: auto;
  background: var(--surface); border-radius: 24px 24px 0 0;
  padding: 10px 18px calc(18px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-3);
  animation: slide-up .28s cubic-bezier(.2, .9, .3, 1.1);
  overscroll-behavior: contain;
}
.sheet .grabber { width: 42px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 0 auto 10px; }
.sheet-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.sheet-head h2 { margin: 0; font-size: 20px; flex: 1; }
.sheet-foot { display: flex; gap: 10px; margin-top: 18px; position: sticky; bottom: calc(-18px - env(safe-area-inset-bottom)); padding: 12px 0 calc(6px + env(safe-area-inset-bottom)); background: var(--surface); }
@keyframes slide-up { from { transform: translateY(40px); opacity: .4; } }
@media (min-width: 700px) {
  .overlay { align-items: center; padding: 24px; }
  .sheet { max-width: 640px; border-radius: 24px; padding: 18px 22px 22px; animation: rise .22s ease-out; }
  .sheet.wide { max-width: 860px; }
  .sheet .grabber { display: none; }
  .sheet-foot { bottom: -22px; padding-bottom: 8px; }
}
@keyframes rise { from { transform: translateY(14px) scale(.98); opacity: 0; } }

/* ---------- Notifications ---------- */

.toasts { position: fixed; z-index: 80; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px); display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
@media (min-width: 900px) { .toasts { bottom: 24px; } }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 16px;
  background: var(--ink); color: var(--bg); font-weight: 700; font-size: 14.5px;
  box-shadow: var(--shadow-3); animation: toast-in .3s cubic-bezier(.2, .9, .3, 1.2);
}
.toast.error { background: var(--danger); color: #fff; }
.toast .emoji { font-size: 20px; }
@keyframes toast-in { from { transform: translateY(16px) scale(.96); opacity: 0; } }

/* ---------- Connexion ---------- */

.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(100%, 440px); text-align: center; }
.login-card .logo { width: 132px; height: 132px; object-fit: contain; margin: 0 auto 6px; }
.login-card h1 { margin: 0 0 4px; font-size: 28px; letter-spacing: -0.02em; }
.who { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; margin: 28px 0 22px; }
.who button { display: flex; flex-direction: column; align-items: center; gap: 8px; border: 0; background: transparent; cursor: pointer; font-weight: 800; color: var(--ink-2); transition: transform .15s; }
.who button:hover { transform: translateY(-3px); }
.who button.on .avatar { box-shadow: 0 0 0 4px var(--bg), 0 0 0 7px currentColor; }
.who button.on { color: var(--ink); }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- Liste de courses ---------- */

.shop-add { display: flex; gap: 8px; margin-bottom: 14px; }
.shop-add .input { flex: 1; min-width: 0; }
.shop-list { overflow: hidden; }
.shop-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; font-size: 16px; }
.shop-item + .shop-item { border-top: 1px solid var(--line); }
.shop-check {
  display: grid; place-items: center; flex-shrink: 0;
  width: 28px; height: 28px; border-radius: 50%; cursor: pointer;
  border: 2px solid var(--line); background: transparent; color: transparent;
  transition: border-color .15s, color .15s, background .15s;
}
.shop-check:hover { border-color: var(--ok); color: var(--ok); background: var(--ok-soft); }
.shop-actions { display: grid; gap: 10px; margin-top: 16px; }

/* ---------- Ramassages des poubelles ---------- */

.bin-row { padding: 10px; margin-bottom: 8px; border-radius: 12px; background: var(--surface-2); }
.bin-row .item { display: flex; gap: 6px; margin-bottom: 6px; }
.bin-row .item .input { flex: 1; min-width: 0; }
.bin-when { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 6px; }
.bin-row .help { display: grid; gap: 4px; margin-top: 6px; font-size: 12.5px; color: var(--muted); }

/* ---------- Premier compte et famille ---------- */

.first-account { text-align: left; }
.family { overflow: hidden; }
.family-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
.family-row + .family-row { border-top: 1px solid var(--line); }
.family-add { display: grid; gap: 8px; margin-top: 10px; }
@media (min-width: 560px) { .family-add { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; } .family-add:has(> :nth-child(2):last-child) { grid-template-columns: minmax(0, 1fr) auto; } }

/* ---------- Accès à « Mon compte » ---------- */

/* Barre latérale (ordinateur) : prénom et « Mon compte », la déconnexion à côté. */
.account-row { display: flex; align-items: center; gap: 4px; }
.navlink.account { flex: 1; min-width: 0; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; }
.navlink.account .grow { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.navlink.account strong { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.navlink.account .muted { font-size: 12.5px; font-weight: 600; }
/* Barre du haut (téléphone) : l'avatar suivi de « Mon compte », pour qu'on le trouve. */
.topbar .me {
  display: inline-flex; align-items: center; gap: 8px; padding: 3px 12px 3px 3px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer;
}
.topbar .me:hover { background: var(--surface-2); }
@media (max-width: 380px) { .topbar .me span { display: none; } .topbar .me { padding: 3px; } }
@media (min-width: 900px) { .topbar .me { display: none; } }
