/*
 * DDV Systems — единая шапка страниц.
 * Карточка-бар: знак + заголовок слева, действия справа.
 * Кнопки — слейт-стиль (как devices/device_approvals, система B).
 */

.ddv-header {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.ddv-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.ddv-brand img {
    width: 32px;
    height: 32px;
    flex: none;
}

/* Полный локап (знак + DDV SYSTEMS) в шапке */
.ddv-brand img.ddv-logo {
    width: auto;
    height: 24px;
}

/* Логотип — ссылка на главную */
.ddv-logo-link {
    display: inline-flex;
    align-items: center;
    flex: none;
    line-height: 0;
}

.ddv-sep {
    width: 1px;
    height: 22px;
    background: #e2e8f0;
    flex: none;
}

/* Узкие сайдбары (графики, live chart): локап сверху, название под ним */
.ddv-brand-stack {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.ddv-brand-stack .ddv-sep { display: none; }

.ddv-brand h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 650;
    letter-spacing: -0.01em;
    color: #0f172a;
    line-height: 1.25;
}

.ddv-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ddv-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.ddv-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 6px;
    background: #ffffff;
    color: #475569;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    line-height: 1.4;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    box-sizing: border-box;
}

.ddv-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.ddv-btn-primary {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

.ddv-btn-primary:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

.ddv-user {
    color: #64748b;
    font-size: 13.5px;
    font-weight: 500;
}

.ddv-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #ef4444;
    color: #ffffff;
    border-radius: 999px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    font-size: 11px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
    box-shadow: 0 0 0 2px #ffffff;
    box-sizing: border-box;
}

.ddv-header .status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #ecfdf5;
    color: #047857;
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 13px;
    font-weight: 550;
}

.ddv-header .status-indicator .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
}

/* Кнопки с SVG-иконками (device_approvals) — под общий стиль */
.ddv-actions .icon-btn {
    background: #ffffff;
    color: #475569;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
}

.ddv-actions .icon-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

@media (max-width: 640px) {
    .ddv-header { padding: 12px 14px; }
    .ddv-brand { flex-wrap: wrap; gap: 8px 10px; }
    .ddv-brand h1 { font-size: 18px; }
    .ddv-brand img { width: 28px; height: 28px; }
    .ddv-brand img.ddv-logo { width: auto; height: 20px; }
    .ddv-sep { display: none; }

    /* Кнопки шапки: ровная сетка по два в ряд на всю ширину */
    .ddv-header .ddv-actions,
    .ddv-header .ddv-group { width: 100%; }
    /* flex-basis 0 — кнопки в ряду строго одинаковой ширины
       независимо от длины текста; min-width даёт максимум две в ряд */
    .ddv-header .ddv-actions > .ddv-btn,
    .ddv-header .ddv-group > .ddv-btn,
    .ddv-header .ddv-actions .icon-btn {
        flex: 1 1 0;
        min-width: 40%;
        justify-content: center;
        min-height: 40px;
    }
    .ddv-header .ddv-user {
        flex: 1 1 100%;
        text-align: center;
    }
    .ddv-header .status-indicator { margin: 0 auto; }
}
