/* ОСББ Білий Дім — кастомизация Bootstrap 5 в стиле Дія */
:root{
    --wh-bg:        #ffffff;
    --wh-surface:   #f4f4f6;
    --wh-line:      #e6e6ea;
    --wh-text:      #19191b;
    --wh-text-2:    #65676e;
    --wh-text-3:    #9a9ba1;
    --wh-accent:    #1f76f2;
    --wh-accent-2:  #145fcc;
    --wh-success:   #00875a;
    --wh-warn:      #b25f00;
    --wh-error:     #da3633;
    --wh-pinned-bg: #fff7df;
    --wh-pinned-bd: #ecdf9b;
    --wh-radius:    14px;
    --wh-radius-sm: 10px;
    --wh-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

*{ box-sizing: border-box; }
html, body{
    background: var(--wh-bg);
    color: var(--wh-text);
    font-family: var(--wh-font);
    font-size: 16px;
    font-weight: 400;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
a{ color: var(--wh-accent); text-decoration: none; }
a:hover{ color: var(--wh-accent-2); text-decoration: underline; }

h1,h2,h3,h4,h5{ color: var(--wh-text); font-weight: 700; letter-spacing: -0.01em; }
h1{ font-size: 2.25rem; line-height: 1.2; margin-bottom: 0.6em; }
h2{ font-size: 1.6rem; }
h3{ font-size: 1.2rem; }

.muted, .text-muted{ color: var(--wh-text-2) !important; }
hr{ border-color: var(--wh-line); opacity: 1; }

/* ----- Шапка ----- */
.wh-top{
    background:#fff;
    border-bottom: 1px solid var(--wh-line);
    padding: 18px 0;
}
.wh-brand{
    display:flex; align-items:center; gap:14px;
    color: var(--wh-text);
    text-decoration:none;
}
.wh-brand:hover{ text-decoration: none; color: var(--wh-text); }
.wh-brand svg{ width:42px; height:42px; flex:0 0 42px; }
.wh-brand .name{ font-weight:700; font-size:1.05rem; letter-spacing:-0.01em; line-height:1.1; }
.wh-brand .loc{ font-size:0.78rem; color:var(--wh-text-2); margin-top:2px; }

.wh-top-right{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.wh-lang{ display:inline-flex; border:1px solid var(--wh-line); border-radius: 999px; overflow:hidden; }
.wh-lang a{
    padding: 5px 12px; font-size: 0.78rem; font-weight:600; letter-spacing:0.04em;
    color: var(--wh-text-2); background:#fff;
}
.wh-lang a:hover{ text-decoration:none; color: var(--wh-text); }
.wh-lang a.active{ background: var(--wh-text); color: #fff; }

/* Шапка: pill «Особистий кабінет» (ім'я + кв.) і кнопка-іконка «Вийти» */
.wh-user-pill{
    display:inline-flex; align-items:center; gap:8px;
    padding: 6px 14px 6px 10px;
    border:1px solid var(--wh-line); border-radius: 999px;
    color: var(--wh-text); background:#fff;
    text-decoration:none;
    font-size: 0.85rem; font-weight:500;
    transition: background .15s, border-color .15s, color .15s;
    max-width: 100%;
}
.wh-user-pill:hover, .wh-user-pill:focus{
    text-decoration:none; color: var(--wh-text);
    background: #f4f5f7; border-color: var(--wh-text-2);
}
.wh-user-pill.active{
    background: var(--wh-text); border-color: var(--wh-text); color: #fff;
}
.wh-user-pill.active .wh-user-apt{ color: rgba(255,255,255,0.75); }
.wh-user-icon{ flex:0 0 auto; opacity: 0.8; }
.wh-user-name{
    max-width: 220px;
    overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.wh-user-apt{ color: var(--wh-text-2); font-weight:600; }

.wh-icon-btn{
    display:inline-flex; align-items:center; justify-content:center;
    width: 36px; height: 36px;
    border:1px solid var(--wh-line); border-radius:999px;
    color: var(--wh-text-2); background:#fff;
    text-decoration:none;
    transition: background .15s, border-color .15s, color .15s;
}
.wh-icon-btn:hover, .wh-icon-btn:focus{
    text-decoration:none;
    color: var(--wh-error); border-color: var(--wh-error); background:#fff;
}

/* ----- Навигация ----- */
.wh-nav{
    background:#fff;
    border-bottom: 1px solid var(--wh-line);
}
.wh-nav .nav{ gap:2px; flex-wrap:wrap; }
.wh-nav .nav-link{
    color: var(--wh-text-2);
    padding: 14px 14px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    transition: color .15s;
}
.wh-nav .nav-link:hover{ color: var(--wh-text); }
.wh-nav .nav-link.active{
    color: var(--wh-text); font-weight: 600;
    border-bottom-color: var(--wh-accent);
}
.wh-nav .nav-link .badge{
    margin-left:6px; vertical-align:middle;
    background: var(--wh-accent); color:#fff; font-weight:600; border-radius:999px;
}

/* Dropdown «ОСББ» — стилізуємо під сайт, прибираючи bootstrap-defaults. */
.wh-nav .dropdown-toggle::after{
    border-top-color: currentColor;
    margin-left: 6px; vertical-align: 0.15em;
}
.wh-dropdown{
    border: 1px solid var(--wh-line);
    border-radius: var(--wh-radius-sm);
    box-shadow: 0 8px 24px rgba(0,0,0,0.06);
    padding: 6px;
    margin-top: -2px;
}
.wh-dropdown .dropdown-item{
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--wh-text-2);
    font-weight: 500;
}
.wh-dropdown .dropdown-item:hover,
.wh-dropdown .dropdown-item:focus{
    background: #f4f5f7; color: var(--wh-text);
}
.wh-dropdown .dropdown-item.active,
.wh-dropdown .dropdown-item:active{
    background: var(--wh-text); color: #fff;
}

/* Checkbox-hack hamburger: чекбокс прячем, label превращаем в кнопку.
   На десктопе toggle скрыт, меню всегда видно. */
.wh-nav-toggle-input{
    position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0;
}
.wh-nav-toggle{ display:none; }
.wh-burger{
    display:inline-block; width:22px; height:16px; position:relative; vertical-align:middle;
    background: transparent;
}
.wh-burger::before, .wh-burger::after{
    content:""; position:absolute; left:0; right:0; height:2px; border-radius:2px;
    background: var(--wh-text);
    transition: transform .2s ease;
}
.wh-burger::before{ top: 2px; box-shadow: 0 6px 0 var(--wh-text); }
.wh-burger::after { bottom: 2px; }
.wh-nav-toggle-input:checked ~ .wh-nav-toggle .wh-burger::before{
    transform: translateY(6px) rotate(45deg); box-shadow:none;
}
.wh-nav-toggle-input:checked ~ .wh-nav-toggle .wh-burger::after{
    transform: translateY(-6px) rotate(-45deg);
}

/* ----- Кнопки ----- */
.btn{
    border-radius: 999px;
    font-weight: 600;
    padding: 10px 22px;
    letter-spacing: -0.005em;
    border-width: 1px;
}
.btn-primary{
    background: var(--wh-text); border-color: var(--wh-text); color:#fff;
}
.btn-primary:hover, .btn-primary:focus{
    background: var(--wh-accent); border-color: var(--wh-accent);
}
.btn-outline-primary{
    color: var(--wh-text); border-color: var(--wh-line); background:#fff;
}
.btn-outline-primary:hover{
    background: var(--wh-text); border-color: var(--wh-text); color:#fff;
}
.btn-link{ color: var(--wh-accent); text-decoration: none; padding-left:0; padding-right:0; }
.btn-danger{ background: var(--wh-error); border-color: var(--wh-error); }
.btn-success{ background: var(--wh-success); border-color: var(--wh-success); }

/* ----- Формы ----- */
.form-label{ font-weight: 600; color: var(--wh-text); margin-bottom:6px; }
.form-control, .form-select{
    border: 1px solid var(--wh-line);
    border-radius: var(--wh-radius-sm);
    padding: 12px 14px;
    background:#fff;
    color: var(--wh-text);
    font-size: 1rem;
}
.form-control:focus, .form-select:focus{
    border-color: var(--wh-accent);
    box-shadow: 0 0 0 4px rgba(31,118,242,0.12);
}
.form-text{ color: var(--wh-text-2); }

/* ----- Карточки ----- */
.wh-card{
    background:#fff;
    border: 1px solid var(--wh-line);
    border-radius: var(--wh-radius);
    padding: 28px;
}
.wh-card + .wh-card{ margin-top: 18px; }

.wh-section-title{
    display:flex; align-items:baseline; justify-content:space-between; gap:16px;
    margin-bottom: 18px;
}
.wh-section-title h1{ margin-bottom:0; }

/* Логин/Регистрация */
.wh-auth-shell{
    min-height: calc(100vh - 120px);
    display:flex; align-items:center; justify-content:center;
    padding: 60px 16px;
}
.wh-auth{
    width: 100%; max-width: 460px;
    background:#fff; border:1px solid var(--wh-line); border-radius: var(--wh-radius);
    padding: 40px 36px;
}
.wh-auth h1{ font-size: 1.6rem; margin-bottom: 8px; }
.wh-auth .lead{ color: var(--wh-text-2); font-size: 0.95rem; margin-bottom: 28px; }

/* Объявления */
.wh-ann{ background:#fff; border:1px solid var(--wh-line); border-radius: var(--wh-radius); padding:24px 28px; margin-bottom:16px; }
.wh-ann.pinned{ background: var(--wh-pinned-bg); border-color: var(--wh-pinned-bd); }
.wh-ann h2{ font-size: 1.25rem; margin: 0 0 6px; }
.wh-ann .meta{ color: var(--wh-text-2); font-size: 0.85rem; margin-bottom: 12px; }
.wh-ann .body{ white-space: pre-line; }

/* Таблицы */
.table{ color: var(--wh-text); }
.table thead th{
    border-bottom: 1px solid var(--wh-line);
    font-weight: 600; font-size: 0.82rem; letter-spacing: 0.04em;
    text-transform: uppercase; color: var(--wh-text-2); background:transparent;
}
.table > :not(caption) > * > *{ background-color: transparent; }
.table tbody tr{ border-bottom: 1px solid var(--wh-line); }
.table tbody tr:last-child{ border-bottom: 0; }

/* Бейджи статусов */
.wh-badge{ display:inline-block; padding: 3px 10px; border-radius:999px; font-size:0.78rem; font-weight:600; }
.wh-badge.new{ background:#eef4ff; color: var(--wh-accent-2); }
.wh-badge.in_progress{ background:#fff3e0; color: var(--wh-warn); }
.wh-badge.resolved{ background:#e8f6ee; color: var(--wh-success); }
.wh-badge.open{ background:#e8f6ee; color: var(--wh-success); }
.wh-badge.closed{ background: var(--wh-surface); color: var(--wh-text-2); }
.wh-badge.unread{ background: var(--wh-accent); color:#fff; }
.wh-badge.pin{ background:#fdebcd; color:#7a5a00; }

/* Алерты */
.alert{ border-radius: var(--wh-radius-sm); border:1px solid transparent; padding: 14px 18px; }
.alert-success{ background:#e8f6ee; color: var(--wh-success); border-color:#bfe4ce; }
.alert-danger{  background:#fdecec; color: var(--wh-error);   border-color:#f5c2c0; }
.alert-info{    background:#eef4ff; color: var(--wh-accent-2);border-color:#cfe1ff; }

/* Подвал */
.wh-foot{
    margin-top: 60px; padding: 28px 0;
    border-top: 1px solid var(--wh-line);
    color: var(--wh-text-2); font-size: 0.85rem;
}
.wh-foot a{ color: var(--wh-text-2); }
.wh-foot a:hover{ color: var(--wh-text); }

/* Вкладення тикетів */
.wh-att-list{
    list-style: none; padding: 0; margin: 12px 0 0;
    display: flex; flex-wrap: wrap; gap: 10px;
}
.wh-att{
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--wh-surface); border: 1px solid var(--wh-line);
    border-radius: var(--wh-radius-sm);
    padding: 6px 12px 6px 6px;
    max-width: 100%;
}
.wh-att-thumb{ display: inline-block; line-height: 0; }
.wh-att-thumb img{
    width: 44px; height: 44px; object-fit: cover;
    border-radius: 8px; display: block;
}
.wh-att-icon{
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; font-size: 22px;
    background: #fff; border: 1px solid var(--wh-line); border-radius: 8px;
    text-decoration: none;
}
.wh-att-name{ font-weight: 500; word-break: break-word; }

/* Виджеты погоды */
.wh-tiles{ display:grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap:14px; }
.wh-tile{ background:#fff; border:1px solid var(--wh-line); border-radius: var(--wh-radius); padding:18px 20px; }
.wh-tile .lbl{ font-size:0.78rem; letter-spacing:0.04em; text-transform:uppercase; color: var(--wh-text-2); }
.wh-tile .val{ font-size:1.8rem; font-weight:700; margin-top:6px; }
.wh-tile .sub{ font-size:0.85rem; color: var(--wh-text-2); margin-top:4px; }

/* Адаптив */
@media (max-width: 768px){
    html, body{ font-size: 15px; }
    h1{ font-size: 1.5rem; }
    h2{ font-size: 1.25rem; }
    h3{ font-size: 1.05rem; }

    /* Шапка плотнее */
    .wh-top{ padding: 12px 0; }
    .wh-brand svg{ width:34px; height:34px; flex:0 0 34px; }
    .wh-brand .name{ font-size: 0.95rem; }
    .wh-brand .loc { font-size: 0.72rem; }
    .wh-top-right{ gap: 10px; }

    /* Карточки и формы плотнее на телефоне */
    .wh-card{ padding: 18px 16px; border-radius: 12px; }
    .wh-card + .wh-card{ margin-top: 14px; }
    .wh-auth{ padding: 24px 20px; }
    .wh-ann{ padding: 18px 16px; }
    .wh-auth-shell{ min-height: auto; padding: 32px 8px; }

    main.container{ padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }

    /* Заголовок секции с действиями переносит блок кнопок ниже */
    .wh-section-title{ flex-direction: column; align-items: stretch; gap: 12px; }
    .wh-section-title h1{ font-size: 1.4rem; }

    /* Кнопки чуть выше — крупнее пальцем */
    .btn{ padding: 11px 18px; }

    /* Навигация — превращается в hamburger drawer */
    .wh-nav{ position: sticky; top: 0; z-index: 1020; background:#fff; }
    .wh-nav-toggle{
        display: flex; align-items: center; gap: 10px;
        padding: 12px 4px;
        font-weight: 600; color: var(--wh-text);
        cursor: pointer; user-select: none;
    }
    .wh-nav-toggle .badge{
        background: var(--wh-accent); color:#fff; border-radius:999px;
        font-size: 0.72rem; padding: 2px 8px; margin-left: 4px;
    }
    .wh-nav .nav{ display: none; }
    .wh-nav-toggle-input:checked ~ .nav{
        display: flex; flex-direction: column; align-items: stretch;
        gap: 0;
        padding: 4px 0 12px;
        border-top: 1px solid var(--wh-line);
    }
    .wh-nav-toggle-input:checked ~ .nav .nav-item{ width:100%; }
    .wh-nav-toggle-input:checked ~ .nav .nav-link{
        padding: 12px 4px;
        border-bottom: 1px solid var(--wh-line);
    }
    .wh-nav-toggle-input:checked ~ .nav .nav-item:last-child .nav-link{ border-bottom: 0; }
    .wh-nav-toggle-input:checked ~ .nav .nav-link.active{
        color: var(--wh-text); border-bottom-color: var(--wh-line);
        background: linear-gradient(90deg, rgba(31,118,242,.08), transparent 60%);
        box-shadow: inset 3px 0 0 var(--wh-accent);
        padding-left: 12px;
    }
    .wh-nav-toggle-input:checked ~ .nav .nav-item.ms-auto{ margin-left: 0 !important; }

    /* Dropdown «ОСББ» в hamburger-drawer: розкривається inline під заголовком,
       без позиціонування bootstrap (overlay). */
    .wh-nav-toggle-input:checked ~ .nav .dropdown-menu{
        position: static; display: block !important;
        float: none; width: 100%; margin: 0; padding: 4px 0 4px 16px;
        background: transparent; border: 0; box-shadow: none;
    }
    .wh-nav-toggle-input:checked ~ .nav .dropdown-menu .dropdown-item{
        padding: 10px 8px;
        border-bottom: 1px solid var(--wh-line);
        background: transparent; color: var(--wh-text-2);
        border-radius: 0;
    }
    .wh-nav-toggle-input:checked ~ .nav .dropdown-menu .dropdown-item.active{
        background: transparent; color: var(--wh-text); font-weight: 600;
        box-shadow: inset 3px 0 0 var(--wh-accent);
    }
    .wh-nav-toggle-input:checked ~ .nav .dropdown-toggle::after{ display: none; }

    /* Шапка: pill без імені (тільки кв.+іконка), щоб не зламати рядок */
    .wh-user-pill{ padding: 5px 10px; font-size: 0.8rem; }
    .wh-icon-btn{ width: 32px; height: 32px; }

    /* Таблицы — горизонтальный скролл внутри карточки */
    .wh-card > .table{ display:block; overflow-x:auto; white-space:nowrap;
                       -webkit-overflow-scrolling: touch; }
    .wh-card > .table thead, .wh-card > .table tbody{ display: table; width: 100%; min-width: 560px; }

    /* Виджеты погоды компактнее */
    .wh-tile .val{ font-size: 1.4rem; }
    .wh-tiles{ grid-template-columns: repeat(2, 1fr); gap: 10px; }

    /* Шапка KPI на developer-дашборде — две колонки */
    .display-6{ font-size: 1.6rem !important; }

    /* Подвал в столбик */
    .wh-foot .container{ flex-direction: column; align-items: flex-start; gap: 8px !important; }
}

/* Очень маленькие экраны (iPhone SE и ниже) */
@media (max-width: 380px){
    .wh-brand .name{ font-size: 0.88rem; }
    .wh-brand .loc { display: none; }
    .wh-tiles{ grid-template-columns: 1fr; }
}

/* Утилиты */
.wh-mono{ font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; }
.wh-clip{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* ----- Розробник: компактний шрифт, щоб широкі таблиці влазили ----- */
.wh-dev-page{ font-size: 0.86rem; }
.wh-dev-page h1{ font-size: 1.5rem; }
.wh-dev-page h3{ font-size: 1.05rem; }
.wh-dev-page h4{ font-size: 0.95rem; }
.wh-dev-page .display-6{ font-size: 1.5rem; font-weight: 600; }
.wh-dev-page .wh-card{ padding: 18px 16px; }
.wh-dev-page .table{ font-size: 0.82rem; }
.wh-dev-page .table th, .wh-dev-page .table td{ padding: 0.35rem 0.5rem; }
.wh-dev-page .table.table-sm{ font-size: 0.78rem; }
.wh-dev-page .table.table-sm th, .wh-dev-page .table.table-sm td{ padding: 0.3rem 0.4rem; }
.wh-dev-page .small, .wh-dev-page small{ font-size: 0.74rem; }
.wh-dev-page .btn-sm{ font-size: 0.75rem; padding: 0.2rem 0.5rem; }
.wh-dev-page .wh-tile{ padding: 12px 14px !important; }
.wh-dev-page .wh-badge{ font-size: 0.72rem; padding: 0.15em 0.5em; }
@media (max-width: 768px){
    .wh-dev-page{ font-size: 0.82rem; }
    .wh-dev-page .display-6{ font-size: 1.25rem !important; }
    .wh-dev-page .table, .wh-dev-page .table.table-sm{ font-size: 0.74rem; }
}

/* Камера: HLS-плеер */
.wh-camera-wrap{
    position: relative;
    background: #0a0a0c;
    border-radius: 10px;
    overflow: hidden;
    aspect-ratio: 16 / 9;
}
.wh-camera-wrap video{
    width: 100%;
    height: 100%;
    display: block;
    background: #000;
    object-fit: contain;
}
.wh-camera-status{
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.85);
    font-size: 0.95rem;
    background: rgba(0,0,0,0.45);
    pointer-events: none;
    text-align: center;
    padding: 16px;
}
.wh-camera-status.error{ background: rgba(120,20,20,0.55); }
.wh-camera-status.loading::before{
    content: "";
    display: inline-block;
    width: 14px; height: 14px; margin-right: 10px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: wh-spin 0.9s linear infinite;
    vertical-align: -2px;
}
@keyframes wh-spin{ to{ transform: rotate(360deg);} }

/* Лічильник глядачів камери */
.wh-camera-viewers{
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(25, 135, 84, 0.10);
    color: #146c43;
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
}
.wh-camera-viewers .dot{
    width: 8px; height: 8px; border-radius: 50%;
    background: #198754;
    box-shadow: 0 0 0 0 rgba(25, 135, 84, 0.6);
    animation: wh-pulse 2s infinite;
}
@keyframes wh-pulse{
    0%   { box-shadow: 0 0 0 0 rgba(25, 135, 84, 0.6); }
    70%  { box-shadow: 0 0 0 8px rgba(25, 135, 84, 0); }
    100% { box-shadow: 0 0 0 0 rgba(25, 135, 84, 0); }
}

/* Password input + toggle "eye" */
.wh-password-wrap{
    position: relative;
    display: block;
}
.wh-password-wrap > input{
    padding-right: 2.6rem !important;
}
.wh-password-toggle{
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #6c757d;
    padding: 4px 6px;
    line-height: 0;
    cursor: pointer;
}
.wh-password-toggle:hover, .wh-password-toggle:focus{
    color: #19191b;
    background: rgba(0,0,0,0.04);
    border-color: var(--wh-line, #e0e0e0);
    outline: none;
}
.wh-password-toggle[aria-pressed="true"]{
    color: #198754;
}
