/* ============================================================
   ERPEvent — style.css
   Thème "Noir & Gris" — inspiré des apps Lecteurs & Bracelets
   Sidebar 60px -> 220px au survol, surfaces charbon, accents gris clair
   ============================================================ */
:root {
    --bg:        #0B0C0E;
    --surface:   #141619;
    --surface2:  #1B1E23;
    --surface3:  #22262C;
    --border:    #2A2F37;
    --text:      #E9EBEE;
    --muted:     #8B919B;
    --accent:    #C7CCD4;
    --accent-hi: #FFFFFF;
    --vert:   #2ECC71;
    --jaune:  #F1C40F;
    --orange: #E67E22;
    --rouge:  #E74C3C;
    --gris:   #5B6069;
    --radius: 12px;
    --sb-min: 60px;
    --sb-max: 220px;
    --shadow: 0 8px 28px rgba(0,0,0,.45);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
    font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
    background: var(--bg); color: var(--text); font-size: 15px;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }

/* ================= AUTH ================= */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px;
    background: radial-gradient(1200px 600px at 50% -10%, #1A1D22 0%, var(--bg) 60%); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border);
    border-radius: 16px; padding: 34px 30px; box-shadow: var(--shadow); }
.auth-logo { font-size: 30px; font-weight: 800; letter-spacing: 1px; text-align: center; color: var(--accent-hi); }
.auth-logo span { color: var(--muted); font-weight: 300; }
.auth-sub { text-align: center; color: var(--muted); margin: 8px 0 22px; line-height: 1.5; }
.auth-card label { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 14px 0 6px; }
.auth-card input { width: 100%; }
.auth-card .btn { margin-top: 22px; }
.auth-foot { margin-top: 18px; font-size: 12.5px; color: var(--muted); text-align: center; line-height: 1.5; }

/* ================= INPUTS / BOUTONS ================= */
input, select, textarea {
    background: var(--surface2); border: 1px solid var(--border); color: var(--text);
    border-radius: 8px; padding: 10px 12px; font-size: 14px; outline: none; transition: border .2s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input[type=file] { padding: 8px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer;
    border: 1px solid var(--border); background: var(--surface3); color: var(--text);
    padding: 9px 16px; border-radius: 8px; font-size: 14px; font-weight: 600; transition: all .2s; }
.btn:hover { background: var(--border); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #0B0C0E; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hi); }
.btn-vert { background: rgba(46,204,113,.14); color: var(--vert); border-color: rgba(46,204,113,.4); }
.btn-rouge { background: rgba(231,76,60,.12); color: var(--rouge); border-color: rgba(231,76,60,.4); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-block { width: 100%; }

/* ================= LAYOUT SIDEBAR ================= */
.app-layout { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sb-min); min-width: var(--sb-min); background: var(--surface);
    border-right: 1px solid var(--border); position: fixed; top: 0; bottom: 0; left: 0; z-index: 50;
    overflow: hidden; transition: width .25s ease; display: flex; flex-direction: column;
}
.sidebar:hover { width: var(--sb-max); }
.sb-logo { height: 60px; display: flex; align-items: center; gap: 12px; padding: 0 16px;
    border-bottom: 1px solid var(--border); white-space: nowrap; }
.sb-logo .ico { font-size: 22px; min-width: 28px; text-align: center; }
.sb-logo .txt { font-weight: 800; letter-spacing: .5px; color: var(--accent-hi); opacity: 0; transition: opacity .2s; }
.sidebar:hover .sb-logo .txt { opacity: 1; }
.sb-nav { flex: 1; padding: 10px 0; overflow-y: auto; overflow-x: hidden; }
.sb-item { display: flex; align-items: center; gap: 14px; padding: 12px 16px; color: var(--muted);
    cursor: pointer; white-space: nowrap; border-left: 3px solid transparent; transition: all .18s; text-decoration: none; }
.sb-item .ico { min-width: 28px; text-align: center; font-size: 18px; }
.ico svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7;
    stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.sb-logo .ico svg { width: 24px; height: 24px; stroke: var(--accent-hi); }
.btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2;
    stroke-linecap: round; stroke-linejoin: round; }
.sb-item .txt { opacity: 0; transition: opacity .2s; font-weight: 500; font-size: 14px; }
.sidebar:hover .sb-item .txt { opacity: 1; }
.sb-item:hover { color: var(--text); background: var(--surface2); }
.sb-item.active { color: var(--accent-hi); background: var(--surface2); border-left-color: var(--accent); }
.sb-foot { border-top: 1px solid var(--border); }
.main { flex: 1; margin-left: var(--sb-min); padding: 26px 30px 60px; max-width: 100%; }

/* ================= TOPBAR ================= */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.topbar h1 { font-size: 21px; font-weight: 700; letter-spacing: .3px; }
.topbar .right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.event-select { min-width: 220px; }
.userchip { display: flex; align-items: center; gap: 9px; background: var(--surface); border: 1px solid var(--border);
    border-radius: 999px; padding: 5px 14px 5px 6px; font-size: 13px; color: var(--muted); }
.userchip .av { width: 28px; height: 28px; border-radius: 50%; background: var(--surface3); display: flex;
    align-items: center; justify-content: center; font-weight: 700; color: var(--accent); overflow: hidden; }
.userchip .av img { width: 100%; height: 100%; object-fit: cover; }

/* ================= CARTES / GRILLES ================= */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; margin-bottom: 24px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.card .k { font-size: 12px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }
.card .v { font-size: 30px; font-weight: 800; margin-top: 6px; color: var(--accent-hi); }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 22px; }
.panel h2 { font-size: 16px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.panel h2 .spacer { flex: 1; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }

/* ================= TABLES ================= */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; padding: 10px 12px; color: var(--muted); font-size: 12px; text-transform: uppercase;
    letter-spacing: .6px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--surface2); vertical-align: middle; }
.tbl tr:hover td { background: var(--surface2); }
.tbl input { padding: 6px 9px; max-width: 110px; }
.prod-thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; background: var(--surface3);
    display: inline-flex; align-items: center; justify-content: center; font-size: 17px; }

/* ================= BADGES / RATIOS ================= */
.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 3px 11px;
    font-size: 12.5px; font-weight: 700; letter-spacing: .3px; }
.b-vert   { background: rgba(46,204,113,.15); color: var(--vert); }
.b-jaune  { background: rgba(241,196,15,.15); color: var(--jaune); }
.b-orange { background: rgba(230,126,34,.15); color: var(--orange); }
.b-rouge  { background: rgba(231,76,60,.15);  color: var(--rouge); }
.b-gris   { background: rgba(139,145,155,.15); color: var(--muted); }
.ratio-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 58px;
    border-radius: 10px; padding: 6px 12px; font-weight: 800; font-size: 16px; }
.r-vert   { background: rgba(46,204,113,.18); color: var(--vert);   border: 1px solid rgba(46,204,113,.5); }
.r-jaune  { background: rgba(241,196,15,.18); color: var(--jaune);  border: 1px solid rgba(241,196,15,.5); }
.r-orange { background: rgba(230,126,34,.18); color: var(--orange); border: 1px solid rgba(230,126,34,.5); }
.r-rouge  { background: rgba(231,76,60,.18);  color: var(--rouge);  border: 1px solid rgba(231,76,60,.5); }
.r-gris   { background: var(--surface3); color: var(--muted); border: 1px solid var(--border); }

/* ================= ALERTES / TOASTS ================= */
.alert { border-radius: 10px; padding: 12px 15px; font-size: 14px; margin-bottom: 14px; line-height: 1.5; }
.alert-rouge { background: rgba(231,76,60,.12); border: 1px solid rgba(231,76,60,.4); color: #F5B7B1; }
.alert-vert  { background: rgba(46,204,113,.1); border: 1px solid rgba(46,204,113,.35); color: #A9DFBF; }
.alert-jaune { background: rgba(241,196,15,.1); border: 1px solid rgba(241,196,15,.35); color: #F9E79F; }
#toast { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--surface3); border: 1px solid var(--border); border-left: 4px solid var(--accent);
    color: var(--text); padding: 12px 18px; border-radius: 10px; box-shadow: var(--shadow); font-size: 14px;
    animation: slidein .25s ease; max-width: 340px; }
.toast.err { border-left-color: var(--rouge); }
.toast.ok  { border-left-color: var(--vert); }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ================= MODAL ================= */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.65); z-index: 100; display: none;
    align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.modal-bg.open { display: flex; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; width: 100%;
    max-width: 560px; padding: 24px; box-shadow: var(--shadow); }
.modal h3 { margin-bottom: 16px; font-size: 17px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.modal .field { margin-bottom: 12px; }
.modal input, .modal select, .modal textarea { width: 100%; }

/* ================= LISTE PERSONNES (stocks) ================= */
.person-card { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 14px 16px; margin-bottom: 14px; }
.person-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.person-head .av { width: 38px; height: 38px; border-radius: 50%; background: var(--surface3); overflow: hidden;
    display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--accent); }
.person-head .av img { width: 100%; height: 100%; object-fit: cover; }
.person-head .nm { font-weight: 700; }
.person-head .rl { font-size: 12px; color: var(--muted); }
.person-head .spacer { flex: 1; }
.chk { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--muted); cursor: pointer; }
.chk input { width: auto; }

/* ================= BARMAN MOBILE ================= */
.bm-wrap { max-width: 520px; margin: 0 auto; padding: 18px 16px 70px; }
.bm-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.bm-head h1 { font-size: 19px; }
.bm-ratio-card { text-align: center; padding: 26px 20px; border-radius: 18px; margin-bottom: 18px;
    background: var(--surface); border: 1px solid var(--border); }
.bm-ratio-val { font-size: 52px; font-weight: 900; line-height: 1; }
.bm-ratio-lbl { color: var(--muted); font-size: 13px; margin-top: 8px; text-transform: uppercase; letter-spacing: 1px; }
.t-vert { color: var(--vert); } .t-jaune { color: var(--jaune); } .t-orange { color: var(--orange); }
.t-rouge { color: var(--rouge); } .t-gris { color: var(--muted); }
.bm-line { display: flex; align-items: center; gap: 12px; background: var(--surface2); border: 1px solid var(--border);
    border-radius: 12px; padding: 10px 12px; margin-bottom: 9px; }
.bm-line .info { flex: 1; min-width: 0; }
.bm-line .info .n { font-weight: 600; font-size: 14.5px; }
.bm-line .info .s { font-size: 12px; color: var(--muted); }
.bm-line input { width: 76px; text-align: center; font-weight: 700; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 20px 0 10px; }

/* ================= RESPONSIVE ================= */
@media (max-width: 860px) {
    .main { padding: 18px 14px 80px; margin-left: 0; }
    .sidebar { top: auto; bottom: 0; left: 0; right: 0; width: 100%; min-width: 100%; height: 58px;
        flex-direction: row; border-right: 0; border-top: 1px solid var(--border); }
    .sidebar:hover { width: 100%; }
    .sb-logo, .sb-foot .sb-item .txt { display: none; }
    .sb-nav { display: flex; flex: 1; padding: 0; }
    .sb-item { flex: 1; flex-direction: column; gap: 3px; padding: 8px 4px; border-left: 0; border-top: 3px solid transparent; justify-content: center; }
    .sb-item.active { border-top-color: var(--accent); border-left: 0; }
    .sb-item .txt { opacity: 1; font-size: 10px; }
    .sidebar:hover .sb-item .txt { opacity: 1; }
    .sb-foot { border-top: 0; display: flex; }
    .topbar h1 { font-size: 18px; }
}
