/* ============================================================================
   Live-Vendor Backoffice — Feuille de style principale
   ============================================================================
   Inspirations :
   - Structure dense et sobre (style "La Calabraise" — POS moderne)
   - Couleurs Live-Vendor : orange/corail vif sur fond bleu nuit profond
   - Typographie : Manrope pour le corps + JetBrains Mono pour le technique
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ----- Variables ----- */
:root {
  /* Identité Live-Vendor */
  --lv-orange:        #F5532C;
  --lv-orange-hover:  #DE4521;
  --lv-orange-soft:   #FFF1EC;

  --lv-navy:          #0E1729;
  --lv-navy-light:    #1A2540;
  --lv-navy-soft:     #F4F6FB;

  /* Neutres */
  --bg:               #FAFAF8;
  --surface:          #FFFFFF;
  --surface-hover:    #F7F7F4;
  --border:           #E8E6E0;
  --border-strong:    #D4D2CB;

  /* Texte */
  --text:             #1A1A1A;
  --text-muted:       #6B6B66;
  --text-faded:       #9B9B95;

  /* Sémantique */
  --success:          #14A06B;
  --success-soft:     #E6F5EE;
  --danger:           #D93838;
  --danger-soft:      #FCEBEB;
  --warning:          #E58A00;
  --warning-soft:     #FFF4DE;
  --info:             #2D6CDF;
  --info-soft:        #E9F0FB;

  /* Rayons */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  /* Espaces */
  --gap-1: 4px;
  --gap-2: 8px;
  --gap-3: 12px;
  --gap-4: 16px;
  --gap-5: 24px;
  --gap-6: 32px;
  --gap-7: 48px;

  /* Typo */
  --font-sans: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;

  /* Sidebar */
  --sidebar-width: 240px;
}

/* ----- Reset léger ----- */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

button {
  font: inherit;
  cursor: pointer;
  border: 0;
  background: none;
}

input, select, textarea {
  font: inherit;
  color: inherit;
}

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.01em;
}

h1 { font-size: 24px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; font-weight: 600; }

code, kbd, .mono {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* ============================================================================
   Login (centré, plein écran)
   ============================================================================ */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(at 20% 30%, rgba(245, 83, 44, 0.06) 0px, transparent 50%),
    radial-gradient(at 80% 70%, rgba(14, 23, 41, 0.04) 0px, transparent 50%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 40px 32px 32px;
  box-shadow: 0 12px 32px rgba(14, 23, 41, 0.04);
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.login-logo {
  width: 100%;
  max-width: 220px;
  height: auto;
  display: block;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 32px;
}

/* ============================================================================
   Layout principal
   ============================================================================ */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--lv-navy);
  color: rgba(255, 255, 255, 0.8);
  padding: 24px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  padding: 0 24px 28px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: white;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.sidebar-brand-mark {
  width: 28px;
  height: 24px;
  flex-shrink: 0;
}

.sidebar-brand-text {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: white;
}
.sidebar-brand-text .orange {
  color: var(--lv-orange);
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 12px;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  color: rgba(255, 255, 255, 0.75);
  border-radius: var(--r-sm);
  font-weight: 500;
  font-size: 13.5px;
  transition: background .15s, color .15s;
}
.sidebar-nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: white;
  text-decoration: none;
}
.sidebar-nav-item.active {
  background: rgba(245, 83, 44, 0.16);
  color: var(--lv-orange);
}

.sidebar-nav-item .icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.sidebar-nav-section {
  padding: 16px 24px 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.35);
  font-weight: 600;
}

.sidebar-user {
  margin-top: auto;
  padding: 16px 12px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
}

.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--lv-orange);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}

.sidebar-user-info {
  min-width: 0;
  flex: 1;
}
.sidebar-user-info .name {
  color: white;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-info .email {
  color: rgba(255, 255, 255, 0.5);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-logout {
  color: rgba(255, 255, 255, 0.5);
  padding: 6px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}
.sidebar-user-logout:hover {
  color: white;
  background: rgba(255, 255, 255, 0.06);
}
.sidebar-user-logout svg { width: 16px; height: 16px; }

/* ----- Main content ----- */

.main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  padding: 18px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--lv-navy);
}

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

.content {
  padding: 32px;
  flex: 1;
}

/* ============================================================================
   Composants
   ============================================================================ */

/* ----- Form ----- */
.field {
  margin-bottom: 16px;
}
.field-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.input, .select, .textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: 14px;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--lv-orange);
  box-shadow: 0 0 0 3px rgba(245, 83, 44, 0.12);
}
.input::placeholder, .textarea::placeholder {
  color: var(--text-faded);
}
.textarea {
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
}
.select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B6B66' stroke-width='2'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
  padding-right: 32px;
}

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

.help { font-size: 12px; color: var(--text-faded); margin-top: 4px; }
.field-error { font-size: 12px; color: var(--danger); margin-top: 4px; }

/* ----- Buttons ----- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--r-sm);
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: -0.005em;
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
  white-space: nowrap;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn-primary {
  background: var(--lv-orange);
  color: white;
}
.btn-primary:hover { background: var(--lv-orange-hover); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--surface-hover); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover { background: #B82B2B; }

.btn-sm { padding: 6px 10px; font-size: 12.5px; }
.btn-block { width: 100%; }

.btn .icon { width: 14px; height: 14px; }

/* ----- Card ----- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--lv-navy);
}
.card-body { padding: 20px; }
.card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  background: var(--surface-hover);
}

/* ----- Table ----- */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table thead th {
  background: var(--surface-hover);
  padding: 11px 16px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:last-child td {
  border-bottom: 0;
}
.table tbody tr:hover {
  background: var(--surface-hover);
}
.table .row-link {
  cursor: pointer;
}

/* Cellule slug : monospace, plus discret */
.cell-slug {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ----- Badges (statuts) ----- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger  { background: var(--danger-soft);  color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-info    { background: var(--info-soft);    color: var(--info); }
.badge-muted   { background: #EEE; color: var(--text-muted); }

.badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

/* ----- Pagination ----- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-hover);
  font-size: 13px;
  color: var(--text-muted);
}
.pagination-actions {
  display: flex;
  gap: 6px;
}
.pagination-actions button {
  padding: 5px 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 500;
}
.pagination-actions button:hover:not(:disabled) {
  background: var(--surface-hover);
}
.pagination-actions button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ----- Filtres au-dessus du tableau ----- */
.filters {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.filters .input, .filters .select {
  padding: 7px 11px;
  font-size: 13px;
}
.filters .search-input {
  flex: 1;
  max-width: 320px;
}

/* ----- Toast / alert inline ----- */
.alert {
  padding: 11px 14px;
  border-radius: var(--r-sm);
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: rgba(217, 56, 56, 0.2); }
.alert-success { background: var(--success-soft); color: var(--success); border-color: rgba(20, 160, 107, 0.2); }
.alert-info { background: var(--info-soft); color: var(--info); border-color: rgba(45, 108, 223, 0.2); }

/* ----- Empty state ----- */
.empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
}
.empty-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.empty-message {
  font-size: 13.5px;
  margin-bottom: 20px;
}

/* ----- Modules pill cluster ----- */
.modules {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.modules .pill {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--lv-navy-soft);
  color: var(--lv-navy);
}

/* ----- Loading spinner ----- */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ----- Toggle switch (compact) ----- */
.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #D4D2CB;
  border-radius: 100px;
  transition: .2s;
}
.switch-slider::before {
  content: '';
  position: absolute;
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: .2s;
}
.switch input:checked + .switch-slider { background: var(--lv-orange); }
.switch input:checked + .switch-slider::before { transform: translateX(16px); }

/* ============================================================================
   Badge Owner — accent particulier
   ============================================================================ */
.badge-owner {
  background: rgba(245, 83, 44, 0.12);
  color: var(--lv-orange);
}

/* ============================================================================
   Readonly value (utilisé dans les modals pour afficher des champs en lecture)
   ============================================================================ */
.readonly-value {
  padding: 10px 12px;
  background: var(--surface-hover);
  border-radius: var(--r-sm);
  font-size: 14px;
  color: var(--text);
  border: 1px solid var(--border);
}

/* ============================================================================
   Affichage du mot de passe (modal après création/reset)
   ============================================================================ */
.password-display {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: var(--lv-navy);
  border-radius: var(--r-sm);
}
.password-display code {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 500;
  color: white;
  letter-spacing: 0.05em;
  user-select: all;
}
.password-display .btn {
  flex-shrink: 0;
}

/* ============================================================================
   Modals
   ============================================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(14, 23, 41, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
  animation: fade-in .15s ease-out;
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(14, 23, 41, 0.2);
  animation: modal-pop .2s ease-out;
}
@keyframes modal-pop {
  from { transform: translateY(8px) scale(0.98); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--lv-navy);
}
.modal-close {
  background: transparent;
  border: 0;
  font-size: 18px;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: var(--r-sm);
  cursor: pointer;
}
.modal-close:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  background: var(--surface-hover);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}

/* ============================================================================
   Fiche tenant — en-tête et sections déroulables
   ============================================================================ */

.tenant-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.tenant-header-main {
  flex: 1;
  min-width: 0;
}
.tenant-display-name {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--lv-navy);
  margin: 0 0 4px 0;
}
.tenant-header-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}
.tenant-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.save-feedback {
  font-size: 13px;
  color: var(--text-muted);
}

/* Cards de section avec accordéon */
.section-card {
  margin-bottom: 16px;
}
.section-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--surface);
  border: 0;
  cursor: pointer;
  border-radius: var(--r-lg);
  transition: background .15s;
}
.section-toggle:hover {
  background: var(--surface-hover);
}
.section-toggle-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.section-toggle h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--lv-navy);
  margin: 0;
}
.section-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--lv-orange-soft);
  color: var(--lv-orange);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.section-chevron {
  color: var(--text-muted);
  transition: transform .2s;
}
.section-toggle.is-open .section-chevron {
  transform: rotate(180deg);
}

.section-body {
  display: none;
  padding: 4px 20px 20px 20px;
}
.section-body.is-open {
  display: block;
}

/* Grille des modules dans la section commercial */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
  padding: 6px 0;
}
.module-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 13px;
  background: var(--surface);
  transition: background .15s, border-color .15s;
}
.module-toggle:hover {
  background: var(--surface-hover);
}
.module-toggle:has(input:checked) {
  border-color: var(--lv-orange);
  background: var(--lv-orange-soft);
}
.module-toggle input {
  margin: 0;
  cursor: pointer;
}

/* Adaptations pour les field-row qui ont des largeurs custom (postal/ville/pays) */
.field-row .field {
  min-width: 0;
}

/* ============================================================================
   Cards de token (section "Sites web & intégration")
   ============================================================================ */

.token-card {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: 12px;
  overflow: hidden;
  background: var(--surface);
}

.token-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface-hover);
  border-bottom: 1px solid var(--border);
}

.token-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.token-card-body {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.token-card-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  flex-wrap: wrap;
}

.token-card-row code {
  font-family: var(--font-mono);
  background: var(--lv-navy-soft);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  word-break: break-all;
  flex: 1;
  min-width: 0;
}

.token-card-label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
  min-width: 80px;
}

.token-value-display {
  cursor: text;
  user-select: all;
}

.token-www-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: var(--lv-orange-soft);
  color: var(--lv-orange);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  cursor: help;
}

/* Bloc snippet de code (modal) */
.snippet-block {
  position: relative;
  background: var(--lv-navy);
  border-radius: var(--r-sm);
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.snippet-block pre {
  flex: 1;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: white;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
}
.snippet-block .btn {
  flex-shrink: 0;
}

/* ----- Responsive (basic) ----- */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .content { padding: 20px; }
  .field-row { grid-template-columns: 1fr; }
  .tenant-header { flex-direction: column; align-items: stretch; }
  .modules-grid { grid-template-columns: 1fr 1fr; }
}

/* ============================================================================
   Onglets de la fiche tenant
   ============================================================================ */
.tabs-nav {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  padding: 0 4px;
  overflow-x: auto;
}
.tab-button {
  background: transparent;
  border: none;
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 120ms ease, border-color 120ms ease;
  white-space: nowrap;
}
.tab-button:hover { color: var(--text); }
.tab-button.is-active {
  color: var(--lv-orange);
  border-bottom-color: var(--lv-orange);
  font-weight: 600;
}
.tab-pane { display: none; }
.tab-pane.is-active { display: block; }

/* Footer de chaque onglet avec bouton "Enregistrer" */
.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 16px;
  margin-top: 16px;
  border-top: 1px solid var(--border);
}
.form-actions .save-feedback {
  font-size: 13px;
  margin-right: auto;
}

/* En-tête du tenant en mode édition */
.tenant-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}
.tenant-header-main { display: flex; flex-direction: column; gap: 4px; }
.tenant-display-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.tenant-header-meta { display: flex; gap: 10px; align-items: center; }

/* Toggle module (rectangulaire) */
.module-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13.5px;
  background: white;
  transition: border-color 100ms ease, background 100ms ease;
}
.module-toggle:has(input:checked) {
  border-color: var(--lv-orange);
  background: var(--lv-orange-soft);
}
.module-toggle input { margin: 0; }
.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}

/* Readonly value (pour afficher emails, tokens, etc.) */
.readonly-value {
  padding: 8px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  word-break: break-all;
}
