/* Admin Bouh les Poux */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, -apple-system, 'Segoe UI', sans-serif; background: #F2F5F3; color: #1B2B25; font-size: 15px; display: flex; min-height: 100vh; }
a { color: #1E9155; text-decoration: none; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.05rem; }

.sidebar { width: 232px; background: #12332B; color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; flex-shrink: 0; }
.side-logo { padding: 22px 20px; font-size: 1.05rem; border-bottom: 1px solid rgba(255,255,255,.1); }
.side-logo img { vertical-align: -8px; background: #fff; border-radius: 8px; padding: 2px; margin-right: 4px; }
.login-panel h1 img { background: #fff; border-radius: 12px; padding: 4px; }
.side-logo span { display: block; font-size: .75rem; opacity: .6; letter-spacing: 2px; text-transform: uppercase; }
.sidebar nav { display: flex; flex-direction: column; padding: 14px 10px; gap: 2px; flex: 1; }
.sidebar nav a { color: rgba(255,255,255,.82); padding: 11px 14px; border-radius: 10px; font-weight: 600; }
.sidebar nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar nav a.active { background: #2FB86B; color: #fff; }
.side-bottom { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.1); display: flex; flex-direction: column; gap: 8px; }
.side-bottom a { color: rgba(255,255,255,.7); font-size: .88rem; }
.side-bottom button { background: none; border: 1px solid rgba(255,255,255,.3); color: rgba(255,255,255,.8); border-radius: 8px; padding: 7px; cursor: pointer; font: inherit; font-size: .85rem; }
.side-bottom button:hover { background: rgba(255,255,255,.1); }

.admin-main { flex: 1; padding: 28px 32px 60px; max-width: 1200px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 22px; flex-wrap: wrap; }

.panel { background: #fff; border-radius: 14px; padding: 20px 22px; box-shadow: 0 2px 10px rgba(18,51,43,.06); margin-bottom: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { text-align: center; padding: 22px 12px; margin-bottom: 0; }
.stat-num { display: block; font-size: 1.65rem; font-weight: 800; color: #12332B; }
.stat-label { color: #5E7A70; font-size: .85rem; font-weight: 600; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .6px; color: #5E7A70; padding: 8px 10px; border-bottom: 2px solid #EDF1EF; }
td { padding: 11px 10px; border-bottom: 1px solid #F0F3F1; vertical-align: middle; }
.rowlink { cursor: pointer; }
.rowlink:hover td, tr:hover .rowlink { background: #F7FAF8; }
.row-off td { opacity: .5; }
.row-total td { border-top: 2px solid #EDF1EF; }
.td-img img { border-radius: 8px; background: #F7FAF8; object-fit: contain; }
.ta-r { text-align: right; }
.muted { color: #5E7A70; font-size: .88rem; margin: 8px 0; }

.tag { display: inline-block; font-size: .72rem; font-weight: 800; padding: 3px 10px; border-radius: 999px; background: #EDF1EF; color: #43584F; text-transform: capitalize; }
.tag-pro { background: #F59E42; color: #fff; }
.tag-ok, .tag-payee { background: #DCF5E7; color: #1E9155; }
.tag-off, .tag-annulee { background: #FBE4E4; color: #C0392B; }
.tag-en_attente { background: #FFF0DD; color: #B45309; }
.tag-expediee { background: #E3EDFF; color: #2563EB; }
.tag-livree { background: #2FB86B; color: #fff; }
.tag-active { background: #12332B; color: #fff; }
.filter-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-tags .tag { padding: 7px 14px; font-size: .82rem; }

.btn { display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 1.5px solid #D4DED9; color: #1B2B25; border-radius: 10px; padding: 9px 16px; font: inherit; font-weight: 700; font-size: .88rem; cursor: pointer; }
.btn:hover { border-color: #2FB86B; color: #1E9155; }
.btn-primary { background: #2FB86B; border-color: #2FB86B; color: #fff; }
.btn-primary:hover { background: #1E9155; color: #fff; }
.btn-danger { border-color: #E5A3A3; color: #C0392B; }
.btn-danger:hover { background: #C0392B; border-color: #C0392B; color: #fff; }
.btn-sm { padding: 6px 12px; font-size: .8rem; }
.btn-lg { padding: 12px 26px; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }

label { display: flex; flex-direction: column; gap: 5px; font-weight: 700; font-size: .82rem; color: #43584F; }
input, select, textarea { border: 1.5px solid #D4DED9; border-radius: 10px; padding: 9px 12px; font: inherit; background: #fff; width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: #2FB86B; }
label.check { flex-direction: row; align-items: center; gap: 8px; }
label.check input { width: auto; }
.form-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.span2 { grid-column: span 2; }
.form-panel { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.form-panel label { width: 100%; }
.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline-form label { min-width: 240px; }
.two-col { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; align-items: start; }
.info-list dt { font-size: .74rem; text-transform: uppercase; color: #5E7A70; letter-spacing: .5px; margin-top: 12px; }
.info-list dd { font-weight: 600; }

.ship-edit-row { display: grid; grid-template-columns: 2.2fr .8fr .8fr .6fr auto auto auto; gap: 10px; align-items: end; padding: 12px 0; border-bottom: 1px solid #F0F3F1; }
.img-list { display: flex; gap: 14px; flex-wrap: wrap; }
.img-item { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.img-item img { border-radius: 10px; background: #F7FAF8; object-fit: contain; }
.danger-zone { border: 1.5px dashed #E5A3A3; }

.alert { border-radius: 10px; padding: 12px 16px; font-weight: 700; margin-bottom: 16px; }
.alert-error { background: #FBE4E4; color: #C0392B; }
.alert-ok { background: #DCF5E7; color: #1E9155; }

.admin-main:has(.login-wrap) { max-width: none; padding: 0; }
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; width: 100%; background: #12332B; }
.login-panel { width: 360px; display: flex; flex-direction: column; gap: 14px; padding: 34px; }
.login-panel h1 { text-align: center; font-size: 1.2rem; margin-bottom: 6px; }

@media (max-width: 860px) {
  body { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .two-col, .form-2col, .ship-edit-row { grid-template-columns: 1fr; }
  .admin-main { padding: 18px; }
}

/* Stats funnel */
.funnel { display: flex; flex-direction: column; gap: 8px; }
.funnel-row { display: flex; align-items: center; gap: 12px; }
.funnel-label { width: 150px; font-weight: 700; font-size: .85rem; color: #43584F; flex-shrink: 0; }
.funnel-bar-wrap { flex: 1; display: flex; align-items: center; gap: 10px; }
.funnel-bar { height: 22px; background: linear-gradient(90deg, #2FB86B, #1E9155); border-radius: 6px; min-width: 4px; transition: width .3s; }
.funnel-count { font-weight: 700; font-size: .85rem; color: #43584F; white-space: nowrap; }

/* Assistant IA */
.chat-panel { display: flex; flex-direction: column; height: calc(100vh - 160px); min-height: 420px; }
.chat-box { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 6px 4px 14px; }
.chat-msg { max-width: 78%; padding: 12px 16px; border-radius: 14px; line-height: 1.5; white-space: pre-wrap; }
.chat-user { align-self: flex-end; background: #12332B; color: #fff; border-bottom-right-radius: 4px; }
.chat-assistant { align-self: flex-start; background: #EFF5F1; border-bottom-left-radius: 4px; }
.chat-thinking { opacity: .6; font-style: italic; }
.chat-actions { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.chat-input { display: flex; gap: 10px; border-top: 1px solid #EDF1EF; padding-top: 14px; }
.chat-input input { flex: 1; }

/* Bob en bulle */
#bob-bubble { position: fixed; bottom: 22px; right: 22px; width: 64px; height: 64px; border-radius: 50%; border: 0; background: #F9D14C; box-shadow: 0 6px 20px rgba(18,51,43,.3); cursor: pointer; z-index: 200; display: flex; align-items: center; justify-content: center; transition: transform .15s; }
#bob-bubble:hover { transform: scale(1.08) rotate(-4deg); }
#bob-panel { position: fixed; bottom: 96px; right: 22px; width: 380px; max-width: calc(100vw - 30px); height: 520px; max-height: calc(100vh - 130px); background: #fff; border-radius: 16px; box-shadow: 0 12px 40px rgba(18,51,43,.25); z-index: 200; display: flex; flex-direction: column; overflow: hidden; }
#bob-panel[hidden] { display: none; }
.bob-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: #12332B; color: #fff; }
.bob-head img { background: #fff; border-radius: 50%; padding: 2px; }
.bob-head div { flex: 1; line-height: 1.2; }
.bob-head span { display: block; font-size: .74rem; opacity: .7; }
.bob-head button { background: none; border: 0; color: rgba(255,255,255,.8); font-size: 1rem; cursor: pointer; padding: 4px 8px; }
.bob-head button:hover { color: #fff; }
#bob-panel .chat-box { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 14px; }
#bob-panel .chat-msg { font-size: .9rem; padding: 10px 13px; }
#bob-panel .chat-input { padding: 10px 12px; border-top: 1px solid #EDF1EF; }
