/* Couleurs Art du Mariage : ivoire, or et encre (comme faire-part-mariage-paris.fr) */
:root {
  --bg: #faf8f5; --card: #fff; --text: #2a241f; --muted: #7a6f63; --line: #ece4d8;
  --accent: #b3894a; --accent-dark: #8f6b35; --accent2: #8f6b35; --accent-soft: #f4ece0;
  --ok: #1e8a4c; --warn: #b45309; --err: #c0392b;
  --radius: 12px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--err); }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 17px; margin: 22px 0 10px; }
a { color: var(--accent2); }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login { background: linear-gradient(160deg, #fff 0%, #f4ece0 100%); }
.login .card { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 18px 40px -20px rgba(179, 137, 74, .35); }

/* Logo */
.brand { display: flex; align-items: center; gap: 9px; color: inherit; text-decoration: none; line-height: 1; }
.brand img { display: block; border-radius: 9px; }
.brand b { font-size: 18px; font-weight: 800; letter-spacing: -.01em; }
.brand span { font-size: 18px; font-weight: 400; margin-left: 4px; }
.brand small { display: block; font-size: 10px; font-weight: 700; letter-spacing: .22em; opacity: .85; margin-top: 3px; }
.brand-login { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 6px 0 4px; }
.brand-login img { width: 100%; max-width: 260px; height: auto; }
.brand-login small { font-size: 11px; font-weight: 700; letter-spacing: .3em; color: var(--muted); }
.brand-top { display: flex; align-items: center; gap: 8px; flex-shrink: 0; padding: 7px 10px; background: #fff; border-radius: 10px; text-decoration: none; box-shadow: 0 2px 8px rgba(0,0,0,.12); line-height: 1; }
.brand-top img { display: block; width: 148px; height: auto; }
.brand-top small { font-size: 10px; font-weight: 800; letter-spacing: .18em; color: var(--accent); }
.brand-lg { color: var(--text); margin-bottom: 4px; }
.brand-lg b, .brand-lg span { font-size: 24px; }
.brand-lg span { color: var(--accent); }
.brand-lg small { color: var(--muted); }

.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 9px 16px; background: #2a241f; color: #fff; box-shadow: 0 2px 10px rgba(179, 137, 74, .25); }
.topbar .brand img { box-shadow: 0 0 0 2px rgba(255,255,255,.85); }
.topbar input { flex: 1; max-width: 420px; margin-left: auto; border: 0; }
.icon-btn { position: relative; background: none; border: 0; color: inherit; font-size: 22px; cursor: pointer; display: none; }
.sidebar { position: fixed; top: 56px; left: 0; bottom: 0; width: 210px; background: var(--card); border-right: 1px solid var(--line); padding: 12px 8px; overflow-y: auto; z-index: 15; }
.sidebar a { display: flex; align-items: center; gap: 6px; padding: 9px 12px; border-radius: 8px; color: var(--text); text-decoration: none; }
.sidebar a:hover, .sidebar a.active { background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; }
.sidebar a.side-logo, .sidebar a.side-logo:hover, .sidebar a.side-logo.active { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; padding: 6px 10px 14px; margin-bottom: 8px; border-bottom: 1px solid var(--line); border-radius: 0; background: none; }
.side-logo img { display: block; width: 100%; max-width: 180px; height: auto; }
.side-logo small { font-size: 10px; font-weight: 800; letter-spacing: .3em; color: var(--accent); padding-left: 2px; }

/* Compteur de nouvelles demandes */
.mail-count { display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 99px; background: #2563eb; color: #fff; font: 700 12px/18px system-ui, sans-serif; text-align: center; font-style: normal; margin-left: auto; }
.mail-list td { vertical-align: top; }
.mail-list tr.non-lu td { font-weight: 700; }
.mail-list tr.non-lu td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.mail-list .apercu-de { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
.mail-dossiers { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 12px; }
.mail-dossiers a { padding: 6px 12px; border: 1px solid var(--line); border-radius: 99px; text-decoration: none; color: var(--text); background: #fff; font-size: 14px; }
.mail-dossiers a.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.mail-tete { border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: 10px; line-height: 1.5; }
.mail-tete h2 { margin: 0 0 6px; font-size: 20px; }
.mail-corps { width: 100%; min-height: 360px; border: 0; background: #fff; border-radius: 8px; }
.mail-texte { white-space: pre-wrap; word-break: break-word; font: inherit; margin: 0; }
.mail-pj { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.mail-pj a { padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; background: var(--accent-soft); color: var(--accent-dark); font-size: 14px; }
.chat-count { display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 99px; background: #1e8a4c; color: #fff; font: 700 12px/18px system-ui, sans-serif; text-align: center; font-style: normal; margin-left: auto; }
.bottomnav .chat-count { position: absolute; margin: -4px 0 0 -6px; font-size: 10px; line-height: 15px; min-width: 16px; padding: 0 4px; }
.dem-count { display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 99px; background: var(--accent); color: #fff; font: 700 12px/18px system-ui, sans-serif; text-align: center; font-style: normal; margin-left: auto; }
.dem-count.dot { position: absolute; top: 0; right: -2px; min-width: 10px; width: 10px; height: 10px; padding: 0; font-size: 0; background: #fff; border: 2px solid var(--accent); }
.cmd-count { display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 99px; background: #1f6fd1; color: #fff; font: 700 12px/18px system-ui, sans-serif; text-align: center; font-style: normal; margin-left: auto; }
.cmd-count.hidden { display: none; }
.cmd-art { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 14px; }
.cmd-art td { padding: 6px 0; border-bottom: 1px solid #f0e8e2; vertical-align: top; }
.cmd-art td.r { text-align: right; white-space: nowrap; padding-left: 12px; }
.bottomnav .dem-count { position: absolute; margin: -4px 0 0 -6px; font-size: 10px; line-height: 15px; min-width: 16px; padding: 0 4px; }
.stat-link { text-decoration: none; color: inherit; }
.stat-hot { border-color: var(--accent); background: var(--accent-soft); }
.dem-info { display: grid; gap: 3px; margin: 8px 0; }
.dem-msg { white-space: pre-wrap; background: var(--bg); border-left: 3px solid var(--accent); padding: 8px 10px; border-radius: 6px; margin: 8px 0; }
.small { font-size: 13px; }
.notif-card { margin-bottom: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
main { margin-left: 210px; padding: 20px; max-width: 1200px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.grid { display: grid; gap: 12px; }
.stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.stat .v { font-size: 24px; font-weight: 700; color: var(--accent); }
.stat .l { color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

input, select, textarea { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; color: var(--text); }
textarea { min-height: 80px; resize: vertical; }
label { display: block; font-size: 13px; color: var(--muted); }
label > input, label > select, label > textarea { margin-top: 3px; }
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.form .full { grid-column: 1 / -1; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--text); font: inherit; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--accent2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(179, 137, 74, .35); outline-offset: 0; border-color: var(--accent); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--err); }
.btn.small { padding: 5px 9px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }

table { width: 100%; border-collapse: collapse; background: var(--card); }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #faf8f5; font-size: 12px; text-transform: uppercase; color: var(--muted); font-weight: 600; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #faf5ee; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.right { text-align: right; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; background: #f5efea; color: var(--muted); }
.badge.ok { background: #e3f4ea; color: var(--ok); }
.badge.warn { background: #fdf1dd; color: var(--warn); }
.badge.err { background: #fbe6e3; color: var(--err); }
.badge.info { background: var(--accent-soft); color: var(--accent-dark); }

.lignes td { padding: 4px; }
.lignes input { padding: 7px; }
.totaux { margin-left: auto; max-width: 300px; }
.totaux div { display: flex; justify-content: space-between; padding: 3px 0; }
.totaux .big { font-weight: 700; font-size: 18px; border-top: 1px solid var(--line); padding-top: 6px; }

.modal { position: fixed; inset: 0; background: rgba(10, 20, 30, .45); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal-box { background: var(--card); border-radius: var(--radius); padding: 18px; width: 100%; max-width: 680px; max-height: 92vh; overflow-y: auto; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 60; max-width: 90vw; }
.toast.err { background: var(--err); }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 8px 0; border-bottom: 1px solid var(--line); }

.wa { display: grid; grid-template-columns: 300px 1fr; height: calc(100vh - 190px); min-height: 420px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--card); }
.wa-list { border-right: 1px solid var(--line); overflow-y: auto; }
.wa-item { padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.wa-item:hover, .wa-item.active { background: #eef5ee; }
.wa-item .n { font-weight: 600; display: flex; justify-content: space-between; gap: 6px; }
.wa-item .p { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-chat { display: flex; flex-direction: column; min-width: 0; }
.wa-msgs { flex: 1; overflow-y: auto; padding: 14px; background: #ece5dd; display: flex; flex-direction: column; gap: 6px; }
.bubble { max-width: 75%; padding: 7px 10px; border-radius: 8px; background: #fff; white-space: pre-wrap; word-wrap: break-word; }
.bubble.me { align-self: flex-end; background: #d9fdd3; }
.bubble small { display: block; color: var(--muted); font-size: 11px; text-align: right; }
.wa-send { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs .btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.nav-backdrop, .bottomnav { display: none; }
img, canvas { max-width: 100%; height: auto; }

@media (max-width: 820px) {
  html { -webkit-text-size-adjust: 100%; }
  body { overflow-x: hidden; }
  .icon-btn { display: block; padding: 4px 6px; }
  .topbar { padding: 8px 12px; padding-top: calc(8px + env(safe-area-inset-top)); gap: 8px; }
  .topbar input { max-width: none; }
  .topbar .brand div { display: none; }
  .brand-top { padding: 6px 8px; }
  .brand-top img { width: 112px; }
  .brand-top small { display: none; }
  .sidebar { top: 0; width: 250px; padding-top: calc(16px + env(safe-area-inset-top)); transform: translateX(-100%); transition: transform .2s; box-shadow: 2px 0 12px rgba(0,0,0,.15); z-index: 40; }
  .sidebar.open { transform: none; }
  .sidebar a { padding: 12px 14px; font-size: 16px; }
  .sidebar.open + .nav-backdrop { display: block; position: fixed; inset: 0; background: rgba(10,20,30,.4); z-index: 30; }
  main { margin-left: 0; padding: 14px 12px calc(84px + env(safe-area-inset-bottom)); }
  h1 { font-size: 20px; }

  /* champs à 16px : évite le zoom automatique sur iPhone */
  input, select, textarea { font-size: 16px; padding: 11px 10px; }
  .btn { padding: 11px 14px; }
  .btn.small { padding: 8px 11px; }
  .form { grid-template-columns: 1fr; }
  .cols2 { grid-template-columns: 1fr; }
  .row > .btn { flex: 1 1 auto; justify-content: center; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat .v { font-size: 20px; }
  .card { padding: 14px 12px; }

  th, td { padding: 8px 7px; }
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .lignes { min-width: 560px; }
  .totaux { max-width: none; width: 100%; }

  .modal { padding: 0; place-items: end stretch; }
  .modal-box { max-width: none; max-height: 92vh; border-radius: 14px 14px 0 0; padding: 16px 14px calc(16px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(80px + env(safe-area-inset-bottom)); }

  .wa { grid-template-columns: 1fr; height: auto; }
  .wa-list { max-height: 260px; border-right: 0; border-bottom: 1px solid var(--line); }
  .wa-msgs { min-height: 340px; }
  .bubble { max-width: 88%; }
  .hide-m { display: none; }

  .bottomnav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -2px 10px rgba(0,0,0,.05); }
  .bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 7px 2px 8px; font-size: 11px; color: var(--muted); text-decoration: none; }
  .bottomnav a span { font-size: 20px; line-height: 1.1; }
  .bottomnav a.active { color: var(--accent); font-weight: 600; }
}

/* ---- Art du Mariage : polices et logo texte (même graphisme que le site) ---- */
body { font-family: Jost, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
h1, h2, .fp-logo { font-family: "Cormorant Garamond", Georgia, serif; font-weight: 500; letter-spacing: .01em; }
h1 { font-size: 30px; } h2 { font-size: 22px; }
.fp-logo { display: block; color: #2a241f; font-size: 26px; font-weight: 600; line-height: 1; white-space: nowrap; }
.brand-login .fp-logo { font-size: 38px; }
.brand-top { background: transparent; box-shadow: none; padding: 4px 0; }
.brand-top .fp-logo { color: #fff; font-size: 22px; }
.brand-top small { color: #c9a66b; }
.side-logo .fp-logo { font-size: 27px; }
.login { background: linear-gradient(160deg, #faf8f5 0%, #f4ece0 100%); }
.btn.primary { background: #2a241f; border-color: #2a241f; }
.btn.primary:hover { background: #b3894a; border-color: #b3894a; }