/* Hotspot Manager Pro — Admin UI v3 */
:root {
  --bg: #f0f2f7;
  --bg-sidebar: #111827;
  --bg-card: #ffffff;
  --bg-input: #f8fafc;
  --border: #e2e8f0;
  --border-focus: #818cf8;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --green: #059669;
  --green-bg: #ecfdf5;
  --amber: #d97706;
  --amber-bg: #fffbeb;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --blue: #0284c7;
  --blue-bg: #f0f9ff;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.12);
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar-w: 272px;
  --transition: 0.18s ease;
}

body {
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.muted { color: var(--text-muted); }
.text-green { color: var(--green); }
.text-amber { color: var(--amber); }
.text-blue { color: var(--blue); }

/* ── Login ── */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.login-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 20% 0%, rgba(79, 70, 229, 0.12), transparent),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(14, 165, 233, 0.1), transparent),
    var(--bg);
  z-index: 0;
}

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 36px;
  box-shadow: var(--shadow-lg);
  animation: rise 0.45s ease;
}

.login-brand { text-align: center; margin-bottom: 32px; }
.login-brand h1 { margin: 16px 0 6px; font-size: 1.45rem; font-weight: 800; letter-spacing: -0.02em; }
.login-brand p { margin: 0; color: var(--text-secondary); font-size: 0.92rem; }

.brand-logo { width: 52px; height: 52px; margin: 0 auto; }
.brand-logo svg,
.brand-logo img { width: 100%; height: 100%; display: block; object-fit: contain; border-radius: 12px; }
.brand-logo.sm { width: 38px; height: 38px; flex-shrink: 0; margin: 0; }

.login-form .field { margin-bottom: 18px; }

.login-actions-row {
  display: flex;
  justify-content: flex-end;
  margin: -8px 0 16px;
}

.btn-link {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: #818cf8;
  cursor: pointer;
  text-decoration: none;
}
.btn-link:hover { color: #a5b4fc; text-decoration: underline; }
.btn-link:disabled { opacity: 0.55; cursor: wait; text-decoration: none; }

/* ── App shell ── */
.app-shell {
  background: var(--bg);
}

.sidebar {
  background: var(--bg-sidebar);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 20;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-top { padding: 20px 14px 12px; }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px 20px;
}
.sidebar-brand strong { display: block; font-size: 0.95rem; font-weight: 700; color: #f8fafc; }
.sidebar-brand span { font-size: 0.75rem; color: #64748b; }

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: #94a3b8;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
}

.nav-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.05);
  transition: var(--transition);
}
.nav-icon svg { width: 17px; height: 17px; }

.nav-item:hover { color: #f1f5f9; background: rgba(255, 255, 255, 0.05); }
.nav-item.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.35), rgba(14, 165, 233, 0.2));
  box-shadow: inset 0 0 0 1px rgba(129, 140, 248, 0.3);
}
.nav-item.active .nav-icon { background: rgba(255, 255, 255, 0.12); color: #a5b4fc; }

.sidebar-footer {
  padding: 16px 14px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  margin-bottom: 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #0ea5e9);
  display: grid;
  place-items: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.user-meta { min-width: 0; }
.user-meta span {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: #f1f5f9;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}
.user-meta small { color: #64748b; font-size: 0.72rem; }

.main {
  margin-left: var(--sidebar-w);
  padding: 28px 32px 48px;
  max-width: 1280px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.topbar h1 {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.topbar p { margin: 4px 0 0; color: var(--text-secondary); font-size: 0.92rem; }

.view { animation: rise 0.25s ease; }

/* ── Stats ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  min-width: 0;
}

.stat-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon-total { background: var(--primary-light); color: var(--primary); }
.stat-icon-green { background: var(--green-bg); color: var(--green); }
.stat-icon-amber { background: var(--amber-bg); color: var(--amber); }
.stat-icon-blue { background: var(--blue-bg); color: var(--blue); }

.stat-card > div {
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

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

.stat-value {
  display: block;
  font-size: clamp(0.95rem, 0.6rem + 0.8vw, 1.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.25;
  white-space: nowrap;
  max-width: 100%;
  /* La taille de police est réduite dynamiquement en JS (fitStatValue) pour que
     le montant tienne toujours sur une seule ligne, sans jamais être coupé.
     Ces deux règles ne servent que de filet de sécurité ultime. */
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #fafbfc, var(--bg-card));
}

.card-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.card-full { width: 100%; }
.table-container-tall { min-height: 480px; }

/* ── Modal ── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
}
.modal.hidden { display: none !important; }

body.modal-open { overflow: hidden; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
}

.modal-dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 560px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  animation: rise 0.25s ease;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px 0;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-body {
  padding: 18px 22px 22px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 8px;
}

.modal-close {
  font-size: 1.25rem;
  line-height: 1;
}

.modal-dialog-detail {
  max-width: min(820px, 96vw);
}

.modal-dialog-proof {
  max-width: min(920px, 96vw);
}

.detail-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px 14px;
  margin-bottom: 16px;
  padding: 12px 14px;
  background: var(--bg-muted, #f8fafc);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.detail-meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.detail-meta-item span {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted, #64748b);
}

.detail-meta-item strong {
  font-size: 0.92rem;
  word-break: break-word;
}

.detail-edit {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.detail-section-title {
  margin: 0 0 10px;
  font-size: 0.95rem;
  font-weight: 700;
}

.license-row-clickable {
  cursor: pointer;
}

.license-row-clickable:hover {
  background: rgba(37, 99, 235, 0.04);
}

.cell-seen-online {
  color: var(--green);
  font-weight: 600;
}

.cell-seen-stale {
  color: var(--muted, #64748b);
}

.device-id-code {
  font-size: 0.75rem;
  word-break: break-all;
}

.proof-viewer-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.proof-viewer-meta {
  margin: 0;
}

.proof-viewer-frame {
  display: flex;
  justify-content: center;
  align-items: center;
  background: #0b1220;
  border: 1px solid var(--border);
  border-radius: 12px;
  min-height: 280px;
  max-height: min(72vh, 720px);
  overflow: auto;
  padding: 12px;
}

.proof-viewer-frame img {
  max-width: 100%;
  max-height: min(68vh, 680px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
}

/* ── Confirm / prompt modal ── */
.modal-dialog-confirm {
  max-width: 440px;
  width: min(440px, calc(100vw - 32px));
  padding: 36px 28px 28px;
  text-align: center;
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.28);
  animation: confirmPop 0.16s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes confirmPop {
  from { opacity: 0; transform: translateY(6px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.confirm-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.45rem;
  font-weight: 800;
}
.confirm-icon-info { background: var(--primary-light); color: var(--primary); }
.confirm-icon-danger { background: var(--red-bg); color: var(--red); }

.confirm-title { margin: 0 0 10px; font-size: 1.2rem; font-weight: 800; letter-spacing: -0.02em; }
.confirm-message { margin: 0 0 22px; color: var(--text-secondary); font-size: 0.95rem; line-height: 1.55; }

#confirmInputWrap, #confirmSelectWrap { text-align: left; margin-bottom: 18px; }

.confirm-footer {
  justify-content: center;
  gap: 10px;
  padding-top: 4px;
  flex-wrap: wrap;
}

/* ── License key (full display) ── */
.license-key-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.license-key-input {
  width: 100%;
  font-family: "Cascadia Code", Consolas, "Courier New", monospace;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 13px 14px;
  background: var(--primary-light);
  border: 1px solid #c7d2fe;
  color: var(--primary);
  overflow-x: auto;
  text-overflow: clip;
  white-space: nowrap;
  cursor: default;
}

.license-key-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.settings-card { max-width: 1040px; }
.settings-header {
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 14px 18px;
}
.settings-header h2 { margin: 0; }
.settings-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
  padding-top: 4px;
}
.settings-tab {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}
.settings-tab:hover { color: var(--text); border-color: var(--text-secondary); }
.settings-tab.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}
.settings-form { padding: 22px; }
.settings-pane { display: none; }
.settings-pane.active { display: block; }
.settings-pane-intro { margin: 0 0 16px; }

.social-channels-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}
.social-channel-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  background: var(--surface-2, #f8fafc);
}
.social-channel-main {
  display: grid;
  grid-template-columns: 140px 1fr 1.4fr auto auto;
  gap: 8px;
  align-items: center;
}
.social-channel-icon-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.social-channel-icon-field .hint {
  margin: 0;
  font-size: 0.75rem;
}
.social-channel-row input,
.social-channel-row select {
  width: 100%;
  min-width: 0;
}
.social-channel-enabled {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  white-space: nowrap;
}
@media (max-width: 900px) {
  .social-channel-main {
    grid-template-columns: 1fr;
  }
}
.settings-form-footer {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}
.settings-updates-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}
.distribute-card { margin-bottom: 18px; }
.distribute-body { padding: 0 22px 20px; display: flex; flex-direction: column; gap: 14px; }
.distribute-intro { margin: 0; }
.distribute-meta {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
}
.distribute-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.distribute-inline {
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-input);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.update-live-box {
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-input);
}
.update-live-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.update-live-pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text);
}
.input-with-action {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.input-with-action input {
  flex: 1;
  min-width: 0;
}
.file-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  white-space: nowrap;
  margin: 0;
}
.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  margin-top: 26px;
  cursor: pointer;
}
.checkbox-label input {
  width: auto;
}

/* ── Forms ── */
.form-stack { display: flex; flex-direction: column; gap: 16px; }

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-row-3 { grid-template-columns: 1fr 1fr 1fr; }

input, select, textarea {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
  background: #fff;
}

input::placeholder { color: #cbd5e1; }
textarea { resize: vertical; font-family: "Cascadia Code", Consolas, monospace; font-size: 0.82rem; }

.hint { display: block; margin-top: 5px; font-size: 0.75rem; color: var(--text-muted); }
.form-msg { margin: 4px 0 0; font-size: 0.85rem; min-height: 1.2em; text-align: center; }

.input-row { display: flex; gap: 8px; }
.input-row input { flex: 1; }

.input-suffix {
  display: flex;
  align-items: center;
  gap: 8px;
}
.input-suffix input { flex: 1; }
.input-suffix span { font-size: 0.85rem; color: var(--text-muted); white-space: nowrap; }

.ops-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 16px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--amber-bg);
  border: 1px solid #fcd34d;
  color: var(--amber);
}
.ops-alert-body {
  min-width: 0;
}
.ops-alert-body strong {
  display: block;
  font-size: 0.95rem;
}
.ops-alert-body p {
  margin: 4px 0 0;
  font-size: 0.86rem;
  font-weight: 500;
  opacity: 0.92;
}
@media (max-width: 720px) {
  .ops-alert {
    flex-direction: column;
    align-items: stretch;
  }
}

.price-banner {
  padding: 12px 16px;
  background: var(--blue-bg);
  border: 1px solid #bae6fd;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--blue);
}
.price-banner-personal {
  background: var(--amber-bg);
  border-color: #fcd34d;
  color: var(--amber);
}
.price-banner-warn {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}
.license-personal-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  cursor: pointer;
}
.license-personal-check input {
  width: auto;
  margin-top: 3px;
  flex-shrink: 0;
}
.license-personal-check strong {
  display: block;
  font-size: 0.92rem;
}
.license-personal-check small {
  display: block;
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #fff;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.35);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #4338ca, #4f46e5);
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-input); border-color: #cbd5e1; }

.btn-outline {
  background: transparent;
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.btn-outline:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg-input); color: var(--text); }

.btn-danger {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid #fecaca;
}
.btn-danger:hover { background: #fee2e2; }

.btn-sm { padding: 7px 12px; font-size: 0.8rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none !important; }

.btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ── Toolbar ── */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.search-box svg {
  position: absolute;
  left: 11px;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}
.search-box input {
  width: 200px;
  padding: 8px 12px 8px 34px;
  font-size: 0.85rem;
}

.select-sm {
  width: auto;
  padding: 8px 12px;
  font-size: 0.85rem;
}

/* Accounting compact date inputs */
input[type="date"] {
  padding: 8px 12px;
  font-size: 0.85rem;
}

/* ── Table ── */
.table-container { overflow-x: auto; }

.table-container,
.pricing-wrap {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
.table-container::-webkit-scrollbar,
.pricing-wrap::-webkit-scrollbar {
  height: 7px;
}
.table-container::-webkit-scrollbar-track,
.pricing-wrap::-webkit-scrollbar-track {
  background: transparent;
}
.table-container::-webkit-scrollbar-thumb,
.pricing-wrap::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 8px;
}
.table-container::-webkit-scrollbar-thumb:hover,
.pricing-wrap::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table th {
  text-align: left;
  padding: 11px 20px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.cell-nowrap {
  white-space: nowrap;
}

.cell-note {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cell-name {
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-table-sales {
  table-layout: auto;
}

.data-table-sales th,
.data-table-sales td {
  white-space: nowrap;
}

.date-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.date-field input[type="date"] {
  min-width: 140px;
}

.toolbar-sales {
  flex-wrap: nowrap;
}

@media (max-width: 1100px) {
  .toolbar-sales {
    flex-wrap: wrap;
  }
}

.data-table tbody tr { transition: background var(--transition); }
.data-table tbody tr:hover { background: #f8fafc; }
.data-table tr:last-child td { border-bottom: none; }

.license-key {
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  padding: 3px 8px;
  border-radius: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge-active { background: var(--green-bg); color: var(--green); }
.badge-expired { background: var(--amber-bg); color: var(--amber); }
.badge-suspended { background: var(--red-bg); color: var(--red); }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }

.nav-badge {
  margin-left: auto;
  min-width: 1.25rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  background: var(--amber);
  color: #1a1200;
  line-height: 1.2;
}

.seats-bar { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--text-secondary); }
.seats-track {
  width: 56px;
  height: 5px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
}
.seats-fill {
  height: 100%;
  background: linear-gradient(90deg, #4f46e5, #0ea5e9);
  border-radius: 3px;
  transition: width 0.35s ease;
}

.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: nowrap; }
.row-actions .btn { padding: 5px 9px; font-size: 0.74rem; }

.col-actions { text-align: right; white-space: nowrap; }

.btn-icon-action {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}
.btn-icon-action svg { width: 15px; height: 15px; }
.btn-icon-action:hover { background: var(--bg-input); color: var(--text); border-color: #cbd5e1; }
.btn-icon-action.primary:hover { background: var(--primary-light); color: var(--primary); border-color: #c7d2fe; }
.btn-icon-action.success:hover { background: var(--green-bg); color: var(--green); border-color: #a7f3d0; }
.btn-icon-action.danger:hover { background: var(--red-bg); color: var(--red); border-color: #fecaca; }

.empty-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.92rem;
}
.empty-icon { font-size: 1.8rem; margin-bottom: 8px; opacity: 0.6; }

/* ── Pricing ── */
.field-hint { margin: 0 0 12px; }

.pricing-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pricing-toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-input, #f8fafc);
}

.pricing-toolbar-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
}

.pricing-legend {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.pricing-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.pricing-add-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.pricing-add-group input[type="text"] { width: 120px; padding: 7px 10px; font-size: 0.85rem; }
.pricing-add-group input[type="number"] { width: 72px; padding: 7px 10px; font-size: 0.85rem; }

.pricing-add-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.pricing-currency {
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.pricing-currency strong { color: var(--primary); }

.pricing-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.pricing-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

.pricing-table th,
.pricing-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.pricing-table th {
  background: var(--bg-input, #f8fafc);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
  font-weight: 700;
}

.pricing-table th.col-vis { width: 88px; text-align: center; }
.pricing-table th.col-dur { min-width: 220px; }
.pricing-table th.col-seat { min-width: 130px; text-align: center; }

.pricing-vis-cell {
  text-align: center;
}
.pricing-vis-tag {
  display: block;
  margin-top: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}
.pricing-row-client .pricing-vis-tag { color: var(--primary); }
.pricing-row-admin {
  background: rgba(245, 158, 11, 0.04);
}
.pricing-row-admin .pricing-vis-tag { color: #b45309; }

.pricing-dur-cell .dur-editor {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.dur-label-input {
  flex: 1 1 120px;
  min-width: 110px;
  padding: 7px 10px;
}
.dur-days-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
  font-size: 0.85rem;
}
.dur-days-input { width: 64px; padding: 7px 8px; }

.price-field {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
}
.price-field input {
  width: 100%;
  max-width: 110px;
  padding: 7px 8px;
  text-align: right;
}
.price-suffix {
  font-size: 0.75rem;
  color: var(--text-muted);
  min-width: 2.5rem;
}

.pricing-table tr:last-child td { border-bottom: none; }

.btn-icon {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
.btn-icon:hover {
  background: var(--red-bg);
  border-color: #fecaca;
  color: var(--red);
}
.col-seat .btn-icon {
  margin: 0 auto;
  display: inline-grid;
  place-items: center;
}
.col-seat {
  position: relative;
  vertical-align: bottom;
}
.col-seat span { display: block; margin-bottom: 4px; }

/* ── Toasts (centrés) ── */
.toast-container {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  pointer-events: none;
}
.toast-container.toast-container-active {
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(2px);
  pointer-events: auto;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 18px 18px 16px;
  border-radius: 16px;
  font-size: 0.92rem;
  font-weight: 500;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.28);
  pointer-events: auto;
  width: min(420px, calc(100vw - 40px));
  opacity: 0;
  transform: translateY(14px) scale(0.96);
  transition: opacity 0.14s ease, transform 0.14s cubic-bezier(0.22, 1, 0.36, 1);
}
.toast.toast-in { opacity: 1; transform: translateY(0) scale(1); }
.toast.toast-out { opacity: 0; transform: translateY(-6px) scale(0.98); }

.toast-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  font-weight: 800;
  line-height: 1;
  margin-top: 1px;
}

.toast-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.toast-title {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.toast-text {
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.45;
  opacity: 0.92;
}

.toast-close {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  opacity: 0.55;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  margin: -2px -2px 0 0;
}
.toast-close:hover { opacity: 1; }

.toast-success { background: #064e3b; color: #a7f3d0; }
.toast-success .toast-icon { background: rgba(167, 243, 208, 0.18); }
.toast-error { background: #7f1d1d; color: #fecaca; }
.toast-error .toast-icon { background: rgba(254, 202, 202, 0.18); }
.toast-info { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); }
.toast-info .toast-icon { background: var(--primary-light); color: var(--primary); }
.toast-warning { background: #78350f; color: #fde68a; }
.toast-warning .toast-icon { background: rgba(253, 230, 138, 0.18); }

.role-perm-panel {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated, var(--bg-card));
}
.role-perm-table { margin: 0; }
.role-perm-table th:not(:first-child),
.role-perm-table td.cell-center {
  text-align: center;
  width: 110px;
}
.perm-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  cursor: pointer;
}
.perm-check input {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* ── Animations ── */
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ── */
@media (max-width: 1100px) {
  .field-row-3 { grid-template-columns: 1fr; }
  .toolbar-sales { flex-wrap: wrap; }
}

@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    position: relative;
    height: auto;
  }
  .main { margin-left: 0; padding: 16px; }
  .app-shell { flex-direction: column; }
  .sidebar-nav { flex-direction: row; overflow-x: auto; }
  .nav-item { white-space: nowrap; font-size: 0.82rem; padding: 9px 12px; }
  .sidebar-footer { display: none; }
  .topbar { flex-direction: column; align-items: flex-start; }
  .search-box input { width: 140px; }
  .stats-grid { grid-template-columns: 1fr; gap: 12px; }
  .stat-card { padding: 16px; gap: 12px; }
  .stat-value { font-size: 1.25rem; }
}
