:root {
  /* Brand: Performances Qualité — blue #0055A8 + red #CF000B */
  --green: #0055a8;      /* primary accent (brand blue) */
  --green-d: #00427f;
  --red: #cf000b;        /* brand red accent */
  --ink: #1b2733;
  --muted: #6b7a89;
  --line: #e5eaef;
  --bg: #f4f6f9;
  --card: #ffffff;
  --danger: #cf000b;
  --warn: #e8a000;
  --side1: #082444;
  --side2: #0a3a6b;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(20,40,60,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.5 -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
  color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; cursor: pointer; }
input, textarea, select {
  font: inherit; color: var(--ink);
  border: 1px solid var(--line); border-radius: 9px;
  padding: 10px 12px; background: #fff; width: 100%; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(18,184,134,.12); }
.btn { border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 9px 15px; color: var(--ink); transition: .15s; }
.btn:hover { border-color: #cfd8e0; }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--green-d); }
.btn.ghost { background: transparent; }
.btn.tiny { padding: 7px 10px; font-size: 13px; }
.btn.danger { color: var(--danger); border-color: #f3c2c2; }
.btn.danger:hover { background: #fff0f0; }
.eye { border: none; background: transparent; font-size: 16px; cursor: pointer; padding: 4px; }
.brand { display: flex; align-items: center; gap: 9px; font-size: 22px; font-weight: 500; }
.brand b { font-weight: 800; }
.brand .shield { font-size: 22px; }
.brand.small { font-size: 18px; color: #eafff8; padding: 4px 6px 18px; }

/* ---- Gate ---- */
.gate { position: fixed; inset: 0; display: grid; place-items: center;
  background: radial-gradient(1200px 600px at 30% -10%, #0a3a6b, var(--side1)); }
.gate-logo { width: 76px; height: 76px; border-radius: 18px; display: block; margin: 0 auto 4px;
  box-shadow: 0 8px 22px rgba(0,0,0,.25); }
.powered { text-align: center; font-size: 11px; color: var(--muted); margin-top: 14px; }
.powered b { color: var(--green); }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; }
.side-powered { font-size: 10.5px; color: #7f9dc0; text-align: center; margin-top: 8px; }
.side-powered b { color: #cfe0f5; }
.gate-card { position: relative; width: 380px; background: var(--card); border-radius: 18px; padding: 30px 28px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.lang-sel { position: absolute; top: 12px; inset-inline-end: 14px; display: flex; gap: 4px; }
.lang-sel button { border: 1px solid var(--line); background: transparent; color: var(--muted);
  border-radius: 6px; padding: 3px 9px; font-size: 12px; cursor: pointer; }
.lang-sel button.active { background: var(--green); color: #fff; border-color: var(--green); }
/* Settings language selector: highlight the active language button. */
.btn[data-lang].active { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
/* RTL (Arabic): flex/grid flip automatically; nudge the sidebar border side. */
[dir="rtl"] .sidebar { border-right: none; }
.gate-card .tag { color: var(--muted); margin: 4px 0 20px; font-size: 12.5px; }
.gate-card input { margin-bottom: 10px; }
.pw-wrap { position: relative; }
.pw-wrap .eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
.gate-actions { display: flex; gap: 10px; margin-top: 6px; }
.gate-actions .btn { flex: 1; }
.strength { font-size: 12px; min-height: 16px; color: var(--muted); margin: -4px 0 6px; }
.msg { font-size: 13px; min-height: 18px; margin-top: 8px; }
.msg.err { color: var(--danger); }
.msg.ok { color: var(--green-d); }
.fineprint { font-size: 11.5px; color: var(--muted); margin-top: 14px; line-height: 1.45; }

/* ---- App shell ---- */
.app { display: grid; grid-template-columns: 240px 1fr; height: 100vh; }
.sidebar { background: linear-gradient(180deg, var(--side1), var(--side2)); color: #cfe8e0;
  display: flex; flex-direction: column; padding: 18px 12px; }
#nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-item { display: flex; align-items: center; gap: 11px; text-align: left;
  border: none; background: transparent; color: #bcd6ce; padding: 10px 12px;
  border-radius: 9px; font-size: 14px; }
.nav-item span { width: 18px; text-align: center; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--green); color: #fff; font-weight: 600; }
.side-foot { border-top: 1px solid rgba(255,255,255,.1); padding-top: 12px; }
.side-account { font-size: 12px; color: #9fc0b7; margin-bottom: 10px; word-break: break-all; }
.side-foot .btn { width: 100%; color: #cfe8e0; border-color: rgba(255,255,255,.15); }
.side-foot .btn:hover { background: rgba(255,255,255,.08); }

.content { overflow: auto; }
.topbar { display: flex; justify-content: space-between; align-items: center;
  padding: 20px 28px 12px; position: sticky; top: 0; background: var(--bg); z-index: 5; }
.topbar h1 { font-size: 21px; margin: 0; }
.sync-state { font-size: 12px; color: var(--muted); min-height: 15px; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }
.search { width: 220px; }
.view { padding: 6px 28px 40px; }

/* ---- Dashboard ---- */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.tile { background: var(--card); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.tile .num { font-size: 30px; font-weight: 800; }
.tile .lbl { color: var(--muted); font-size: 13px; margin-top: 2px; }
.tile.clickable { cursor: pointer; transition: box-shadow .15s, transform .15s; }
.tile.clickable:hover { box-shadow: 0 8px 20px rgba(20,40,60,.14); transform: translateY(-2px); }
.eye.urgent { color: var(--danger); }
.row.weak-row { box-shadow: inset 3px 0 0 var(--danger), var(--shadow); }
.tile.good .num { color: var(--green); }
.tile.warn .num { color: var(--warn); }
.tile.bad .num { color: var(--danger); }
.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px; }
.panel h3 { margin: 0 0 12px; font-size: 15px; }
.health-bar { height: 10px; border-radius: 6px; background: var(--line); overflow: hidden; display: flex; }
.health-bar i { display: block; height: 100%; }

/* ---- Item list ---- */
.list { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 14px; background: var(--card);
  border-radius: 11px; padding: 12px 16px; box-shadow: var(--shadow); }
.row .ic { width: 38px; height: 38px; border-radius: 9px; background: #e8f0fb; color: var(--green);
  display: grid; place-items: center; font-size: 18px; flex: none; }
.row .main { flex: 1; min-width: 0; }
.row .t { font-weight: 600; }
.row .s { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .acts { display: flex; gap: 6px; opacity: .55; }
.row:hover .acts { opacity: 1; }
.pill { font-size: 11px; padding: 2px 8px; border-radius: 20px; background: #eef2f6; color: var(--muted); }
.pill.weak { background: #fdecec; color: var(--danger); }
.pill.reused { background: #fff4e0; color: var(--warn); }
.pill.pk { background: #e8f0fb; color: var(--green); }
.rec-code { background: var(--bg); border: 1px dashed var(--green); border-radius: 10px;
  padding: 14px; font-size: 18px; letter-spacing: 2px; text-align: center; word-break: break-all;
  user-select: all; margin: 4px 0 12px; }
.empty { text-align: center; color: var(--muted); padding: 60px 0; }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }

/* ---- Forms / modal ---- */
.modal-back { position: fixed; inset: 0; background: rgba(15,25,35,.45); display: grid; place-items: center; z-index: 20; }
.modal { width: 460px; max-width: 92vw; max-height: 88vh; overflow: auto; background: var(--card); border-radius: 16px; box-shadow: 0 24px 70px rgba(0,0,0,.3); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--card); }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-body { padding: 18px 20px; }
.field { margin-bottom: 13px; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
.field .pw-wrap .btn { position: absolute; right: 4px; top: 4px; padding: 6px 9px; }
.row-actions { display: flex; gap: 10px; margin-top: 6px; }
.row-actions .btn { flex: 1; }

/* ---- Generator ---- */
.gen-out { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; }
.gen-out .val { flex: 1; font-family: ui-monospace, Consolas, monospace; font-size: 18px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px; word-break: break-all; }
.gen-opts { display: flex; flex-direction: column; gap: 12px; max-width: 420px; }
.gen-opts label { display: flex; align-items: center; gap: 9px; }
.gen-opts input[type=checkbox] { width: auto; }
.gen-opts input[type=range] { width: 100%; }
.chk { display: inline-flex; align-items: center; gap: 8px; }
.qr-box { background: #fff; padding: 10px; border-radius: 10px; display: inline-block; image-rendering: pixelated; }
code.secret { user-select: all; font-size: 15px; letter-spacing: 2px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
