/* ==========================================================================
   AR TRANSFER — Gestion des factures
   Identité visuelle : dashboard SaaS moderne — fond bleu-lavande doux,
   sidebar indigo profond, chips colorées, cartes flottantes arrondies.
   ========================================================================== */
:root{
  --ink:#171d33;
  --muted:#7c869c;
  --muted-2:#a3abbd;
  --line:#e7eaf4;
  --paper:#eef1f9;
  --white:#fff;

  --indigo:#131a3a;
  --indigo-2:#1c2454;
  --indigo-soft:#eef0fb;

  --primary:#3562f6;
  --primary-2:#2750d6;
  --primary-soft:#e8edfe;

  --accent:#f7a63e;
  --accent-ink:#8a4c06;
  --accent-soft:#fef1de;

  --violet:#8b5cf6;
  --violet-soft:#f1eafe;

  --success:#17b26a;
  --success-soft:#e4f9ee;

  --danger:#ef4444;
  --danger-soft:#fdecec;

  --radius-lg:22px;
  --radius:16px;
  --radius-sm:11px;

  --shadow:0 24px 48px -22px rgba(19,26,58,.16);
  --shadow-sm:0 10px 24px -14px rgba(19,26,58,.14);
  --shadow-xs:0 2px 8px rgba(19,26,58,.05);

  --font-display:'Plus Jakarta Sans',ui-sans-serif,system-ui,sans-serif;
  --font-body:'Inter',ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  --font-mono:'JetBrains Mono',ui-monospace,SFMono-Regular,Menlo,monospace;
  --font-serif:'Lora','Iowan Old Style','Georgia',serif;
  --font-ledger:'Times New Roman','Liberation Serif','PT Serif',Georgia,serif;

  /* classic corporate palette, used on the invoice document only */
  --doc-navy:#101b3d;
  --doc-navy-2:#1b2a5c;
  --doc-line:#d8dceb;
  --doc-hair:#c7ccdf;
  --doc-gold:#a9822f;
  --doc-paper:#fbfbfd;
  --doc-blue:#dceaf3;
}
*{box-sizing:border-box}
body{margin:0;background:var(--paper);color:var(--ink);font-family:var(--font-body);-webkit-font-smoothing:antialiased;font-size:14.5px}
a{color:inherit}
.icn{width:19px;height:19px;flex:none;display:block}

/* ---------- shell / sidebar ---------- */
.app-shell{min-height:100vh;display:flex}
.sidebar{
  width:264px;background:linear-gradient(190deg,var(--indigo-2) 0%,var(--indigo) 65%,#0b0f24 100%);color:#fff;
  padding:24px 16px;display:flex;flex-direction:column;position:fixed;inset:0 auto 0 0;z-index:20;
}
.brand{display:flex;gap:12px;align-items:center;padding:8px 10px 28px}
.brand-mark{
  width:44px;height:44px;border-radius:13px;background:linear-gradient(155deg,var(--primary),var(--violet));color:#fff;
  display:grid;place-items:center;font-weight:700;font-family:var(--font-display);font-size:15px;letter-spacing:-.02em;
  box-shadow:0 10px 22px -6px rgba(53,98,246,.55);
}
.brand strong{display:block;font-size:14px;letter-spacing:.01em;font-family:var(--font-display);font-weight:700}
.brand span{display:block;font-size:11px;color:#8b93b8;margin-top:2px}

.sidebar nav{display:grid;gap:4px}
.nav-label{font-size:10px;text-transform:uppercase;letter-spacing:.14em;color:#6b74a0;font-weight:700;padding:14px 12px 6px}
.sidebar nav a{
  color:#aab1d6;text-decoration:none;padding:11px 14px;border-radius:12px;
  display:flex;gap:12px;align-items:center;font-size:13.5px;font-weight:600;
  transition:background .15s ease,color .15s ease;position:relative;
}
.sidebar nav a .icn{color:#7f89b8;transition:color .15s ease}
.sidebar nav a.active,.sidebar nav a:hover{background:rgba(255,255,255,.08);color:#fff}
.sidebar nav a.active{background:linear-gradient(120deg,var(--primary),#4a6bf5);color:#fff;box-shadow:0 10px 20px -8px rgba(53,98,246,.6)}
.sidebar nav a.active .icn,.sidebar nav a:hover .icn{color:#fff}

.side-card{
  margin-top:18px;background:rgba(255,255,255,.06);border:1px solid rgba(255,255,255,.08);
  border-radius:16px;padding:16px;font-size:12px;color:#c2c8e6;
}
.side-card .icn{color:var(--accent);margin-bottom:8px}
.side-card strong{display:block;color:#fff;font-size:12.5px;margin-bottom:3px;font-family:var(--font-display)}

.side-footer{margin-top:auto;color:#7680a8;font-size:11px;padding:16px 12px 4px;line-height:1.7}
.side-footer .credit{color:#8b93bd}
.side-footer .credit a{color:var(--accent);text-decoration:none;font-weight:700}
.side-footer .credit a:hover{text-decoration:underline}

/* ---------- main / topbar ---------- */
.main{margin-left:264px;flex:1;display:flex;flex-direction:column;min-height:100vh}
.topbar{
  background:transparent;
  display:flex;align-items:center;justify-content:space-between;gap:20px;padding:30px 40px 18px;
}
.eyebrow{font-size:10.5px;letter-spacing:.18em;color:var(--primary);font-weight:800;text-transform:uppercase}
.topbar h1{font-size:26px;margin:4px 0 0;font-family:var(--font-display);font-weight:700;letter-spacing:-.02em}
.topbar-actions{display:flex;align-items:center;gap:14px}
.icon-btn{
  width:42px;height:42px;border-radius:13px;background:var(--white);border:1px solid var(--line);
  display:grid;place-items:center;color:#5b6478;box-shadow:var(--shadow-xs);cursor:pointer;position:relative;flex:none;
}
.icon-btn .dot{position:absolute;top:9px;right:9px;width:7px;height:7px;border-radius:50%;background:var(--accent);box-shadow:0 0 0 2px var(--white)}
.profile-chip{display:flex;align-items:center;gap:10px;background:var(--white);border:1px solid var(--line);border-radius:14px;padding:6px 14px 6px 6px;box-shadow:var(--shadow-xs)}
.profile-avatar{width:32px;height:32px;border-radius:10px;background:linear-gradient(155deg,var(--accent),#f4863a);display:grid;place-items:center;color:#fff;font-family:var(--font-display);font-weight:700;font-size:12.5px}
.profile-chip .who strong{display:block;font-size:12.5px;font-family:var(--font-display)}
.profile-chip .who span{display:block;font-size:10.5px;color:var(--muted)}

.content{padding:8px 40px 36px;max-width:1480px;margin:auto;width:100%;flex:1}

/* ---------- buttons ---------- */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:7px;border:0;border-radius:12px;padding:11px 20px;text-decoration:none;font-weight:700;font-size:13px;cursor:pointer;font-family:var(--font-body);transition:transform .1s ease,box-shadow .15s ease,background .15s ease,filter .15s ease}
.btn .icn{width:16px;height:16px}
.btn-primary{background:linear-gradient(120deg,var(--primary),var(--primary-2));color:#fff;box-shadow:0 12px 22px -10px rgba(53,98,246,.65)}
.btn-primary:hover{filter:brightness(1.06)}
.btn-light{background:var(--white);color:#3c4457;border:1px solid var(--line);box-shadow:var(--shadow-xs)}
.btn-light:hover{background:#f7f8fd;border-color:#d9deee}
.btn:active{transform:translateY(1px)}

/* ---------- dashboard stats ---------- */
.stats{display:grid;grid-template-columns:repeat(3,1fr);gap:20px;margin-bottom:24px}
.stat{background:var(--white);border:1px solid var(--line);border-radius:var(--radius-lg);padding:22px;box-shadow:var(--shadow-sm);display:flex;flex-direction:column;gap:16px}
.stat-top{display:flex;align-items:center;justify-content:space-between}
.stat-icon{width:46px;height:46px;border-radius:14px;display:grid;place-items:center}
.stat-icon .icn{width:22px;height:22px}
.stat:nth-child(1) .stat-icon{background:var(--primary-soft);color:var(--primary)}
.stat:nth-child(2) .stat-icon{background:var(--success-soft);color:var(--success)}
.stat:nth-child(3) .stat-icon{background:var(--accent-soft);color:var(--accent-ink)}
.stat-trend{font-size:11px;font-weight:700;color:var(--success);background:var(--success-soft);padding:5px 9px;border-radius:20px;display:flex;align-items:center;gap:4px}
.stat-trend .icn{width:12px;height:12px}
.stat span.label{display:block;color:var(--muted);font-size:12px;font-weight:600}
.stat strong{display:block;font-family:var(--font-display);font-size:27px;margin:4px 0 0;font-weight:700;letter-spacing:-.02em}
.stat strong i{font-style:normal;font-size:12px;color:var(--muted);font-family:var(--font-body);font-weight:600}
.stat small{color:var(--muted-2);font-size:12px}

/* ---------- panel / table ---------- */
.panel{background:var(--white);border:1px solid var(--line);border-radius:var(--radius-lg);box-shadow:var(--shadow-sm)}
.panel-head{padding:24px 26px;border-bottom:1px solid var(--line);display:flex;justify-content:space-between;gap:20px;align-items:center}
.panel-head h2{font-size:16.5px;margin:0;font-family:var(--font-display);font-weight:700}
.panel-head p{font-size:12.5px;color:var(--muted);margin:5px 0 0}
.search{display:flex;gap:8px;position:relative}
.search .icn{position:absolute;left:13px;top:50%;transform:translateY(-50%);color:var(--muted-2);width:16px;height:16px}
.search input{width:290px;border:1px solid var(--line);border-radius:11px;padding:11px 12px 11px 36px;outline:0;font:inherit;background:var(--paper)}
.search input:focus{border-color:var(--primary);box-shadow:0 0 0 3px var(--primary-soft);background:var(--white)}
.search button{border:0;border-radius:11px;background:var(--indigo);padding:11px 16px;font-weight:700;color:#fff;cursor:pointer;font-size:13px}
.table-wrap{overflow:auto}
table{width:100%;border-collapse:collapse;font-size:13px}
th{text-align:left;color:#9099ac;font-size:10.5px;text-transform:uppercase;letter-spacing:.08em;font-weight:700;background:#fafbfd}
th,td{padding:16px 20px;border-bottom:1px solid var(--line);white-space:nowrap}
tbody tr{transition:background .12s ease}
tbody tr:hover{background:#f8faff}
td strong{font-family:var(--font-mono);font-weight:600}
.actions{text-align:right}
.actions{display:flex;gap:6px;justify-content:flex-end}
.actions a{color:#5b6478;text-decoration:none;font-weight:600;font-size:12px;width:34px;height:34px;border-radius:10px;display:inline-flex;align-items:center;justify-content:center;background:var(--paper);border:1px solid transparent}
.actions a .icn{width:16px;height:16px}
.actions a:hover{border-color:var(--primary);color:var(--primary);background:var(--primary-soft)}
.empty{text-align:center;padding:74px 20px}
.empty-icon{width:56px;height:56px;margin:0 auto 18px;border-radius:16px;background:var(--primary-soft);color:var(--primary);display:grid;place-items:center}
.empty-icon .icn{width:26px;height:26px}
.empty h3{margin:4px 0 4px;font-family:var(--font-display)}
.empty p{color:var(--muted);font-size:13px;margin-bottom:20px}

/* ---------- forms ---------- */
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:20px}
.panel-pad{padding:28px}
.field{display:grid;gap:7px}
.field label{font-size:12px;font-weight:700;color:#4b5468}
.field-hint{font-size:12px;color:var(--muted);margin:-4px 0 10px}
.field input,.field textarea,.field select{width:100%;border:1px solid var(--line);border-radius:11px;padding:11px 13px;background:var(--paper);color:var(--ink);font:inherit;outline:0;transition:border-color .12s,background .12s,box-shadow .12s}
.field input:focus,.field textarea:focus,.field select:focus{border-color:var(--primary);box-shadow:0 0 0 3px var(--primary-soft);background:var(--white)}
.full{grid-column:1/-1}
.items{width:100%;border-collapse:collapse;margin-top:8px}
.items th{font-size:10.5px;color:var(--muted);text-transform:uppercase;letter-spacing:.06em;padding:8px 7px}
.items td{padding:6px 7px}
.items input,.items select{width:100%;border:1px solid var(--line);border-radius:10px;padding:10px;font:inherit;background:var(--paper)}
.items input:focus,.items select:focus{border-color:var(--primary);outline:0;box-shadow:0 0 0 3px var(--primary-soft);background:var(--white)}
.items .line-total{font-weight:700;text-align:right;font-family:var(--font-mono)}
.payments-table{margin-top:2px}
.remove{border:0;background:var(--danger-soft);color:var(--danger);width:32px;height:32px;border-radius:9px;font-size:18px;cursor:pointer;line-height:1;transition:background .12s}
.remove:hover{background:#fbd8d8}
.form-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:26px}
.summary{margin-left:auto;max-width:360px;margin-top:22px;background:var(--indigo-soft);border-radius:var(--radius);padding:18px 20px}
.sumrow{display:flex;justify-content:space-between;padding:7px 0;color:#596478;font-size:13px}
.sumrow strong{font-family:var(--font-mono)}
.sumrow.total{border-top:1px dashed #c9cfec;margin-top:6px;padding-top:14px;color:var(--ink);font-weight:700;font-size:19px}
.sumrow.total strong{color:var(--primary-2)}

/* ---------- invoice preview / print — classic ledger style ---------- */
.invoice-preview{max-width:800px;margin:auto;background:#fff;border:1px solid #dfe3ea;box-shadow:var(--shadow-sm);padding:0;border-radius:2px;overflow:hidden;font-family:var(--font-ledger);color:#1a1a1a}
.invoice-body{padding:40px 44px 10px}
.invoice-topline{display:flex;justify-content:space-between;gap:30px;margin-bottom:24px;padding-bottom:16px;border-bottom:1px solid #222}
.invoice-topline .topline-right{text-align:right}
.invoice-topline .mini-label{display:block;font-size:10px;text-transform:uppercase;letter-spacing:.1em;color:#5a6472;font-weight:700;margin-bottom:4px}
.invoice-topline strong{display:block;font-size:15px;font-weight:700;color:#111}
.invoice-topline .sub{display:block;font-size:12px;color:#3a4250;margin-top:3px}

.invoice-table{width:100%;border-collapse:collapse;border:1px solid #222}
.invoice-table th{background:var(--doc-blue);color:#111;padding:12px 16px;font-weight:700;font-size:13px;border:1px solid #222;text-align:left}
.invoice-table td{padding:11px 16px;border:1px solid #222;font-size:13px;color:#1a1a1a}
.invoice-table td.desig{text-align:left}
.invoice-table .c{text-align:center}
.invoice-table .r{text-align:right}
.invoice-table th:nth-child(2),.invoice-table th:nth-child(3){text-align:center}
.invoice-table th:nth-child(3){text-align:right}
.invoice-table th:last-child{text-align:right}
.invoice-table tr.total-row td{background:var(--doc-blue);font-weight:700;padding:10px 16px}
.invoice-table tr.total-row td.label{font-weight:700;letter-spacing:.02em}

.words{margin:18px 0 0;font-size:12.5px;color:#1a1a1a;text-align:center}

.payment{margin-top:26px}
.payment .pay-title{font-weight:700;font-size:13px}
.payment-list{list-style:none;margin:8px 0 0;padding:0}
.payment-list li{font-size:12.5px;padding:2px 0 2px 14px;color:#1a1a1a}

.notes{margin-top:22px;padding-top:14px;border-top:1px dashed #c7ccdf;font-size:11.5px;color:#4a5261}

.invoice-footer{margin-top:34px;padding:18px 20px 22px;text-align:center;border-top:2px solid #222}
.invoice-footer .footer-name{font-weight:700;font-size:14px;letter-spacing:.02em;color:#111;margin-bottom:4px}
.invoice-footer .footer-line{font-size:11px;color:var(--doc-navy-2);line-height:1.7}
.invoice-footer .footer-label{color:#4a5261}
.page-actions{max-width:900px;margin:0 auto 18px;display:flex;justify-content:space-between}
.danger{color:var(--danger)!important}
.alert{background:var(--danger-soft);color:#8e2929;border:1px solid #f6cccc;padding:13px 16px;border-radius:12px;margin-bottom:18px;font-size:13px;font-weight:600}

/* ---------- site footer ---------- */
.site-footer{
  padding:20px 40px;color:var(--muted-2);font-size:11.5px;
  display:flex;gap:8px;align-items:center;justify-content:center;flex-wrap:wrap;
}
.site-footer .dot{opacity:.5}
.site-footer a{color:var(--primary);text-decoration:none;font-weight:700}
.site-footer a:hover{text-decoration:underline}

/* ---------- responsive ---------- */
@media(max-width:850px){
  .sidebar{position:static;width:100%;height:auto;padding:16px}
  .app-shell{display:block}
  .sidebar nav{display:flex;overflow:auto;gap:6px}
  .nav-label,.side-card,.side-footer{display:none}
  .main{margin:0}
  .topbar{padding:18px 20px;flex-wrap:wrap}
  .profile-chip .who{display:none}
  .content{padding:0 20px 24px}
  .stats{grid-template-columns:1fr}
  .panel-head{display:block}
  .search{margin-top:15px}
  .search input{width:100%}
  .form-grid{grid-template-columns:1fr}
  .full{grid-column:auto}
  .invoice-body{padding:24px}
  .invoice-topline{flex-direction:column;gap:12px}
  .invoice-topline .topline-right{text-align:left}
  .site-footer{padding:16px 20px}
}
@media print{
  body{background:#fff}
  .sidebar,.topbar,.page-actions,.site-footer{display:none!important}
  .main{margin:0}
  .content{padding:0}
  .invoice-preview{box-shadow:none;border:0;border-radius:0}
  .invoice-table th,.invoice-table tr.total-row td{-webkit-print-color-adjust:exact;print-color-adjust:exact}
}
