/* AI Ads Planner — dashboard theme. Dark by default, light via data-bs-theme="light". */
:root, [data-bs-theme="dark"] {
  --ap-bg: #10131c; --ap-surface: #171b27; --ap-surface-2: #1d2231; --ap-border: #262c3d; --ap-text: #e8eaf1; --ap-muted: #8d94a9;
  --ap-accent: #7c6cf3; --ap-accent-2: #5b4ce0; --ap-good: #34c38f; --ap-bad: #f46a6a; --ap-warn: #f1b44c;
  --ap-google: #4f8df7; --ap-meta: #2bb0ff;
  --bs-body-bg: var(--ap-bg); --bs-body-color: var(--ap-text); --bs-border-color: var(--ap-border); --bs-secondary-color: var(--ap-muted);
}
[data-bs-theme="light"] {
  --ap-bg: #f4f6fb; --ap-surface: #ffffff; --ap-surface-2: #f1f3f9; --ap-border: #e3e7f0; --ap-text: #1b2130; --ap-muted: #667085;
  --ap-accent: #5b4ce0; --ap-accent-2: #4a3ccc; --ap-good: #1f9d6a; --ap-bad: #d9484a; --ap-warn: #c98a12;
  --bs-body-bg: var(--ap-bg); --bs-body-color: var(--ap-text); --bs-border-color: var(--ap-border); --bs-secondary-color: var(--ap-muted);
}
body { background: var(--ap-bg); color: var(--ap-text); }
.app { display: flex; min-height: 100vh; }
.sidebar { width: 236px; min-width: 236px; background: var(--ap-surface); border-right: 1px solid var(--ap-border); padding: 18px 12px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ap-text); padding: 4px 8px 18px; }
.brand small { display: block; color: var(--ap-muted); font-size: 11px; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, var(--ap-accent), #3fb8d8); display: grid; place-items: center; color: #fff; font-size: 18px; }
.nav-section { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ap-muted); padding: 14px 10px 4px; }
.sidebar .nav-link { display: flex; align-items: center; gap: 10px; color: var(--ap-text); padding: 8px 10px; border-radius: 8px; font-size: 14px; }
.sidebar .nav-link:hover { background: var(--ap-surface-2); }
.sidebar .nav-link.active { background: var(--ap-accent); color: #fff; }
.sidebar .nav-link .badge { background: var(--ap-warn); color: #1b2130; }
.sidebar-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; padding: 10px; border-top: 1px solid var(--ap-border); font-size: 13px; }
.sidebar-foot a { color: var(--ap-muted); text-decoration: none; } .sidebar-foot a:hover { color: var(--ap-text); }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 16px 24px; border-bottom: 1px solid var(--ap-border); background: var(--ap-surface); position: sticky; top: 0; z-index: 20; }
.topbar-title h1 { font-size: 20px; margin: 0; font-weight: 700; } .topbar-title small { display: block; font-size: 12px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.theme-toggle { display: inline-flex; background: var(--ap-surface-2); border: 1px solid var(--ap-border); border-radius: 999px; padding: 3px; }
.theme-toggle button { border: 0; background: transparent; color: var(--ap-muted); font-size: 12px; padding: 3px 12px; border-radius: 999px; }
.theme-toggle button.on { background: var(--ap-accent); color: #fff; }
.topbar .btn-outline-secondary { color: var(--ap-text); border-color: var(--ap-border); } .topbar .btn-outline-secondary:hover { background: var(--ap-surface-2); color: var(--ap-text); }
.btn-accent { background: var(--ap-accent); border-color: var(--ap-accent); color: #fff; } .btn-accent:hover { background: var(--ap-accent-2); border-color: var(--ap-accent-2); color: #fff; }
main { padding: 22px 24px 40px; }
.card { background: var(--ap-surface); border: 1px solid var(--ap-border); border-radius: 14px; box-shadow: none; }
.card-header { background: transparent; border-bottom: 1px solid var(--ap-border); font-weight: 600; }
.kpi { padding: 16px 18px; }
.kpi .label { color: var(--ap-muted); font-size: 12.5px; }
.kpi .value { font-size: 26px; font-weight: 800; letter-spacing: -.01em; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.kpi .delta { font-size: 12px; } .delta.up { color: var(--ap-good); } .delta.down { color: var(--ap-bad); } .delta.flat { color: var(--ap-muted); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.seg { display: inline-flex; background: var(--ap-surface-2); border: 1px solid var(--ap-border); border-radius: 10px; padding: 3px; }
.seg a { color: var(--ap-text); text-decoration: none; padding: 5px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; }
.seg a.on { background: var(--ap-accent); color: #fff; }
.table { --bs-table-bg: transparent; --bs-table-color: var(--ap-text); --bs-table-border-color: var(--ap-border); font-variant-numeric: tabular-nums; }
.table thead th { background: var(--ap-surface-2); color: var(--ap-muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; border-bottom: 1px solid var(--ap-border); }
.table td { vertical-align: middle; }
.tag { display: inline-block; white-space: nowrap; padding: 2px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 600; }
.tag-google { background: rgba(79,141,247,.16); color: var(--ap-google); } .tag-meta { background: rgba(43,176,255,.16); color: var(--ap-meta); } .tag-other { background: var(--ap-surface-2); color: var(--ap-muted); }
.tag-on { background: rgba(52,195,143,.16); color: var(--ap-good); } .tag-off { background: var(--ap-surface-2); color: var(--ap-muted); } .tag-warn { background: rgba(241,180,76,.16); color: var(--ap-warn); }
.pri-high { color: var(--ap-bad); } .pri-medium { color: var(--ap-warn); } .pri-low { color: var(--ap-muted); }
.rec { border-left: 3px solid var(--ap-accent); padding: 10px 14px; background: var(--ap-surface-2); border-radius: 8px; }
.empty { text-align: center; padding: 48px 20px; color: var(--ap-muted); }
.empty i { font-size: 36px; display: block; margin-bottom: 10px; color: var(--ap-accent); }
.form-control, .form-select { background: var(--ap-surface-2); border-color: var(--ap-border); color: var(--ap-text); }
.form-control:focus, .form-select:focus { background: var(--ap-surface-2); color: var(--ap-text); border-color: var(--ap-accent); box-shadow: 0 0 0 .2rem rgba(124,108,243,.2); }
.nav-tabs { border-bottom-color: var(--ap-border); } .nav-tabs .nav-link { color: var(--ap-muted); } .nav-tabs .nav-link.active { background: var(--ap-surface); color: var(--ap-text); border-color: var(--ap-border) var(--ap-border) var(--ap-surface); }
.chart-box { position: relative; height: 280px; }
@media (max-width: 991.98px) {
  .sidebar { position: fixed; left: -260px; transition: left .2s; z-index: 30; } .sidebar.open { left: 0; }
  .topbar { padding: 12px 14px; } main { padding: 14px; } .kpi .value { font-size: 22px; }
}
@media print { .sidebar, .topbar, .btn, form, .alert { display: none !important; } body { background: #fff; } .card { border: 1px solid #ddd; } }
.tag-high { background: rgba(244,106,106,.16); color: var(--ap-bad); } .tag-medium { background: rgba(241,180,76,.16); color: var(--ap-warn); } .tag-low { background: var(--ap-surface-2); color: var(--ap-muted); }
.mini { font-size: 12px; color: var(--ap-muted); }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps li { position: relative; padding: 10px 0 10px 44px; border-bottom: 1px solid var(--ap-border); }
.steps li:last-child { border-bottom: 0; }
.steps li::before { counter-increment: s; content: counter(s); position: absolute; left: 0; top: 10px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--ap-surface-2); color: var(--ap-muted); font-weight: 700; font-size: 13px; }
.steps li.done::before { content: "✓"; background: var(--ap-good); color: #fff; }
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-wrap { display: grid; grid-template-columns: 1.1fr 1fr; max-width: 880px; width: 100%; background: var(--ap-surface); border: 1px solid var(--ap-border); border-radius: 18px; overflow: hidden; }
.login-side { padding: 40px 36px; background: linear-gradient(160deg, rgba(124,108,243,.28), rgba(63,184,216,.10)); display: flex; flex-direction: column; gap: 14px; }
.login-side ul { padding-left: 18px; color: var(--ap-muted); font-size: 14px; margin: 0; } .login-side li { margin-bottom: 6px; }
.login-card { padding: 40px 36px; }
@media (max-width: 767.98px) { .login-wrap { grid-template-columns: 1fr; } .login-side { display: none; } }
details > summary { cursor: pointer; color: var(--ap-accent); }
.activity li { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--ap-border); font-size: 13.5px; } .activity li:last-child { border-bottom: 0; }
.activity .ic { width: 30px; height: 30px; border-radius: 8px; background: var(--ap-surface-2); display: grid; place-items: center; color: var(--ap-accent); flex: none; }
.table-wrap { overflow-x: auto; }
.table { font-size: 13.5px; } .table > :not(caption) > * > * { padding: .5rem .55rem; }
.table .name-col { min-width: 180px; } .table .name-col a { display: inline-block; }
.table td, .table th { white-space: nowrap; } .table td.wrap { white-space: normal; }
.preview-table td, .preview-table th { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
