:root {
  --primary:        #1e3a5f;
  --accent:         #2563eb;
  --accent-light:   #dbeafe;
  --success:        #16a34a;
  --success-light:  #dcfce7;
  --warning:        #d97706;
  --warning-light:  #fef3c7;
  --gray-50:  #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-600: #475569;
  --gray-800: #1e293b;
  --white: #ffffff;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--gray-100);
  color: var(--gray-800);
  min-height: 100vh;
  font-size: 16px;
}

/* ── Header & nav ── */
header {
  background: var(--primary);
  color: var(--white);
  padding: .875rem 1.25rem;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: var(--shadow-md);
}
.header-inner {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-link {
  color: rgba(255,255,255,.65);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 600;
  padding: .3rem .6rem;
  border-radius: 6px;
  transition: color .15s, background .15s;
  letter-spacing: -.01em;
}
.nav-link:hover { color: var(--white); background: rgba(255,255,255,.1); }
.nav-active     { color: var(--white); background: rgba(255,255,255,.15); }

.edit-hint {
  font-size: .78rem;
  color: var(--gray-400);
  margin-left: .5rem;
}

/* ── Main ── */
main {
  max-width: 860px;
  margin: 0 auto;
  padding: 1.25rem 1rem 6rem;
}

/* ── Status bar ── */
.status-bar {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .7rem 1rem;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}
.status-label { font-size: .8rem; color: var(--gray-600); }
.badge {
  display: inline-block;
  padding: .2rem .75rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .03em;
}
.badge-nouveau { background: var(--gray-200); color: var(--gray-600); }
.badge-projet  { background: var(--warning-light); color: var(--warning); }
.badge-valide  { background: var(--success-light); color: var(--success); }

/* ── Cards ── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.25rem 1.5rem;
  margin-bottom: 1rem;
}
.card-title {
  display: flex;
  align-items: center;
  gap: .625rem;
  font-size: .95rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 1.1rem;
  padding-bottom: .75rem;
  border-bottom: 1.5px solid var(--gray-100);
}
.card-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.625rem;
  height: 1.625rem;
  background: var(--primary);
  color: var(--white);
  border-radius: 50%;
  font-size: .8rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* ── Form grid ── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .875rem;
}
.form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.field.full { grid-column: 1 / -1; }

.field label {
  display: block;
  font-size: .75rem;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: .3rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.field input,
.field select {
  width: 100%;
  padding: .6rem .8rem;
  border: 1.5px solid var(--gray-200);
  border-radius: 6px;
  font-size: .9rem;
  color: var(--gray-800);
  background: var(--white);
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
  appearance: none;
}
.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .75rem center;
  padding-right: 2.25rem;
  cursor: pointer;
}
.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.field input::placeholder,
.field textarea::placeholder { color: var(--gray-300); }

.field textarea {
  width: 100%;
  padding: .6rem .8rem;
  border: 1.5px solid var(--gray-200);
  border-radius: 6px;
  font-size: .9rem;
  color: var(--gray-800);
  background: var(--white);
  font-family: inherit;
  resize: vertical;
  transition: border-color .15s, box-shadow .15s;
}
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

/* ── Damier ── */
.box-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.box-header-label { font-size: .8rem; color: var(--gray-600); }
.box-badge-display {
  background: var(--primary);
  color: var(--white);
  padding: .2rem .9rem;
  border-radius: 6px;
  font-weight: 700;
  font-size: .95rem;
  min-width: 3.5rem;
  text-align: center;
}
.box-hint {
  font-size: .75rem;
  color: var(--gray-400);
  margin-left: auto;
}

.legend {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .78rem;
  color: var(--gray-600);
}
.legend-swatch {
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 4px;
  border: 1.5px solid;
  flex-shrink: 0;
}
.legend-swatch.free     { background: var(--gray-50);     border-color: var(--gray-300); }
.legend-swatch.selected { background: var(--accent-light); border-color: var(--accent);  }
.legend-swatch.occupied { background: var(--gray-200);    border-color: var(--gray-400); }

.floor-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  max-width: 300px;
  margin: 0 auto;
}

.grid-cell {
  aspect-ratio: 5 / 4;
  border: 2px solid var(--gray-200);
  border-radius: 6px;
  background: var(--gray-50);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  color: var(--gray-400);
  transition: background .12s, border-color .12s, color .12s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.grid-cell:hover:not(.occupied):not(.selected) {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}
.grid-cell.selected {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}
.grid-cell.selected .cell-dot { display: block; }
.cell-dot {
  display: none;
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  margin-top: 3px;
}
.grid-cell.occupied {
  background: var(--gray-200);
  border-color: var(--gray-300);
  color: var(--gray-400);
  cursor: not-allowed;
}
.grid-cell.occupied .cell-label { opacity: .5; }

.grid-placeholder {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem 1rem;
  color: var(--gray-400);
  font-size: .875rem;
  line-height: 1.6;
}
.grid-placeholder .placeholder-icon {
  font-size: 2rem;
  line-height: 1;
  margin-bottom: .5rem;
  opacity: .4;
}

.grid-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1rem;
  font-size: .82rem;
  color: var(--gray-600);
  flex-wrap: wrap;
  gap: .5rem;
}
.btn-clear-sel {
  background: none;
  border: 1px solid var(--gray-300);
  color: var(--gray-600);
  padding: .3rem .75rem;
  border-radius: 6px;
  font-size: .78rem;
  cursor: pointer;
  transition: background .12s;
}
.btn-clear-sel:hover { background: var(--gray-100); }

/* ── Actions bar ── */
.actions-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(241,245,249,.97);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-top: 1px solid var(--gray-200);
  padding: .75rem 1rem;
  display: flex;
  gap: .75rem;
  flex-direction: column;
  z-index: 100;
}
@media (min-width: 480px) {
  .actions-bar { flex-direction: row; }
}

.btn {
  flex: 1;
  padding: .8rem 1rem;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: opacity .15s, transform .1s;
  letter-spacing: .01em;
}
.btn:active { transform: scale(.98); }

.btn-save {
  background: #dc2626;
  color: var(--white);
  transition: background .25s, opacity .15s, transform .1s;
}
.btn-save.btn-clean {
  background: var(--success);
}
.btn-save:hover { opacity: .88; }

.btn-pdf {
  background: var(--white);
  color: #000000;
  border: 2px solid #000000;
}
.btn-pdf:hover { background: var(--gray-100); }

.btn-validate {
  background: #dc2626;
  color: var(--white);
  transition: background .25s, opacity .15s, transform .1s;
}
.btn-validate.btn-validated {
  background: var(--success);
}
.btn-validate:hover { opacity: .88; }

/* ── Toast notification ── */
.toast {
  position: fixed;
  top: 4.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(-1rem);
  background: var(--gray-800);
  color: var(--white);
  padding: .65rem 1.25rem;
  border-radius: 8px;
  font-size: .875rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transition: opacity .2s, transform .2s;
  z-index: 300;
  white-space: nowrap;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast-success { background: var(--success); }
.toast-error   { background: #dc2626; }
.toast-info    { background: var(--gray-800); }

/* ── Section facturation ── */
.billing-list { display: flex; flex-direction: column; gap: .5rem; }
.billing-empty {
  font-size: .82rem;
  color: var(--gray-400);
  text-align: center;
  padding: 1.25rem 0;
}
.billing-row {
  display: grid;
  grid-template-columns: 5.5rem 8rem 1fr auto auto;
  align-items: center;
  gap: .625rem;
  padding: .625rem .875rem;
  border-radius: 6px;
  border: 1px solid var(--gray-200);
  font-size: .84rem;
}
.billing-acompte  { background: var(--success-light); border-color: var(--success); }
.billing-credit   { color: var(--success); }
.billing-num    { font-weight: 700; }
.billing-period { font-weight: 600; }
.billing-detail { font-size: .76rem; color: var(--gray-400); }
.billing-amount { font-weight: 700; white-space: nowrap; text-align: right; }
.billing-btn {
  padding: .3rem .7rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 5px;
  font-size: .76rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.billing-btn:hover { background: #1d4ed8; }
.billing-btn-ph { width: 3.5rem; }
.billing-btns { display: flex; gap: .35rem; align-items: center; }
.billing-btn-quittance {
  padding: .3rem .7rem;
  background: #16a34a;
  color: white;
  border: none;
  border-radius: 5px;
  font-size: .76rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.billing-btn-quittance:hover { background: #15803d; }
.billing-cloture {
  border-color: #f59e0b;
  background: #fffbeb;
}
.billing-cloture-label { color: #92400e; font-style: italic; }
.billing-cloture-date-wrap { display: flex; align-items: center; }
.billing-date-input {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  padding: .22rem .375rem;
  font-size: .8rem;
  font-family: inherit;
  color: var(--gray-700);
  background: white;
  box-sizing: border-box;
}
.billing-custom {
  border-color: #7c3aed;
  background: #f5f3ff;
}
.billing-custom-label { color: #4c1d95; font-style: italic; }
.billing-custom-amount-wrap { display: flex; align-items: center; gap: .3rem; }
.billing-num-input {
  width: 5.5rem;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  padding: .22rem .375rem;
  font-size: .8rem;
  font-family: inherit;
  text-align: right;
  background: white;
}
.billing-eur { font-size: .8rem; color: var(--gray-500); font-weight: 600; }
.billing-label-input {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  padding: .22rem .375rem;
  font-size: .8rem;
  font-family: inherit;
  color: var(--gray-700);
  background: white;
  min-width: 0;
}

@media (max-width: 560px) {
  .billing-row {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto auto;
  }
  .billing-num    { grid-column: 1; grid-row: 1; }
  .billing-btn, .billing-btn-ph, .billing-btns, .billing-btn-quittance { grid-column: 2; grid-row: 1; }
  .billing-period { grid-column: 1 / -1; grid-row: 2; }
  .billing-cloture-date-wrap { grid-column: 1 / -1; grid-row: 2; }
  .billing-custom-amount-wrap { grid-column: 1 / -1; grid-row: 2; }
  .billing-label-input { grid-column: 1 / -1; grid-row: 3; }
  .billing-detail { grid-column: 1 / -1; grid-row: 3; }
  .billing-amount { grid-column: 1 / -1; grid-row: 4; text-align: left; }
}

/* ── Section upload ── */
.upload-notice {
  font-size: .8rem;
  color: var(--warning);
  background: var(--warning-light);
  border-radius: 6px;
  padding: .6rem .875rem;
  margin-bottom: 1rem;
}
.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.upload-zone {
  border: 2px dashed var(--gray-300);
  border-radius: 8px;
  padding: 1.25rem 1rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .625rem;
  transition: border-color .15s, background .15s;
}
.upload-has-file {
  border-style: solid;
  border-color: var(--success);
  background: var(--success-light);
}
.upload-zone-title {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--gray-600);
}
.req { color: #dc2626; }
.upload-file-info { font-size: .8rem; min-height: 1.2rem; }
.file-absent { color: var(--gray-400); }
.file-present { color: var(--success); font-weight: 600; word-break: break-all; }
.upload-progress { font-size: .78rem; color: var(--accent); }
.btn-file-label {
  display: inline-block;
  padding: .45rem .9rem;
  background: var(--white);
  border: 1.5px solid var(--gray-300);
  border-radius: 6px;
  font-size: .8rem;
  font-weight: 600;
  color: var(--gray-700);
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.btn-file-label:hover { background: var(--gray-100); border-color: var(--gray-400); }
.upload-has-file .btn-file-label { border-color: var(--success); color: var(--success); }

@media (max-width: 480px) {
  .upload-grid { grid-template-columns: 1fr; }
  main { padding-bottom: 13rem; }
}

/* ── Page clients ── */
.clients-main {
  max-width: 860px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}
.clients-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
  gap: .75rem;
}
.clients-title { font-size: 1.25rem; font-weight: 700; color: var(--primary); }

.btn-new {
  background: var(--primary);
  color: var(--white);
  border: none;
  padding: .55rem 1.1rem;
  border-radius: 8px;
  font-size: .875rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: opacity .15s;
}
.btn-new:hover { opacity: .85; }

.clients-legend {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  padding: .65rem 1rem;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
  font-size: .78rem;
  color: var(--gray-600);
}
.legend-item-cl { display: flex; align-items: center; gap: .4rem; }
.legend-dot {
  display: inline-block;
  width: .9rem;
  height: .9rem;
  border-radius: 3px;
  border: 1.5px solid;
  flex-shrink: 0;
}
.dot-active   { background: #bbf7d0; border-color: #4ade80; }
.dot-upcoming { background: #fed7aa; border-color: #fb923c; }
.dot-partial  { background: #fecaca; border-color: #f87171; }

.box-code-legend {
  display: flex; align-items: center; gap: .55rem; flex-wrap: wrap;
  padding: .5rem 1rem;
  background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 1rem; font-size: .78rem; color: var(--gray-600);
}
.bcl-label { font-weight: 600; color: var(--gray-800); }
.bcl-example { font-family: monospace; font-size: .95rem; font-weight: 700; letter-spacing: .02em; }
.bcl-lot   { background: #dbeafe; color: #1d4ed8; border-radius: 3px; padding: 1px 3px; }
.bcl-niv   { background: #fef3c7; color: #b45309; border-radius: 3px; padding: 1px 3px; }
.bcl-porte { background: #dcfce7; color: #15803d; border-radius: 3px; padding: 1px 3px; }
.bcl-sep   { color: var(--gray-300); }
.bcl-item  { display: flex; align-items: center; gap: .3rem; }
.bcl-chip  { padding: 1px 6px; border-radius: 3px; font-size: .72rem; font-weight: 700; }
.bcl-chip-lot   { background: #dbeafe; color: #1d4ed8; }
.bcl-chip-niv   { background: #fef3c7; color: #b45309; }
.bcl-chip-porte { background: #dcfce7; color: #15803d; }

.clients-count {
  font-size: .78rem;
  color: var(--gray-400);
  margin-bottom: .75rem;
  padding: 0 .25rem;
}

.clients-list {
  list-style: none;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.client-row {
  display: flex;
  align-items: center;
  padding: .875rem 1.25rem;
  border-bottom: 1px solid var(--gray-100);
  gap: .875rem;
  flex-wrap: wrap;
  transition: filter .1s;
}
.client-row:last-child { border-bottom: none; }
.client-row:hover { filter: brightness(.97); }

.row-active   { background: #bbf7d0; }
.row-upcoming { background: rgba(251,146,60,.35); }
.row-partial  { background: rgba(248,113,113,.35); }

.client-name {
  font-weight: 700;
  font-size: .95rem;
  color: var(--primary);
  text-decoration: none;
  flex: 1;
  min-width: 140px;
}
.client-name:hover { text-decoration: underline; }

.client-meta {
  font-size: .78rem;
  color: var(--gray-600);
  flex: 2;
  min-width: 130px;
}

.client-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-shrink: 0;
}

.btn-delete {
  background: none;
  border: 1px solid #fca5a5;
  color: #dc2626;
  padding: .3rem .7rem;
  border-radius: 6px;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s;
}
.btn-delete:hover { background: #fee2e2; }

.box-group {
  margin-bottom: 1.25rem;
}
.box-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .45rem .85rem;
  background: var(--primary);
  color: var(--white);
  border-radius: var(--radius) var(--radius) 0 0;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .04em;
}
.box-group-count {
  font-weight: 400;
  opacity: .75;
  font-size: .77rem;
}
.box-group .clients-list {
  border-radius: 0 0 var(--radius) var(--radius);
}

.clients-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--gray-400);
  font-size: .9rem;
}

/* ── Page import LLM ── */
.import-hint {
  font-size: .85rem;
  color: var(--gray-600);
  margin-bottom: 1rem;
  line-height: 1.5;
}
.import-textarea {
  width: 100%;
  min-height: 280px;
  padding: .75rem 1rem;
  border: 1.5px solid var(--gray-200);
  border-radius: 6px;
  font-family: 'Courier New', Courier, monospace;
  font-size: .82rem;
  color: var(--gray-800);
  background: var(--gray-50);
  resize: vertical;
  transition: border-color .15s, box-shadow .15s;
  line-height: 1.5;
}
.import-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
  background: var(--white);
}
.import-actions {
  display: flex;
  gap: .75rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.import-result {
  margin-top: .875rem;
  padding: .75rem 1rem;
  border-radius: 6px;
  font-size: .875rem;
  font-weight: 500;
  line-height: 1.5;
}
.import-result-error {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #991b1b;
}
.import-result-success {
  background: var(--success-light);
  border: 1px solid #86efac;
  color: #166534;
}
.import-result-warning {
  background: var(--warning-light);
  border: 1px solid #fcd34d;
  color: #92400e;
}
.btn-inline {
  display: inline-block;
  padding: .55rem 1.25rem;
  border-radius: 8px;
  font-size: .875rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: opacity .15s;
  white-space: nowrap;
}
.btn-inline:disabled { opacity: .55; cursor: not-allowed; }
.btn-inline-primary { background: var(--primary); color: var(--white); }
.btn-inline-primary:hover:not(:disabled) { opacity: .85; }

/* ── Visionneuse pièces justificatives ── */
.file-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.88);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.file-modal-inner {
  position: relative;
  max-width: min(95vw, 900px);
  max-height: 92vh;
  background: var(--white);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,.55);
  display: flex;
  align-items: center;
  justify-content: center;
}
.file-modal-close {
  position: absolute;
  top: .5rem;
  right: .5rem;
  background: rgba(0,0,0,.55);
  color: white;
  border: none;
  border-radius: 50%;
  width: 2.1rem;
  height: 2.1rem;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  line-height: 1;
  transition: background .15s;
}
.file-modal-close:hover { background: rgba(0,0,0,.8); }
.file-modal-img {
  display: block;
  max-width: min(95vw, 900px);
  max-height: 88vh;
  width: auto;
  height: auto;
  object-fit: contain;
}
.file-modal-fallback {
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2.5rem 2rem;
  color: var(--gray-600);
  font-size: .9rem;
  text-align: center;
}
.file-viewable {
  cursor: pointer;
  text-decoration: underline dotted;
  transition: color .12s;
}
.file-viewable:hover { color: var(--accent); }

/* ── Logout nav link ── */
.nav-logout { margin-left: auto; }
.nav-logout:hover { background: rgba(255,80,80,.18); }

/* ── Login page ── */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.login-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 360px;
}
.login-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  text-align: center;
  margin-bottom: .25rem;
}
.login-subtitle {
  font-size: .875rem;
  color: var(--gray-400);
  text-align: center;
  margin-bottom: 1.75rem;
}
.login-error {
  background: #fee2e2;
  color: #dc2626;
  border-radius: var(--radius);
  padding: .6rem .9rem;
  font-size: .875rem;
  margin-bottom: 1rem;
}
.login-form .login-field { margin-bottom: 1rem; }
.login-form label {
  display: block;
  font-size: .875rem;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: .35rem;
}
.login-form input {
  width: 100%;
  padding: .6rem .8rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 1rem;
  color: var(--gray-800);
  background: var(--white);
  transition: border-color .15s;
}
.login-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.btn-login {
  width: 100%;
  padding: .7rem;
  background: var(--accent);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: .5rem;
  transition: background .15s;
}
.btn-login:hover { background: #1d4ed8; }

/* ── Responsive ── */
@media (max-width: 600px) {
  .form-grid        { grid-template-columns: 1fr; }
  .form-grid.cols-3 { grid-template-columns: 1fr 1fr; }
  .field.full       { grid-column: 1; }
  .card             { padding: 1rem; }
  .client-meta      { flex-basis: 100%; order: 3; }
}
@media (max-width: 360px) {
  .form-grid.cols-3 { grid-template-columns: 1fr; }
}

/* Page d'accueil */
.home-main {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 60px);
}
.home-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
.home-subtitle {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary);
  letter-spacing: .01em;
}
.home-logo {
  width: calc(860px / 3);
  max-width: 33.33vw;
  height: auto;
  display: block;
}

/* Page Tiime (VNC) */
.tiime-main   { max-width: 1300px; }
.tiime-vnc-wrap {
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
}
.tiime-vnc-frame {
  width: 100%;
  height: 80vh;
  border: none;
  display: block;
}
.tiime-actions  { display: flex; gap: .75rem; margin-bottom: .25rem; }
.tiime-mfa-row  { display: flex; align-items: flex-end; gap: .75rem; margin-top: .875rem; max-width: 320px; }
.tiime-mfa-row .field { flex: 1; }

.tiime-session-card .tiime-stepup-row { display: flex; align-items: flex-end; gap: .75rem; max-width: 360px; }
.tiime-session-card .field { flex: 1; }
.tiime-countdown {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: .75rem;
  font-variant-numeric: tabular-nums;
}
.tiime-vnc-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 80vh;
  color: var(--gray-400);
  font-size: .9rem;
  text-align: center;
  padding: 1rem;
}
.btn-inline-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.btn-inline-danger:hover:not(:disabled) { opacity: .85; }
