/* ProveAds — faithful rebuild of the reference (Laravel starter kit) theme. Vanilla, no deps. */

:root {
    --background: #ffffff;
    --foreground: #0a0a0a;
    --card: #ffffff;
    --card-foreground: #0a0a0a;
    --primary: #171717;
    --primary-foreground: #fafafa;
    --secondary: #ebebeb;
    --secondary-foreground: #171717;
    --muted: #f5f5f5;
    --muted-foreground: #737373;
    --accent: #f5f5f5;
    --accent-foreground: #171717;
    --border: #ededed;
    --input: #e5e5e5;
    --ring: #a3a3a3;
    --destructive: #ef4444;
    --destructive-foreground: #fafafa;

    --sidebar-background: #fafafa;
    --sidebar-foreground: #3f3f46;
    --sidebar-border: #e8e8e8;
    --sidebar-accent: #f0f0f0;
    --sidebar-accent-foreground: #4d4d4d;
    --sidebar-primary: #1a1a1a;
    --sidebar-primary-foreground: #ffffff;

    --ok: #16a34a;
    --ok-bg: #f0fdf4;
    --warn: #b45309;
    --warn-bg: #fffbeb;
    --info: #1d4ed8;
    --info-bg: #eff6ff;
    --danger: #b91c1c;
    --danger-bg: #fef2f2;
    --neutral-bg: #f5f5f5;
    --neutral-fg: #525252;

    --radius: 0.5rem;
    --font-sans: "Instrument Sans", ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
}

.dark {
    --background: #0a0a0a;
    --foreground: #fafafa;
    --card: #0f0f0f;
    --card-foreground: #fafafa;
    --primary: #fafafa;
    --primary-foreground: #171717;
    --secondary: #262626;
    --secondary-foreground: #fafafa;
    --muted: #262626;
    --muted-foreground: #a3a3a3;
    --accent: #262626;
    --accent-foreground: #fafafa;
    --border: #262626;
    --input: #2a2a2a;
    --ring: #6b7280;
    --destructive: #ef4444;
    --destructive-foreground: #fafafa;

    --sidebar-background: #121212;
    --sidebar-foreground: #d4d4d8;
    --sidebar-border: #262626;
    --sidebar-accent: #262626;
    --sidebar-accent-foreground: #f4f4f5;
    --sidebar-primary: #ffffff;
    --sidebar-primary-foreground: #171717;

    --ok: #4ade80;
    --ok-bg: #052e1a;
    --warn: #fbbf24;
    --warn-bg: #2a1e05;
    --info: #60a5fa;
    --info-bg: #0a1a33;
    --danger: #f87171;
    --danger-bg: #2a0a0a;
    --neutral-bg: #262626;
    --neutral-fg: #a3a3a3;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font-sans);
    background: var(--background);
    color: var(--foreground);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }

/* ---------- Layout shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
    width: 256px;
    flex-shrink: 0;
    background: var(--sidebar-background);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    padding: 16px 12px;
    gap: 4px;
    position: sticky;
    top: 0;
    height: 100vh;
}
.brand {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 8px 16px; font-weight: 600; font-size: 15px;
}
.brand .logo {
    width: 32px; height: 32px; border-radius: 8px;
    background: var(--sidebar-primary); color: var(--sidebar-primary-foreground);
    display: grid; place-items: center; font-weight: 700; font-size: 15px;
}
.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
    color: var(--muted-foreground); padding: 12px 8px 4px; }
.nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: var(--radius);
    color: var(--sidebar-foreground); font-weight: 500;
}
.nav a:hover { background: var(--sidebar-accent); color: var(--sidebar-accent-foreground); }
.nav a.active { background: var(--sidebar-accent); color: var(--sidebar-accent-foreground); font-weight: 600; }
.nav a .ico { width: 18px; height: 18px; opacity: .8; }
.sidebar-footer { margin-top: auto; border-top: 1px solid var(--sidebar-border); padding-top: 12px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius); }
.user-chip .avatar { width: 32px; height: 32px; border-radius: 999px; background: var(--muted);
    display: grid; place-items: center; font-weight: 600; color: var(--muted-foreground); }
.user-chip .meta { overflow: hidden; }
.user-chip .meta .nm { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .meta .em { font-size: 12px; color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
    height: 60px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; position: sticky; top: 0; background: var(--background); z-index: 5;
}
.topbar h1 { font-size: 18px; }
.content { padding: 24px; max-width: 1100px; width: 100%; }

/* ---------- Cards ---------- */
.card {
    background: var(--card); color: var(--card-foreground);
    border: 1px solid var(--border); border-radius: calc(var(--radius) + 2px);
    padding: 20px;
}
.card + .card { margin-top: 16px; }
.card-title { font-size: 15px; font-weight: 600; }
.card-desc { color: var(--muted-foreground); font-size: 13px; margin-top: 2px; }
.card-head { margin-bottom: 16px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }

.grid { display: grid; gap: 16px; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }

/* ---------- Stat tiles ---------- */
.stat { }
.stat .k { font-size: 12px; color: var(--muted-foreground); font-weight: 500; }
.stat .v { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; margin-top: 6px; }
.stat .sub { font-size: 12px; color: var(--muted-foreground); margin-top: 2px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 38px; padding: 0 16px; border-radius: var(--radius);
    font-weight: 500; font-size: 14px; cursor: pointer; border: 1px solid transparent;
    transition: background .15s, opacity .15s; white-space: nowrap;
}
.btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.btn-primary { background: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover { opacity: .9; }
.btn-outline { background: transparent; border-color: var(--input); color: var(--foreground); }
.btn-outline:hover { background: var(--accent); }
.btn-ghost { background: transparent; color: var(--foreground); }
.btn-ghost:hover { background: var(--accent); }
.btn-danger { background: var(--destructive); color: var(--destructive-foreground); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 16px; }
.label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.input, .textarea, select {
    width: 100%; height: 38px; padding: 0 12px; font: inherit; color: var(--foreground);
    background: var(--background); border: 1px solid var(--input); border-radius: var(--radius);
}
.textarea { height: auto; padding: 10px 12px; min-height: 120px; font-family: ui-monospace, monospace; font-size: 12px; }
.input:focus, .textarea:focus, select:focus { outline: 2px solid var(--ring); outline-offset: 1px; border-color: var(--ring); }
.input-hint { font-size: 12px; color: var(--muted-foreground); margin-top: 6px; }
.input-group { display: flex; }
.input-group .prefix { display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--input);
    border-right: 0; border-radius: var(--radius) 0 0 var(--radius); background: var(--muted); color: var(--muted-foreground); }
.input-group .input { border-radius: 0 var(--radius) var(--radius) 0; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: calc(var(--radius) + 2px); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th { text-align: left; font-weight: 500; color: var(--muted-foreground);
    padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--muted); }
.mono { font-family: ui-monospace, monospace; font-size: 12px; }
.truncate { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 500; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.badge.active  { color: var(--ok);      background: var(--ok-bg); }
.badge.review  { color: var(--warn);    background: var(--warn-bg); }
.badge.pending { color: var(--warn);    background: var(--warn-bg); }
.badge.paused  { color: var(--neutral-fg); background: var(--neutral-bg); }
.badge.failed  { color: var(--danger);  background: var(--danger-bg); }
.badge.done    { color: var(--info);    background: var(--info-bg); }

/* ---------- Alerts / flash ---------- */
.alert { padding: 12px 14px; border-radius: var(--radius); font-size: 13px; margin-bottom: 16px; border: 1px solid transparent; }
.alert.success { color: var(--ok); background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.alert.error { color: var(--danger); background: var(--danger-bg); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-head { text-align: center; margin-bottom: 24px; }
.auth-head .logo { width: 44px; height: 44px; border-radius: 10px; margin: 0 auto 16px;
    background: var(--primary); color: var(--primary-foreground); display: grid; place-items: center; font-weight: 700; font-size: 18px; }
.auth-head h1 { font-size: 20px; }
.auth-head p { color: var(--muted-foreground); margin-top: 6px; }

.muted { color: var(--muted-foreground); }
.row-actions { display: flex; gap: 8px; align-items: center; }
.page-actions { display: flex; justify-content: flex-end; margin-bottom: 16px; }
.credit-hero { font-size: 32px; font-weight: 600; letter-spacing: -0.02em; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted-foreground); }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form .input { width: auto; }

@media (max-width: 820px) {
    .sidebar { position: fixed; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
    .sidebar.open { transform: none; }
    .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
    .menu-toggle { display: inline-flex !important; }
}
.menu-toggle { display: none; }

/* ---------- Progress bar ---------- */
.progress { height: 8px; background: var(--muted); border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--primary); border-radius: 999px; transition: width .3s ease; }

/* ---------- Mini bar chart ---------- */
.chart { display: flex; align-items: flex-end; gap: 4px; height: 170px; padding-top: 8px; overflow-x: auto; }
.chart-col { flex: 1 0 20px; display: flex; flex-direction: column; align-items: center;
    justify-content: flex-end; height: 100%; }
.chart-bar { width: 100%; max-width: 30px; background: var(--primary);
    border-radius: 4px 4px 0 0; min-height: 2px; transition: opacity .15s; }
.chart-col:hover .chart-bar { opacity: .75; }
.chart-x { font-size: 10px; color: var(--muted-foreground); margin-top: 6px; white-space: nowrap; }

/* ---------- Pager ---------- */
.pager { display: flex; align-items: center; justify-content: center; margin-top: 16px; }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.filters .input, .filters select { width: auto; }

/* ---------- Code blocks (API docs) ---------- */
.code { margin: 0; padding: 12px 14px; background: var(--muted); border-radius: var(--radius); overflow-x: auto;
    font-family: ui-monospace, monospace; font-size: 12px; line-height: 1.5; white-space: pre; }
