@font-face {
    font-family: "pfont";
    src: url("../fonts/pfont-regular.woff2") format("woff2");
    font-weight: 200 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "pfont";
    src: url("../fonts/pfont-bold.woff2") format("woff2");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "pfont";
    src: url("../fonts/pfont-extrabold.woff2") format("woff2");
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}

:root {
    --gads-blue: #132E75;
    --gads-green: #38BB5B;
    --gads-accent: #FBBC04;
    --gads-bg: #F6F8FC;
    --gads-text: #172033;
    --gads-muted: #667085;
    --gads-border: #E4E8F0;
    --gads-card: #FFFFFF;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "pfont", Tahoma, Arial, sans-serif;
    background: var(--gads-bg);
    color: var(--gads-text);
    letter-spacing: 0;
}

body.dark {
    --gads-bg: #0f172a;
    --gads-card: #111c33;
    --gads-text: #e5edf8;
    --gads-muted: #aab5c6;
    --gads-border: #253451;
}

a {
    text-decoration: none;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        linear-gradient(135deg, rgba(19, 46, 117, .95), rgba(19, 46, 117, .78)),
        url("https://images.unsplash.com/photo-1551288049-bebda4e38f71?auto=format&fit=crop&w=1600&q=80") center/cover;
}

.auth-card {
    width: min(480px, 100%);
    background: rgba(255, 255, 255, .96);
    border-radius: 28px;
    padding: 32px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, .25);
}

.brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: inline-grid;
    place-items: center;
    background: var(--gads-blue);
    color: #fff;
    font-weight: 800;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 284px 1fr;
}

[dir="rtl"] .app-shell {
    grid-template-columns: 1fr 284px;
}

.sidebar {
    background: var(--gads-blue);
    color: #fff;
    min-height: 100vh;
    padding: 22px 18px;
    position: sticky;
    top: 0;
}

[dir="rtl"] .sidebar {
    grid-column: 2;
    grid-row: 1;
}

[dir="rtl"] .main-area {
    grid-column: 1;
    grid-row: 1;
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, .78);
    border-radius: 14px;
    padding: 11px 13px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, .12);
}

.main-area {
    min-width: 0;
    padding: 18px 22px 36px;
}

.topbar {
    height: 72px;
    background: var(--gads-card);
    border: 1px solid var(--gads-border);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    margin-bottom: 22px;
    box-shadow: 0 12px 30px rgba(16, 24, 40, .05);
}

.surface {
    background: var(--gads-card);
    border: 1px solid var(--gads-border);
    border-radius: 24px;
    box-shadow: 0 12px 30px rgba(16, 24, 40, .05);
}

.metric-card {
    padding: 18px;
    min-height: 118px;
}

.metric-label {
    color: var(--gads-muted);
    font-size: .88rem;
}

.metric-value {
    font-size: 1.55rem;
    font-weight: 800;
    margin-top: 8px;
}

.badge-status {
    border-radius: 999px;
    padding: 6px 10px;
    font-weight: 700;
}

.status-enabled {
    background: rgba(56, 187, 91, .14);
    color: #168035;
}

.status-paused {
    background: rgba(102, 112, 133, .16);
    color: #667085;
}

.status-removed,
.status-disapproved {
    background: rgba(220, 53, 69, .14);
    color: #b42318;
}

.status-limited {
    background: rgba(251, 188, 4, .22);
    color: #9a6700;
}

.btn-primary {
    background: var(--gads-blue);
    border-color: var(--gads-blue);
}

.btn-success {
    background: var(--gads-green);
    border-color: var(--gads-green);
}

.btn-accent {
    background: var(--gads-accent);
    color: #241a00;
    border-color: var(--gads-accent);
}

.table {
    color: var(--gads-text);
}

.gads-table thead th,
.table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--gads-card);
    box-shadow: inset 0 -1px 0 var(--gads-border);
}

.table > :not(caption) > * > * {
    background: transparent;
}

.ai-sidebar {
    position: fixed;
    inset-block: 92px 24px;
    inset-inline-start: 24px;
    width: min(420px, calc(100vw - 48px));
    transform: translateX(calc(-100% - 40px));
    transition: transform .22s ease;
    z-index: 30;
    overflow: auto;
}

[dir="rtl"] .ai-sidebar {
    inset-inline-start: auto;
    inset-inline-end: 24px;
    transform: translateX(calc(100% + 40px));
}

.ai-sidebar.open {
    transform: translateX(0);
}

.empty-state {
    border: 1px dashed var(--gads-border);
    border-radius: 20px;
    background: rgba(102, 112, 133, .04);
    color: var(--gads-muted);
}

.skeleton {
    position: relative;
    overflow: hidden;
    background: rgba(102, 112, 133, .12);
    border-radius: 12px;
    min-height: 18px;
}

.skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.45), transparent);
    animation: gads-skeleton 1.3s infinite;
}

@keyframes gads-skeleton {
    100% { transform: translateX(100%); }
}

.breadcrumb-lite {
    color: var(--gads-muted);
    font-size: .9rem;
}

.form-control,
.form-select {
    border-radius: 14px;
    border-color: var(--gads-border);
    min-height: 46px;
}

textarea.form-control {
    min-height: 180px;
}

.code-area {
    direction: ltr;
    text-align: left;
    font-family: Consolas, Monaco, monospace;
    font-size: .88rem;
}

@media (max-width: 991px) {
    .app-shell,
    [dir="rtl"] .app-shell {
        display: block;
    }

    .sidebar {
        position: relative;
        min-height: auto;
        border-radius: 0 0 24px 24px;
    }

    .topbar {
        height: auto;
        min-height: 72px;
        flex-wrap: wrap;
        gap: 12px;
    }
}
