:root {
    --bg: #f4f6fa;
    --card: #ffffff;
    --border: #e8eaf0;
    --text: #1c2430;
    --text-muted: #6b7280;
    --accent: #1877f2;
    --accent-dark: #0f5cd1;
    --green: #16a34a;
    --green-bg: #e8f8ee;
    --red: #dc2626;
    --red-bg: #fdecec;
    --sidebar-bg: #171f2e;
    --sidebar-text: #aeb6c4;
    --sidebar-text-active: #ffffff;
    --sidebar-accent: #2b6ef2;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    display: flex;
    min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    padding: 1.5rem 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.sidebar .brand {
    padding: 0 1.5rem 1.5rem;
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    margin-bottom: 1rem;
}
.sidebar .brand small { display: block; font-weight: 400; color: var(--sidebar-text); font-size: .72rem; margin-top: .2rem; }
.sidebar .group-label { padding: 1rem 1.5rem .35rem; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: #5b6472; }
.sidebar a {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .55rem 1.5rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: .87rem;
    border-left: 3px solid transparent;
}
.sidebar a:hover { background: rgba(255, 255, 255, .04); color: #fff; }
.sidebar a.active { background: rgba(43, 110, 242, .15); color: var(--sidebar-text-active); border-left-color: var(--sidebar-accent); font-weight: 600; }
.sidebar .sidebar-logout { display: flex; align-items: center; gap: .6rem; width: 100%; padding: .55rem 1.5rem; background: none; border: none; border-left: 3px solid transparent; color: var(--sidebar-text); font-size: .87rem; font-family: inherit; text-align: left; cursor: pointer; }
.sidebar .sidebar-logout:hover { background: rgba(255, 255, 255, .04); color: #fff; }

/* ---------- Main content ---------- */
.main { flex: 1; min-width: 0; padding: 2rem 2.5rem; }
.page-header { margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.5rem; margin: 0 0 .25rem; display: flex; align-items: center; gap: .5rem; }
.page-header p { color: var(--text-muted); margin: 0; font-size: .9rem; }

/* ---------- Flash ---------- */
.flash { padding: .75rem 1.1rem; border-radius: var(--radius); margin-bottom: 1.25rem; font-size: .87rem; }
.flash.status { background: var(--green-bg); color: var(--green); }
.flash.error { background: var(--red-bg); color: var(--red); }

/* ---------- KPI cards ---------- */
.kpis { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.kpi { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.4rem; box-shadow: var(--shadow); min-width: 150px; }
.kpi .n { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.kpi .l { font-size: .78rem; color: var(--text-muted); margin-top: .15rem; }
.kpi-big { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem 1.75rem; box-shadow: var(--shadow); margin-bottom: 1.5rem; }
.kpi-big .n { font-size: 2rem; font-weight: 700; }
.kpi-big .l { color: var(--text-muted); font-size: .87rem; margin-top: .2rem; }

/* ---------- Cards / sections ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); margin-bottom: 1.5rem; }
h2.section-title { font-size: 1rem; margin: 2rem 0 .75rem; color: var(--text); }
h2.section-title:first-of-type { margin-top: 0; }

/* ---------- Tables ---------- */
.table-wrap { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .65rem 1.1rem; border-bottom: 1px solid var(--border); font-size: .86rem; white-space: nowrap; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfd; }
th { background: #fafbfd; color: var(--text-muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .02em; }
td.caption { white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
th.caption-col { min-width: 320px; }
td a { color: var(--accent); text-decoration: none; font-weight: 600; }
td a:hover { text-decoration: underline; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: .2rem .6rem; border-radius: 999px; font-size: .74rem; font-weight: 600; }
.badge-active, .badge-green { background: var(--green-bg); color: var(--green); }
.badge-none, .badge-red { background: var(--red-bg); color: var(--red); }
.tag-post { color: var(--accent); font-weight: 600; }
.tag-reel { color: #e0316b; font-weight: 600; }
.best { color: var(--green); font-weight: 700; }

/* ---------- Filters / tabs ---------- */
.filters { margin-bottom: 1rem; font-size: .85rem; display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.filters .sep { width: 1px; height: 1.2rem; background: var(--border); margin: 0 .4rem; }
.filters a { display: inline-block; padding: .35rem .85rem; border-radius: 999px; text-decoration: none; color: var(--text); background: #eef0f4; }
.filters a.active { background: var(--accent); color: #fff; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .55rem 1.1rem; border-radius: 8px; text-decoration: none; font-size: .85rem; border: none; cursor: pointer; font-weight: 600; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary { background: #eef0f4; color: var(--text); }
.btn-secondary:hover { background: #e3e6ec; }
.btn-row { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1.5rem; }

/* ---------- Forms ---------- */
form.entry label { display: block; font-size: .8rem; color: var(--text-muted); margin: .85rem 0 .3rem; font-weight: 600; }
form.entry select, form.entry input, form.entry textarea {
    width: 100%; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: 8px;
    font-size: .87rem; font-family: inherit; background: #fbfbfd;
}
form.entry select:focus, form.entry input:focus, form.entry textarea:focus { outline: none; border-color: var(--accent); background: #fff; }
.error { color: var(--red); font-size: .8rem; margin-top: .6rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.help-text { font-size: .78rem; color: var(--text-muted); margin-top: 1rem; line-height: 1.5; }
code.tracking-url { background: #f0f2f5; padding: .15rem .5rem; border-radius: 5px; font-size: .8rem; }

/* ---------- Funnel ---------- */
.funnel { max-width: 460px; }
.funnel .stage { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.5rem; margin-bottom: .4rem; box-shadow: var(--shadow); }
.funnel .stage .n { font-size: 1.5rem; font-weight: 700; }
.funnel .stage .l { color: var(--text-muted); font-size: .84rem; }
.funnel .conv { text-align: center; font-size: .78rem; color: #9aa1ac; margin: .3rem 0; }
.funnel .conv.low { color: var(--red); font-weight: 700; }

/* ---------- Pagination (custom view — resources/views/vendor/pagination/custom.blade.php) ---------- */
.pager { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .75rem; margin-top: 1.25rem; font-size: .82rem; }
.pager-info { color: var(--text-muted); }
.pager-info strong { color: var(--text); font-weight: 600; }
.pager-links { display: flex; gap: .25rem; }
.pager-link { display: inline-flex; align-items: center; justify-content: center; min-width: 2rem; height: 2rem; padding: 0 .5rem; border-radius: 6px; text-decoration: none; color: var(--text); background: #fff; border: 1px solid var(--border); font-size: .82rem; }
.pager-link:hover { background: #f2f4f8; }
.pager-link.current { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
.pager-link.disabled { color: #c3c8d1; cursor: default; background: #fafbfd; }

@media (max-width: 900px) {
    body { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: relative; }
    .main { padding: 1.25rem; }
    .grid-2 { grid-template-columns: 1fr; }
}
