/* =====================================================================
   welcome-mutta — charte graphique Mutta
   ===================================================================== */
:root {
  --navy:        #1a2854;
  --navy-dark:   #12224b;
  --navy-deeper: #0c1838;
  --blue:        #2196d3;
  --blue-light:  #e8f4fc;
  --blue-hover:  #1c84ba;
  --bg:          #f5f7fb;
  --card-bg:     #ffffff;
  --text:        #1a2854;
  --muted:       #6b7280;
  --border:      #e5e9f2;
  --danger:      #dc2626;
  --danger-bg:   #fef2f2;
  --success:     #059669;
  --success-bg:  #ecfdf5;
  --shadow-sm:   0 1px 2px rgba(15, 25, 60, 0.06);
  --shadow-md:   0 4px 16px rgba(15, 25, 60, 0.08);
  --shadow-lg:   0 12px 40px rgba(15, 25, 60, 0.14);
  --radius:      10px;
  --radius-lg:   16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { color: var(--navy); font-weight: 700; line-height: 1.2; margin-top: 0; }
h1 { font-size: 1.85rem; margin-bottom: 1.2rem; }
h2 { font-size: 1.45rem; margin-bottom: 1rem; }
h3 { font-size: 1.1rem; margin-bottom: 0.5rem; }

code { background: var(--blue-light); color: var(--navy); padding: 0.1rem 0.4rem; border-radius: 4px; font-size: 0.9em; }

/* =================== Header =================== */
#app-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-logo {
  height: 38px;
  width: auto;
  display: block;
}
.brand-prefix {
  color: var(--muted);
  font-weight: 500;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}
.brand-at {
  color: var(--blue);
  font-weight: 700;
  font-size: 1.25em;
  margin: 0 0.05em;
}
#user-menu {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.user-pill {
  background: var(--blue-light);
  color: var(--navy);
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
}
.app-version {
  color: var(--muted);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

/* =================== Layout =================== */
main { min-height: calc(100vh - 70px); }
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}
.container-narrow {
  max-width: 480px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}
.page-title {
  margin-bottom: 0.4rem;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 0.8rem;
  text-decoration: none;
  font-weight: 500;
}
.back-link:hover { color: var(--blue); text-decoration: none; }
.page-subtitle {
  color: var(--muted);
  font-size: 1rem;
  margin-bottom: 1.8rem;
}

/* =================== Auth pages =================== */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background:
    radial-gradient(ellipse at top left, rgba(33, 150, 211, 0.10), transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(26, 40, 84, 0.08), transparent 50%),
    var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem 2.2rem;
}
.auth-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 1.2rem;
}
.auth-logo img { height: 40px; }
.auth-title {
  text-align: center;
  font-size: 1.4rem;
  margin-bottom: 0.4rem;
}
.auth-subtitle {
  text-align: center;
  color: var(--muted);
  margin-bottom: 1.8rem;
  font-size: 0.95rem;
}
.auth-footer {
  text-align: center;
  margin-top: 1.4rem;
  font-size: 0.9rem;
}

/* =================== Form fields =================== */
.field {
  margin-bottom: 1rem;
}
.field label, label.field {
  display: block;
  font-weight: 500;
  font-size: 0.88rem;
  margin-bottom: 0.35rem;
  color: var(--navy);
}
.field input, .field select, .field textarea,
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-size: 0.95rem;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(33, 150, 211, 0.15);
}
input[type=checkbox] {
  width: 1.05rem; height: 1.05rem;
  accent-color: var(--blue);
  vertical-align: middle;
  margin-right: 0.35rem;
}

/* =================== Buttons =================== */
.btn, button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.2rem;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.05s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--blue);
  color: #fff;
}
.btn-primary:hover { background: var(--blue-hover); color: #fff; }
.btn-secondary {
  background: #fff;
  color: var(--navy);
  border-color: var(--border);
}
.btn-secondary:hover { border-color: var(--blue); color: var(--blue); }
.btn-ghost {
  background: transparent;
  color: var(--navy);
  padding: 0.4rem 0.8rem;
}
.btn-ghost:hover { background: var(--bg); color: var(--navy); }
.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: transparent;
  padding: 0.4rem 0.6rem;
}
.btn-danger:hover { background: var(--danger-bg); }
.btn-block { width: 100%; }

/* Form actions row */
.actions-row {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 1.2rem;
}
.actions-row.right { justify-content: flex-end; }

/* =================== Cards / grids =================== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.card-grid {
  display: grid;
  gap: 1.2rem;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.client-card,
.form-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.client-card:hover, .form-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--blue);
}
.client-card h3, .form-card h3 {
  color: var(--navy);
  margin: 0;
  font-size: 1.1rem;
}
.client-card .code,
.form-card .meta {
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}
.client-card .actions, .form-card .actions {
  margin-top: auto;
}

/* Decorative icon block */
.icon-bubble {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--blue-light);
  color: var(--blue);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

/* =================== Tables (admin) =================== */
.table-wrap { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
table thead {
  background: var(--blue-light);
}
table th {
  text-align: left;
  font-weight: 600;
  color: var(--navy);
  padding: 0.7rem 0.9rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
table td {
  padding: 0.7rem 0.9rem;
  border-top: 1px solid var(--border);
}
table tbody tr:hover { background: #fafbfd; }
.row-actions { display: flex; gap: 0.5rem; }

/* =================== Messages =================== */
.msg { padding: 0.7rem 1rem; border-radius: var(--radius); font-size: 0.9rem; margin-top: 0.8rem; }
.msg-error { background: var(--danger-bg); color: var(--danger); border: 1px solid #fecaca; }
.msg-success { background: var(--success-bg); color: var(--success); border: 1px solid #a7f3d0; }
.error { color: var(--danger); }
.success { color: var(--success); }

/* =================== Form embed page =================== */
.form-embed-card {
  padding: 2rem;
}

/* =================== 404 page =================== */
.notfound {
  min-height: calc(100vh - 80px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  background:
    radial-gradient(ellipse at top right, rgba(33, 150, 211, 0.10), transparent 60%),
    radial-gradient(ellipse at bottom left, rgba(26, 40, 84, 0.08), transparent 60%),
    var(--bg);
}
.notfound-inner { max-width: 560px; }
.notfound-figure {
  font-size: 9rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--navy);
  margin-bottom: 0.4rem;
  display: inline-flex;
  align-items: baseline;
}
.notfound-figure .bang {
  color: var(--blue);
  margin-left: 0.1em;
}
.notfound h1 {
  font-size: 1.6rem;
  margin-bottom: 0.6rem;
}
.notfound p {
  color: var(--muted);
  margin-bottom: 1.8rem;
}

/* =================== Admin dashboard tiles =================== */
.tile-grid {
  display: grid;
  gap: 1.2rem;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.tile {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  text-decoration: none;
  color: var(--navy);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--blue);
  text-decoration: none;
}
.tile h3 { margin: 0; }
.tile p { margin: 0; color: var(--muted); font-size: 0.88rem; }

/* =================== Fieldsets =================== */
fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin: 1rem 0;
}
fieldset legend {
  font-weight: 600;
  color: var(--navy);
  padding: 0 0.5rem;
  font-size: 0.9rem;
}

/* =================== Toolbar (admin lists) =================== */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  gap: 1rem;
  flex-wrap: wrap;
}

/* =================== Tag picker (multi-select clients) =================== */
.tag-picker {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  min-height: 1.4rem;
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.7rem;
  background: var(--blue-light);
  color: var(--navy);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
}
.tag-remove {
  cursor: pointer;
  font-weight: 700;
  color: var(--navy);
  opacity: 0.5;
  font-size: 1.05rem;
  line-height: 1;
  background: none;
  border: none;
  padding: 0;
}
.tag-remove:hover { opacity: 1; color: var(--danger); }
.tag-picker-empty { color: var(--muted); font-size: 0.85rem; padding: 0.2rem 0.4rem; }

/* =================== Picto formulaire (carte client) =================== */
.form-card-pictoed {
  background: var(--blue-light);
  border: 1px solid var(--blue-light);
  border-radius: var(--radius-lg);
  padding: 1.8rem 1.2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--navy);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  min-height: 220px;
}
.form-card-pictoed:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--blue);
  text-decoration: none;
}
.form-card-pictoed .picto {
  width: 86px;
  height: 86px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.6rem;
}
.form-card-pictoed .picto img,
.form-card-pictoed .picto svg { max-width: 100%; max-height: 100%; }
.form-card-pictoed h3 {
  font-size: 1.05rem;
  margin: 0;
  font-weight: 700;
}
.form-card-pictoed .form-sub {
  color: var(--navy);
  opacity: 0.7;
  font-size: 0.9rem;
  margin-top: 0.2rem;
}

/* Admin picto preview */
.picto-preview {
  width: 80px;
  height: 80px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--blue-light);
  overflow: hidden;
}
.picto-preview img { max-width: 100%; max-height: 100%; }
.picto-row { display: flex; align-items: center; gap: 1rem; }

/* =================== Responsive =================== */
@media (max-width: 640px) {
  .header-inner { padding: 0.7rem 1rem; }
  .container { padding: 1.2rem 1rem; }
  .brand-suffix { display: none; }
  .auth-card { padding: 1.8rem 1.4rem; }
  .notfound-figure { font-size: 6rem; }
}
