/* =====================================================
   TRAVIAN FORGE — Design System
   Thème : ivoire/ocre/or – inspiré des screenshots
   ===================================================== */

/* ── Tokens ─────────────────────────────────────────── */
:root {
  /* Palette générale */
  --tf-bg:              #ede8dc;
  --tf-surface:         #faf7f0;
  --tf-surface-2:       #f4f0e6;
  --tf-border:          #d8cebc;
  --tf-border-light:    #e8e2d4;

  /* Sidebar */
  --tf-sidebar-bg:      #f2ede3;
  --tf-sidebar-border:  #ddd5c4;

  /* Topbar */
  --tf-topbar-bg:       #ffffff;
  --tf-topbar-border:   #e5ddd0;

  /* Accent doré */
  --tf-accent:          #c49a0a;
  --tf-accent-dark:     #a07d08;
  --tf-accent-light:    #fdf3d0;
  --tf-accent-mid:      #e8c84a;

  /* Texte */
  --tf-text:            #2a2110;
  --tf-text-2:          #5a4e36;
  --tf-text-muted:      #8a7c60;
  --tf-text-inverse:    #ffffff;

  /* Statuts */
  --tf-success:         #2a7a48;
  --tf-success-bg:      #eaf5ee;
  --tf-success-border:  #b8dfc9;
  --tf-danger:          #b93030;
  --tf-danger-bg:       #fdecea;
  --tf-danger-border:   #f0b8b8;
  --tf-warning:         #b86800;
  --tf-warning-bg:      #fef3d9;
  --tf-warning-border:  #f0d08a;
  --tf-info:            #1a5f8a;
  --tf-info-bg:         #e6f2fa;
  --tf-info-border:     #a8d0ea;

  /* Dimensions */
  --tf-sidebar-w:       204px;
  --tf-topbar-h:        54px;

  /* Formes */
  --tf-radius-sm:       6px;
  --tf-radius:          10px;
  --tf-radius-lg:       14px;

  /* Ombres */
  --tf-shadow-sm:       0 1px 3px rgba(30,20,0,.07);
  --tf-shadow:          0 2px 8px rgba(30,20,0,.09);
  --tf-shadow-md:       0 4px 20px rgba(30,20,0,.11);

  /* Typo */
  --tf-font: 'Inter', 'Segoe UI', system-ui, sans-serif;
}

/* ── Reset & base ────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--tf-font);
  background: var(--tf-bg);
  color: var(--tf-text);
  min-height: 100%;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

/* Permettre la sélection de texte */
*, input, textarea, [contenteditable] {
  -webkit-user-select: text;
  user-select: text;
}

/* ── Shell app ────────────────────────────────────────── */
.tf-app {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────── */
.tf-sidebar {
  width: var(--tf-sidebar-w);
  min-width: var(--tf-sidebar-w);
  background: var(--tf-sidebar-bg);
  border-right: 1px solid var(--tf-sidebar-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 50;
  transition: transform .3s ease;
  overflow: hidden;
}

/* Logo */
.tf-sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 16px 13px;
  border-bottom: 1px solid var(--tf-sidebar-border);
  text-decoration: none;
  flex-shrink: 0;
}
.tf-sidebar-logo:hover { text-decoration: none; }
.tf-sidebar-logo-text {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--tf-text);
  letter-spacing: 0.01em;
  line-height: 1.15;
}
.tf-logo-icon { flex-shrink: 0; }

/* Nav */
.tf-sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
}

.tf-nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 11px;
  border-radius: var(--tf-radius-sm);
  text-decoration: none;
  color: var(--tf-text-2);
  font-size: 0.84rem;
  font-weight: 500;
  margin-bottom: 2px;
  transition: background .15s, color .15s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  line-height: 1;
}
.tf-nav-item:hover {
  background: var(--tf-accent-light);
  color: var(--tf-text);
  text-decoration: none;
}
.tf-nav-item.active {
  background: var(--tf-accent);
  color: #fff;
  font-weight: 600;
}
.tf-nav-item.active .tf-nav-icon { opacity: 1; color: #fff; }

/* Nav item grisé (accès auth requis, non connecté) */
.tf-nav-item.tf-nav-disabled {
  opacity: .38;
  cursor: not-allowed;
  pointer-events: none;
}
.tf-nav-item.tf-nav-disabled:hover {
  background: none;
}

.tf-nav-icon {
  width: 17px;
  text-align: center;
  flex-shrink: 0;
  opacity: .7;
  font-size: 0.85rem;
}
.tf-nav-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tf-nav-item.sub {
  padding-left: 26px;
  font-size: 0.79rem;
  color: var(--tf-text-muted);
}
.tf-nav-item.sub.active { color: #fff; }
.tf-nav-section {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--tf-text-muted);
  padding: 12px 11px 4px;
}
.tf-nav-divider {
  border: none;
  border-top: 1px solid var(--tf-border-light);
  margin: 6px 8px;
}

/* Footer sidebar */
.tf-sidebar-footer {
  padding: 8px 10px 12px;
  border-top: 1px solid var(--tf-sidebar-border);
  flex-shrink: 0;
}
.tf-nav-item.logout { color: var(--tf-danger); }
.tf-nav-item.logout:hover { background: var(--tf-danger-bg); color: var(--tf-danger); }
.tf-nav-item.logout .tf-nav-icon { color: var(--tf-danger); opacity: 1; }

/* ── Overlay mobile ───────────────────────────────────── */
.tf-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 49;
}

/* ── Main area ────────────────────────────────────────── */
.tf-main {
  flex: 1;
  margin-left: var(--tf-sidebar-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

/* ── Topbar ───────────────────────────────────────────── */
.tf-topbar {
  height: var(--tf-topbar-h);
  background: var(--tf-topbar-bg);
  border-bottom: 1px solid var(--tf-topbar-border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 40;
  flex-shrink: 0;
}

.tf-topbar-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--tf-radius-sm);
  border: 1px solid var(--tf-border);
  background: var(--tf-surface);
  color: var(--tf-text-2);
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s;
}
.tf-topbar-menu-btn:hover { background: var(--tf-accent-light); color: var(--tf-accent); }

.tf-topbar-title { flex: 1; min-width: 0; }
.tf-topbar-heading {
  font-size: .9rem;
  font-weight: 700;
  color: var(--tf-text);
  letter-spacing: .06em;
  text-transform: uppercase;
  font-variant: small-caps;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tf-topbar-sub {
  font-size: 0.7rem;
  color: var(--tf-text-muted);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tf-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Avatar utilisateur */
.tf-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--tf-accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}
.tf-user-avatar.admin-avatar {
  background: var(--tf-danger);
}

.tf-user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  border: none;
  background: none;
  padding: 4px 8px;
  border-radius: var(--tf-radius-sm);
  transition: background .15s;
  text-align: left;
}
.tf-user-btn:hover { background: var(--tf-surface-2); }
.tf-user-name {
  font-size: 0.79rem;
  font-weight: 600;
  color: var(--tf-text);
}
.tf-user-role {
  font-size: 0.63rem;
  color: var(--tf-text-muted);
}
.tf-chevron { font-size: .55rem; color: var(--tf-text-muted); }

/* ── Dropdown ─────────────────────────────────────────── */
.tf-dropdown { position: relative; }

.tf-dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 176px;
  background: var(--tf-topbar-bg);
  border: 1px solid var(--tf-border);
  border-radius: var(--tf-radius);
  box-shadow: var(--tf-shadow-md);
  z-index: 100;
  overflow: hidden;
}
.tf-dropdown-menu a,
.tf-dropdown-menu button {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 14px;
  font-size: 0.81rem;
  color: var(--tf-text-2);
  text-decoration: none;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background .12s;
  font-family: var(--tf-font);
}
.tf-dropdown-menu a:hover,
.tf-dropdown-menu button:hover { background: var(--tf-surface-2); color: var(--tf-text); text-decoration: none; }
.tf-dropdown-menu a.danger,
.tf-dropdown-menu button.danger { color: var(--tf-danger); }
.tf-dropdown-menu a.danger:hover,
.tf-dropdown-menu button.danger:hover { background: var(--tf-danger-bg); }
.tf-dropdown-divider { border: none; border-top: 1px solid var(--tf-border-light); margin: 3px 0; }
.tf-dropdown-header {
  padding: 8px 14px 4px;
  font-size: 0.68rem;
  color: var(--tf-text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* ── Content ──────────────────────────────────────────── */
.tf-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

/* ── Cards ────────────────────────────────────────────── */
.tf-card {
  background: var(--tf-surface);
  border: 1px solid var(--tf-border);
  border-radius: var(--tf-radius);
  box-shadow: var(--tf-shadow-sm);
}
.tf-card-body { padding: 20px 24px; }
.tf-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--tf-border-light);
  gap: 12px;
  flex-wrap: wrap;
}
.tf-card-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--tf-text);
  letter-spacing: .05em;
  text-transform: uppercase;
  font-variant: small-caps;
  line-height: 1.2;
}
.tf-card-sub {
  font-size: 0.72rem;
  color: var(--tf-text-muted);
  margin-top: 2px;
  font-weight: 400;
  text-transform: none;
  font-variant: normal;
  letter-spacing: 0;
}

/* Stat card */
.tf-stat-card {
  background: var(--tf-surface);
  border: 1px solid var(--tf-border);
  border-radius: var(--tf-radius);
  padding: 18px 20px;
  box-shadow: var(--tf-shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.tf-stat-label {
  font-size: 0.73rem;
  color: var(--tf-text-muted);
  font-weight: 500;
  margin-bottom: 4px;
}
.tf-stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--tf-text);
  line-height: 1;
}
.tf-stat-value.accent { color: var(--tf-accent); }
.tf-stat-link {
  font-size: .72rem;
  color: var(--tf-accent);
  text-decoration: none;
  margin-top: 4px;
  display: inline-block;
}
.tf-stat-link:hover { color: var(--tf-accent-dark); text-decoration: underline; }
.tf-stat-icon {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: var(--tf-accent-light);
  color: var(--tf-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.tf-stat-icon.green  { background: var(--tf-success-bg); color: var(--tf-success); }
.tf-stat-icon.red    { background: var(--tf-danger-bg);  color: var(--tf-danger); }
.tf-stat-icon.blue   { background: var(--tf-info-bg);    color: var(--tf-info); }

/* Action chip */
.tf-chip {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 18px;
  background: var(--tf-surface);
  border: 1px solid var(--tf-border);
  border-radius: var(--tf-radius);
  text-decoration: none;
  color: var(--tf-text);
  transition: border-color .15s, box-shadow .15s;
  box-shadow: var(--tf-shadow-sm);
}
.tf-chip:hover {
  border-color: var(--tf-accent);
  box-shadow: 0 2px 10px rgba(196,154,10,.13);
  text-decoration: none;
  color: var(--tf-text);
}
.tf-chip-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--tf-accent-light);
  color: var(--tf-accent);
  display: flex; align-items: center; justify-content: center;
  font-size: .95rem;
  flex-shrink: 0;
}
.tf-chip-title { font-weight: 600; font-size: .85rem; color: var(--tf-text); }
.tf-chip-sub   { font-size: .71rem; color: var(--tf-text-muted); margin-top: 1px; }

/* Activity list */
.tf-activity { padding: 0; list-style: none; }
.tf-activity-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--tf-border-light);
  font-size: .82rem;
}
.tf-activity-item:last-child { border-bottom: none; }
.tf-activity-name { font-weight: 600; color: var(--tf-text); }
.tf-activity-sub  { font-size: .7rem; color: var(--tf-accent); margin-top: 1px; }
.tf-activity-time { font-size: .7rem; color: var(--tf-text-muted); white-space: nowrap; margin-left: 12px; }

/* ── Boutons ──────────────────────────────────────────── */
.tf-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: .81rem;
  font-weight: 600;
  font-family: var(--tf-font);
  border-radius: var(--tf-radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all .15s;
  white-space: nowrap;
  line-height: 1;
  user-select: none;
}
.tf-btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

.tf-btn-primary {
  background: var(--tf-accent);
  color: #fff;
  border-color: var(--tf-accent);
}
.tf-btn-primary:hover {
  background: var(--tf-accent-dark);
  border-color: var(--tf-accent-dark);
  color: #fff; text-decoration: none;
}
.tf-btn-secondary {
  background: var(--tf-surface);
  color: var(--tf-text-2);
  border-color: var(--tf-border);
}
.tf-btn-secondary:hover {
  background: var(--tf-surface-2);
  color: var(--tf-text); text-decoration: none;
}
.tf-btn-danger {
  background: var(--tf-danger);
  color: #fff;
  border-color: var(--tf-danger);
}
.tf-btn-danger:hover {
  background: #9b2626;
  color: #fff; text-decoration: none;
}
.tf-btn-warning {
  background: var(--tf-warning);
  color: #fff;
  border-color: var(--tf-warning);
}
.tf-btn-warning:hover { background: #9a5600; color: #fff; text-decoration: none; }
.tf-btn-success {
  background: var(--tf-success);
  color: #fff;
  border-color: var(--tf-success);
}
.tf-btn-success:hover { background: #216039; color: #fff; text-decoration: none; }
.tf-btn-ghost {
  background: transparent;
  color: var(--tf-text-2);
  border-color: transparent;
}
.tf-btn-ghost:hover {
  background: var(--tf-surface-2);
  color: var(--tf-text); text-decoration: none;
}
.tf-btn-sm  { padding: 5px 10px; font-size: .75rem; }
.tf-btn-lg  { padding: 11px 22px; font-size: .9rem; }
.tf-btn-full { width: 100%; justify-content: center; }

/* Bouton icône */
.tf-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: var(--tf-radius-sm);
  border: 1px solid var(--tf-border);
  background: var(--tf-surface);
  color: var(--tf-text-2);
  cursor: pointer;
  text-decoration: none;
  transition: all .15s;
  font-size: .73rem;
  flex-shrink: 0;
  font-family: var(--tf-font);
}
.tf-icon-btn:hover {
  background: var(--tf-accent-light);
  color: var(--tf-accent);
  border-color: var(--tf-accent-mid);
  text-decoration: none;
}
.tf-icon-btn.danger:hover {
  background: var(--tf-danger-bg);
  color: var(--tf-danger);
  border-color: var(--tf-danger-border);
}
.tf-icon-btn.warn:hover {
  background: var(--tf-warning-bg);
  color: var(--tf-warning);
  border-color: var(--tf-warning-border);
}

/* ── Formulaires ──────────────────────────────────────── */
.tf-input,
.tf-select,
.tf-textarea {
  width: 100%;
  padding: 8px 11px;
  font-size: .84rem;
  font-family: var(--tf-font);
  color: var(--tf-text);
  background: var(--tf-topbar-bg);
  border: 1px solid var(--tf-border);
  border-radius: var(--tf-radius-sm);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.tf-input:focus,
.tf-select:focus,
.tf-textarea:focus {
  border-color: var(--tf-accent);
  box-shadow: 0 0 0 3px rgba(196,154,10,.18);
}
.tf-textarea { resize: vertical; min-height: 90px; }
.tf-label {
  display: block;
  font-size: .76rem;
  font-weight: 600;
  color: var(--tf-text-2);
  margin-bottom: 5px;
}
.tf-form-group { margin-bottom: 16px; }
.tf-help-text { font-size: .71rem; color: var(--tf-text-muted); margin-top: 4px; }
.tf-input-wrap { position: relative; }
.tf-input-wrap .tf-input-icon {
  position: absolute;
  right: 10px; top: 50%; transform: translateY(-50%);
  color: var(--tf-text-muted);
  cursor: pointer;
  font-size: .8rem;
}

/* Checkbox & radio */
.tf-check-group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .83rem;
  color: var(--tf-text-2);
  cursor: pointer;
}
.tf-check-group input[type="checkbox"],
.tf-check-group input[type="radio"] {
  width: 16px; height: 16px;
  accent-color: var(--tf-accent);
  cursor: pointer;
}

/* ── Tables ───────────────────────────────────────────── */
.tf-table-wrap {
  overflow-x: auto;
  border-radius: var(--tf-radius);
  border: 1px solid var(--tf-border);
  background: var(--tf-surface);
}
.tf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
}
.tf-table thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--tf-text-muted);
  background: var(--tf-surface-2);
  border-bottom: 1px solid var(--tf-border);
  white-space: nowrap;
}
.tf-table thead th.center { text-align: center; }
.tf-table tbody tr { border-bottom: 1px solid var(--tf-border-light); transition: background .1s; }
.tf-table tbody tr:hover { background: var(--tf-surface-2); }
.tf-table tbody tr:last-child { border-bottom: none; }
.tf-table td {
  padding: 10px 14px;
  color: var(--tf-text-2);
  vertical-align: middle;
}
.tf-table td.center { text-align: center; }
.tf-table td.bold { font-weight: 600; color: var(--tf-text); }

/* ── Badges ───────────────────────────────────────────── */
.tf-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: .67rem;
  font-weight: 600;
  border-radius: 999px;
  white-space: nowrap;
}
.tf-badge-green  { background: var(--tf-success-bg);  color: var(--tf-success); }
.tf-badge-red    { background: var(--tf-danger-bg);   color: var(--tf-danger); }
.tf-badge-gold   { background: var(--tf-accent-light); color: var(--tf-accent); }
.tf-badge-gray   { background: #ece8de; color: var(--tf-text-muted); }
.tf-badge-blue   { background: var(--tf-info-bg); color: var(--tf-info); }
.tf-badge-warning { background: var(--tf-warning-bg); color: var(--tf-warning); }

/* ── Alertes ──────────────────────────────────────────── */
.tf-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 15px;
  border-radius: var(--tf-radius-sm);
  font-size: .82rem;
  border: 1px solid transparent;
  margin-bottom: 16px;
}
.tf-alert i { margin-top: 1px; flex-shrink: 0; }
.tf-alert-success { background: var(--tf-success-bg); color: var(--tf-success); border-color: var(--tf-success-border); }
.tf-alert-danger  { background: var(--tf-danger-bg);  color: var(--tf-danger);  border-color: var(--tf-danger-border); }
.tf-alert-warning { background: var(--tf-warning-bg); color: var(--tf-warning); border-color: var(--tf-warning-border); }
.tf-alert-info    { background: var(--tf-info-bg);    color: var(--tf-info);    border-color: var(--tf-info-border); }

/* ── Modales ──────────────────────────────────────────── */
.tf-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.tf-modal {
  background: var(--tf-surface);
  border: 1px solid var(--tf-border);
  border-radius: var(--tf-radius-lg);
  box-shadow: var(--tf-shadow-md);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}
.tf-modal-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--tf-border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.tf-modal-title { font-size: .92rem; font-weight: 700; color: var(--tf-text); }
.tf-modal-body  { padding: 18px 22px; }
.tf-modal-footer {
  padding: 12px 22px;
  border-top: 1px solid var(--tf-border-light);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── Page header ──────────────────────────────────────── */
.tf-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.tf-page-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--tf-text);
  font-variant: small-caps;
  letter-spacing: .04em;
  text-transform: uppercase;
  line-height: 1.2;
}
.tf-page-sub {
  font-size: .75rem;
  color: var(--tf-text-muted);
  margin-top: 3px;
  font-variant: normal;
  text-transform: none;
  letter-spacing: 0;
}

/* Section */
.tf-section-title {
  font-size: .85rem;
  font-weight: 700;
  color: var(--tf-text);
  letter-spacing: .05em;
  font-variant: small-caps;
  text-transform: uppercase;
  margin-bottom: 14px;
}

/* ── Grilles ──────────────────────────────────────────── */
.tf-grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 16px; }
.tf-grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.tf-grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
.tf-flex   { display: flex; align-items: center; gap: 8px; }
.tf-flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tf-flex-end { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.tf-gap { display: flex; flex-direction: column; gap: 16px; }
.tf-gap-sm { display: flex; flex-direction: column; gap: 10px; }

/* ── État vide ────────────────────────────────────────── */
.tf-empty {
  text-align: center;
  padding: 44px 24px;
  color: var(--tf-text-muted);
}
.tf-empty i { font-size: 2.2rem; opacity: .3; display: block; margin-bottom: 10px; }
.tf-empty-title { font-size: .9rem; font-weight: 600; color: var(--tf-text-2); margin-bottom: 4px; }
.tf-empty-sub   { font-size: .78rem; }

/* ── Spinner ──────────────────────────────────────────── */
.tf-spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--tf-border);
  border-top-color: var(--tf-accent);
  border-radius: 50%;
  animation: tf-spin .7s linear infinite;
  vertical-align: middle;
}
@keyframes tf-spin { to { transform: rotate(360deg); } }

/* ── Animations ───────────────────────────────────────── */
.tf-fade-in { animation: tf-fade .25s ease; }
@keyframes tf-fade { from { opacity:0; transform:translateY(5px); } to { opacity:1; transform:none; } }

/* ── Code mono ────────────────────────────────────────── */
.tf-code {
  font-family: 'Consolas','Courier New',monospace;
  font-size: .78rem;
  background: var(--tf-surface-2);
  border: 1px solid var(--tf-border-light);
  border-radius: var(--tf-radius-sm);
  padding: 2px 6px;
  color: var(--tf-text-2);
  word-break: break-all;
}

/* ── Tabs switch ──────────────────────────────────────── */
.tf-tab-group {
  display: flex;
  background: var(--tf-surface-2);
  border: 1px solid var(--tf-border);
  border-radius: var(--tf-radius-sm);
  padding: 3px;
  gap: 2px;
}
.tf-tab {
  flex: 1;
  padding: 6px 14px;
  text-align: center;
  font-size: .8rem;
  font-weight: 600;
  font-family: var(--tf-font);
  border-radius: calc(var(--tf-radius-sm) - 2px);
  cursor: pointer;
  border: none;
  background: none;
  color: var(--tf-text-muted);
  transition: all .15s;
}
.tf-tab.active {
  background: var(--tf-surface);
  color: var(--tf-text);
  box-shadow: var(--tf-shadow-sm);
}

/* ── Page de login ────────────────────────────────────── */
.tf-login-page {
  min-height: 100vh;
  background: var(--tf-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.tf-login-card {
  background: var(--tf-surface);
  border: 1px solid var(--tf-border);
  border-radius: var(--tf-radius-lg);
  box-shadow: var(--tf-shadow-md);
  padding: 38px 36px;
  width: 100%;
  max-width: 400px;
}
.tf-login-logo { text-align: center; margin-bottom: 24px; }
.tf-login-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--tf-text);
  margin-top: 10px;
  font-variant: small-caps;
  letter-spacing: .04em;
}
.tf-login-sub { font-size: .76rem; color: var(--tf-text-muted); margin-top: 3px; }

/* ── Scrollbar ────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--tf-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--tf-accent); }

/* ── Focus accessibilité ──────────────────────────────── */
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--tf-accent);
  outline-offset: 2px;
}

/* ── Notifications toast ──────────────────────────────── */
.tf-toast {
  position: fixed;
  top: 16px; right: 16px;
  z-index: 300;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--tf-radius);
  font-size: .83rem;
  font-weight: 500;
  box-shadow: var(--tf-shadow-md);
  border: 1px solid transparent;
  transform: translateX(120%);
  transition: transform .3s ease;
  max-width: 340px;
}
.tf-toast.show { transform: translateX(0); }
.tf-toast-success { background: var(--tf-surface); border-color: var(--tf-success-border); color: var(--tf-success); }
.tf-toast-error   { background: var(--tf-surface); border-color: var(--tf-danger-border);  color: var(--tf-danger); }
.tf-toast-info    { background: var(--tf-surface); border-color: var(--tf-info-border);    color: var(--tf-info); }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 768px) {
  .tf-sidebar { transform: translateX(-100%); }
  .tf-sidebar.open { transform: translateX(0); }
  .tf-sidebar-overlay.active { display: block; }
  .tf-main { margin-left: 0; }
  .tf-topbar-menu-btn { display: flex; }
  .tf-content { padding: 14px; }
  .tf-grid-4 { grid-template-columns: repeat(2,1fr); }
  .tf-grid-3 { grid-template-columns: repeat(2,1fr); }
  .tf-table  { min-width: 520px; }
  .tf-page-header { gap: 10px; }
}
@media (max-width: 480px) {
  .tf-grid-4, .tf-grid-3, .tf-grid-2 { grid-template-columns: 1fr; }
  .tf-content { padding: 10px; }
  .tf-login-card { padding: 26px 18px; }
  .tf-user-name, .tf-user-role { display: none; }
}

/* ── Reduced motion ───────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
