/* Ajinsafro Cloud — design system (aucun build requis).
   Utiliser les classes ci-dessous plutot que du CSS ad hoc. Compatible RTL (proprietes logiques). */
:root {
  --c-primary: #0e7c86;
  --c-primary-600: #0b6770;
  --c-primary-50: #e6f4f5;
  --c-accent: #f59e0b;
  --c-ink: #0f172a;
  --c-text: #334155;
  --c-muted: #64748b;
  --c-line: #e2e8f0;
  --c-bg: #f5f7fa;
  --c-card: #ffffff;
  --c-side: #0b1f2a;
  --c-side-text: #b6c6d0;
  --c-ok: #15803d; --c-ok-bg: #dcfce7;
  --c-warn: #b45309; --c-warn-bg: #fef3c7;
  --c-bad: #b91c1c; --c-bad-bg: #fee2e2;
  --c-info: #1d4ed8; --c-info-bg: #dbeafe;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15,23,42,.06), 0 4px 14px rgba(15,23,42,.05);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font); color: var(--c-text); background: var(--c-bg); line-height: 1.55; font-size: 15px; -webkit-font-smoothing: antialiased; }
[dir="rtl"] body { font-family: "Segoe UI", Tahoma, "Noto Naskh Arabic", Arial, sans-serif; }
h1, h2, h3, h4 { color: var(--c-ink); line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.05rem; }
a { color: var(--c-primary); text-decoration: none; } a:hover { text-decoration: underline; }
p { margin: 0 0 1em; }
img { max-width: 100%; height: auto; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em; background: #eef2f6; padding: .1em .4em; border-radius: 5px; word-break: break-all; }
.muted { color: var(--c-muted); } .small { font-size: .85rem; } .right { text-align: end; } .center { text-align: center; }
.nowrap { white-space: nowrap; } .w-full { width: 100%; }
.mt-0{margin-top:0}.mt-1{margin-top:.5rem}.mt-2{margin-top:1rem}.mt-3{margin-top:1.5rem}.mt-4{margin-top:2rem}
.mb-0{margin-bottom:0}.mb-1{margin-bottom:.5rem}.mb-2{margin-bottom:1rem}.mb-3{margin-bottom:1.5rem}
.flex { display: flex; } .between { justify-content: space-between; } .items-center { align-items: center; } .gap-1{gap:.5rem}.gap-2{gap:1rem}.gap-3{gap:1.5rem} .wrap { flex-wrap: wrap; }
.container { width: min(1160px, 92%); margin-inline: auto; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .55rem 1rem; border-radius: 8px; border: 1px solid var(--c-line); background: var(--c-card); color: var(--c-ink); font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { background: #f1f5f9; text-decoration: none; } .btn:active { transform: translateY(1px); }
.btn-primary { background: var(--c-primary); border-color: var(--c-primary); color: #fff; } .btn-primary:hover { background: var(--c-primary-600); }
.btn-accent { background: var(--c-accent); border-color: var(--c-accent); color: #1f1300; } .btn-accent:hover { background: #d98a06; }
.btn-danger { background: var(--c-card); border-color: #fca5a5; color: var(--c-bad); } .btn-danger:hover { background: var(--c-bad-bg); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--c-primary); } .btn-ghost:hover { background: var(--c-primary-50); }
.btn-sm { padding: .3rem .65rem; font-size: .8rem; } .btn-lg { padding: .8rem 1.5rem; font-size: 1rem; }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }

/* Cartes, grilles, stats */
.card { background: var(--c-card); border: 1px solid var(--c-line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.card-head h2, .card-head h3 { margin: 0; }
.grid { display: grid; gap: 1rem; } .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid > * { min-width: 0; }
.content .card, .content [style*="grid-template-columns"] > * { min-width: 0; }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
.stat { display: flex; flex-direction: column; gap: .15rem; }
.stat .label { color: var(--c-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.stat .value { font-size: 1.8rem; font-weight: 700; color: var(--c-ink); }
.stat .hint { font-size: .8rem; color: var(--c-muted); }

/* Formulaires */
.form-group { margin-bottom: 1rem; }
label, .label { display: block; font-weight: 600; font-size: .85rem; color: var(--c-ink); margin-bottom: .3rem; }
.input, input:not([type]), input[type=time], input[type=month], input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=url], input[type=tel], input[type=search], select, textarea { width: 100%; padding: .55rem .75rem; border: 1px solid #cbd5e1; border-radius: 8px; font: inherit; color: var(--c-ink); background: var(--c-card); }
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--c-primary); outline-offset: 0; border-color: var(--c-primary); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--c-primary); }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
.help { font-size: .8rem; color: var(--c-muted); margin-top: .25rem; }
.error-text { color: var(--c-bad); font-size: .82rem; margin-top: .25rem; }
.form-row { display: grid; gap: 1rem; grid-template-columns: repeat(2, 1fr); } @media (max-width: 700px) { .form-row { grid-template-columns: 1fr; } }
.form-actions { display: flex; gap: .75rem; justify-content: flex-end; margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--c-line); }

/* Tableaux */
.table-wrap { overflow-x: auto; border: 1px solid var(--c-line); border-radius: var(--radius); background: var(--c-card); }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: start; background: color-mix(in srgb, var(--c-ink) 4%, var(--c-card)); color: var(--c-muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; padding: .7rem 1rem; border-bottom: 1px solid var(--c-line); white-space: nowrap; }
.table td { padding: .75rem 1rem; border-bottom: 1px solid #eef2f6; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; } .table tbody tr:hover { background: #fafcfd; }
.table .actions { text-align: end; white-space: nowrap; }

/* Badges, alertes */
.badge { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 700; background: #e2e8f0; color: #334155; }
.badge-ok { background: var(--c-ok-bg); color: var(--c-ok); } .badge-warn { background: var(--c-warn-bg); color: var(--c-warn); }
.badge-bad { background: var(--c-bad-bg); color: var(--c-bad); } .badge-info { background: var(--c-info-bg); color: var(--c-info); }
.alert { padding: .8rem 1rem; border-radius: 8px; border: 1px solid; margin-bottom: 1rem; font-size: .92rem; }
.alert-ok { background: var(--c-ok-bg); border-color: #86efac; color: #14532d; } .alert-warn { background: var(--c-warn-bg); border-color: #fcd34d; color: #78350f; }
.alert-bad { background: var(--c-bad-bg); border-color: #fca5a5; color: #7f1d1d; } .alert-info { background: var(--c-info-bg); border-color: #93c5fd; color: #1e3a8a; }
.empty { text-align: center; padding: 3rem 1rem; color: var(--c-muted); } .empty h3 { color: var(--c-ink); }
.pagination { display: flex; gap: .25rem; margin-top: 1rem; justify-content: center; } .pagination a, .pagination span { padding: .3rem .7rem; border: 1px solid var(--c-line); border-radius: 6px; background: var(--c-card); font-size: .85rem; }
.pagination .active span, .pagination span[aria-current] { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
nav[role=navigation] svg { width: 1rem; height: 1rem; }

/* Onglets */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--c-line); margin-bottom: 1.25rem; overflow-x: auto; }
.tabs a { padding: .6rem 1rem; color: var(--c-muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active, .tabs a:hover { color: var(--c-primary); border-bottom-color: var(--c-primary); text-decoration: none; }

/* Gabarit back-office (agence + console) */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { background: var(--c-side); color: var(--c-side-text); padding: 1.1rem .8rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { display: flex; align-items: center; gap: .6rem; color: #fff; font-weight: 800; font-size: 1.05rem; padding: .3rem .6rem 1.1rem; }
.sidebar .brand .logo { width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, var(--c-primary), #14b8a6); display: grid; place-items: center; color: #fff; font-weight: 800; }
.sidebar .group { font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: #6b8394; padding: 1rem .7rem .35rem; }
.sidebar a.nav { display: flex; align-items: center; gap: .65rem; padding: .55rem .75rem; border-radius: 8px; color: var(--c-side-text); font-weight: 500; font-size: .92rem; }
.sidebar a.nav:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.sidebar a.nav.active { background: var(--c-primary); color: #fff; }
.sidebar a.nav.locked { opacity: .5; } .sidebar .ico { width: 18px; height: 18px; flex: none; }
svg.ico { width: 1.1rem; height: 1.1rem; flex: none; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { background: #fff; border-bottom: 1px solid var(--c-line); padding: .7rem 1.5rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; position: sticky; top: 0; z-index: 5; }
.topbar .who { display: flex; align-items: center; gap: .75rem; font-size: .88rem; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--c-primary-50); color: var(--c-primary); display: grid; place-items: center; font-weight: 700; }
.content { padding: 1.5rem; max-width: 1280px; width: 100%; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head h1 { margin: 0; } .page-head .sub { color: var(--c-muted); margin: .2rem 0 0; }
.menu-toggle { display: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: 260px; z-index: 20; transform: translateX(-105%); transition: transform .2s; }
  [dir="rtl"] .sidebar { transform: translateX(105%); }
  body.menu-open .sidebar { transform: none; }
  body.menu-open::after { content: ""; position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 15; }
  .menu-toggle { display: inline-flex; }
  .content { padding: 1rem; }
  .topbar { flex-wrap: wrap; padding: .6rem 1rem; row-gap: .5rem; }
  .topbar > * { min-width: 0; max-width: 100%; }
  .topbar .who { flex-wrap: wrap; }
  .topbar .branch-switcher { max-width: 100%; } .topbar .branch-switcher label { white-space: nowrap; } .topbar .branch-switcher select { max-width: calc(100vw - 10rem); }
  .topbar .flex.items-center.gap-2 > .small { display: none; }
}

/* Pages publiques (marketing, auth) */
.pub-header { background: #fff; border-bottom: 1px solid var(--c-line); position: sticky; top: 0; z-index: 10; }
.pub-header .container { display: flex; align-items: center; justify-content: space-between; padding: .85rem 0; gap: 1rem; }
.pub-header nav { display: flex; gap: 1.4rem; align-items: center; } .pub-header nav a { color: var(--c-text); font-weight: 600; font-size: .92rem; }
@media (max-width: 700px) { .pub-header .container { flex-wrap: wrap; row-gap: .5rem; } .pub-header nav { flex-wrap: wrap; gap: .5rem 1rem; } }
.brand-mark { display: inline-flex; align-items: center; gap: .55rem; font-weight: 800; color: var(--c-ink); font-size: 1.1rem; }
.brand-mark:hover { text-decoration: none; } .brand-mark .logo { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--c-primary), #14b8a6); color: #fff; display: grid; place-items: center; font-weight: 800; }
.pub-footer { background: var(--c-side); color: var(--c-side-text); padding: 2.5rem 0; margin-top: 4rem; font-size: .9rem; } .pub-footer a { color: #fff; }
.hero { padding: 5rem 0 4rem; background: radial-gradient(1200px 400px at 80% -10%, #c9eef0 0, transparent 60%), linear-gradient(180deg, #fff, var(--c-bg)); }
.hero h1 { font-size: clamp(2rem, 5vw, 3.4rem); max-width: 18ch; } .hero p.lead { font-size: 1.15rem; max-width: 56ch; color: var(--c-text); }
.section { padding: 3.5rem 0; } .section-title { text-align: center; max-width: 60ch; margin: 0 auto 2.5rem; }
.price-card { display: flex; flex-direction: column; gap: .75rem; position: relative; } .price-card.featured { border-color: var(--c-primary); box-shadow: 0 0 0 2px var(--c-primary), var(--shadow); }
.price-card .price { font-size: 2.2rem; font-weight: 800; color: var(--c-ink); } .price-card .price small { font-size: .9rem; color: var(--c-muted); font-weight: 500; }
.price-card ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .45rem; } .price-card li::before { content: "✓"; color: var(--c-ok); font-weight: 800; margin-inline-end: .5rem; }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; background: linear-gradient(160deg, #e6f4f5, var(--c-bg) 60%); }
.auth-card { width: min(440px, 100%); } .auth-card .brand-mark { justify-content: center; width: 100%; margin-bottom: 1.25rem; }
.lang-switch { display: flex; gap: .35rem; font-size: .8rem; } .lang-switch a { padding: .15rem .45rem; border-radius: 5px; color: var(--c-muted); } .lang-switch a.active { background: var(--c-primary-50); color: var(--c-primary); font-weight: 700; }
.banner { padding: .65rem 1.5rem; font-size: .9rem; display: flex; justify-content: space-between; gap: 1rem; align-items: center; flex-wrap: wrap; }
.banner-warn { background: var(--c-warn-bg); color: #78350f; } .banner-bad { background: var(--c-bad-bg); color: #7f1d1d; } .banner-info { background: var(--c-info-bg); color: #1e3a8a; }

/* Accessibilité : lien d'évitement (clavier) et focus visible sur fond sombre */
.skip-link { position: absolute; inset-inline-start: .5rem; top: -3rem; z-index: 100; background: #fff; color: var(--c-ink); padding: .5rem .9rem; border-radius: 8px; font-weight: 700; box-shadow: 0 4px 16px rgba(0,0,0,.25); }
.skip-link:focus { top: .5rem; }
.sidebar a:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.content:focus { outline: none; }
