:root {
    --bg: #0b1121;
    --glass: rgba(30, 41, 59, 0.7);
    --glass-solid: rgba(30, 41, 59, 0.95);
    --border: rgba(255, 255, 255, 0.08);
    --accent: #f05a28;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --radius: 20px;
    --shadow: 0 10px 40px -10px rgba(0,0,0,0.5);
    
    /* Calendar Colors */
    --fc-border-color: rgba(255, 255, 255, 0.1);
    --fc-page-bg-color: transparent;
    --fc-neutral-bg-color: rgba(255,255,255,0.05);
    --fc-list-event-hover-bg-color: rgba(255,255,255,0.1);
    --fc-today-bg-color: rgba(240, 90, 40, 0.15) !important;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;   /* fallback */
    min-height: 100dvh;  /* iOS Safari: 100vh ignores the URL bar and cuts content off */
}

/* Background */
.app-background { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; overflow: hidden; }
.orb { position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.4; }
.orb-1 { top: -10%; left: -10%; width: 50vw; height: 50vw; background: #4f46e5; animation: float 10s ease-in-out infinite alternate; }
.orb-2 { bottom: -10%; right: -10%; width: 60vw; height: 60vw; background: var(--accent); animation: float 12s ease-in-out infinite alternate-reverse; }
@keyframes float { to { transform: translate(30px, 30px); } }

/* Layout */
.app-layout { display: flex; max-width: 1200px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; }
.content-area { flex: 1; padding: 24px; padding-bottom: 100px; max-width: 100%; }

/* Navigation */
.glass-nav {
    width: 250px; padding: 30px 20px; background: var(--glass); backdrop-filter: blur(20px);
    border-right: 1px solid var(--border); position: sticky; top: 0; height: 100vh; height: 100dvh;
    display: flex; flex-direction: column; z-index: 100;
}
.nav-brand { font-size: 24px; font-weight: 800; letter-spacing: 2px; color: var(--accent); margin-bottom: 40px; text-align: center; }
.tab-links { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.tab-links a { display: flex; align-items: center; gap: 12px; padding: 12px 16px; color: var(--text-muted); text-decoration: none; font-weight: 500; border-radius: 12px; transition: 0.2s; cursor: pointer; }
.tab-links svg { width: 20px; height: 20px; }
.tab-links li.active a { background: var(--accent); color: white; box-shadow: 0 4px 20px rgba(240, 90, 40, 0.4); }
.tab-links li:not(.active) a:hover { background: rgba(255,255,255,0.05); color: white; }
.tab-links li.disabled { opacity: 0.5; pointer-events: none; }

/* Tabs */
.tab { display: none; animation: fadeEffect 0.3s; }
.tab.active { display: block; }
@keyframes fadeEffect { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Every page title gets the same treatment: a short accent bar, tighter size so long titles
   like "Пропозиції та Покращення" do not dominate the screen, consistent spacing. */
.glass-header h1 {
    font-size: 22px; margin: 0 0 20px; font-weight: 700; line-height: 1.2;
    letter-spacing: -0.01em; display: flex; align-items: center; gap: 10px;
}
.glass-header h1::before {
    content: ""; width: 4px; align-self: stretch; min-height: 22px;
    background: var(--accent); border-radius: 4px; flex-shrink: 0;
}
.schedule-header { display: flex; justify-content: space-between; align-items: center; }
.small-btn { padding: 8px 16px; font-size: 14px; }

/* Cards */
.glass-card { background: var(--glass); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; backdrop-filter: blur(12px); margin-bottom: 16px; box-shadow: var(--shadow); }
.accent-border { border-left: 3px solid var(--accent); }

/* Profile */
.profile-flex { display: flex; align-items: center; gap: 20px; }
.photo-wrapper { position: relative; }
.photo-wrapper img { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255,255,255,0.2); }
.status-dot { width: 12px; height: 12px; background: #10b981; border-radius: 50%; position: absolute; bottom: 5px; right: 0; border: 2px solid var(--bg); }
.profile-text h2 { margin: 0; font-size: 20px; }
.user-email { color: var(--text-muted); font-size: 14px; margin: 4px 0 10px; }
.tags { display: flex; gap: 8px; }
.tag { background: rgba(255,255,255,0.1); padding: 4px 10px; border-radius: 20px; font-size: 12px; }

/* Sub Tabs */
.sub-nav-wrapper { margin: 20px 0; }
.sub-tab-links { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.sub-tab-links a { display: block; padding: 9px 16px; background: rgba(255,255,255,0.05); border: 1px solid var(--border); color: var(--text-muted); text-decoration: none; border-radius: 20px; font-size: 13px; font-weight: 500; transition: background .15s, color .15s, border-color .15s; }
.sub-tab-links a:hover { background: rgba(255,255,255,0.1); color: var(--text); }
/* Active filter uses the accent, not stark white - it read as a foreign element on the dark theme. */
.sub-tab-links li.active a { background: rgba(240,90,40,0.16); color: var(--accent); border-color: rgba(240,90,40,0.5); }
.sub-tab-links li.disabled a { opacity: .4; pointer-events: none; }
.sub-tab { display: none; }
.sub-tab.active { display: block; }

/* Sub Content */
.info-card { display: flex; align-items: center; gap: 15px; }
.products-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.product-item .prod-head { display: flex; justify-content: space-between; margin-bottom: 10px; }
.price-badge { color: var(--accent); font-weight: bold; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 15px; font-size: 12px; }
.stats-grid div { display: flex; flex-direction: column; background: rgba(0,0,0,0.2); padding: 8px; border-radius: 8px; }
.stats-grid span { color: var(--text-muted); margin-bottom: 2px; }
.clubs-wrapper { display: flex; gap: 10px; flex-wrap: wrap; }
.club-card { text-align: center; min-width: 120px; }
.club-val { display: block; font-size: 24px; font-weight: bold; color: var(--accent); }

/* Credit Card */
.credit-card { background: linear-gradient(135deg, #f05a28, #c2410c); border-radius: 20px; padding: 24px; color: white; position: relative; overflow: hidden; max-width: 340px; margin: 0 auto; box-shadow: 0 20px 50px rgba(240, 90, 40, 0.3); }
.card-bg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0IiBoZWlnaHQ9IjQiPgo8cmVjdCB3aWR0aD0iNCIgaGVpZ2h0PSI0IiBmaWxsPSIjZmZmIiBmaWxsLW9wYWNpdHk9IjAuMSIvPgo8L3N2Zz4='); opacity: 0.3; }
.card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.card-num { font-size: 22px; letter-spacing: 2px; margin-bottom: 30px; font-family: monospace; text-shadow: 0 2px 2px rgba(0,0,0,0.2); }
.card-bottom { display: flex; justify-content: space-between; text-transform: uppercase; font-size: 10px; }
.card-bottom .val { display: block; font-size: 14px; font-weight: bold; margin-top: 4px; }

/* Payments — collapsible contract -> month -> day.
   Every tappable target here is >= 44px, and the master/leaf checkboxes are drawn with spans so
   the real inputs can stay visually hidden but still submit. */
.pay-help { color: var(--text-muted); font-size: 13px; margin: 0 0 16px; }
.payments-list { display: flex; flex-direction: column; gap: 12px; }

.contract-group { background: var(--glass); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.group-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; min-height: 44px; cursor: pointer; }
.grp-main { flex: 1; min-width: 0; cursor: pointer; }
.grp-title { font-weight: 600; font-size: 15px; }
.grp-title.sm { font-size: 14px; }
.grp-sub { color: var(--text-muted); font-size: 12px; margin-top: 3px; }
.grp-amt { font-weight: 700; font-size: 16px; white-space: nowrap; cursor: pointer; }
.grp-amt.sm { font-size: 14px; font-weight: 600; }
.grp-chev { color: var(--text-muted); transition: transform .2s; width: 20px; text-align: center; flex-shrink: 0; }
.grp-chev.spacer { visibility: hidden; }
.contract-group.open > .group-head .grp-chev,
.month-group.open > .month-head .grp-chev { transform: rotate(180deg); }

/* Master checkbox (contract / month) drawn as a button so it is its own >=44px hit area. */
.grp-check { width: 26px; height: 26px; min-width: 26px; border-radius: 7px; border: 2px solid rgba(255,255,255,.25);
    background: transparent; flex-shrink: 0; position: relative; padding: 0; cursor: pointer; }
.grp-check.mini { width: 22px; height: 22px; min-width: 22px; }
.grp-check.on { background: var(--accent); border-color: var(--accent); }
.grp-check.on::after { content: "✔"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 14px; }
.grp-check.some { border-color: var(--accent); background: rgba(240,90,40,.25); }
.grp-check.some::after { content: "–"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--accent); font-size: 16px; font-weight: 700; }

.group-body { display: none; padding: 0 16px 6px; }
.contract-group.open > .group-body { display: block; }
.month-group { border-top: 1px solid var(--border); }
.month-head { display: flex; align-items: center; gap: 12px; padding: 12px 0; min-height: 44px; }
.month-body { display: none; padding: 2px 0 8px 38px; }
.month-group.open > .month-body { display: block; }

.day-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; font-size: 13px; cursor: pointer; }
.day-row input { position: absolute; opacity: 0; pointer-events: none; }
.leaf-check { width: 20px; height: 20px; min-width: 20px; border-radius: 6px; border: 2px solid rgba(255,255,255,.25); position: relative; }
.day-row input:checked + .leaf-check { background: var(--accent); border-color: var(--accent); }
.day-row input:checked + .leaf-check::after { content: "✔"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 12px; }
.day-label { flex: 1; color: var(--text-muted); }
.day-amt { font-weight: 500; white-space: nowrap; }

.pay-dock { position: fixed; bottom: 20px; left: 270px; right: 20px; background: var(--glass-solid); border: 1px solid var(--accent); padding: 16px 24px; border-radius: 16px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 10px 40px rgba(0,0,0,0.5); z-index: 90; }
.pay-total { font-size: 15px; font-weight: 500; color: var(--text-muted); }
.pay-total b { font-size: 20px; color: var(--text); font-weight: 700; }
.pay-btn:disabled { opacity: .4; cursor: not-allowed; }
.pay-btn { background: var(--accent); color: white; border: none; padding: 12px 24px; border-radius: 12px; font-weight: 600; font-size: 16px; cursor: pointer; }
.pay-btn.full { width: 100%; margin-top: 20px; }

/* Calendar */
.calendar-wrapper { padding: 10px; min-height: 600px; overflow: hidden; }
#calendar { color: var(--text); font-family: 'Inter', sans-serif; }
.fc-button-primary { background-color: rgba(255,255,255,0.1) !important; border: 1px solid rgba(255,255,255,0.1) !important; color: var(--text) !important; }
.fc-button-primary:hover, .fc-button-active { background-color: var(--accent) !important; border-color: var(--accent) !important; }
.fc-theme-standard th, .fc-theme-standard td { border-color: var(--fc-border-color); }
.fc-event { border: none; background-color: var(--accent); box-shadow: 0 4px 10px rgba(240, 90, 40, 0.4); }

/* Modal */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(5px); z-index: 1000; display: none; justify-content: center; align-items: center; padding: 20px; opacity: 0; transition: opacity 0.3s ease; }
.modal-overlay.open { display: flex; opacity: 1; }
.modal-content { width: 100%; max-width: 400px; background: #1e293b; position: relative; transform: translateY(20px); transition: transform 0.3s ease; }
.modal-overlay.open .modal-content { transform: translateY(0); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.close-btn { background: none; border: none; color: var(--text-muted); font-size: 28px; cursor: pointer; }
.glass-input { width: 100%; padding: 12px; background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.2); border-radius: 10px; color: white; margin-top: 5px; font-family: inherit; }
.glass-input:focus { outline: none; border-color: var(--accent); }
.search-group { position: relative; }
.search-dropdown { position: absolute; top: 100%; left: 0; width: 100%; background: #1e293b; border: 1px solid rgba(255,255,255,0.1); border-radius: 10px; margin-top: 5px; max-height: 150px; overflow-y: auto; z-index: 10; display: none; box-shadow: 0 10px 20px rgba(0,0,0,0.5); }
.search-result-item { padding: 10px; cursor: pointer; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 13px; }
.search-result-item:hover { background: var(--accent); color: white; }

/* Login */
.login-box { text-align: center; }
.login-box h2 { margin-bottom: 20px; }

/* Mobile */
@media (max-width: 768px) {
    .app-layout { display: block; }
    .glass-nav {
        width: 100%; height: auto; position: fixed; bottom: 0; top: auto;
        flex-direction: row; justify-content: space-around;
        border-right: none; border-top: 1px solid var(--border);
        background: rgba(15, 23, 42, 0.95);
        /* The home indicator sits over the bottom ~34px on iPhone X and later. Without this the
           nav is physically under it and the bottom row of taps lands on the system gesture. */
        padding: 10px 10px calc(10px + env(safe-area-inset-bottom, 0px));
    }
    .nav-brand { display: none; }
    .tab-links { flex-direction: row; width: 100%; justify-content: space-around; gap: 0; }
    /* 44px is Apple's minimum touch target. At padding:8px around a 24px icon these were
       ~40px, which is the difference between "tapped it" and "tapped it twice". */
    .tab-links a { flex-direction: column; gap: 4px; padding: 8px; font-size: 10px; border-radius: 8px; min-height: 44px; justify-content: center; }
    .tab-links svg { width: 24px; height: 24px; }
    .tab-links li.active a { box-shadow: none; background: transparent; color: var(--accent); }
    .logout-link span { display: none; }
    .content-area { padding: 16px; padding-bottom: calc(90px + env(safe-area-inset-bottom, 0px)); }
    .pay-dock { left: 16px; right: 16px; bottom: calc(85px + env(safe-area-inset-bottom, 0px)); flex-direction: row; padding: 12px 16px; }
    .fc-header-toolbar { flex-direction: column; gap: 10px; }
    .profile-flex { flex-direction: column; text-align: center; }
    .status-dot { right: 50%; transform: translateX(50px); }
    .tags { justify-content: center; }
}


/* --- LOGIN FIXES --- */

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;   /* fallback */
    min-height: 100dvh;
    padding: 20px;
    padding-top: max(20px, env(safe-area-inset-top));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    position: relative;
    z-index: 1;
}

.login-card {
    width: 100%;
    max-width: 400px; /* Обмежуємо ширину */
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.login-header {
    margin-bottom: 30px;
}

.logo-circle {
    width: 60px;
    height: 60px;
    background: var(--accent);
    color: white;
    font-size: 32px;
    font-weight: bold;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 0 20px rgba(240, 90, 40, 0.5);
}

.login-header h2 {
    margin: 0 0 10px;
    font-size: 24px;
}

.login-header p {
    margin: 0;
    color: var(--text-muted);
}

.login-form-content {
    width: 100%;
}

.input-group {
    margin-bottom: 20px;
    text-align: left;
    width: 100%;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 15px;
    width: 20px;
    height: 20px;
    color: var(--text-muted);
}

.input-wrapper input {
    width: 100%;
    padding: 12px 12px 12px 45px; /* Відступ зліва для іконки */
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: white;
    font-size: 16px;
    transition: 0.3s;
    font-family: inherit;
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(0, 0, 0, 0.4);
}

.pay-btn.full-width {
    width: 100%;
    margin-top: 10px;
    padding: 15px;
    font-size: 16px;
}

/* Flash Messages */
.flash-messages {
    margin-top: 20px;
    width: 100%;
}

.flash-item {
    background: rgba(220, 38, 38, 0.2);
    border: 1px solid rgba(220, 38, 38, 0.5);
    color: #fecaca;
    padding: 10px;
    border-radius: 10px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}


/* Стиль для спінера */
.spinner {
    position: absolute;
    right: 15px; /* Відступ справа */
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff; /* Колір "активної" частини */
    animation: spin 1s ease-in-out infinite;
    z-index: 10;
}

/* Анімація обертання */
@keyframes spin {
    to { transform: translateY(-50%) rotate(360deg); }
}


.event-details-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.detail-row {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
}

.detail-icon {
    color: var(--accent);
    padding-top: 2px;
}

.detail-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    font-size: 16px;
    font-weight: 500;
    color: var(--text);
    word-break: break-word;
}

.text-muted {
    font-style: italic;
    font-size: 14px;
}

/* Layout for Suggestions Tab */
.suggestions-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

/* Priority Badges Updates */
.badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* ID 1: Low (Green) */
.badge-1 { 
    background: rgba(16, 185, 129, 0.2); 
    color: #34d399; 
    border: 1px solid rgba(16, 185, 129, 0.4); 
}

/* ID 2: Medium (Yellow/Gold) */
.badge-2 { 
    background: rgba(251, 191, 36, 0.2); 
    color: #fbbf24; 
    border: 1px solid rgba(251, 191, 36, 0.4); 
}

/* ID 3: High (Orange) */
.badge-3 { 
    background: rgba(249, 115, 22, 0.2); 
    color: #fb923c; 
    border: 1px solid rgba(249, 115, 22, 0.4); 
}

/* ID 4: Critical (Red) */
.badge-4 { 
    background: rgba(239, 68, 68, 0.25); 
    color: #f87171; 
    border: 1px solid rgba(239, 68, 68, 0.5); 
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.2); /* Легке світіння для критичного */
}
/* List Item Styling */
.suggestion-card {
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    position: relative;
    padding-right: 40px; /* Space for arrow */
}
.suggestion-card:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.08);
}
.suggestion-card::after {
    content: '→';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-weight: bold;
    opacity: 0.5;
}

/* Mobile Adaptation */
@media (max-width: 900px) {
    .suggestions-layout {
        grid-template-columns: 1fr; /* Stack vertically */
    }
}


/* Базові стилі для списку пропозицій */
.suggestion-card {
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}
.suggestion-card:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.08);
}

/* Кольори бейджів (відповідають PRIORITIES у JS) */
.badge-1 { background: rgba(74, 222, 128, 0.15); color: #4ade80; border: 1px solid rgba(74, 222, 128, 0.3); }
.badge-2 { background: rgba(250, 204, 21, 0.15); color: #facc15; border: 1px solid rgba(250, 204, 21, 0.3); }
.badge-3 { background: rgba(251, 146, 60, 0.15); color: #fb923c; border: 1px solid rgba(251, 146, 60, 0.3); }
.badge-4 { background: rgba(248, 113, 113, 0.15); color: #f87171; border: 1px solid rgba(248, 113, 113, 0.3); box-shadow: 0 0 10px rgba(248, 113, 113, 0.2); }

/* --- iOS / touch behaviour -----------------------------------------------------------------
   Added with the mobile pass. Trainers use this on iPhones, so Safari is the primary target.  */

/* Safari paints a grey box over anything tappable unless told otherwise. It makes a custom UI
   feel like an unstyled web page. */
a, button, .nav-item, .tab-links a, .pay-btn, [role="button"] {
    -webkit-tap-highlight-color: transparent;
}

/* Stops the whole page rubber-banding when a scrollable card is already at its end. */
body {
    overscroll-behavior-y: none;
}

/* Buttons and links should never be text-selected by a long press - that gesture should either
   do nothing or trigger the action, not pop up a selection handle. */
button, .pay-btn, .nav-item, .tab-links a {
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;   /* also removes the 300ms double-tap-zoom delay */
}

/* Respect the notch on the sides in landscape, and the status bar at the top. The top inset
   matters once installed to the home screen: apple-mobile-web-app-status-bar-style is
   black-translucent, so our background runs under the status bar and the first row of content
   would otherwise sit beneath the clock. */
.content-area {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    padding-top: max(16px, env(safe-area-inset-top));
}

@media (prefers-reduced-motion: reduce) {
    .orb { animation: none; }
    * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}


/* --- No horizontal scroll, ever ------------------------------------------------------------
   Added after a real-device report of side-scrolling that did not reproduce in the emulator.
   overflow-x: clip (not hidden) so it does not turn the root into a scroll container and break
   position: sticky. Long unbroken strings wrap instead of widening the layout. */
html, body {
    overflow-x: clip;
    max-width: 100%;
}
.grp-title, .grp-sub, .card-desc, .glass-card, h1, h2, h3, p, td, .badge {
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* --- Visual polish pass: consistent states, section headers, focus -------------------------
   No new framework, no restructure - just makes the existing components feel like one designed
   app: every interactive element has hover / active / focus-visible, section headers are
   consistent, and the accent is used deliberately rather than stark white. */

/* Section sub-headings inside tabs ("Деталі підписки", "Ваші подані пропозиції"): a consistent
   quiet label rather than a second competing H1. */
.tab h3, .section-title {
    font-size: 13px; text-transform: uppercase; letter-spacing: .06em;
    color: var(--text-muted); font-weight: 600; margin: 22px 0 12px;
}

/* Buttons: a subtle press + a real focus ring for keyboard users. Colours unchanged. */
.pay-btn, .small-btn, button.pay-btn {
    transition: transform .12s ease, filter .15s ease, opacity .15s ease;
}
.pay-btn:hover:not(:disabled), .small-btn:hover { filter: brightness(1.06); }
.pay-btn:active:not(:disabled) { transform: scale(.98); }

/* One consistent keyboard focus ring across every interactive element. Mouse users never see
   it (focus-visible), so it does not clutter the design. */
a:focus-visible, button:focus-visible, .grp-check:focus-visible,
.sub-tab-links a:focus-visible, .nav-item:focus-visible, input:focus-visible, select:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 2px;
}

/* Bottom-nav active item (MOBILE ONLY): a soft accent pill. Scoped to the media query so the
   desktop sidebar keeps its filled-orange-with-white-text active state - overriding the colour
   globally would put accent text on the accent-filled desktop pill and make it invisible. */
@media (max-width: 768px) {
    .tab-links li.active a { color: var(--accent); background: rgba(240,90,40,0.12); box-shadow: none; }
    .nav-item:active { transform: scale(.94); transition: transform .1s; }
}

/* Profile detail tags: give them a hairline so they read as chips, not floating text. */
.tag { border: 1px solid var(--border); }

/* Inputs: accent focus border to match the buttons. */
.glass-input:focus, .input-wrapper input:focus, select:focus {
    border-color: var(--accent); outline: none;
}
