/* assets/beltva.css */
:root{
  --bg: #f6f8fb;
  --card: #ffffff;
  --border: #e6ebf2;
  --text: #0f172a;
  --muted: #667085;

  --primary: #1d4ed8;     /* bleu pro */
  --primaryHover: #1e40af;

  --danger: #b42318;
  --dangerBg: #fef3f2;
  --success: #027a48;
  --successBg: #ecfdf3;
  --warning: #b54708;
  --warningBg: #fffaeb;

  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  --radius: 14px;
  --radius2: 10px;


  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
}
//  --max: 1120px;

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.35;
}

a{ color: var(--primary); text-decoration:none; }
a:hover{ text-decoration: underline; }

.container{
  max-width: var(--max);
  margin: 0 auto;
  padding: 18px;
}

.auth-wrap{
  min-height: 100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 24px;
}

/* Card */
.card{
  width: 100%;
  max-width: 520px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header{
  padding: 20px 22px;
  border-bottom: 1px solid var(--border);
  background: #fbfcfe;
}

.brand{
  display:flex;
  align-items:center;
  gap: 12px;
}
.brand-mark{
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #0b2a6f, var(--primary));
}
.brand-title{
  font-weight: 800;
  letter-spacing: .2px;
  font-size: 18px;
}
.brand-sub{
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.card-body{
  padding: 20px 22px 22px 22px;
}

.kicker{
  margin: 0 0 16px 0;
  color: var(--muted);
  font-size: 13px;
}

/* Form */
.field{ margin-bottom: 12px; }
label{
  display:block;
  margin: 0 0 6px 0;
  font-size: 12.5px;
  color: var(--muted);
}
.input{
  width: 100%;
  padding: 11px 12px;
  border-radius: var(--radius2);
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  outline: none;
}
.input:focus{
  border-color: rgba(29,78,216,.45);
  box-shadow: 0 0 0 4px rgba(29,78,216,.12);
}

.form-row{
  display:flex;
  gap: 12px;
}
@media (max-width: 520px){
  .form-row{ flex-direction: column; }
}

/* Buttons */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius2);
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: .2px;
  background: var(--primary);
  color: #fff;
}
.btn:hover{ background: var(--primaryHover); }
.btn:active{ transform: translateY(1px); }

.btn-secondary{
  width:100%;
  background: #ffffff;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover{ background:#f8fafc; }

.actions{
  display:flex;
  gap: 10px;
  margin-top: 10px;
}
.actions .btn{ width:auto; flex:1; }

/* Alerts */
.alert{
  border-radius: var(--radius2);
  padding: 12px 12px;
  margin: 0 0 12px 0;
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--text);
  font-size: 13px;
}
.alert-danger{
  border-color: rgba(180,35,24,.25);
  background: var(--dangerBg);
  color: #7a271a;
}
.alert-success{
  border-color: rgba(2,122,72,.25);
  background: var(--successBg);
  color: #05603a;
}
.small{
  font-size: 12px;
  color: var(--muted);
}

/* Dashboard layout */
.shell{
  max-width: var(--max);
  margin: 0 auto;
  padding: 18px;
}

.topbar{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.topbar-right{
  display:flex;
  align-items:center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}
.pill{
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fbfcfe;
  color: var(--muted);
  font-size: 12px;
}

.layout{
  display:flex;
  gap: 16px;
  margin-top: 16px;
}

.sidebar{
  width: 260px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.side-head{
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 12.5px;
  background: #fbfcfe;
}

.nav{
  display:flex;
  flex-direction:column;
  padding: 10px;
  gap: 6px;
}
.nav a{
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  color: var(--text);
}
.nav a:hover{
  background: #f8fafc;
  border-color: var(--border);
  text-decoration:none;
}
.nav a.active{
  background: rgba(29,78,216,.08);
  border-color: rgba(29,78,216,.25);
  color: #0b2a6f;
}

.main{
  flex:1;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  min-height: 420px;
}

.h1{ margin:0 0 6px 0; font-size: 18px; font-weight: 800; }
.p{ margin:0 0 14px 0; color: var(--muted); }
.hr{ height:1px; background: var(--border); margin: 14px 0; }

.table{
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow:hidden;
}
.table th, .table td{
  text-align:left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.table th{
  background: #fbfcfe;
  color: var(--muted);
  font-weight: 700;
  font-size: 12.5px;
}
.table tr:last-child td{ border-bottom: 0; }

@media (max-width: 900px){
  .layout{ flex-direction: column; }
  .sidebar{ width: 100%; }
}





/* ===== beltva encode invoice page ===== */

.switch-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}
@media (max-width: 700px){
  .switch-grid{ grid-template-columns: 1fr; }
}

.switch-card{
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 14px;
  cursor: pointer;
  transition: transform .06s ease, box-shadow .06s ease, border-color .06s ease;
}
.switch-card:hover{
  box-shadow: 0 10px 18px rgba(15,23,42,.06);
  transform: translateY(-1px);
}
.switch-card.active{
  border-color: rgba(29,78,216,.35);
  box-shadow: 0 10px 20px rgba(29,78,216,.10);
}
.switch-title{
  display:flex; align-items:center; justify-content:space-between;
  gap:10px;
  font-weight: 800;
}
.badge{
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fbfcfe;
  color: var(--muted);
  font-weight: 700;
}
.badge.sale{ border-color: rgba(29,78,216,.25); color:#0b2a6f; background: rgba(29,78,216,.06); }
.badge.purchase{ border-color: rgba(2,122,72,.25); color:#05603a; background: rgba(2,122,72,.06); }

.grid-2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 900px){
  .grid-2{ grid-template-columns:1fr; }
}

.panel{
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  padding: 14px;
}

.toolbar{
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items:center;
  justify-content: space-between;
}
.toolbar-left{
  display:flex;
  gap:10px;
  flex-wrap: wrap;
  align-items:center;
}
.btn-sm{
  width:auto;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13px;
}
.btn-danger{
  background: var(--danger);
}
.btn-danger:hover{ filter: brightness(.95); }

.lines-wrap{
  overflow:auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.lines-table{
  width: 100%;
  border-collapse: collapse;
  min-width: 880px;
}
.lines-table th, .lines-table td{
  padding: 10px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: top;
}
.lines-table th{
  background:#fbfcfe;
  color: var(--muted);
  font-weight: 800;
  font-size: 12px;
}
.lines-table tr:last-child td{ border-bottom: 0; }

.input-sm{
  padding: 9px 10px;
  border-radius: 10px;
}

.total-box{
  display:grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}
@media (max-width: 900px){
  .total-box{ grid-template-columns: 1fr; }
}
.kpi{
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fbfcfe;
  padding: 12px;
}
.kpi .k{ color: var(--muted); font-size: 12px; font-weight: 800; }
.kpi .v{ font-size: 18px; font-weight: 900; margin-top: 6px; }




/* ===== Encode facture (simple) ===== */
.choice-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 12px 0 16px 0;
}
@media (max-width: 820px){
  .choice-grid{ grid-template-columns: 1fr; }
}
.choice-card{
  border: 1px solid var(--border);
  background: #fff;
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .06s ease, box-shadow .06s ease;
}
.choice-card:hover{
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.10);
}
.choice-title{
  font-weight: 900;
  font-size: 16px;
  margin: 0 0 6px 0;
}
.choice-sub{
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}
.choice-pill{
  display:inline-block;
  margin-top: 10px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fbfcfe;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.filebox{
  border: 1px dashed var(--border);
  border-radius: 12px;
  background:#fbfcfe;
  padding: 12px;
}



.autocomplete{
  position:absolute;
  left:0; right:0;
  top:100%;
  background:#fff;
  border:1px solid rgba(0,0,0,.08);
  border-radius:12px;
  box-shadow:0 16px 40px rgba(0,0,0,.10);
  margin-top:6px;
  z-index:50;
  overflow:hidden;
}
.ac-item{ padding:10px 12px; cursor:pointer; }
.ac-item:hover{ background:#f6f8fb; }
.ac-title{ font-weight:700; font-size:14px; }
.ac-sub{ font-size:12px; opacity:.75; margin-top:2px; }




/* =========================================================
   BELTVA - Ultra compact invoice encoding
   (scope: .inv-compact)
   ========================================================= */

.inv-compact .panel{padding:10px;}
.inv-compact .h1{margin:0 0 6px 0;}
.inv-compact .p{margin:0 0 8px 0;}

.inv-compact label{font-size:12px; margin-bottom:4px;}
.inv-compact .field{margin:0;}
.inv-compact .grid-3{gap:8px;}
.inv-compact .grid-2{gap:8px;}

.inv-compact .input{
  padding:7px 9px;
  font-size:13px;
  line-height:1.15;
  border-radius:10px;
}

.inv-compact textarea.input{
  padding:8px 10px;
}

.inv-compact .hr{margin:8px 0;}

.inv-compact .toolbar{margin:0 0 6px 0;}
.inv-compact .toolbar-left{gap:8px;}
.inv-compact .small{font-size:12px;}

.inv-compact .lines-wrap{
  border-radius:12px;
  overflow:hidden;
  max-height:220px; /* table scroll internal */
  overflow:auto;
}

.inv-compact .lines-table thead th{
  position:sticky;
  top:0;
  background:#fff;
  z-index:2;
  font-size:12px;
  padding:8px 8px;
}

.inv-compact .lines-table td{
  padding:6px 6px;
  vertical-align:middle;
}

.inv-compact .lines-table .input{
  padding:7px 8px;
  font-size:13px;
}

.inv-compact .total-box{
  margin-top:8px;
  padding:8px 10px;
  border-radius:12px;
}

.inv-compact .kpi .k{font-size:11px;}
.inv-compact .kpi .v{font-size:16px;}

.inv-compact .bottom-save{
  position:static;           /* ✅ le bouton reste en fin de formulaire */
  background:transparent;
  padding:10px 0 0 0;
  margin-top:12px;
  border-top:1px solid rgba(15,23,42,.08);
}
.inv-compact .btn-save-big{
  width:100%;
  font-size:16px;
  font-weight:900;
  padding:14px 16px;
  border-radius:14px;
}
.inv-compact .btn-row{display:flex; gap:8px; margin-top:8px;}
.inv-compact .btn-row .btn{flex:1;}

.inv-compact .btn-row{
  display:flex;
  gap:8px;
  margin-top:8px;
}

.inv-compact .btn-row .btn{flex:1;}

.inv-compact .acbox{
  position:absolute; left:0; right:0; top:100%;
  background:#fff;
  border:1px solid rgba(15,23,42,.12);
  border-radius:12px;
  box-shadow:0 14px 30px rgba(2,6,23,.12);
  overflow:hidden;
  margin-top:6px;
  z-index:999;
}

.inv-compact .acitem{padding:9px 10px; cursor:pointer; display:flex; justify-content:space-between; gap:10px;}
.inv-compact .acitem:hover{background:rgba(15,23,42,.05);}
.inv-compact .acname{font-weight:900; font-size:13px;}
.inv-compact .acmeta{font-size:12px; opacity:.8; white-space:nowrap;}

/* Sur petits écrans: moins de colonnes */
@media (max-width: 900px){
  .inv-compact .grid-3{grid-template-columns:1fr 1fr;}
}
@media (max-width: 640px){
  .inv-compact .grid-3{grid-template-columns:1fr;}
  .inv-compact .lines-wrap{max-height:260px;}
}
