:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --card: #ffffff;
  --panel: #ffffff;
  --input-bg: #f8fafc;
  --primary: #1e3a8a;
  --primary-2: #274bb5;
  --accent: #1e3a8a;
  --accent-2: #274bb5;
  --success: #16a34a;
  --danger: #ef4444;
  --warning: #f59e0b;
  --muted: #6b7280;
  --text: #0f172a;
  --border: #e4e7f1;
  --shadow: 0 16px 48px rgba(15, 23, 42, 0.07);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

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

body {
  margin: 0;
  font-family: "Inter", "Poppins", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
  transition: all 0.18s ease;
}

img {
  max-width: 100%;
  display: block;
}

button {
  font-family: inherit;
  transition: all 0.18s ease;
  touch-action: manipulation;
}

.app-shell {
  min-height: 100vh;
}

.app-content {
  min-height: 100vh;
  padding-top: 72px;
  padding-bottom: 120px; /* espace pour la tabbar */
}

.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(228,231,241,0.6);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  z-index: 100;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.brand img {
  height: 44px;
  width: auto;
}

.header-left,
.header-right {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.header-right {
  justify-content: flex-end;
  flex-wrap: nowrap;
  min-width: 0;
  overflow: hidden;
}
.header-right > * { flex-shrink: 0; }

.desktop-only {
  display: inline-flex;
}

.mobile-only {
  display: none !important;
}

/* Navbar specifique compte utilisateur connecte */
.header-right.auth-user {
  gap: 8px;
  flex-wrap: nowrap;
  overflow: visible;
}

.header-right.auth-user .lang-switch > button {
  min-height: 34px;
  padding: 6px 8px;
  font-size: 12px;
}

.header-right.auth-user .status-badge {
  padding: 3px 7px;
  font-size: 11px;
  white-space: nowrap;
}

.header-right.auth-user .icon-btn {
  height: 32px;
  width: 32px;
}

.header-right.auth-user .avatar {
  height: 34px;
  width: 34px;
}

/* Keep user navbar controls visible and aligned */
.app-auth .header-right.auth-user {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: nowrap;
  overflow: visible;
}

.app-auth .header-right.auth-user .status-badge {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: auto;
}

.app-auth .header-right.auth-user .avatar {
  margin-left: 0;
}

.app-auth .header-right.auth-user .icon-btn,
.app-auth .header-right.auth-user .avatar {
  display: inline-flex !important;
  visibility: visible !important;
  opacity: 1 !important;
}

@media (max-width: 420px) {
  .app-auth .header-right.auth-user .status-badge {
    display: none !important;
  }
}

/* Definitive fix: compact right-aligned user header controls */
.app-auth .header-right.auth-user {
  flex: 0 0 auto !important;
  width: auto !important;
  min-width: 0 !important;
  margin-left: auto !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 6px !important;
  flex-wrap: nowrap !important;
}

.app-auth .header-right.auth-user .status-badge {
  order: 1 !important;
  margin: 0 !important;
  max-width: 110px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.app-auth .header-right.auth-user .lang-switch {
  order: 2 !important;
  margin: 0 !important;
  width: auto !important;
  display: inline-flex !important;
}

.app-auth .header-right.auth-user .icon-btn {
  order: 3 !important;
}

.app-auth .header-right.auth-user .avatar {
  order: 4 !important;
}

/* ===== Final navbar polish (wins over old duplicated rules) ===== */
.app-header .header-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.app-header .header-right .lang-switch > button,
.app-header .header-right .btn-sm,
.app-header .header-right .admin-menu > button,
.app-header .header-right .public-menu > button {
  min-height: 32px !important;
  padding: 6px 9px !important;
  border-radius: 10px !important;
  font-size: 12px !important;
}

.app-header .header-right .icon-btn {
  height: 32px !important;
  width: 32px !important;
  border-radius: 10px !important;
}

.app-header .header-right .avatar {
  height: 34px !important;
  width: 34px !important;
}

/* Connected user order: status | language | bell | profile */
.app-auth .header-right.auth-user {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 6px !important;
  flex-wrap: nowrap !important;
  overflow: visible !important;
}

.app-auth .header-right.auth-user .status-badge {
  order: 1 !important;
  margin-right: auto !important;
  max-width: 120px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.app-auth .header-right.auth-user .lang-switch {
  order: 2 !important;
  width: auto !important;
  margin: 0 !important;
  display: inline-flex !important;
}

.app-auth .header-right.auth-user .icon-btn {
  order: 3 !important;
}

.app-auth .header-right.auth-user .avatar {
  order: 4 !important;
}

@media (max-width: 640px) {
  .app-auth .header-right.auth-user {
    gap: 5px !important;
  }

  .app-auth .header-right.auth-user .lang-switch > button {
    min-height: 28px !important;
    padding: 4px 7px !important;
    font-size: 11px !important;
  }

  .app-auth .header-right.auth-user .status-badge {
    max-width: 86px !important;
  }
}

/* Absolute final order: status | langue | cloche | profil */
.app-auth .header-right.auth-user {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 6px !important;
}

.app-auth .header-right.auth-user .status-badge {
  order: 1 !important;
  margin-right: auto !important;
}

.app-auth .header-right.auth-user .lang-switch {
  order: 2 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  width: auto !important;
  display: inline-flex !important;
}

.app-auth .header-right.auth-user .icon-btn {
  order: 3 !important;
}

.app-auth .header-right.auth-user .avatar {
  order: 4 !important;
}

/* Final override: keep language menu on the right (before notification) */
.app-auth .header-right.auth-user {
  justify-content: flex-end !important;
}

.app-auth .header-right.auth-user .status-badge {
  order: 1 !important;
  margin-right: auto !important;
}

.app-auth .header-right.auth-user .lang-switch {
  order: 2 !important;
  margin-right: 0 !important;
  margin-left: 0 !important;
  width: auto !important;
  display: inline-flex !important;
}

.app-auth .header-right.auth-user .icon-btn {
  order: 3 !important;
}

.app-auth .header-right.auth-user .avatar {
  order: 4 !important;
}

/* Final navbar order (connected user): status | langue | cloche | profil */
.app-auth .header-right.auth-user {
  justify-content: flex-end !important;
}

.app-auth .header-right.auth-user .status-badge {
  order: 1 !important;
  margin-right: auto !important;
}

.app-auth .header-right.auth-user .lang-switch {
  order: 2 !important;
  margin-right: 0 !important;
  width: auto !important;
}

.app-auth .header-right.auth-user .icon-btn {
  order: 3 !important;
}

.app-auth .header-right.auth-user .avatar {
  order: 4 !important;
}

/* User request: language button back to the left side */
.app-auth .header-right.auth-user .lang-switch {
  order: 1 !important;
  margin-right: auto !important;
}

.app-auth .header-right.auth-user .status-badge {
  order: 2 !important;
  margin-right: 0 !important;
}

.app-auth .header-right.auth-user .icon-btn {
  order: 3 !important;
}

.app-auth .header-right.auth-user .avatar {
  order: 4 !important;
}

/* Final header order fix (connected user): status | langue | cloche | profil */
.app-auth .header-right.auth-user {
  justify-content: flex-end !important;
}

.app-auth .header-right.auth-user .status-badge {
  order: 1 !important;
  margin-right: auto !important;
}

.app-auth .header-right.auth-user .lang-switch {
  order: 2 !important;
  width: auto !important;
  display: inline-flex !important;
  justify-content: flex-end !important;
}

.app-auth .header-right.auth-user .icon-btn {
  order: 3 !important;
}

.app-auth .header-right.auth-user .avatar {
  order: 4 !important;
}


/* Final navbar order for connected user */
.app-auth .header-right.auth-user .status-badge {
  order: 1 !important;
  margin-right: auto !important;
}

.app-auth .header-right.auth-user .lang-switch {
  order: 2 !important;
}

.app-auth .header-right.auth-user .icon-btn {
  order: 3 !important;
}

.app-auth .header-right.auth-user .avatar {
  order: 4 !important;
}

/* Keep mobile readable and stable */
@media (max-width: 767px) {
  :root {
    --half-scale: 1 !important;
  }
}

.public-links {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
  flex-wrap: nowrap;
  white-space: nowrap;
}
.public-links a {
  padding: 6px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: #f6f8fc;
  font-size: 13px;
}
.public-links a:hover {
  background: #eef2fb;
  color: var(--primary);
  border-color: #e2e7f5;
}

.lang-switch > button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 8px 10px;
  white-space: nowrap;
  background: #f6f8fc;
  border: 1px solid #dfe5f2;
  font-size: 12px;
}
.lang-switch > button:hover { border-color: var(--primary); }

.public-menu {
  position: relative;
}
.public-menu > button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid #dfe5f2;
  background: #f6f8fc;
  font-weight: 700;
  font-size: 13px;
}
.public-menu > button:hover { border-color: var(--primary); }
.public-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
  display: none;
  min-width: 200px;
  z-index: 210;
  padding: 8px;
}
.public-panel.show { display: block; }
.public-panel a {
  display: block;
  padding: 10px;
  border-radius: 10px;
  font-weight: 700;
  color: var(--text);
}
.public-panel a:hover { background: #f6f8fc; }

.admin-links {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.admin-links a {
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: #f6f8fc;
  font-size: 13px;
  font-weight: 700;
}

.admin-links a:hover {
  background: #eef2fb;
  color: var(--primary);
  border-color: #e2e7f5;
}

#railToggle {
  display: inline-flex;
}

@media (min-width: 1024px) {
  #railToggle {
    display: none;
  }
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(22, 163, 74, 0.12);
  color: var(--success);
  font-weight: 700;
  font-size: 12px;
  border: 1px solid rgba(22, 163, 74, 0.22);
}

.status-badge.warning {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.22);
  color: var(--warning);
}

.icon-btn {
  height: 36px;
  width: 36px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
}

.icon-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.avatar {
  height: 42px;
  width: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.profile-avatar {
  height: 76px;
  width: 76px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  font-weight: 800;
  display: grid;
  place-items: center;
  font-size: 24px;
  letter-spacing: 0.03em;
  overflow: hidden;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.profile-meta {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
  display: grid;
  gap: 8px;
}

.profile-meta li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 600;
}

.profile-meta small {
  color: var(--muted);
  font-weight: 500;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.profile-photo-form {
  display: grid;
  gap: 8px;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}

.admin-menu {
  position: relative;
}

.admin-menu button {
  border: 1px solid var(--border);
  background: #fff3e0;
  color: #9a5b00;
  padding: 8px 12px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
}

.admin-menu-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
  min-width: 220px;
  padding: 8px;
  display: none;
  z-index: 200;
}

.admin-menu-panel a {
  display: block;
  padding: 10px 10px;
  border-radius: 10px;
  font-weight: 600;
  color: var(--text);
}

.admin-menu-panel a:hover {
  background: var(--hover);
}

.lang-switch {
  position: relative;
}
.lang-switch > button {
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  padding: 8px 12px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: none;
  min-height: 40px;
}
.lang-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
  display: none;
  min-width: 190px;
  z-index: 210;
  overflow: hidden;
}
.lang-panel.show { display: block; }
.lang-panel form { margin: 0; }
.lang-panel button {
  width: 100%;
  text-align: left;
  background: #fff;
  color: var(--text);
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: 0;
  box-shadow: none;
  min-height: 38px;
}
.lang-panel button:last-child { border-bottom: none; }
.lang-panel button:hover { background: #f4f6fb; }

.profile-compact {
  font-size: 0.85rem;
  line-height: 1.4;
}

.profile-compact h1 {
  font-size: 20px;
}

.profile-compact h2 {
  font-size: 17px;
}

.profile-compact .pill {
  font-size: 12px;
  padding: 5px 9px;
}

/* nav rail removed per mobile-first single-pane design */

main.page {
  width: min(1200px, 96vw);
  margin: 0 auto;
  padding: 18px;
  display: grid;
  gap: 14px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
  animation: fadeUp 0.25s ease;
}
.card:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.08);
}

.card.muted {
  background: #f8fafc;
  border-style: dashed;
}

.card.gradient {
  background: linear-gradient(135deg, #1e3a8a, #274bb5);
  color: #e5edff;
  border: none;
  box-shadow: 0 20px 60px rgba(30, 58, 138, 0.35);
}

.card.gradient .muted,
.card.gradient .eyebrow,
.card.gradient p {
  color: #dce6ff;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.eyebrow {
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 800;
  font-size: 11px;
  margin: 0 0 4px 0;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  color: var(--text);
  letter-spacing: -0.02em;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 22px;
}

h3 {
  font-size: 18px;
}

p {
  margin: 6px 0;
  color: var(--muted);
  line-height: 1.5;
}

.bullet {
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.5;
}

.bullet li {
  margin-bottom: 6px;
}

.muted {
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 14px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  align-items: start;
}

.stack {
  display: flex;
  flex-direction: column;
}

.btn,
button:not(.tab-item):not(.icon-btn):not(.pill),
input[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  min-height: 40px;
  border-radius: 12px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.14s ease;
  font-size: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #f5f7ff;
  box-shadow: 0 8px 20px rgba(30, 58, 138, 0.2);
}

.btn:hover,
button:not(.tab-item):not(.icon-btn):not(.pill):hover,
input[type="submit"]:hover {
  transform: translateY(-1px);
}

.btn-primary { /* alias */
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #f5f7ff;
  box-shadow: 0 10px 24px rgba(30, 58, 138, 0.24);
}

.btn-ghost,
button.secondary,
.btn-secondary {
  background: #f1f4fa;
  color: var(--text);
  border: 1px solid #d6deed;
  box-shadow: none;
}

.btn-sm {
  padding: 6px 10px;
  min-height: 32px;
  font-size: 12px;
  border-radius: 9px;
}

.btn-nav-auth {
  margin-left: 4px;
}

@media (max-width: 640px) {
  .btn-nav-auth {
    display: none;
  }
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: none;
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: #fff7f7;
  box-shadow: 0 12px 32px rgba(239, 68, 68, 0.22);
}

.btn-full,
button.full,
.btn-block {
  width: 100%;
}

/* préserver le style du menu admin malgré le reset global des boutons */
.admin-menu button {
  background: #fff3e0;
  color: #9a5b00;
  border: 1px solid var(--border);
  box-shadow: none;
  min-height: 40px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  font-weight: 700;
  border: 1px solid #dfe5f2;
  color: var(--text);
  background: #f6f8fc;
}

.pill.success {
  background: rgba(22, 163, 74, 0.12);
  border-color: rgba(22, 163, 74, 0.24);
  color: var(--success);
}

.pill.danger {
  background: rgba(239, 68, 68, 0.10);
  border-color: rgba(239, 68, 68, 0.22);
  color: var(--danger);
}

.pill.warning {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.24);
  color: var(--warning);
}

.balance-card {
  display: grid;
  gap: 14px;
  background: #ffffff;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  position: relative;
  overflow: hidden;
}

.balance-card .section-head,
.balance-card .card-row {
  position: relative;
  z-index: 2;
}

.balance-amount {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.balance-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.balance-logo-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
}

.balance-logo {
  width: auto;
  height: 66px;
  max-width: 180px;
  object-fit: contain;
  filter: drop-shadow(0 6px 14px rgba(15, 23, 42, 0.12));
}

.balance-logo-watermark {
  position: absolute;
  top: -14px;
  right: 2px;
  z-index: 1;
  opacity: 0.26;
  pointer-events: none;
}

.balance-logo-watermark .balance-logo {
  height: 122px;
  max-width: 300px;
  filter: none;
}

.balance-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.balance-actions .btn,
.balance-actions button {
  flex: 1 1 0;
  min-width: 0;
  padding: 10px 12px;
  min-height: 42px;
  font-size: 12px;
  border-radius: 12px;
}

.card-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.card-row .eyebrow {
  font-size: 9px;
}

.card-row .balance-amount {
  font-size: 14px;
}

.account-details-grid {
  display: grid;
  gap: 8px;
}

.account-detail-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: #f8fafc;
}

.account-detail-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.account-detail-value {
  font-size: 13px;
  color: var(--text);
  font-weight: 700;
  text-align: right;
  word-break: break-word;
}

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

.transaction-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.transaction-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: #fff;
}

.tx-icon {
  height: 40px;
  width: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #fff;
}

.tx-icon.credit {
  background: linear-gradient(135deg, #16a34a, #22c55e);
}

.tx-icon.debit {
  background: linear-gradient(135deg, #ef4444, #f97316);
}

.tx-title {
  font-weight: 700;
  color: var(--text);
}

.tx-date {
  color: var(--muted);
  font-size: 12px;
}

.tx-amount {
  font-weight: 800;
  font-size: 16px;
}

.tx-amount.credit {
  color: var(--success);
}

.tx-amount.debit {
  color: var(--danger);
}

.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 72px;
  background: #ffffff;
  border-top: 1px solid #e5e7eb;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  z-index: 900;
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #9ca3af;
  font-weight: 700;
  font-size: 12px;
  background: none;
  border: none;
  cursor: pointer;
  position: relative;
  transition: color 200ms ease, transform 200ms ease;
}

.tab-item::after {
  content: "";
  position: absolute;
  bottom: 6px;
  left: 20%;
  right: 20%;
  height: 3px;
  border-radius: 999px;
  background: transparent;
}

.tab-item.active {
  color: #1e3a8a;
}

.tab-item.active::after {
  background: #1e3a8a;
}

.tab-icon {
  height: 20px;
  width: 20px;
  color: currentColor;
}

form {
  display: grid;
  gap: 10px;
}

label {
  font-weight: 700;
  font-size: 12px;
  color: var(--text);
}

input,
textarea,
select {
  width: 100%;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 15px;
  color: var(--text);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

/* Tables responsive par défaut */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
}

.card table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 520px;
}

.card th,
.card td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.card th {
  color: var(--muted);
  font-weight: 700;
}

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

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(30, 58, 138, 0.55);
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.15);
}

.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.helper {
  font-size: 12px;
  color: var(--muted);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: var(--primary);
  padding: 6px 0 2px;
}

.input-wrap {
  position: relative;
  width: 100%;
}

.input-wrap input {
  padding-right: 46px;
}

.toggle-eye {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
}

.toggle-eye:hover {
  color: var(--primary);
}

.alert {
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #f8fafc;
}

.alert.success {
  border-color: rgba(22, 163, 74, 0.35);
  background: rgba(22, 163, 74, 0.10);
}

.alert.error {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.12);
}

.alert.info {
  background: #f8fafc;
}

.progress {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: #eef1f7;
  overflow: hidden;
  border: 1px solid var(--border);
}

.progress > div {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  width: 0;
  transition: width 0.6s ease;
}

.transfer-progress {
  width: 100%;
  min-height: 20px;
  position: relative;
}

.progress-wait-text {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(15, 23, 42, 0.7);
  white-space: nowrap;
  pointer-events: none;
  z-index: 2;
  animation: patience-marquee 4s linear infinite;
}

@keyframes patience-marquee {
  0% { left: -34%; }
  100% { left: 100%; }
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef2fb;
  color: var(--text);
  font-weight: 700;
}

.footer {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 18px 18px 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.footer .links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.55);
  z-index: 200;
  padding: 18px;
}

.overlay.hidden {
  display: none;
}

.modal {
  width: min(520px, 100%);
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.25);
  padding: 18px;
}

.transfer-code-modal {
  position: relative;
  width: min(560px, 100%);
  display: grid;
  gap: 12px;
}

.transfer-overlay-close {
  position: absolute;
  top: 10px;
  right: 10px;
  height: 34px !important;
  width: 34px !important;
  min-height: 34px !important;
  padding: 0 !important;
  border-radius: 50% !important;
  border: 1px solid var(--border) !important;
  background: #f5f7fa !important;
  color: var(--text) !important;
  box-shadow: none !important;
  font-size: 20px !important;
  line-height: 1;
  cursor: pointer;
}

.transfer-overlay-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.transfer-overlay-form {
  gap: 8px;
}

.virtual-card {
  background: linear-gradient(145deg, #1e3a8a, #0f172a);
  color: #e9edff;
  border-radius: 18px;
  padding: 18px;
  display: grid;
  gap: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.virtual-card .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.virtual-card .digits {
  font-size: 20px;
  letter-spacing: 0.28em;
  font-weight: 700;
}

.virtual-card small {
  color: #c8d2ff;
}

.toast-inline {
  padding: 12px;
  border-radius: 14px;
  background: #1e293b;
  color: #fff;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-weight: 800;
  font-size: 12px;
}

.shake {
  animation: shake 0.3s ease;
}

@keyframes shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(4px); }
  50% { transform: translateX(-4px); }
  75% { transform: translateX(3px); }
  100% { transform: translateX(0); }
}

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

@media (min-width: 1024px) {
  .app-content {
    padding-left: 0;
  }
}

@media (max-width: 900px) {
  main.page {
    padding: 14px;
  }
  .app-header {
    padding: 10px 14px;
  }
  .card {
    padding: 14px;
  }
  h1 {
    font-size: 24px;
  }
  .balance-amount {
    font-size: 32px;
  }
}

@media (min-width: 768px) {
  .header-right {
    overflow: visible;
  }
  .desktop-only {
    display: inline-flex;
  }
  .mobile-only {
    display: none !important;
  }
}

@media (max-width: 767px) {
  .desktop-only {
    display: none !important;
  }
  .mobile-only {
    display: inline-flex !important;
  }

  .app-auth .app-header {
    height: 60px;
    padding: 8px 10px;
  }

  .app-auth .brand span {
    display: none;
  }

  .app-auth .brand img {
    height: 32px;
  }

  .app-auth .header-right.auth-user {
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 6px;
    overflow: visible;
  }

  .app-auth .header-right.auth-user > * {
    flex: 0 0 auto;
  }

  .app-auth .header-right.auth-user .status-badge {
    display: inline-flex;
  }

  .app-auth .header-right.auth-user .lang-switch > button {
    min-height: 30px;
    padding: 5px 7px;
    font-size: 11px;
    border-radius: 9px;
  }

  .app-auth .header-right.auth-user .icon-btn {
    height: 30px;
    width: 30px;
  }

  .app-auth .header-right.auth-user .avatar {
    height: 31px;
    width: 31px;
    font-size: 10px;
  }
}

@media (max-width: 640px) {
  h1 { font-size: 22px; }
  h2 { font-size: 20px; }
  .card { padding: 12px; }
  .balance-amount { font-size: 30px; }
  .card-row { grid-template-columns: 1fr; }
  .balance-actions { flex-direction: row; align-items: center; }
  .actions { flex-direction: column; align-items: stretch; width: 100%; }
  .btn-full, .btn { width: 100%; }
  .card th, .card td { font-size: 12px; padding: 8px 6px; }
  .app-header { height: auto; gap: 8px; flex-wrap: wrap; padding: 10px 12px; }
  .brand span { display: none; } /* gagner de la place sur mobile */
  .header-right { flex-wrap: wrap; justify-content: space-between; row-gap: 8px; }
  .header-right > * { flex: 1 1 auto; }
  .lang-switch { order: 1; width: 100%; display: flex; justify-content: flex-end; }
  .status-badge { order: 2; flex: 0 1 auto; justify-content: center; }
  .admin-menu { order: 3; flex: 0 1 auto; }
  .icon-btn, .avatar { flex: 0 0 auto; }
  .public-links { order: 4; flex-wrap: wrap; width: 100%; gap: 8px; justify-content: flex-start; overflow: visible; white-space: normal; }
  .public-links a { padding: 6px 8px; background:#f1f4fa; border-radius:10px; }
  .account-detail-item { flex-direction: column; align-items: flex-start; }
  .account-detail-value { text-align: left; }
  .balance-topline { gap: 8px; }
  .balance-logo-watermark {
    top: -10px;
    right: 2px;
    opacity: 0.22;
  }
  .balance-logo-watermark .balance-logo {
    height: 92px;
    max-width: 220px;
  }
  .balance-logo {
    height: 54px;
    max-width: 145px;
  }

  /* Public mobile: garder Langue + Menu sur la meme ligne */
  .app-public .header-right {
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 8px;
    row-gap: 0;
    overflow: visible;
  }
  .app-public .header-right > * {
    flex: 0 0 auto;
  }
  .app-public .lang-switch,
  .app-public .public-menu {
    width: auto;
    order: 0;
    display: inline-flex;
    justify-content: flex-end;
  }
  .app-public .lang-switch > button,
  .app-public .public-menu > button {
    min-height: 32px;
    padding: 6px 8px;
    font-size: 12px;
    border-radius: 10px;
  }

  /* Priorite finale: navbar user connecte compact et alignee */
  .app-auth .header-right.auth-user {
    flex-wrap: nowrap !important;
    justify-content: flex-end !important;
    gap: 6px !important;
    overflow: visible !important;
  }
  .app-auth .header-right.auth-user .lang-switch {
    width: auto !important;
    order: 0 !important;
    display: inline-flex !important;
  }
  .app-auth .header-right.auth-user .lang-switch > button {
    min-height: 30px !important;
    padding: 5px 7px !important;
    font-size: 11px !important;
  }
  .app-auth .header-right.auth-user > * {
    flex: 0 0 auto !important;
  }
  .app-auth .header-right.auth-user .status-badge {
    display: inline-flex !important;
    max-width: 88px !important;
    margin-right: auto !important;
    order: 0 !important;
  }
}

/* Tabbar visible sur toutes les largeurs pour coller au design app */

/* Global UI scale (kept readable) */
:root {
  --half-scale: 1;
}

body {
  font-size: 100%;
}

h1 { font-size: calc(28px * var(--half-scale)) !important; }
h2 { font-size: calc(22px * var(--half-scale)) !important; }
h3 { font-size: calc(18px * var(--half-scale)) !important; }
h4 { font-size: calc(16px * var(--half-scale)) !important; }
p,
label,
.muted,
.helper,
.eyebrow,
.tx-date,
.tx-title,
.tx-amount,
.footer,
.public-links a,
.public-panel a,
.admin-links a,
.admin-menu-panel a,
.lang-panel button,
.status-badge,
.pill,
.chip,
.badge,
.tab-item {
  font-size: calc(14px * var(--half-scale)) !important;
}

input,
textarea {
  font-size: calc(15px * var(--half-scale)) !important;
}

.balance-amount {
  font-size: calc(36px * var(--half-scale)) !important;
}

.card-row .balance-amount {
  font-size: calc(14px * var(--half-scale)) !important;
}

.btn,
button:not(.tab-item):not(.icon-btn):not(.pill),
input[type="submit"] {
  padding: calc(10px * var(--half-scale)) calc(14px * var(--half-scale)) !important;
  min-height: calc(40px * var(--half-scale)) !important;
  border-radius: calc(12px * var(--half-scale)) !important;
  font-size: calc(14px * var(--half-scale)) !important;
}

.btn-sm {
  padding: calc(6px * var(--half-scale)) calc(10px * var(--half-scale)) !important;
  min-height: calc(32px * var(--half-scale)) !important;
  border-radius: calc(9px * var(--half-scale)) !important;
  font-size: calc(12px * var(--half-scale)) !important;
}

.public-links a,
.public-menu > button,
.lang-switch > button,
.admin-menu button {
  padding: calc(5px * var(--half-scale)) calc(8px * var(--half-scale)) !important;
  border-radius: calc(10px * var(--half-scale)) !important;
}

.public-panel a,
.admin-menu-panel a,
.lang-panel button {
  padding: calc(8px * var(--half-scale)) !important;
  border-radius: calc(8px * var(--half-scale)) !important;
}

.status-badge,
.pill,
.chip,
.badge {
  padding: calc(4px * var(--half-scale)) calc(8px * var(--half-scale)) !important;
  border-radius: calc(999px * var(--half-scale)) !important;
}

.icon-btn {
  height: calc(36px * var(--half-scale)) !important;
  width: calc(36px * var(--half-scale)) !important;
  border-radius: calc(12px * var(--half-scale)) !important;
}

.avatar {
  height: calc(42px * var(--half-scale)) !important;
  width: calc(42px * var(--half-scale)) !important;
}

.tabbar {
  height: calc(72px * var(--half-scale)) !important;
}

.tab-item {
  gap: calc(4px * var(--half-scale)) !important;
}

.tab-item::after {
  bottom: calc(6px * var(--half-scale)) !important;
  height: calc(3px * var(--half-scale)) !important;
}

.tab-icon {
  height: calc(20px * var(--half-scale)) !important;
  width: calc(20px * var(--half-scale)) !important;
}

/* Final guard: keep user notification/profile always visible */
.app-auth .header-right.auth-user .icon-btn {
  height: 30px !important;
  width: 30px !important;
}

.app-auth .header-right.auth-user .avatar {
  height: 32px !important;
  width: 32px !important;
  font-size: 11px !important;
}

@media (max-width: 420px) {
  .app-auth .header-right.auth-user .status-badge {
    display: none !important;
  }
}

/* Mobile hardening: responsive layout + prevent focus zoom on inputs */
@media (max-width: 767px) {
  .app-content {
    padding-top: 72px !important;
    padding-bottom: 108px !important;
  }

  .app-header {
    height: 64px !important;
    padding: 8px 10px !important;
    gap: 8px !important;
    flex-wrap: nowrap !important;
  }

  .header-left {
    min-width: 0 !important;
    flex: 1 1 auto !important;
  }

  .brand {
    max-width: 100%;
    min-width: 0;
  }

  .brand img {
    height: 32px !important;
  }

  .brand span {
    display: none !important;
  }

  .header-right {
    margin-left: auto !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 6px !important;
    flex-wrap: nowrap !important;
    overflow: visible !important;
  }

  .header-right > * {
    flex: 0 0 auto !important;
    min-width: 0 !important;
  }

  .lang-switch > button,
  .public-menu > button,
  .admin-menu > button {
    min-height: 32px !important;
    padding: 6px 8px !important;
    font-size: 12px !important;
    border-radius: 10px !important;
  }

  .icon-btn {
    height: 32px !important;
    width: 32px !important;
  }

  .avatar {
    height: 34px !important;
    width: 34px !important;
    font-size: 11px !important;
  }

  .app-auth .header-right.auth-user .status-badge {
    display: inline-flex !important;
    max-width: 96px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  main.page {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 12px !important;
    gap: 12px !important;
  }

  .card {
    border-radius: 14px !important;
    padding: 12px !important;
  }

  .grid-2,
  .card-row,
  .field-row {
    grid-template-columns: 1fr !important;
  }

  .transaction-row {
    grid-template-columns: auto 1fr auto !important;
    gap: 8px !important;
    padding: 10px !important;
  }

  .tx-icon {
    height: 34px !important;
    width: 34px !important;
    border-radius: 10px !important;
  }

  .balance-actions {
    gap: 8px !important;
  }

  .balance-actions .btn,
  .balance-actions button {
    min-height: 40px !important;
    font-size: 13px !important;
  }

  .btn,
  button:not(.tab-item):not(.icon-btn):not(.pill),
  input[type="submit"] {
    min-height: 40px !important;
    font-size: 14px !important;
  }

  /* iOS: no input focus zoom */
  input,
  textarea,
  select {
    font-size: 16px !important;
    line-height: 1.35;
  }
}
