/* Portail client — style sobre et neutre, à habiller aux couleurs de l'atelier. */
:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --ink: #16181a;
  --muted: #5d6166;
  --line: #e3e3df;
  --accent: #1f5f5b;
  --accent-soft: #e6f0ef;
  --danger: #a3302a;
  --warn-bg: #fdf4e3;
  --ok-bg: #e8f3ec;
  --err-bg: #fbeceb;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px; line-height: 1.5;
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--accent); }
h1 { font-size: 1.75rem; line-height: 1.2; margin: 0 0 8px; }
h2 { font-size: 1.15rem; margin: 0; }
h3 { font-size: 1.05rem; margin: 0; }
.wrap { width: 100%; max-width: 920px; margin: 0 auto; padding: 0 16px; }
.main { flex: 1; padding-top: 28px; padding-bottom: 48px; }

.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 1.05rem; color: var(--ink); text-decoration: none; letter-spacing: .01em; }
.nav { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.nav > a:not(.btn) { color: var(--ink); text-decoration: none; }
.inline { display: inline; margin: 0; }

.footer { border-top: 1px solid var(--line); background: var(--surface); }
.footer-inner { display: flex; justify-content: space-between; gap: 12px; padding-top: 16px; padding-bottom: 16px; font-size: .85rem; color: var(--muted); flex-wrap: wrap; }
.powered { opacity: .8; }

.btn {
  display: inline-block; border: 1px solid var(--ink); background: var(--ink); color: #fff;
  padding: 10px 18px; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { opacity: .9; }
.btn[disabled] { opacity: .35; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-small { padding: 6px 12px; font-size: .9rem; }
.btn-block { width: 100%; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; }
.link.danger { color: var(--danger); font-size: .9rem; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; font-size: .9rem; }
.row-actions form { margin: 0; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.ref { font-size: .8rem; color: var(--muted); letter-spacing: .03em; text-transform: uppercase; }
.back { display: inline-block; margin-bottom: 16px; color: var(--muted); text-decoration: none; font-size: .9rem; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 8px; flex-wrap: wrap; }
.status-help { color: var(--muted); margin: 0 0 24px; }
.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: .85rem; font-weight: 600; white-space: nowrap; }
.badge-draft { background: #efefec; color: var(--muted); }

.list { display: flex; flex-direction: column; gap: 8px; }
.row-card {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
  color: inherit; text-decoration: none;
}
a.row-card:hover { border-color: var(--ink); }
.row-title { font-weight: 600; color: var(--ink); text-decoration: none; }
.row-right { text-align: right; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.empty { text-align: center; padding: 40px 20px; }
.empty p { margin: 8px 0 20px; }

.flash-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.flash { padding: 12px 16px; border-radius: 8px; background: var(--ok-bg); }
.flash-error { background: var(--err-bg); }
.flash-warning { background: var(--warn-bg); }
.notice { margin: 12px 0 0; padding: 10px 14px; border-radius: 8px; background: var(--warn-bg); font-size: .95rem; }

.section { margin-top: 32px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.checklist h2 { margin-bottom: 8px; }
.todo { margin: 0 0 16px; padding-left: 20px; }
.todo li { margin: 4px 0; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 0; }
.facts div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.facts dt, .texts dt { font-size: .8rem; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-weight: 600; }
.texts { margin: 12px 0 0; }
.texts dd { margin: 2px 0 12px; }

.garment { margin-bottom: 12px; }
.table { width: 100%; border-collapse: collapse; margin: 8px 0 12px; font-size: .95rem; }
.table th { text-align: left; font-size: .8rem; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); padding: 8px 6px; }
.table td { border-bottom: 1px solid var(--line); padding: 10px 6px; vertical-align: top; }
.table .num { text-align: right; white-space: nowrap; }
.chip { display: inline-block; margin: 0 6px 6px 0; padding: 2px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: .85rem; }

.add-box { margin-top: 12px; padding: 0; }
.add-box summary { padding: 14px 20px; cursor: pointer; font-weight: 600; }
.add-box form { padding: 0 20px 20px; }

.form > div, .field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form label, .field label { font-weight: 600; font-size: .95rem; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=email], input[type=file], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff;
  border: 1px solid #cfcfca; border-radius: 8px; padding: 10px 12px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.helptext, .help { font-size: .85rem; color: var(--muted); }
.errorlist, .error { color: var(--danger); font-size: .9rem; margin: 0; padding-left: 0; list-style: none; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; flex-direction: row !important; margin-top: 8px; }
.stack > * + * { margin-top: 16px; }

.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.choice { position: relative; display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 20px 20px 48px; cursor: pointer; }
.choice input { position: absolute; left: 18px; top: 23px; }
.choice:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.choice-title { font-weight: 700; }
.choice-text { color: var(--muted); font-size: .95rem; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
.sizes { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px 4px; margin: 0 0 16px; }
.sizes legend { font-weight: 600; padding: 0 6px; }
.size-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 10px; }
.size-cell { display: flex; flex-direction: column; gap: 4px; }
.size-cell label { font-size: .85rem; text-align: center; }
.size-cell input { text-align: center; }

.thread { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.msg { max-width: 80%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
.msg-mine { align-self: flex-end; background: var(--accent-soft); border-color: transparent; }
.msg-meta { font-size: .8rem; color: var(--muted); margin-bottom: 4px; }

.auth-card { max-width: 420px; margin: 24px auto; }

@media (max-width: 600px) {
  h1 { font-size: 1.45rem; }
  .row-card { flex-direction: column; }
  .row-right { align-items: flex-start; text-align: left; }
  .msg { max-width: 100%; }
}

/* Espace atelier */
.atelier .wrap { max-width: 1180px; }
.tag { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); }
.badge-new { background: var(--warn-bg); color: #7a4b00; }
.badge-blocked { background: var(--err-bg); color: var(--danger); }
.badge-internal { background: #efefec; color: var(--muted); }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 12px; align-items: end; margin: 16px 0 20px; padding: 16px; }
.filters .field { margin-bottom: 12px; }
.filters .actions { margin: 0 0 12px; }
.table-scroll { overflow-x: auto; }
.queue { background: var(--surface); min-width: 760px; }
.queue tr.to-take td:first-child { box-shadow: inset 3px 0 0 #d99a1e; }
.history { margin: 0; }
details.add-box .history { margin: 0 20px 20px; width: calc(100% - 40px); }
.internal-zone .thread .msg { background: #fbfbf9; border-style: dashed; }

/* Propositions */
.badge-ok { background: var(--ok-bg); color: #1d6b3a; }
.ok-notice { background: var(--ok-bg); }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 16px 0 8px; }
.tab { display: flex; flex-direction: column; padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 600; font-size: .9rem; }
.tab-active { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.tab-state { font-weight: 400; font-size: .75rem; color: var(--muted); }
.options { display: flex; flex-direction: column; gap: 12px; }
.option-parts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.part { border-top: 1px solid var(--line); padding-top: 10px; }
.part-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.thumb { display: flex; flex-direction: column; gap: 4px; max-width: 160px; text-decoration: none; }
.thumb img { width: 160px; height: 120px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.file-chip { display: inline-block; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: .85rem; }
.image-admin { margin: 10px 0 0; padding-left: 18px; }
.share-box { margin-top: 12px; }
.danger-btn { color: var(--danger); border-color: var(--danger); }
.decision { align-self: stretch; border-left: 3px solid #d99a1e; background: var(--surface); padding: 10px 14px; border-radius: 6px; }
.decision-ok { border-left-color: #2f8a4f; }
.validate-box { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.recap { font-size: 1.05rem; }
