* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #07080d;
  --panel: rgba(255,255,255,.028);
  --panel-solid: #10131d;
  --panel-2: rgba(255,255,255,.055);
  --border: rgba(255,255,255,.07);
  --border-2: rgba(255,255,255,.13);
  --text: #eef0f8;
  --muted: #8a90a6;
  --muted-2: #5c6178;
  --accent: #ff2d78;
  --accent-2: #7c4dff;
  --grad: linear-gradient(135deg, #ff2d78, #7c4dff);
  --green: #34d399;
  --red: #f87171;
  --amber: #fbbf24;
  --radius: 14px;
  --shadow: 0 10px 40px rgba(0,0,0,.45);
}
html, body { height: 100%; }
body {
  background: var(--bg);
  background-image:
    radial-gradient(1200px 500px at 85% -10%, rgba(124,77,255,.09), transparent 60%),
    radial-gradient(900px 400px at -10% 110%, rgba(255,45,120,.07), transparent 60%);
  background-attachment: fixed;
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
::selection { background: rgba(255,45,120,.35); }

/* ================= Login ================= */
.login-screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--bg); z-index: 100; padding: 16px; }
.login-box {
  background: var(--panel-solid); border: 1px solid var(--border); border-radius: 20px;
  padding: 40px 36px; width: 350px; display: flex; flex-direction: column; gap: 14px;
  text-align: center; box-shadow: var(--shadow);
}
.login-logo {
  width: 52px; height: 52px; margin: 0 auto 4px; border-radius: 15px; background: var(--grad);
  display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 900;
}
.login-box h1 { font-size: 22px; font-weight: 800; letter-spacing: -.5px; }
.login-box h1 span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-sub { color: var(--muted); font-size: 13px; margin-top: -8px; }
.login-error { color: var(--red); font-size: 13px; min-height: 16px; }

/* ================= Layout admin ================= */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 218px; flex-shrink: 0; padding: 22px 14px; display: flex; flex-direction: column; gap: 26px;
  border-right: 1px solid var(--border); background: rgba(255,255,255,.012);
  position: sticky; top: 0; height: 100vh;
}
.logo { display: flex; align-items: center; gap: 11px; padding: 0 8px; }
.logo-mark {
  width: 38px; height: 38px; border-radius: 12px; background: var(--grad); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 19px;
  box-shadow: 0 4px 18px rgba(255,45,120,.35);
}
.logo-text { font-weight: 800; font-size: 15px; letter-spacing: -.3px; line-height: 1.15; }
.logo-text span { display: block; font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: 1.5px; text-transform: uppercase; }
.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px;
  background: none; border: none; color: var(--muted); font-size: 13.5px; font-weight: 600;
  font-family: inherit; cursor: pointer; text-align: left; text-decoration: none; transition: all .15s; width: 100%;
}
.nav-item:hover { color: var(--text); background: var(--panel-2); }
.nav-item.active { color: var(--text); background: var(--panel-2); box-shadow: inset 2px 0 0 var(--accent); }
.nav-ico { width: 20px; text-align: center; font-size: 15px; }
.nav-badge {
  margin-left: auto; background: var(--red); color: #fff; font-size: 11px; font-weight: 800;
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
}
.sidebar-footer { border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 3px; }

.main { flex: 1; min-width: 0; padding: 26px 30px 60px; max-width: 1350px; }
.pagebar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.pagebar h1 { font-size: 26px; font-weight: 800; letter-spacing: -.6px; }
.pagebar-actions { display: flex; gap: 10px; }
.page-sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.page { animation: fadeUp .25s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ================= Contrôles ================= */
.filters { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; align-items: center; }
.ctl {
  background: var(--panel-solid); border: 1px solid var(--border); color: var(--text);
  padding: 9px 12px; border-radius: 10px; font-size: 13.5px; font-family: inherit; font-weight: 500;
}
.ctl:focus { outline: none; border-color: var(--accent-2); }
.grow { flex: 1; min-width: 160px; }
.seg { display: inline-flex; background: var(--panel-solid); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button {
  background: none; border: none; color: var(--muted); font-family: inherit; font-size: 12.5px;
  font-weight: 700; padding: 6px 12px; border-radius: 7px; cursor: pointer; transition: all .15s; white-space: nowrap;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--panel-2); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.3); }

.btn {
  border: 1px solid var(--border-2); background: var(--panel-2); color: var(--text);
  padding: 9px 18px; border-radius: 10px; cursor: pointer; font-size: 13.5px; font-weight: 700;
  font-family: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 8px;
  transition: all .15s;
}
.btn:hover { border-color: rgba(255,255,255,.25); transform: translateY(-1px); }
.btn:active { transform: none; }
.btn-primary { background: var(--grad); border: none; box-shadow: 0 4px 18px rgba(255,45,120,.3); }
.btn-primary:hover { box-shadow: 0 6px 24px rgba(255,45,120,.45); }
.btn-ghost { background: transparent; }
.btn-danger { background: rgba(248,113,113,.12); border-color: rgba(248,113,113,.3); color: var(--red); }
.btn-block { width: 100%; justify-content: center; }
.btn-xs { padding: 5px 11px; font-size: 12px; }

select, input, textarea {
  background: var(--panel-solid); border: 1px solid var(--border); color: var(--text);
  padding: 9px 11px; border-radius: 9px; font-size: 14px; font-family: inherit;
}
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(124,77,255,.15); }

/* ================= Cards & KPI ================= */
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; backdrop-filter: blur(6px);
}
.card-table { padding: 8px 14px; overflow-x: auto; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; position: relative; overflow: hidden;
}
.kpi::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: var(--grad); opacity: .5; }
.kpi.warn::before { background: var(--amber); opacity: .8; }
.kpi.bad::before { background: var(--red); opacity: .8; }
.kpi-value { font-size: 26px; font-weight: 800; letter-spacing: -.8px; font-variant-numeric: tabular-nums; }
.kpi-label { color: var(--muted); font-size: 12px; font-weight: 600; margin-top: 3px; }

/* ================= Tables ================= */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; color: var(--muted-2); font-size: 11px; text-transform: uppercase; font-weight: 800;
  letter-spacing: .8px; padding: 12px 10px 9px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 11px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; font-variant-numeric: tabular-nums; }
.table tbody tr:last-child td { border-bottom: none; }
.table-hover tbody tr { cursor: pointer; transition: background .12s; }
.table-hover tbody tr:hover { background: var(--panel-2); }
.num { text-align: right; }
th.num { text-align: right; }
.cell-strong { font-weight: 700; }
.cell-dim { color: var(--muted); }
.delta-up { color: var(--green); font-weight: 700; font-size: 12px; }
.delta-down { color: var(--red); font-weight: 700; font-size: 12px; }

.net { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; }
.net-ico {
  width: 24px; height: 24px; border-radius: 7px; display: inline-flex; align-items: center;
  justify-content: center; font-size: 11px; font-weight: 900; color: #fff; flex-shrink: 0;
}
.net-ico.instagram { background: linear-gradient(45deg, #f09433, #dc2743, #bc1888); }
.net-ico.twitter { background: #000; border: 1px solid #333; }

/* Badges état */
.ok-badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 800;
  color: var(--green); background: rgba(52,211,153,.1); border: 1px solid rgba(52,211,153,.25);
  padding: 2px 8px; border-radius: 20px;
}
.warn-badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 800;
  color: var(--amber); background: rgba(251,191,36,.1); border: 1px solid rgba(251,191,36,.25);
  padding: 2px 8px; border-radius: 20px;
}
.diff-badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700;
  color: var(--red); background: rgba(248,113,113,.1); border: 1px solid rgba(248,113,113,.3);
  padding: 3px 10px; border-radius: 20px; max-width: 260px; overflow: hidden;
}
.diff-badge span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Grille 7 jours */
.days { display: inline-flex; gap: 3px; }
.day-dot {
  width: 22px; height: 22px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 800; background: var(--panel-2); color: var(--muted-2);
}
.day-dot.some { background: rgba(52,211,153,.18); color: var(--green); }
.day-dot.zero { background: rgba(251,191,36,.15); color: var(--amber); }
.day-dot.diff { box-shadow: 0 0 0 1.5px var(--red); }

/* ================= Vue VA ================= */
.va-app { max-width: 660px; margin: 0 auto; padding: 26px 16px 80px; }
.preview-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: rgba(251,191,36,.1); border: 1px solid rgba(251,191,36,.35);
  border-radius: var(--radius); padding: 11px 16px; margin-bottom: 18px;
  font-size: 13px; line-height: 1.5; color: var(--amber);
}
.preview-banner strong { color: var(--text); }
.va-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.va-header h1 { font-size: 23px; font-weight: 800; letter-spacing: -.5px; }
.va-header h1 span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.va-intro { color: var(--muted); font-size: 13.5px; line-height: 1.5; margin: 10px 0 22px; }
.va-account {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin-bottom: 14px;
}
.va-account.done { border-color: rgba(52,211,153,.3); }
.va-account-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; flex-wrap: wrap; }
.va-account-head .net { font-size: 14.5px; font-weight: 700; }
.va-last { color: var(--muted-2); font-size: 12px; margin-bottom: 12px; }
.va-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.va-form label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--muted); flex: 1; min-width: 110px; }
.va-form input[type="text"] { font-weight: 700; font-variant-numeric: tabular-nums; }
.va-diff-row { margin-top: 12px; }
.va-diff-toggle { display: flex; gap: 8px; margin-bottom: 8px; }
.va-diff-toggle button {
  flex: 1; padding: 8px; border-radius: 9px; border: 1px solid var(--border); background: var(--panel-solid);
  color: var(--muted); font-family: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; transition: all .15s;
}
.va-diff-toggle button.on-ok { border-color: rgba(52,211,153,.4); color: var(--green); background: rgba(52,211,153,.08); }
.va-diff-toggle button.on-diff { border-color: rgba(248,113,113,.4); color: var(--red); background: rgba(248,113,113,.08); }
.va-diff-text { width: 100%; resize: vertical; }
.va-save-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.va-days { margin-top: 12px; display: flex; align-items: center; gap: 8px; color: var(--muted-2); font-size: 11.5px; }

/* ================= VAs (admin) ================= */
.va-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.va-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; cursor: pointer; transition: all .15s;
}
.va-card:hover { transform: translateY(-2px); border-color: var(--border-2); box-shadow: var(--shadow); }
.va-card-name { font-size: 17px; font-weight: 800; letter-spacing: -.3px; }
.va-card-code { color: var(--muted-2); font-size: 12px; margin: 4px 0 12px; font-family: ui-monospace, monospace; }
.va-card-stats { display: flex; gap: 14px; color: var(--muted); font-size: 12.5px; font-weight: 600; flex-wrap: wrap; }
.va-card-stats strong { color: var(--text); }
.va-card-status { margin-top: 12px; display: flex; gap: 6px; flex-wrap: wrap; }

.code-row { display: flex; gap: 8px; align-items: center; }
.code-row input { flex: 1; font-family: ui-monospace, monospace; font-weight: 600; }
#va-code-actions { display: inline-flex; gap: 6px; }

/* ================= Planning ================= */
.va-summary {
  background: linear-gradient(135deg, rgba(255,45,120,.12), rgba(124,77,255,.12));
  border: 1px solid rgba(255,45,120,.25); border-radius: var(--radius);
  padding: 14px 18px; margin-bottom: 18px; font-size: 14.5px; font-weight: 600; line-height: 1.5;
}
.va-summary strong { font-size: 17px; }
.sched-block {
  background: rgba(124,77,255,.06); border: 1px solid rgba(124,77,255,.2);
  border-radius: 10px; padding: 12px 14px; margin-bottom: 12px;
}
.sched-block-title { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-bottom: 8px; }
.sched-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 0; flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}
.sched-item:last-child { border-bottom: none; }
.sched-item.done { opacity: .55; }
.sched-item.done .sched-caption { text-decoration: line-through; }
.sched-time {
  font-weight: 800; font-variant-numeric: tabular-nums; font-size: 13.5px;
  background: var(--panel-2); border-radius: 7px; padding: 3px 8px; flex-shrink: 0;
}
.sched-caption { flex: 1; min-width: 140px; font-size: 13px; line-height: 1.4; white-space: normal; }
.sched-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.sched-check {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border-2);
  background: var(--panel-2); color: var(--muted); font-size: 15px; cursor: pointer; transition: all .15s;
}
.sched-check.on { background: rgba(52,211,153,.18); border-color: rgba(52,211,153,.5); color: var(--green); }
.bot-hint { line-height: 1.6; margin-bottom: 16px; font-size: 13.5px; }
.bot-hint code { background: var(--panel-2); border-radius: 5px; padding: 1px 6px; font-size: 12px; }
.links-title { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: var(--muted-2); margin-bottom: 10px; }
.link-chip {
  display: inline-flex; align-items: center; gap: 8px; background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 20px; padding: 5px 6px 5px 12px; margin: 0 8px 8px 0; font-size: 12.5px; font-weight: 600;
}
.link-chip button { background: none; border: none; color: var(--muted-2); cursor: pointer; font-size: 13px; padding: 2px 6px; }
.link-chip button:hover { color: var(--red); }

/* ================= Journal ================= */
.event-item {
  display: flex; align-items: flex-start; gap: 12px; padding: 10px 4px;
  border-bottom: 1px solid var(--border); font-size: 13.5px; line-height: 1.5;
}
.event-item:last-child { border-bottom: none; }
.event-time { color: var(--muted-2); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; padding-top: 1px; min-width: 96px; }
.event-msg { flex: 1; }
.event-item.highlight { background: linear-gradient(90deg, rgba(251,191,36,.06), transparent); border-radius: 8px; }
.event-item.highlight .event-msg { font-weight: 600; }
.event-item.error .event-msg { color: #fca5a5; }

/* ================= Empty / modales / toasts ================= */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-ico { font-size: 40px; margin-bottom: 12px; opacity: .8; }
.empty p { font-weight: 700; font-size: 15px; color: var(--text); }
.empty .empty-sub { font-weight: 500; font-size: 13px; color: var(--muted); margin-top: 5px; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(3,4,8,.72); backdrop-filter: blur(3px); z-index: 50;
  display: flex; align-items: flex-start; justify-content: center; padding: 46px 16px; overflow-y: auto;
}
.modal {
  background: var(--panel-solid); border: 1px solid var(--border-2); border-radius: 18px;
  padding: 26px; width: 100%; max-width: 620px; box-shadow: var(--shadow); animation: pop .18s ease;
}
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(8px); } to { opacity: 1; transform: none; } }
.modal-sm { max-width: 420px; }
.modal h2 { font-size: 18px; font-weight: 800; letter-spacing: -.4px; margin-bottom: 20px; }
.modal label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 13px; }
.form-row { display: flex; gap: 12px; }
.form-row label { flex: 1; }
.form-row .grow { flex: 2; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; align-items: center; }
.spacer { flex: 1; }
.confirm-text { color: var(--muted); line-height: 1.5; }
.history { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.history h3 { font-size: 11px; color: var(--muted-2); margin-bottom: 10px; text-transform: uppercase; letter-spacing: 1px; font-weight: 800; }
.chart-wrap { position: relative; height: 270px; }
.chart-mini { height: 150px; }

.toasts { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 90; }
.toast {
  background: var(--panel-solid); border: 1px solid var(--border-2); border-left: 3px solid var(--green);
  border-radius: 12px; padding: 13px 18px; font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow); animation: slideIn .25s ease; max-width: 340px;
}
.toast.err { border-left-color: var(--red); }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
.toast.out { opacity: 0; transform: translateX(20px); transition: all .3s; }

/* ================= Responsive ================= */
@media (max-width: 860px) {
  .app { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: static; flex-direction: row; align-items: center;
    padding: 10px 14px; gap: 12px; border-right: none; border-bottom: 1px solid var(--border);
    overflow-x: auto;
  }
  .logo-text { display: none; }
  .sidebar-footer { border-top: none; padding-top: 0; flex-direction: row; }
  .nav { flex-direction: row; }
  .nav-item { padding: 8px 10px; white-space: nowrap; }
  .main { padding: 18px 14px 60px; }
  .form-row { flex-direction: column; gap: 0; }
}
