/* =========================================================
   Meta CAPI Console — стили
   Дизайн-система: Google for Education (light, single blue accent)
   ========================================================= */

:root {
    --canvas:   #f8f9fa;
    --ink:      #202124;
    --graphite: #3c4043;
    --slate:    #5f6368;
    --mist:     #dadce0;
    --cloud:    #c4c6c7;
    --blue:     #1a73e8;
    --blue-deep:#1967d2;
    --green:    #188038;
    --red:      #d93025;
    --amber:    #e37400;
    --tint:     #e8f0fe;
    --white:    #ffffff;

    --r-card: 24px;
    --r-sm:   12px;
    --r-pill: 999px;

    --shadow-sm: 0 1px 2px rgba(60,64,67,.10), 0 1px 3px rgba(60,64,67,.06);
    --shadow-md: 0 1px 3px rgba(60,64,67,.12), 0 4px 12px rgba(60,64,67,.10);

    --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--canvas);
    color: var(--ink);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    letter-spacing: .1px;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-deep); }

.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    font-size: 20px;
    line-height: 1;
    vertical-align: middle;
}

/* ===================== Layout ===================== */

.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 248px;
    flex-shrink: 0;
    background: var(--white);
    border-right: 1px solid var(--mist);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px 24px;
}
.brand-mark {
    display: grid;
    place-items: center;
    width: 40px; height: 40px;
    border-radius: 12px;
    background: var(--tint);
    color: var(--blue);
    font-size: 24px;
}
.brand-mark--lg { width: 56px; height: 56px; font-size: 32px; margin: 0 auto 16px; }
.brand-name { font-weight: 600; font-size: 17px; color: var(--ink); letter-spacing: -.2px; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: 10px;
    color: var(--graphite);
    font-weight: 500;
    transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--canvas); color: var(--ink); }
.nav-item--active { background: var(--tint); color: var(--blue-deep); }
.nav-item--active .material-symbols-outlined { color: var(--blue); }
.nav-item--bottom { margin-top: auto; color: var(--slate); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    border-bottom: 1px solid var(--mist);
    background: var(--white);
    position: sticky; top: 0; z-index: 10;
}
.topbar-title { font-size: 22px; font-weight: 600; letter-spacing: -.3px; margin: 0; }
.topbar-user {
    display: flex; align-items: center; gap: 8px;
    color: var(--slate); font-weight: 500;
}
.topbar-user .material-symbols-outlined { font-size: 28px; }

.content { padding: 32px; max-width: 1400px; width: 100%; }

/* ===================== Cards ===================== */

.card {
    background: var(--white);
    border: 1px solid var(--mist);
    border-radius: var(--r-card);
    padding: 28px;
    margin-bottom: 24px;
}
.card--table { padding: 8px 8px 4px; }
.card-title {
    display: flex; align-items: center; gap: 10px;
    font-size: 16px; font-weight: 600; margin: 0 0 20px;
    padding: 20px 20px 0;
}
.card--table .card-title { padding: 20px 16px 8px; }
.card:not(.card--table) .card-title { padding: 0; }

/* ===================== Stats ===================== */

.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--white);
    border: 1px solid var(--mist);
    border-radius: var(--r-card);
    padding: 24px;
    display: flex; align-items: center; gap: 18px;
}
.stat-icon {
    display: grid; place-items: center;
    width: 48px; height: 48px; border-radius: 14px;
    background: var(--tint); color: var(--blue); font-size: 26px;
}
.stat-card--ok    .stat-icon { background: #e6f4ea; color: var(--green); }
.stat-card--fail  .stat-icon { background: #fce8e6; color: var(--red); }
.stat-card--money .stat-icon { background: #fef7e0; color: var(--amber); }
.stat-value { font-size: 26px; font-weight: 600; letter-spacing: -.5px; }
.stat-label { color: var(--slate); font-size: 13px; }

/* ===================== Forms / fields ===================== */

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12px; font-weight: 500; color: var(--slate); letter-spacing: .3px; }

.field input[type=text],
.field input[type=password],
.field input[type=date],
.field select,
.field textarea,
.select--sm {
    font-family: var(--font);
    font-size: 14px;
    color: var(--ink);
    background: var(--white);
    border: 1px solid var(--mist);
    border-radius: 10px;
    padding: 10px 12px;
    transition: border-color .15s, box-shadow .15s;
    width: 100%;
}
.field textarea { resize: vertical; line-height: 1.5; }
.field input:focus,
.field select:focus,
.field textarea:focus,
.select--sm:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(26,115,232,.15);
}

.field-control {
    display: flex; align-items: center; gap: 8px;
    border: 1px solid var(--mist);
    border-radius: 10px;
    padding: 0 12px;
    background: var(--white);
    transition: border-color .15s, box-shadow .15s;
}
.field-control:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26,115,232,.15); }
.field-control .material-symbols-outlined { color: var(--slate); font-size: 20px; }
.field-control input { border: none; padding: 10px 0; flex: 1; background: transparent; }
.field-control input:focus { outline: none; box-shadow: none; }

.stack { display: flex; flex-direction: column; gap: 16px; }

.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.switch input { display: none; }
.switch-track {
    width: 40px; height: 22px; border-radius: 999px;
    background: var(--mist); position: relative; transition: background .15s;
}
.switch-track::after {
    content: ''; position: absolute; top: 2px; left: 2px;
    width: 18px; height: 18px; border-radius: 50%;
    background: var(--white); transition: transform .15s; box-shadow: var(--shadow-sm);
}
.switch input:checked + .switch-track { background: var(--blue); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }

/* ===================== Buttons ===================== */

.btn {
    display: inline-flex; align-items: center; gap: 8px;
    font-family: var(--font); font-size: 14px; font-weight: 500;
    border: 1px solid transparent;
    border-radius: var(--r-pill);
    padding: 10px 20px;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
    white-space: nowrap;
}
.btn .material-symbols-outlined { font-size: 18px; }
.btn--primary { background: var(--blue); color: #fff; }
.btn--primary:hover { background: var(--blue-deep); color: #fff; }
.btn--ghost { background: transparent; border-color: var(--mist); color: var(--blue); }
.btn--ghost:hover { background: var(--canvas); border-color: var(--blue); }
.btn--danger { background: transparent; border-color: #f3c4bf; color: var(--red); }
.btn--danger:hover { background: #fce8e6; }
.btn--sm { padding: 7px 14px; font-size: 13px; }
.btn--block { width: 100%; justify-content: center; padding: 12px; }

.icon-btn {
    display: inline-grid; place-items: center;
    width: 34px; height: 34px; border-radius: 50%;
    border: none; background: transparent; color: var(--slate); cursor: pointer;
    transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--canvas); color: var(--blue); }
.icon-btn--danger:hover { background: #fce8e6; color: var(--red); }
.icon-btn .material-symbols-outlined { font-size: 20px; }

.inline { display: inline; }

/* ===================== Filters ===================== */

.filters { padding: 20px 24px; }
.filters-row {
    display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end;
}
.field--sm { width: 160px; }
.field--grow { flex: 1; min-width: 220px; }
.field--dates { width: auto; }
.dates-inline { display: flex; gap: 8px; }
.dates-inline input { width: 150px; }
.filters-actions { display: flex; gap: 8px; margin-left: auto; }

/* ===================== Table ===================== */

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table thead th {
    text-align: left; font-weight: 500; color: var(--slate);
    font-size: 12px; letter-spacing: .3px; text-transform: uppercase;
    padding: 12px 14px; border-bottom: 1px solid var(--mist);
}
.table tbody td { padding: 13px 14px; border-bottom: 1px solid #eff1f3; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fafbfc; }
.col-check { width: 36px; }
.col-actions { width: 80px; text-align: right; white-space: nowrap; }
.mono { font-family: 'SF Mono', 'Roboto Mono', ui-monospace, monospace; font-size: 12.5px; }
.muted { color: var(--slate); }
.sub { font-size: 11px; margin-top: 2px; }
.pixel-name { display: block; font-weight: 500; }
.pixel-id { display: block; font-size: 11px; color: var(--slate); font-family: ui-monospace, monospace; }

input[type=checkbox] {
    width: 17px; height: 17px; accent-color: var(--blue); cursor: pointer;
}

.empty {
    text-align: center; color: var(--slate); padding: 48px 0 !important;
}
.empty .material-symbols-outlined { display: block; font-size: 40px; margin: 0 auto 10px; opacity: .5; }

/* ===================== Badges ===================== */

.badge {
    display: inline-block; padding: 3px 11px; border-radius: 999px;
    font-size: 12px; font-weight: 500; letter-spacing: .2px;
}
.badge--lead     { background: var(--tint);   color: var(--blue-deep); }
.badge--reg      { background: #f3e8fd;        color: #8430ce; }
.badge--purchase { background: #fef7e0;        color: var(--amber); }
.badge--ok       { background: #e6f4ea;        color: var(--green); }
.badge--fail     { background: #fce8e6;        color: var(--red); }
.badge--pending  { background: #f1f3f4;        color: var(--slate); }

/* ===================== Bulk bar ===================== */

.bulkbar {
    display: none; align-items: center; gap: 12px;
    background: var(--ink); color: #fff;
    border-radius: var(--r-pill);
    padding: 8px 10px 8px 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-md);
    flex-wrap: wrap;
}
.bulkbar.is-active { display: flex; }
.bulkbar-count { font-weight: 600; margin-right: 8px; }
.bulkbar .btn--ghost { border-color: rgba(255,255,255,.3); color: #fff; }
.bulkbar .btn--ghost:hover { background: rgba(255,255,255,.12); border-color: #fff; }
.bulkbar .btn--danger { color: #ffb4ab; border-color: rgba(255,180,171,.4); }
.bulkbar .btn--danger:hover { background: rgba(217,48,37,.25); }
.bulkbar-group { display: flex; align-items: center; gap: 6px; }
.bulkbar .select--sm {
    width: auto; background: rgba(255,255,255,.1); color: #fff;
    border-color: rgba(255,255,255,.25); padding: 7px 10px;
}
.bulkbar .select--sm option { color: var(--ink); }

.select--sm { width: auto; padding: 8px 10px; }

/* ===================== Pager ===================== */

.pager { display: flex; gap: 6px; flex-wrap: wrap; }
.pager-item {
    min-width: 36px; height: 36px; display: grid; place-items: center;
    border-radius: 10px; border: 1px solid var(--mist); color: var(--graphite);
    font-weight: 500; padding: 0 8px;
}
.pager-item:hover { border-color: var(--blue); color: var(--blue); }
.pager-item--active { background: var(--blue); color: #fff; border-color: var(--blue); }

/* ===================== Alerts ===================== */

.alert {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 18px; border-radius: 14px; margin-bottom: 20px;
    font-weight: 500;
}
.alert--success { background: #e6f4ea; color: var(--green); }
.alert--error   { background: #fce8e6; color: var(--red); }

/* ===================== Pixels page ===================== */

.pixels-grid { display: grid; grid-template-columns: 380px 1fr; gap: 24px; align-items: start; }
.form-card { position: sticky; top: 96px; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 4px; }

/* ===================== Detail page ===================== */

.back-link { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 18px; font-weight: 500; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 10px 16px; margin: 0; }
.kv dt { color: var(--slate); font-size: 13px; }
.kv dd { margin: 0; font-weight: 500; }
.kv dd.break { word-break: break-all; font-weight: 400; }
.code {
    background: #1f2023; color: #e3e6e8; border-radius: 14px;
    padding: 18px; overflow: auto; font-size: 12.5px; line-height: 1.6;
    font-family: 'SF Mono', 'Roboto Mono', ui-monospace, monospace;
    margin: 0 0 20px;
}

/* ===================== Integrations / постбеки ===================== */

.hint { color: var(--slate); font-size: 13.5px; line-height: 1.6; margin: 0 0 18px; }
.hint code, .kv code {
    background: var(--canvas); border: 1px solid var(--mist); border-radius: 6px;
    padding: 1px 6px; font-family: ui-monospace, 'Roboto Mono', monospace; font-size: 12.5px; color: var(--graphite);
}

.url-cards { display: flex; flex-direction: column; gap: 16px; margin-bottom: 24px; }
.url-card { padding: 20px 22px; margin: 0; }
.url-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.url-desc { color: var(--slate); font-size: 13px; }
.url-row { display: flex; align-items: stretch; gap: 10px; }
.url-box {
    flex: 1; min-width: 0;
    background: #1f2023; color: #e3e6e8;
    border-radius: 12px; padding: 14px 16px;
    font-family: ui-monospace, 'Roboto Mono', monospace; font-size: 12.5px; line-height: 1.6;
    overflow-x: auto; white-space: nowrap;
    display: flex; align-items: center;
}
.url-box::-webkit-scrollbar { height: 6px; }
.url-box::-webkit-scrollbar-thumb { background: #44474b; border-radius: 3px; }
.js-copy { flex-shrink: 0; }
.js-copy.is-copied { color: var(--green); border-color: var(--green); }

.kv--wide { grid-template-columns: 130px 1fr; gap: 12px 18px; }
.kv--wide dt { color: var(--graphite); }

@media (max-width: 720px) {
    .url-row { flex-direction: column; }
    .js-copy { justify-content: center; }
}

/* ===================== Login ===================== */

.login-body {
    display: grid; place-items: center; min-height: 100vh;
    background:
        radial-gradient(1200px 600px at 50% -10%, var(--tint), transparent 60%),
        var(--canvas);
    padding: 24px;
}
.login-card {
    width: 100%; max-width: 400px;
    background: var(--white); border: 1px solid var(--mist);
    border-radius: 28px; padding: 40px 36px;
    box-shadow: var(--shadow-md);
}
.login-brand { text-align: center; margin-bottom: 28px; }
.login-brand h1 { font-size: 22px; font-weight: 600; margin: 0 0 4px; letter-spacing: -.3px; }
.login-brand p { color: var(--slate); margin: 0; font-size: 13px; }
.login-form { display: flex; flex-direction: column; gap: 18px; }

/* ===================== Responsive ===================== */

@media (max-width: 1100px) {
    .stats { grid-template-columns: repeat(2, 1fr); }
    .pixels-grid, .detail-grid { grid-template-columns: 1fr; }
    .form-card { position: static; }
}
@media (max-width: 720px) {
    .sidebar { width: 72px; padding: 16px 10px; }
    .brand-name, .nav-item span:not(.material-symbols-outlined) { display: none; }
    .content { padding: 20px 16px; }
    .stats { grid-template-columns: 1fr 1fr; }
    .filters-actions { margin-left: 0; width: 100%; }
    .field--sm, .field--grow { width: 100%; }
}
