:root {
  --ink: #1f2933;
  --muted: #616e7c;
  --line: #d9dee5;
  --surface: #ffffff;
  --background: #f4f6f8;
  --accent: #1d4f91;
  --accent-dark: #163c6e;
  --accent-soft: #e8eff9;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --warn: #8a5a00;
  --warn-soft: #fff4d6;
  --ok: #1e6b3a;
  --ok-soft: #e4f4ea;
  --radius: 8px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--background);
}

body.modal-open {
  overflow: hidden;
}

a {
  color: var(--accent);
}

h1, h2, h3 {
  line-height: 1.25;
  margin: 0 0 .5rem;
}

h3 {
  font-size: 1.05rem;
}

img {
  max-width: 100%;
}

.wrap {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 16px;
}

main.wrap {
  padding-top: 20px;
  padding-bottom: 60px;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: .875rem;
}

.sample-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  font-size: .85rem;
  background: var(--warn-soft);
  color: #5c4100;
  border-bottom: 1px solid #f0dfa8;
  text-align: center;
}

.link-button {
  background: none;
  border: 0;
  padding: 2px 0;
  font: inherit;
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
  font-weight: 600;
}

.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding-top: 18px;
}

.app-header h1 {
  font-size: 1.35rem;
}

.lead {
  margin: 0 0 14px;
  color: var(--muted);
  max-width: 760px;
}

.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
}

.tabs a {
  padding: 10px 14px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}

.tabs a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  padding: 8px 16px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover {
  background: var(--accent-dark);
}

.btn:disabled {
  opacity: .6;
  cursor: wait;
}

.btn-secondary {
  background: var(--surface);
  color: var(--accent);
}

.btn-secondary:hover {
  background: var(--accent-soft);
}

.btn-small {
  min-height: 34px;
  padding: 4px 10px;
  font-size: .875rem;
}

.btn-block {
  width: 100%;
}

.icon-button {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 6px;
  padding: 4px 9px;
  font: inherit;
  font-size: .85rem;
  cursor: pointer;
}

.icon-button:disabled {
  opacity: .4;
  cursor: default;
}

.icon-button.danger {
  color: var(--danger);
}

.tag {
  display: inline-block;
  padding: 0 7px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  line-height: 1.6;
  vertical-align: middle;
  background: #eef1f4;
  color: var(--muted);
  white-space: nowrap;
}

.tag-sample {
  background: var(--warn-soft);
  color: var(--warn);
}

.tag-new {
  background: var(--ok-soft);
  color: var(--ok);
}

.tag-warn {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-nouvelle {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge-en_cours {
  background: var(--warn-soft);
  color: var(--warn);
}

.badge-traite {
  background: var(--ok-soft);
  color: var(--ok);
}

.notice {
  padding: 10px 12px;
  border-radius: var(--radius);
  background: #eef1f4;
  border: 1px solid var(--line);
  margin: 12px 0;
}

.notice-info {
  background: var(--accent-soft);
  border-color: #c9d8ee;
}

.notice-error {
  background: var(--danger-soft);
  border-color: #f3c3bd;
  color: var(--danger);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.section-head {
  margin: 8px 0 14px;
}

.section-head.row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  justify-content: space-between;
}

.section-title {
  font-size: 1.25rem;
}

.section-head p {
  margin: 0;
}

.try-panel {
  display: flex;
  gap: 16px;
  align-items: center;
  background: var(--surface);
  border: 1px solid #c9d8ee;
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 18px;
}

.try-panel h2 {
  font-size: 1.1rem;
}

.try-panel ol {
  margin: 0 0 6px;
  padding-left: 1.2rem;
}

.try-panel p {
  margin: 0;
}

.try-qr {
  flex: none;
  display: none;
}

.try-qr img {
  display: block;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.board {
  display: grid;
  gap: 14px;
}

.column {
  background: #e9edf1;
  border-radius: var(--radius);
  padding: 10px;
  min-width: 0;
}

.column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px 10px;
}

.column-head h2 {
  font-size: 1rem;
  margin: 0;
}

.count {
  background: var(--surface);
  border-radius: 999px;
  padding: 0 9px;
  font-size: .85rem;
  font-weight: 600;
}

.cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 70px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: grab;
  font-size: .9rem;
  overflow-wrap: anywhere;
  transition: box-shadow .15s;
}

.card:hover,
.card:focus-visible {
  box-shadow: 0 2px 8px rgba(15, 30, 50, .12);
  outline: none;
  border-color: #b8c4d2;
}

.card.is-new {
  border-color: var(--ok);
  box-shadow: 0 0 0 3px var(--ok-soft);
  animation: arrive 1.2s ease-out;
}

@keyframes arrive {
  from { transform: translateY(-6px); background: var(--ok-soft); }
  to { transform: none; background: var(--surface); }
}

.card-ghost {
  opacity: .4;
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}

.card-name {
  font-size: .98rem;
}

.card-line {
  color: var(--ink);
}

.card-meta {
  color: var(--muted);
  font-size: .8rem;
  margin-top: 6px;
}

.card-assignee {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed var(--line);
  font-size: .82rem;
}

.card-assignee.unassigned {
  color: var(--muted);
  font-style: italic;
}

.field {
  display: block;
  font-weight: 600;
  font-size: .9rem;
  margin-bottom: 12px;
}

.field input,
.field select,
.field textarea,
.public-field input[type="text"],
.public-field input[type="email"],
.public-field input[type="tel"],
.public-field input[type="date"],
.public-field select,
.public-field textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  margin-top: 4px;
  padding: 9px 11px;
  border: 1px solid #b8c1cc;
  border-radius: 6px;
  background: #fff;
  font: inherit;
  font-weight: 400;
  color: var(--ink);
  min-height: 44px;
}

.field textarea,
.public-field textarea {
  resize: vertical;
}

.public-field input[type="date"] {
  -webkit-appearance: none;
  appearance: none;
  min-width: 0;
  text-align: left;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .9rem;
  min-height: 44px;
  cursor: pointer;
}

.check input {
  width: 18px;
  height: 18px;
}

.field-error {
  display: block;
  color: var(--danger);
  font-size: .85rem;
  font-weight: 600;
  margin: 4px 0 0;
  min-height: 0;
}

.field-error:empty {
  display: none;
}

.has-error input,
.has-error select,
.has-error textarea {
  border-color: var(--danger);
}

.question-item.has-error {
  border-color: var(--danger);
}

.saved {
  font-size: .9rem;
  color: var(--ok);
  font-weight: 600;
  min-height: 1.2em;
  margin: 0;
}

.saved.saved-error {
  color: var(--danger);
}

.grid-2 {
  display: grid;
  gap: 0 14px;
  margin-top: 12px;
}

.coords {
  list-style: none;
  padding: 0;
  margin: 8px 0;
  overflow-wrap: anywhere;
}

.coords li {
  padding: 2px 0;
}

.coords .muted {
  display: inline-block;
  min-width: 84px;
}

.answers {
  margin: 0;
}

.answers > div {
  padding: 8px 0;
  border-bottom: 1px solid #eef1f4;
}

.answers dt {
  font-size: .82rem;
  color: var(--muted);
  font-weight: 600;
}

.answers dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: .8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 32, .45);
}

.modal-panel {
  position: relative;
  width: 100%;
  max-width: 640px;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: 12px 12px 0 0;
  padding: 20px 18px 24px;
}

.modal-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 40px;
  height: 40px;
  border: 0;
  background: none;
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 60;
  width: calc(100% - 32px);
  max-width: 520px;
  background: #1f2933;
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
  font-size: .92rem;
}

.toast a {
  color: #b9d3ff;
}

.form-list,
.contact-list,
.request-list,
.plain-list,
.question-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.form-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
  display: grid;
  gap: 12px;
}

.form-item h3 a {
  text-decoration: none;
  color: var(--ink);
}

.form-item-head p {
  margin: 0 0 8px;
}

.share {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  min-width: 0;
}

.share-qr {
  flex: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  width: 112px;
  height: 112px;
}

.share-large .share-qr {
  width: 150px;
  height: 150px;
}

.share-text {
  flex: 1;
  min-width: 0;
}

.share-text .field {
  margin-bottom: 8px;
}

.share-url {
  font-size: .85rem !important;
  background: #f8fafc !important;
}

.share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.question-item {
  background: #fafbfc;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 10px;
}

.q-head {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.q-num {
  font-weight: 700;
  font-size: .85rem;
  color: var(--accent);
}

.q-tools {
  display: flex;
  gap: 4px;
}

.q-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0 18px;
  align-items: flex-end;
}

.q-row .field {
  flex: 1 1 200px;
}

.add-question {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: flex-end;
  padding: 12px;
  border: 1px dashed #b8c1cc;
  border-radius: var(--radius);
  margin: 6px 0 16px;
}

.add-question .field {
  flex: 1 1 220px;
  margin: 0;
}

.editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.search {
  max-width: 420px;
}

.contact-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
  text-decoration: none;
  color: var(--ink);
}

.contact-row:hover {
  border-color: #b8c4d2;
}

.contact-main {
  min-width: 0;
  overflow-wrap: anywhere;
}

.contact-coords {
  display: block;
  color: var(--muted);
  font-size: .87rem;
}

.contact-side {
  flex: none;
  text-align: right;
  font-size: .9rem;
}

.contact-side .muted {
  display: block;
}

.dup-panel {
  background: var(--danger-soft);
  border: 1px solid #f3c3bd;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 18px;
}

.dup-panel h3 {
  color: var(--danger);
}

.dup-panel p {
  margin: 0 0 10px;
}

.dup-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.dup-contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  flex: 1 1 280px;
}

.dup-contact {
  flex: 1 1 200px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  text-decoration: none;
  color: var(--ink);
  font-size: .9rem;
  overflow-wrap: anywhere;
}

.contact-title {
  margin-bottom: 12px;
}

.detail-grid {
  display: grid;
  gap: 0 16px;
}

.plain-list li {
  padding: 6px 0;
  border-bottom: 1px solid #eef1f4;
}

.request-row {
  display: flex;
  width: 100%;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  background: none;
  border: 0;
  border-bottom: 1px solid #eef1f4;
  padding: 10px 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.request-row:hover strong {
  color: var(--accent);
}

.request-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex: none;
}

.required {
  color: var(--danger);
}

.public-body {
  background: var(--background);
}

.public-wrap {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 16px 12px 40px;
}

.public-form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px 16px;
}

.public-head {
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
  padding-bottom: 8px;
  overflow-wrap: anywhere;
}

.public-head h1 {
  font-size: 1.4rem;
  margin-top: 6px;
}

.public-field {
  margin-bottom: 18px;
}

.public-label {
  display: block;
  font-weight: 600;
  margin: 0 0 2px;
  overflow-wrap: anywhere;
}

.choices {
  display: grid;
  gap: 4px;
  margin-top: 4px;
}

.choice {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.choice input {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 0;
}

.has-error .choice {
  border-color: #f3c3bd;
}

.public-foot {
  text-align: center;
  margin-top: 16px;
}

.confirmation {
  text-align: center;
}

.check-mark {
  width: 56px;
  height: 56px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 1.8rem;
  line-height: 56px;
  font-weight: 700;
}

@media (min-width: 640px) {
  .try-qr {
    display: block;
  }

  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }

  .modal {
    align-items: center;
  }

  .modal-panel {
    border-radius: 12px;
    padding: 24px;
  }

  .public-form {
    padding: 28px 28px;
  }

  .form-item {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
    align-items: start;
  }
}

@media (min-width: 900px) {
  .board {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
  }

  .cards {
    min-height: 160px;
  }

  .detail-grid {
    grid-template-columns: 1fr 1fr;
  }

  .app-header h1 {
    font-size: 1.5rem;
  }
}

@media (max-width: 420px) {
  .share {
    flex-direction: column;
  }

  .share-qr {
    width: 140px;
    height: 140px;
  }

  .contact-row {
    flex-direction: column;
  }

  .contact-side {
    text-align: left;
  }
}
