/* © ФОП Татарников О.Ю. | +380504468872 | https://mambursoft.org.ua */
/**
 * Bevend Cabinet — основні стилі
 * Мінімалістичний дизайн, палітра Vibrant Organic (#95C14D)
 */

/* === CSS-змінні === */

/* Прибираємо tap highlight на мобільних */
*, *::before, *::after {
    -webkit-tap-highlight-color: transparent;
}

:root {
    --brand: #95C14D;
    --brand-light: #a8d460;
    --brand-dark: #7aa33e;
    --brand-bg: #f4f9ed;
    --brand-accent: #a8d460;

    /* Вторинні та третинні кольори */
    --secondary: #8e9804;
    --tertiary: #b3a502;
    --neutral: #777b44;

    /* Градієнти бренду */
    --crystal: linear-gradient(135deg, #7aa33e 0%, #95C14D 50%, #a8d460 100%);
    --crystal-subtle: linear-gradient(135deg, rgba(149,193,77,0.08) 0%, rgba(149,193,77,0.04) 100%);
    --crystal-border: linear-gradient(135deg, #7aa33e, #95C14D);
    --diamond-shadow: 0 4px 20px rgba(149, 193, 77, 0.15);
    --diamond-glow: 0 0 20px rgba(149, 193, 77, 0.25);

    /* Типографіка */
    --font-display: 'Manrope', sans-serif;
    --font-body: 'Inter', sans-serif;

    /* Монохромні кольори */
    --text: #1a2332;
    --text-secondary: #5a6a7e;
    --text-muted: #8a96a6;
    --bg: #f5f7fa;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --border-hover: #cbd5e1;

    /* Статуси */
    --success: #6aab35;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    /* Акцентні кольори */
    --accent-orange: #f59e0b;
    --accent-blue: #3b82f6;
    --accent-rose: #f43f5e;
    --accent-emerald: #6aab35;

    /* Розміри */
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
    --transition: 0.2s ease;
}

/* === Скидання та базові стилі === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-display);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6,
.tile__title,
.nav__logo {
    font-family: var(--font-display);
}

a {
    color: var(--brand);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--brand-light);
}

[x-cloak] { display: none !important; }

/* === Бейдж інстансу === */
.instance-badge {
    position: fixed;
    top: 0;
    left: 130px;
    padding: 2px 16px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    z-index: 9999;
    border-radius: 0 0 var(--radius) var(--radius);
    opacity: 0.7;
}

/* Instance-badge (dev/stage) — Badge висота ~22px. */
@media (max-width: 1023px) {
    body:has(.instance-badge) .main--with-sidebar {
        padding-top: 75px;
    }
}

.instance-badge--dev {
    background: var(--warning);
    color: #1a1a1a;
}

.instance-badge--stage {
    background: var(--brand);
    color: #1a2332;
}

/* === Навігація === */
.nav {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav__brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav__logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 700;
    color: var(--brand);
}

.nav__logo i {
    background: var(--crystal);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}


.nav__menu {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav__link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition);
    white-space: nowrap;
}

.nav__link:hover,
.nav__link:focus {
    color: var(--brand);
    background: var(--brand-bg);
}

.nav__actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav__lang {
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 12px;
    background: var(--bg-card);
    cursor: pointer;
}

.nav__link--logout {
    color: var(--danger);
}

.nav__link--logout:hover {
    background: rgba(239, 68, 68, 0.08);
    color: var(--danger);
}

/* === Основний контент === */
.app-layout {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 100vh;
}

.main {
    flex: 1;
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    min-width: 0;
}

/* === Glass-card === */
.glass-card {
    background: rgba(255, 255, 255, 0.95); /* fallback for browsers without backdrop-filter */
    background: rgba(255, 255, 255, 0.7);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-xl);
}

@supports not (backdrop-filter: blur(10px)) {
    .glass-card {
        background: rgba(255, 255, 255, 0.95);
    }
}

/* === Tile layout === */
.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.tile {
    background: rgba(255, 255, 255, 0.95); /* fallback */
    background: rgba(255, 255, 255, 0.7);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-xl);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

@supports not (backdrop-filter: blur(10px)) {
    .tile {
        background: rgba(255, 255, 255, 0.95);
    }
}

.tile::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--crystal);
    opacity: 0;
    transition: opacity var(--transition);
}

.tile:hover {
    border-color: var(--brand);
    box-shadow: var(--diamond-shadow);
    background: rgba(255, 255, 255, 0.85);
}

.tile:hover::before {
    opacity: 1;
}

.tile__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.tile__title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.tile__icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    background: var(--crystal-subtle);
    color: var(--brand);
    font-size: 16px;
}

.tile__body {
    font-size: 13px;
    color: var(--text-secondary);
}

.tile__value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
}

.tile__footer {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
}

/* === Кнопки === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

.btn--primary {
    background: var(--brand);
    color: #1a2332;
}

.btn--primary:hover {
    background: var(--brand-dark);
    box-shadow: var(--diamond-shadow);
    color: #fff;
}

.btn--secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn--secondary:hover {
    border-color: var(--brand);
    color: var(--brand);
}

.btn--danger {
    background: var(--danger);
    color: #fff;
}

.btn--danger:hover {
    background: #dc2626;
}

.btn--full {
    width: 100%;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn--outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn--outline:hover {
    border-color: var(--brand);
    color: var(--brand);
}

.btn--icon {
    padding: 8px;
    min-width: auto;
}

/* === Форми === */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text);
    background: var(--bg-card);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(149, 193, 77, 0.12);
}

/* === Сторінка входу === */
.login-page {
    background: var(--crystal-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login {
    width: 100%;
    max-width: 420px;
    padding: 16px;
}

.login__card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 40px 32px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.login__header {
    text-align: center;
    margin-bottom: 32px;
}

.login__icon {
    font-size: 40px;
    background: var(--crystal);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
}

.login__title {
    font-size: 24px;
    font-weight: 700;
    color: var(--brand);
}

.login__subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

.login__error {
    background: rgba(239, 68, 68, 0.08);
    color: var(--danger);
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 16px;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.login__divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0;
    color: var(--text-muted);
    font-size: 12px;
}

.login__divider::before,
.login__divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.login__oauth {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn--oauth {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 10px 16px;
    font-size: 14px;
}

.btn--oauth:hover {
    border-color: var(--brand);
    box-shadow: var(--shadow-md);
    color: var(--text);
}

.btn--google:hover { border-color: #4285f4; }
.btn--apple:hover { border-color: #333; }
.btn--facebook:hover { border-color: #1877f2; }

/* Перемикач мови на сторінці логіну */
.login__lang {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.lang-btn {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-muted);
}

.lang-btn:hover {
    border-color: var(--brand);
    color: var(--brand);
}

.lang-btn.active {
    background: var(--brand);
    color: #1a2332;
    border-color: var(--brand);
}

/* Забули пароль */
.login__forgot {
    text-align: center;
    margin-bottom: 16px;
}

.login__forgot-link {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
}

.login__forgot-link:hover {
    text-decoration: underline;
}

.login__forgot-form {
    margin-top: 12px;
}

.login__forgot-msg {
    margin-top: 8px;
    font-size: 13px;
}

.login__forgot-via {
    margin-top: 6px;
    font-size: 12px;
    color: var(--brand);
}

.text-success { color: var(--success); }
.text-error { color: var(--error); }

.login__success {
    text-align: center;
    color: var(--success);
    padding: 20px 0;
}

.login__success i {
    font-size: 48px;
    margin-bottom: 12px;
    display: block;
}

.btn--sm {
    padding: 8px 16px;
    font-size: 13px;
}

/* Таби Вхід/Реєстрація */
.login__tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border);
}

.login__tab {
    flex: 1;
    background: transparent;
    border: none;
    padding: 10px 16px;
    font-size: 14px;
    cursor: pointer;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.login__tab:hover {
    color: var(--brand);
}

.login__tab.active {
    color: var(--brand);
    border-bottom-color: var(--brand);
    font-weight: 600;
}

.login__tab i {
    margin-right: 6px;
}

/* === Статуси (маркери терміналів) === */
.status { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; }
.status--online { color: var(--success); }
.status--offline { color: var(--danger); }
.status--warning { color: var(--warning); }

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot--green { background: var(--success); }
.status-dot--red { background: var(--danger); }
.status-dot--yellow { background: var(--warning); }
.status-dot--grey { background: var(--text-muted); }
.status-dot--blue { background: var(--info); }
.status-dot--orange { background: #f97316; }
.status-dot--purple { background: #8b5cf6; }
.status-dot--black { background: #1a1a1a; }

/* === Футер === */
.footer {
    border-top: 1px solid var(--border);
    padding: 16px 24px;
    font-size: 12px;
    color: var(--text-muted);
    margin-left: 260px;
    margin-top: auto;
}

.footer__inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* === Sidebar === */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 260px;
    height: 100vh;
    z-index: 1000;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: transform var(--transition);
}

.sidebar__header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar__close {
    display: none;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--radius);
    background: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    transition: all var(--transition);
}

.sidebar__close:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.08);
}

.sidebar__logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 800;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.5px;
}

.sidebar__logo i {
    color: var(--brand);
    font-size: 20px;
}

.sidebar__nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.sidebar__footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.sidebar__link {
    display: flex;
    align-items: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    gap: 10px;
    padding: 9px 20px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition);
    border-radius: 0;
}

.sidebar__link i {
    width: 18px;
    text-align: center;
    font-size: 14px;
    flex-shrink: 0;
}

.sidebar__link:hover {
    color: var(--brand);
    background: var(--brand-bg);
}

.sidebar__link--active {
    color: var(--text);
    background: var(--bg);
    font-weight: 600;
}

/* Nav groups */
.nav-group {
    margin-bottom: 2px;
}

.nav-group__toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 20px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    text-align: left;
    font-family: var(--font-body);
}

.nav-group__toggle i:first-child {
    width: 18px;
    text-align: center;
    font-size: 14px;
    flex-shrink: 0;
}

.nav-group__toggle:hover {
    color: var(--brand);
    background: var(--brand-bg);
}

.nav-group__chevron {
    margin-left: auto;
    font-size: 11px;
    transition: transform var(--transition);
    color: var(--text-muted);
}

.nav-group__chevron--open {
    transform: rotate(180deg);
}

.nav-group__items {
    padding-left: 0;
}

.nav-group__items .sidebar__link {
    padding-left: 48px;
    font-size: 13px;
}

/* Main with sidebar offset */
.main--with-sidebar {
    margin-left: 260px;
    width: calc(100% - 260px);
    max-width: none;
}

/* === Mobile header === */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    z-index: 999;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
}

.mobile-header__toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text);
    cursor: pointer;
    border-radius: var(--radius);
    transition: background var(--transition);
}

.mobile-header__toggle:hover {
    background: var(--brand-bg);
}

.mobile-header__logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    color: var(--brand);
    text-decoration: none;
}

.mobile-header__logo i {
    background: var(--crystal);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.mobile-header__actions {
    display: flex;
    align-items: center;
    gap: 2px;
}

.mobile-header__action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius);
    font-size: 14px;
    text-decoration: none;
    transition: all var(--transition);
}

.mobile-header__action-btn:hover {
    color: var(--brand);
    background: var(--brand-bg);
}

.mobile-header__lang {
    appearance: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px 6px;
    font-size: 14px;
    cursor: pointer;
    color: var(--text);
}

/* === Sidebar overlay === */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
    background: rgba(0, 0, 0, 0.5);
}

/* === Top bar === */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* === Page header (заголовок сторінки + кнопки) === */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-header h1,
.page-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-header h1 i,
.page-title i {
    color: var(--brand-dark);
}

/* === Section (секція контенту) === */
.section {
    margin-top: 2rem;
    margin-bottom: 1.5rem;
}

.section__title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section__title i {
    color: var(--brand-dark);
}

.top-bar__actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--bg-card);
    padding: 0.25rem;
    border-radius: 9999px;
    border: 1px solid var(--border);
}

.top-bar__action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0.5rem;
    border-radius: 9999px;
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    transition: all var(--transition);
}

.top-bar__action-btn:hover {
    background: var(--brand-bg);
    color: var(--brand);
}

.top-bar__right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.top-bar__controls {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--bg-card);
    padding: 0.25rem;
    border-radius: 9999px;
    border: 1px solid var(--border);
}

.top-bar__lang {
    padding: 0.375rem 0.5rem;
    border: none;
    border-radius: 9999px;
    background: transparent;
    font-size: 14px;
    cursor: pointer;
    color: var(--text);
    appearance: none;
    -webkit-appearance: none;
}

.top-bar__user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
}

.top-bar__user-info {
    text-align: right;
    display: none;
}

.top-bar__user-email {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
}

@media (min-width: 640px) {
    .top-bar__user-info {
        display: block;
    }
}

.top-bar__avatar {
    width: 40px;
    height: 40px;
    border-radius: 9999px;
    object-fit: cover;
    border: 2px solid var(--border);
}

.top-bar__avatar-link {
    display: inline-block;
    position: relative;
    border-radius: 9999px;
    transition: opacity 0.2s;
}

.top-bar__avatar-link:hover {
    opacity: 0.75;
}

.top-bar__avatar-link .top-bar__avatar {
    border-color: var(--brand);
    border-style: dashed;
}

.breadcrumbs__list {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0;
    padding: 0;
}

.breadcrumbs__list a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition);
}

.breadcrumbs__list a:hover {
    color: var(--brand);
}

.breadcrumbs__separator {
    color: var(--border-hover);
}

.breadcrumbs__current {
    color: var(--text);
    font-weight: 500;
}

/* === Metric cards === */
.metrics-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.metric-card {
    padding: 1.25rem;
}

.metric-card__label {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.metric-card__value {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.metric-card__trend {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 0.5rem;
}

.metric-card__trend--up {
    color: var(--accent-emerald);
}

.metric-card__trend--down {
    color: var(--danger);
}

/* === Progress bars === */
.progress-bar {
    width: 100%;
    height: 0.375rem;
    background: var(--border);
    border-radius: 9999px;
    overflow: hidden;
}

.progress-bar__fill {
    height: 100%;
    border-radius: 9999px;
    transition: width var(--transition);
}

.progress-bar__fill--brand {
    background: var(--brand);
}

.progress-bar__fill--orange {
    background: var(--accent-orange);
}

.progress-bar__fill--blue {
    background: var(--accent-blue);
}

/* === Card header === */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.card-header__title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

.card-header__action {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    background: none;
    border: none;
    transition: color var(--transition);
}

.card-header__action:hover {
    color: var(--brand);
}

/* Mobile: sidebar off-screen by default */
@media (max-width: 1023px) {
    .mobile-header {
        display: flex;
    }

    .sidebar {
        transform: translateX(-100%);
    }

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

    .sidebar__close {
        display: flex;
    }

    .main--with-sidebar {
        margin-left: 0;
        width: 100%;
        max-width: none;
        padding-top: 72px;
    }

    .footer {
        margin-left: 0;
    }

    .top-bar {
        display: none;
    }

    /* Leaflet zoom — вправо, щоб не перекривати hamburger */
    .leaflet-top.leaflet-left {
        left: auto;
        right: 10px;
    }
}

/* Desktop: hide mobile header */
@media (min-width: 1024px) {
    .mobile-header {
        display: none;
    }
}

/* === Адаптивність — breakpoints: 360px, 768px, 1024px === */

/* < 768px: 1 колонка tiles, зменшений padding */
@media (max-width: 767px) {
    .main {
        padding: 16px;
    }

    .tiles {
        grid-template-columns: 1fr;
    }
}

/* 768px – 1023px: 2 колонки tiles */
@media (min-width: 768px) and (max-width: 1023px) {
    .tiles {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ≥ 1024px: sidebar видимий, tile-сітка 2-3 колонки (auto-fill) */
@media (min-width: 1024px) {
    .tiles {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

/* === Dark theme === */
html.dark {
    --bg: #121212;
    --bg-card: #1E1E1E;
    --text: #E2E8F0;
    --text-secondary: #A0AEC0;
    --text-muted: #718096;
    --border: rgba(255, 255, 255, 0.1);
    --border-hover: rgba(255, 255, 255, 0.2);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
    --crystal-subtle: linear-gradient(135deg, rgba(149, 193, 77, 0.12) 0%, rgba(149, 193, 77, 0.06) 100%);
    --brand-bg: rgba(149, 193, 77, 0.1);
}

/* Glass-card та tile */
html.dark .glass-card,
html.dark .tile {
    background: rgba(30, 30, 30, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Sidebar */
html.dark .sidebar {
    background: #1E1E1E;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

/* Mobile header */
html.dark .mobile-header {
    background: #1E1E1E;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Top bar */
html.dark .top-bar__actions,
html.dark .top-bar__controls {
    background: #1E1E1E;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

html.dark .top-bar__avatar {
    border-color: rgba(255, 255, 255, 0.15);
}

/* Footer */
html.dark .footer {
    border-top-color: rgba(255, 255, 255, 0.1);
}

/* Форми */
html.dark .form-input,
html.dark select,
html.dark textarea,
html.dark input[type="text"],
html.dark input[type="email"],
html.dark input[type="password"],
html.dark input[type="number"],
html.dark input[type="search"],
html.dark input[type="date"] {
    background: #2a2a2a;
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--text);
}

html.dark .form-input:focus,
html.dark select:focus,
html.dark textarea:focus,
html.dark input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(149, 193, 77, 0.15);
}

/* Кнопки secondary */
html.dark .btn--secondary {
    background: #2a2a2a;
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--text);
}

html.dark .btn--secondary:hover {
    border-color: var(--brand);
    color: var(--brand);
}

/* Login */
html.dark .login__card {
    background: #1E1E1E;
    border-color: rgba(255, 255, 255, 0.1);
}

html.dark .btn--oauth {
    background: #2a2a2a;
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--text);
}

html.dark .lang-btn {
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--text-muted);
}

/* Inline стилі — card/tile з background:#fff */
html.dark .card,
html.dark [style*="background:#fff"],
html.dark [style*="background: #fff"] {
    background: #1E1E1E !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

/* Inline стилі — border:#e0e0e0 */
html.dark [style*="border:1px solid #e0e0e0"],
html.dark [style*="border: 1px solid #e0e0e0"] {
    border-color: rgba(255, 255, 255, 0.1) !important;
}

/* Inline стилі — background:#f5f7fa, #f0f0f0 */
html.dark [style*="background:#f5f7fa"],
html.dark [style*="background: #f5f7fa"],
html.dark [style*="background:#f0f0f0"],
html.dark [style*="background: #f0f0f0"] {
    background: #2a2a2a !important;
}

/* Inline стилі — color:#888, #6b7280 */
html.dark [style*="color:#888"],
html.dark [style*="color: #888"] {
    color: var(--text-muted) !important;
}

/* Top bar lang select */
html.dark .top-bar__lang {
    color: var(--text);
}

/* Sidebar footer */
html.dark .sidebar__footer {
    border-top-color: rgba(255, 255, 255, 0.1);
}

/* Inline borders #e0e0e0, #ddd */
html.dark [style*="border:1px solid #e0e0e0"],
html.dark [style*="border: 1px solid #e0e0e0"],
html.dark [style*="border:1px solid #ddd"],
html.dark [style*="border: 1px solid #ddd"] {
    border-color: rgba(255, 255, 255, 0.1) !important;
}

/* Inline select/button з background:#fff */
html.dark [style*="background:#fff;"],
html.dark [style*="background: #fff;"],
html.dark [style*="background:#fff}"] {
    background: #1E1E1E !important;
    color: var(--text) !important;
}

/* Inline color:#6b7280 */
html.dark [style*="color:#6b7280"],
html.dark [style*="color: #6b7280"] {
    color: var(--text-muted) !important;
}

/* Inline color:#1a1a2e (основний текст) */
html.dark [style*="color:inherit"] {
    color: var(--text) !important;
}

/* Chart.js canvas — прозорий фон */
html.dark canvas {
    filter: none;
}

/* Pre/code блоки */
html.dark pre,
html.dark code {
    background: #2a2a2a;
    color: var(--text);
}

/* Scrollbar для dark theme */
html.dark ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

html.dark ::-webkit-scrollbar-track {
    background: #1a1a1a;
}

html.dark ::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}

html.dark ::-webkit-scrollbar-thumb:hover {
    background: #555;
}
