/* ── SimpleAds — feuille de style ─────────────────────────── */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #eff6ff;
    --success: #16a34a;
    --danger: #dc2626;
    --bg: #f1f5f9;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 4px 12px rgba(15, 23, 42, .05);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); }
.hidden { display: none !important; }
h1 { font-size: 24px; margin-bottom: 20px; }
h2 { font-size: 16px; margin-bottom: 14px; }
h3 { font-size: 13px; margin: 14px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.logo { font-size: 22px; font-weight: 800; color: var(--primary); letter-spacing: -.02em; }

/* ── Auth ── */
.auth-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 55%, #60a5fa 100%); }
.auth-card { background: var(--card); border-radius: 16px; padding: 36px; width: 400px;
    box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.auth-brand { text-align: center; margin-bottom: 24px; }
.auth-brand p { color: var(--muted); margin-top: 6px; font-size: 14px; }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 20px; background: var(--bg); border-radius: 8px; padding: 4px; }
.auth-tab { flex: 1; padding: 8px; border: none; background: transparent; border-radius: 6px;
    cursor: pointer; font-weight: 600; color: var(--muted); }
.auth-tab.active { background: var(--card); color: var(--primary); box-shadow: var(--shadow); }
.auth-form label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 14px; }
.auth-form input { width: 100%; padding: 10px 12px; margin-top: 5px; border: 1px solid var(--border);
    border-radius: 8px; font-size: 14px; }
.error-msg { color: var(--danger); font-size: 13px; margin-top: 12px; text-align: center; }

/* ── Layout app ── */
#view-app { display: flex; min-height: 100vh; }
.sidebar { width: 230px; background: #0f172a; color: #e2e8f0; display: flex; flex-direction: column;
    padding: 22px 14px; position: sticky; top: 0; height: 100vh; }
.sidebar .logo { color: #fff; margin: 0 8px 26px; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-link { color: #cbd5e1; text-decoration: none; padding: 10px 12px; border-radius: 8px;
    font-size: 14px; font-weight: 500; transition: .15s; }
.nav-link:hover { background: #1e293b; color: #fff; }
.nav-link.active { background: var(--primary); color: #fff; }
.sidebar-footer { border-top: 1px solid #1e293b; padding-top: 14px; }
.user-chip { font-size: 13px; color: #94a3b8; padding: 6px 8px; margin-bottom: 8px; }
.user-chip strong { color: #fff; display: block; }
.content { flex: 1; padding: 32px 40px; }

/* ── Boutons ── */
.btn { padding: 10px 18px; border: none; border-radius: 8px; font-size: 14px; font-weight: 600;
    cursor: pointer; transition: .15s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; font-size: 15px; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); padding: 6px 12px; font-size: 12px; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Cartes & tableaux ── */
.card { background: var(--card); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); margin-bottom: 20px; }

/* Infobulle d'aide */
.help-tip { display: inline-flex; align-items: center; justify-content: center;
    width: 18px; height: 18px; border-radius: 50%; background: var(--bg); color: var(--muted);
    font-size: 11px; font-weight: 700; cursor: help; margin-left: 8px; vertical-align: middle;
    position: relative; }
.help-tip:hover { background: var(--primary); color: #fff; }
.help-tip::after { content: attr(data-tip); position: absolute; top: 24px; left: 0; z-index: 60;
    width: 290px; padding: 10px 12px; background: #0f172a; color: #fff; font-size: 12px;
    font-weight: 400; line-height: 1.45; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.25);
    opacity: 0; visibility: hidden; transition: .15s; }
.help-tip:hover::after { opacity: 1; visibility: visible; }
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 11px; text-transform: uppercase; color: var(--muted);
    padding: 8px 10px; border-bottom: 2px solid var(--border); }
.table td { padding: 10px; border-bottom: 1px solid var(--border); }
.table tr:hover td { background: #f8fafc; }
.billing-total td { border-top: 2px solid var(--primary); background: var(--primary-light); }

/* ── Synchronisation Google Ads ── */
.sync-state { margin-top: 10px; padding: 10px 14px; border-radius: 8px; font-size: 13px;
    background: var(--ok-light); border: 1px solid #bbf7d0; }
.sync-state.drift { background: #fff7ed; border-color: #fed7aa; color: #9a3412; }
.sync-state ul { margin: 6px 0 0 18px; }
.sync-state .hint { display: block; margin-top: 6px; font-size: 12px; }
.badge.drift { background: #fff7ed; color: #c2410c; font-size: 11px; }
.drift-list { margin: 8px 0 0 18px; font-size: 13px; color: #9a3412; }
.badge.active { background: var(--ok-light); color: var(--ok-dark); }
.forgot-link { display: block; text-align: center; font-size: 13px;
    color: var(--primary); margin-top: 10px; }
.tfa-secret { font-family: monospace; font-size: 16px; letter-spacing: 2px;
    background: var(--bg); padding: 10px 14px; border-radius: 8px; font-weight: 700;
    user-select: all; word-break: break-all; }

/* ── KPI ── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi-card { background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
    border-top: 4px solid var(--primary); }
.kpi-card .kpi-value { font-size: 24px; font-weight: 800; color: var(--primary-dark); }
.kpi-card .kpi-label { font-size: 12px; color: var(--muted); margin-top: 4px; }
.kpi-card.warn { border-top-color: var(--success); }
.kpi-card.warn .kpi-value { color: var(--success); }

/* ── Tips ── */
.tips { list-style: none; }
.tips li { padding: 10px 0 10px 30px; position: relative; font-size: 14px; line-height: 1.5;
    border-bottom: 1px solid var(--border); }
.tips li::before { content: '💡'; position: absolute; left: 0; }
.tips.reco-list li { padding-left: 0; display: flex; align-items: center;
    justify-content: space-between; gap: 14px; }
.tips.reco-list li::before { content: none; }
.tips.reco-list .reco-text { flex: 1; line-height: 1.5; }
.reco-apply { flex-shrink: 0; white-space: nowrap; }

/* ── Wizard ── */
.wizard { padding: 30px; }
.wizard-progress { display: flex; gap: 8px; margin-bottom: 28px; }
.wizard-progress .dot { flex: 1; height: 6px; border-radius: 3px; background: var(--border); }
.wizard-progress .dot.done { background: var(--primary); }
.wizard-step h2 { font-size: 20px; margin-bottom: 20px; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.choice { padding: 22px; border: 2px solid var(--border); border-radius: var(--radius);
    background: var(--card); cursor: pointer; font-size: 15px; font-weight: 600; text-align: left;
    transition: .15s; }
.choice:hover { border-color: var(--primary); }
.choice.selected { border-color: var(--primary); background: var(--primary-light); }
.choice-icon { display: block; font-size: 26px; margin-bottom: 8px; }
.geo-types { display: flex; gap: 10px; margin-bottom: 18px; }
.choice-sm { padding: 8px 16px; border: 1.5px solid var(--border); border-radius: 20px;
    background: var(--card); cursor: pointer; font-size: 13px; font-weight: 600; }
.choice-sm.active { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.input-lg { width: 100%; padding: 14px 16px; font-size: 16px; border: 2px solid var(--border);
    border-radius: var(--radius); margin-bottom: 14px; }
.input-lg:focus { outline: none; border-color: var(--primary); }
input[type=range] { width: 100%; accent-color: var(--primary); height: 32px; }
.slider-label { font-size: 14px; display: block; margin-bottom: 4px; }
.budget-display { font-size: 34px; font-weight: 800; color: var(--primary); margin-bottom: 10px; }
.budget-display span { font-size: 44px; }
.budget-marks { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 2px; }
.hint { font-size: 13px; color: var(--muted); margin-top: 12px; }
.hint-inline { font-weight: 400; color: var(--muted); font-size: 12px; }
.client-name-label { display: block; font-size: 13px; font-weight: 600; margin-top: 20px; }
.client-name-label input { width: 100%; padding: 10px; margin-top: 6px; border: 1px solid var(--border); border-radius: 8px; }
.wizard-nav { display: flex; justify-content: space-between; margin-top: 28px; }
.summary { background: var(--primary-light); border-radius: var(--radius); padding: 18px; font-size: 15px; line-height: 2; }
.summary strong { color: var(--primary-dark); }
#preview-loading { color: var(--muted); font-style: italic; margin-top: 14px; }
.preview-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.preview-tags span { background: var(--primary-light); color: var(--primary-dark); border-radius: 16px;
    padding: 5px 12px; font-size: 13px; font-weight: 600; }
.preview-tags.kw span { background: #f0fdf4; color: #15803d; }
.preview-tags.neg span { background: #fee2e2; color: var(--danger); text-decoration: line-through; }
.preview-tags .match { font-size: 10px; font-style: normal; font-weight: 400; opacity: .65; margin-left: 3px; }

/* ── Force de l'annonce ── */
.ad-strength { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px;
    border-radius: 16px; font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.ad-strength.excellent { background: #dcfce7; color: #15803d; }
.ad-strength.bonne { background: #dbeafe; color: #1d4ed8; }
.ad-strength.faible { background: #fef3c7; color: #b45309; }
.ad-strength .score { font-weight: 400; font-size: 12px; }
.strength-improve { font-size: 12px; color: var(--muted); margin: 4px 0 10px; }

/* ── Décisions de l'arbitre ── */
.decisions { background: var(--primary-light); border-radius: 8px; padding: 14px 18px; margin: 12px 0; }
.decisions h3 { margin: 0 0 10px; }
.decisions li { font-size: 13px; padding: 4px 0; list-style: none; }
.decisions .delta-up { color: var(--success); font-weight: 800; }
.decisions .delta-down { color: var(--danger); font-weight: 800; }
.decisions .delta-eq { color: var(--muted); font-weight: 700; }
.decisions .why { color: var(--muted); }
.preview-list { padding-left: 18px; font-size: 14px; line-height: 1.9; color: #374151; }

/* ── Badges / statuts ── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 700; }
.badge.active { background: #dcfce7; color: #15803d; }
.badge.paused { background: #fef3c7; color: #b45309; }
.badge.draft { background: var(--bg); color: var(--muted); }

/* ── Plans ── */
.plan-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.plan-card { background: var(--card); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow);
    text-align: center; border: 2px solid transparent; position: relative; }
.plan-card.current { border-color: var(--primary); }
.plan-card .plan-name { font-size: 18px; font-weight: 800; }
.plan-card .plan-price { font-size: 36px; font-weight: 800; color: var(--primary); margin: 14px 0 4px; }
.plan-card .plan-desc { color: var(--muted); font-size: 14px; margin-bottom: 20px; }
.plan-card .current-tag { position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
    background: var(--primary); color: #fff; font-size: 11px; padding: 4px 12px; border-radius: 10px; font-weight: 700; }

/* ── Budget ── */
.budget-global-row { display: flex; align-items: center; justify-content: space-between;
    gap: 16px; margin: 14px 0; }
.alloc-status { padding: 12px 16px; border-radius: 8px; font-size: 14px; font-weight: 600;
    background: var(--bg); margin-bottom: 16px; }
.alloc-status.ok { background: #dcfce7; color: #15803d; }
.alloc-status.over { background: #fee2e2; color: var(--danger); }
.alloc-status.under { background: #fef3c7; color: #b45309; }
.alloc-row { padding: 14px 0; border-bottom: 1px solid var(--border); }
.alloc-row:last-child { border-bottom: none; }
.alloc-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.alloc-head .alloc-name { font-weight: 700; font-size: 14px; }
.alloc-head .alloc-value { font-weight: 800; color: var(--primary); font-size: 16px; min-width: 110px; text-align: right; }
.alloc-meta { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.alloc-rate { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.alloc-rate strong { color: var(--primary-dark); }
.auto-opt { display: flex; align-items: center; gap: 14px; margin-top: 14px;
    padding: 10px 14px; background: var(--bg); border-radius: 8px; flex-wrap: wrap; }
.opt-time-label { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.opt-time-label input { padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; font-family: inherit; }
.alloc-controls { display: flex; align-items: center; gap: 12px; }
.alloc-controls input[type=range] { flex: 1; height: 20px; }
.alloc-controls .badge { min-width: 70px; text-align: center; }
.paused-note { font-size: 12px; color: #b45309; font-style: italic; }

/* ── Mode DÉMO / PROD ── */
.mode-row { display: flex; align-items: center; justify-content: space-between;
    gap: 8px; padding: 4px 8px 10px; }
.mode-badge { font-size: 11px; font-weight: 800; padding: 3px 10px; border-radius: 10px; letter-spacing: .05em; }
.mode-badge.demo { background: #334155; color: #94a3b8; }
.mode-badge.prod { background: var(--danger); color: #fff; }
.mode-row .btn { color: #94a3b8; font-size: 12px; padding: 4px 8px; }
.mode-row .btn:hover { color: #fff; background: #1e293b; }

/* ── Modale de confirmation ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .55);
    display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal-card { background: var(--card); border-radius: 16px; padding: 28px; width: 440px;
    box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.modal-card h2 { font-size: 18px; color: var(--danger); margin-bottom: 14px; }
.modal-warning { font-size: 14px; line-height: 1.6; color: var(--text); margin-bottom: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.btn-danger-solid { background: var(--danger); color: #fff; }
.btn-danger-solid:hover:not(:disabled) { background: #b91c1c; }

/* ── Entonnoir & visibilité ── */
.funnel .f-step { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.funnel .f-bar { height: 22px; border-radius: 6px; background: var(--primary);
    min-width: 22px; display: flex; align-items: center; justify-content: flex-end;
    padding-right: 8px; color: #fff; font-size: 12px; font-weight: 700; transition: width .3s; }
.funnel .f-bar.g2 { background: #3b82f6; }
.funnel .f-bar.g3 { background: var(--success); }
.funnel .f-label { font-size: 13px; color: var(--muted); min-width: 180px; }
.funnel .f-cost { font-size: 12px; color: var(--muted); margin-left: auto; }
.vis-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.vis-item { background: var(--bg); border-radius: 8px; padding: 12px; }
.vis-item .v { font-size: 20px; font-weight: 800; color: var(--primary-dark); }
.vis-item .v.good { color: var(--success); }
.vis-item .v.bad { color: var(--danger); }
.vis-item .l { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ── Sélecteur de période ── */
.period-bar { display: flex; align-items: center; gap: 10px; background: var(--card);
    border-radius: var(--radius); padding: 12px 18px; box-shadow: var(--shadow);
    margin-bottom: 20px; font-size: 14px; }
.period-bar input[type=date] { padding: 7px 10px; border: 1px solid var(--border);
    border-radius: 8px; font-family: inherit; font-size: 13px; }
.period-label { font-weight: 600; color: var(--muted); }

/* ── Paramètres ── */
.settings-form label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 12px; }
.settings-form input { width: 100%; padding: 10px 12px; margin-top: 5px; border: 1px solid var(--border);
    border-radius: 8px; font-size: 14px; font-family: inherit; }
.key-state { font-size: 11px; font-weight: 700; margin-left: 6px; }
.key-state.set { color: var(--success); }
.key-state.unset { color: var(--danger); }
#gads-status { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 10px; vertical-align: middle; }
#gads-status.ok { background: #dcfce7; color: #15803d; }
#gads-status.ko { background: #fee2e2; color: var(--danger); }

/* ── Divers ── */
.toast { position: fixed; bottom: 24px; right: 24px; background: #0f172a; color: #fff;
    padding: 14px 20px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow); z-index: 50; }
.toast.error { background: var(--danger); }
.campaign-item { display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 16px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 12px; }
.campaign-item .ci-name { font-weight: 700; }
.campaign-item .ci-meta { font-size: 13px; color: var(--muted); margin-top: 3px; }
.campaign-item .actions-row { flex-wrap: nowrap; }
.campaign-item .actions-row .btn { min-width: 108px; justify-content: center;
    white-space: nowrap; }
.ad-preview { border: 1px solid var(--border); border-radius: 8px; padding: 14px; margin-bottom: 10px; background: #fafafa; }
.ad-preview .ad-title { color: #1a0dab; font-size: 17px; font-weight: 500; }
.ad-preview .ad-url { color: #006621; font-size: 12px; }
.ad-preview .ad-desc { font-size: 13px; color: #545454; margin-top: 4px; }
.ad-preview .ad-image { display: block; max-width: 240px; max-height: 160px; border-radius: 8px;
    margin-top: 10px; object-fit: cover; }
.edit-image { display: flex; gap: 16px; align-items: flex-start; }
.edit-image-preview { width: 200px; height: 120px; border: 1px dashed var(--border); border-radius: 8px;
    display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; }
.edit-image-preview img { width: 100%; height: 100%; object-fit: cover; }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; }
.empty-state { text-align: center; color: var(--muted); padding: 40px 0; }

#chart-weekly { display: block; width: 100%; }
.card-title-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.card-title-row h2 { margin-bottom: 0; }
.chart-select { padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px;
    font-size: 13px; font-family: inherit; background: #fff; max-width: 260px; }

/* ── Chips de métriques (façon Google Ads) ── */
.chart-kpis { display: flex; gap: 0; margin-bottom: 8px; border: 1px solid var(--border);
    border-radius: 8px; overflow: hidden; }
.chart-chip { flex: 1; padding: 10px 14px; border-right: 1px solid var(--border); background: #fff; }
.chart-chip:last-child { border-right: none; }
.chart-chip .cc-label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); }
.chart-chip .cc-value { display: block; font-size: 20px; font-weight: 800; color: var(--text); margin-top: 2px; }
.chart-chip.imp { border-top: 3px solid #2563eb; }
.chart-chip.imp .cc-label { color: #2563eb; }
.chart-chip.clk { border-top: 3px solid #dc2626; }
.chart-chip.clk .cc-label { color: #dc2626; }

/* ── Éditeur de campagne en ligne ── */
.edit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 16px; }
.edit-grid label, .edit-block-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.edit-grid input, .edit-grid select { width: 100%; padding: 9px 11px; margin-top: 5px; border: 1px solid var(--border);
    border-radius: 8px; font-size: 14px; font-family: inherit; }
.edit-block-label { margin-top: 8px; }
.edit-list { margin-bottom: 14px; }
.edit-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.edit-item { flex: 1; padding: 8px 11px; border: 1px solid var(--border); border-radius: 8px;
    font-size: 13px; font-family: inherit; }
.edit-row .btn-danger { flex-shrink: 0; }
.kw-row .kw-term { flex: 1; }
.kw-row .kw-match { padding: 8px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; }
.regen-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted);
    margin: 14px 0 4px; cursor: pointer; }

/* ── Groupes d'annonces & calendrier ── */
.ad-group { border: 1px solid var(--border); border-radius: 10px; padding: 16px;
    margin-bottom: 16px; background: #fafbfd; }
.ad-group .ag-head { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.ad-group .ag-name { font-weight: 700; font-size: 15px; }
.sched-days { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 18px; }
.sched-day { display: inline-flex; align-items: center; gap: 5px; padding: 6px 12px;
    border: 1px solid var(--border); border-radius: 20px; font-size: 13px; cursor: pointer;
    background: #fff; }
.sched-day input { accent-color: var(--primary); }
.sched-day:has(input:checked) { background: var(--primary-light); border-color: var(--primary); }
