@import "https://www.nerdfonts.com/assets/css/webfont.css";

/* ========== CSS RESET & VARIABLES ========== */
:root {
    --primary: #f0385a;
    --primary-hover: #ee506f;
    --primary-light: rgba(240, 56, 90, 0.08);
    --primary-border: rgba(240, 56, 90, 0.25);

    --bg: #f8fafc;
    --bg-card: #ffffff;
    --bg-section: #ffffff;
    --bg-input: #ffffff;
    --bg-hover: #f1f5f9;

    --text: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;

    --border: #e2e8f0;
    --border-focus: rgba(240, 56, 90, 0.5);

    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.08);
    --success-border: rgba(16, 185, 129, 0.25);

    --error: #ef4444;
    --error-bg: rgba(239, 68, 68, 0.08);
    --error-border: rgba(239, 68, 68, 0.25);

    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.08);
    --warning-border: rgba(245, 158, 11, 0.25);

    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.08);
    --info-border: rgba(59, 130, 246, 0.25);

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    --shadow-card: 0 25px 50px -12px rgba(0, 0, 0, 0.1);

    /* Radii */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;

    /* Font */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a.no-style {
    text-decoration: none;
}

.hr {
    width: 100%;
    border-top: 1px solid var(--border);
}

.center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.row-400,
.row-600,
.row-800,
.row {
    display: flex;
    flex-direction: row;
    gap: 12px;
}

.g8 {
    gap: 8px;
}

.g4 {
    gap: 4px;
}

.col {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stack {
    display: grid;
    place-items: center;
}

.stack > * {
    grid-column: 1;
    grid-row: 1;
}

@media (max-width: 800px) {
    .row-800 {
        flex-direction: column;
    }
}

@media (max-width: 600px) {
    .row-600 {
        flex-direction: column;
    }
}

@media (max-width: 400px) {
    .row-400 {
        flex-direction: column;
    }
}

/* ========== TOPBAR ========== */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    height: 64px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
}

@media (max-width: 600px) {
    .topbar {
        padding: 0;
    }
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 24px;
}

.topbar-inner img {
    width: 32px;
    height: 32px;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text);
}

.topbar-logo {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary), #ee506f);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 16px;
    flex-shrink: 0;
}

.topbar-logo-img {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    object-fit: contain;
}

.topbar-brand-name {
    font-weight: 700;
    font-size: 18px;
}

.topbar-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.topbar-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.topbar-link:hover {
    color: var(--text);
    background: var(--bg-hover);
}

.topbar-link.active {
    color: var(--primary);
    background: var(--primary-light);
}

.topbar-link svg {
    width: 18px;
    height: 18px;
}

.topbar-right {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-avatar {
    position: relative;
    overflow: hidden;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #ee506f);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
}

.topbar-avatar--lg {
    width: 38px;
    height: 38px;
    font-size: 14px;
}

/* ===== Apps grid button ===== */
.topbar-apps-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.topbar-apps-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.topbar-apps-btn.active {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary-border);
}

/* ===== Apps panel (desktop flyout) ===== */
.topbar-apps-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 380px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    padding: 0;
    z-index: 110;
    display: none;
    animation: panelIn .18s ease;
    overflow: hidden;
}

@keyframes panelIn {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.topbar-apps-panel.open {
    display: block;
}

.topbar-apps-panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--text-muted);
    padding: 16px 20px 8px;
}

.topbar-apps-panel-header svg {
    opacity: .5;
}

.topbar-apps-grid {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px 10px 14px;
}

.topbar-apps-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text);
    transition: all var(--transition-fast);
    position: relative;
}

.topbar-apps-item:hover {
    background: var(--bg-hover);
}

.topbar-apps-item.current {
    background: var(--primary-light);
}

.topbar-apps-item.current::after {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--primary);
}

.topbar-apps-item.soon {
    opacity: .55;
    pointer-events: none;
}

.topbar-apps-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 800;
    color: #fff;
    letter-spacing: .3px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .08);
    flex-shrink: 0;
}

.topbar-apps-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.topbar-apps-label {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text);
}

.topbar-apps-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-apps-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    background: rgba(245, 158, 11, .12);
    color: #b45309;
    white-space: nowrap;
    flex-shrink: 0;
}

.topbar-apps-badge--date {
    background: rgba(16, 185, 129, .10);
    color: #047857;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 600;
}

.topbar-apps-badge--current {
    background: rgba(240, 56, 90, .10);
    color: var(--primary);
    text-transform: none;
    letter-spacing: 0;
    font-weight: 600;
}

/* ===== Account dropdown ===== */
.topbar-account {
    position: relative;
}

.topbar-account-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    cursor: pointer;
    transition: all var(--transition-fast);
    max-width: 260px;
}

.topbar-account-btn:hover {
    background: var(--bg-hover);
}

.topbar-account-btn.active {
    background: var(--primary-light);
    border-color: var(--primary-border);
}

.topbar-account-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    text-align: left;
}

.topbar-account-org {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.topbar-account-email {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.topbar-account-caret {
    color: var(--text-muted);
    transition: transform .2s ease;
    flex-shrink: 0;
}

.topbar-account.open .topbar-account-caret {
    transform: rotate(180deg);
}

/* ===== Account menu ===== */
.topbar-account-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 280px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 8px;
    z-index: 110;
    display: none;
    animation: panelIn .15s ease;
}

.topbar-account.open .topbar-account-menu {
    display: block;
}

.topbar-account-menu-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
}

.topbar-account-menu-org {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
}

.topbar-account-menu-email {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.3;
}

.topbar-account-menu-sep {
    height: 1px;
    background: var(--border);
    margin: 6px 8px;
}

.topbar-account-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.topbar-account-menu-item:hover {
    background: var(--bg-hover);
}

.topbar-account-menu-item i {
    width: 16px;
    height: 16px;
    display: grid;
    place-content: center;
}

.topbar-account-menu-item svg,
.topbar-account-menu-item i {
    color: var(--text-muted);
    flex-shrink: 0;
}

.topbar-account-menu-item:hover svg,
.topbar-account-menu-item:hover i {
    color: var(--text);
}

.topbar-account-menu-item--danger {
    color: var(--error);
}

.topbar-account-menu-item--danger:hover {
    background: var(--error-bg);
}

.topbar-account-menu-item--danger svg {
    color: var(--error);
}

/* ===== Mobile hamburger ===== */
.topbar-toggle {
    display: none;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--text);
}

/* ===== Mobile drawer ===== */
.topbar-mob-drawer {
    display: none;
}

/* ===== Bottom navigation (mobile) ===== */
.bottom-nav {
    display: none;
}

@media (max-width: 1024px) {
    .topbar-mob-nav {
        display: flex;
        flex-direction: column;
        gap: 4px;
        padding: 12px 16px;
    }

    .topbar-mob-link {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 12px 14px;
        border-radius: var(--radius-sm);
        text-decoration: none;
        color: var(--text);
        font-size: 14px;
        font-weight: 600;
        transition: all var(--transition-fast);
    }

    .topbar-mob-link:hover {
        background: var(--bg-hover);
    }

    .topbar-mob-link.active {
        color: var(--primary);
        background: var(--primary-light);
    }

    .topbar-mob-link--danger {
        color: var(--error);
    }

    .topbar-mob-link--danger:hover {
        background: var(--error-bg);
    }

    .topbar-mob-sep {
        height: 1px;
        background: var(--border);
        margin: 4px 16px;
    }

    .topbar-mob-section-label {
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .6px;
        color: var(--text-muted);
        padding: 12px 20px 6px;
    }

    .topbar-mob-services {
        display: flex;
        flex-direction: column;
        gap: 2px;
        padding: 4px 12px;
    }

    .topbar-mob-service {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 10px 12px;
        border-radius: var(--radius-sm);
        text-decoration: none;
        color: var(--text);
        transition: all var(--transition-fast);
    }

    .topbar-mob-service:hover {
        background: var(--bg-hover);
    }

    .topbar-mob-service.current {
        background: var(--primary-light);
    }

    .topbar-mob-service.soon {
        opacity: .5;
        pointer-events: none;
    }

    .topbar-mob-service-icon {
        width: 34px;
        height: 34px;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 12px;
        font-weight: 800;
        color: #fff;
        letter-spacing: .3px;
        box-shadow: 0 1px 3px rgba(15, 23, 42, .08);
        flex-shrink: 0;
    }

    .topbar-mob-service-text {
        display: flex;
        flex-direction: column;
        min-width: 0;
        flex: 1;
    }

    .topbar-mob-service-name {
        font-size: 14px;
        font-weight: 600;
        color: var(--text);
        line-height: 1.3;
    }

    .topbar-mob-service-desc {
        font-size: 12px;
        color: var(--text-muted);
        line-height: 1.3;
    }

    .topbar-mob-service-badge {
        display: inline-flex;
        padding: 2px 7px;
        border-radius: var(--radius-full);
        font-size: 10px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .3px;
        background: rgba(245, 158, 11, .12);
        color: #b45309;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .topbar-mob-service-badge--date {
        background: rgba(16, 185, 129, .10);
        color: #047857;
        text-transform: none;
        letter-spacing: 0;
        font-weight: 600;
    }

    .topbar-mob-service-badge--current {
        background: rgba(240, 56, 90, .12);
        color: var(--primary);
        text-transform: none;
        letter-spacing: 0;
        font-weight: 700;
    }

    /* Padding pro obsah, aby neschovával za bottom nav */
    body.je-prehled {
        padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px));
    }
}

/* ========== MAIN CONTENT ========== */
.main-content {
    max-width: 1600px;
    margin: 0 auto;
    padding: 32px 24px;
}

@media (max-width: 640px) {
    .main-content {
        padding: 20px 16px;
    }
}

/* ========== PAGE HEADER ========== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ========== PAGE TABS ========== */
.page-tabs {
    display: inline-flex;
    gap: 4px;
    margin-bottom: 24px;
    padding: 3px;
    background: var(--bg-hover);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.page-tab {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: 9px;
    cursor: pointer;
    transition: all 150ms ease;
    font-family: inherit;
    white-space: nowrap;
}

.page-tab:hover {
    color: var(--text);
}

.page-tab.active {
    color: var(--primary);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
}

.page-tab-content {
    display: none;
}

.page-tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* ========== CARDS / PANELS ========== */
.panel {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    padding: 28px;
    position: relative;
    overflow: hidden;
}

.panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), #ee506f);
}

.panel-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========== STAT CARDS ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all var(--transition-fast);
}

.stat-card:hover {
    border-color: var(--primary-border);
    box-shadow: var(--shadow-md);
}

.stat-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
}

.stat-value.credits {
    color: var(--primary);
}

.stat-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ========== FORMS (identické s auth.css) ========== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-label.required::after {
    content: ' *';
    color: var(--error);
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 15px;
    font-family: inherit;
    color: var(--text);
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input:hover {
    border-color: #cbd5e1;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.form-input:disabled {
    background: var(--bg-hover);
    color: var(--text-muted);
    cursor: not-allowed;
}

.form-input.error {
    border-color: var(--error);
}

.form-input.error:focus {
    box-shadow: 0 0 0 4px var(--error-bg);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 480px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-hint {
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.form-section {
    background: var(--bg-section);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
}

.form-section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-section-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========== BUTTONS (identické s auth.css) ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #ee506f);
    color: white;
    box-shadow: 0 4px 14px rgba(240, 56, 90, 0.35);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(240, 56, 90, 0.45);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-section);
    color: var(--text);
    border: 2px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: #cbd5e1;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 10px 16px;
}

.btn-ghost:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-block {
    width: 100%;
}

.btn-lg {
    padding: 16px 28px;
    font-size: 16px;
}

.btn-sm {
    padding: 8px 14px;
    font-size: 13px;
}

.btn .spinner {
    width: 18px;
    height: 18px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========== ALERTS (identické s auth.css) ========== */
.alert {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    display: none;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
    animation: alertIn 0.3s ease;
}

.alert.show {
    display: flex;
}

.alert-error {
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    color: #991b1b;
}

.alert-success {
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    color: #065f46;
}

.alert-info {
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid var(--primary-border);
    display: flex;
}

@keyframes alertIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== MEMBERS TABLE ========== */
.members-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.members-table th {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 2px solid var(--border);
}

.members-table td {
    padding: 14px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.members-table tr:last-child td {
    border-bottom: none;
}

.members-table tr:hover td {
    background: var(--bg-hover);
}

.member-email {
    font-weight: 600;
    color: var(--text);
}

.member-id {
    font-size: 11px;
    color: var(--text-muted);
    font-family: monospace;
}

.member-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
}

.member-badge.owner {
    background: linear-gradient(135deg, var(--primary-light), rgba(238, 80, 111, 0.08));
    color: var(--primary);
}

/* Service toggle checkboxes */
.service-toggle {
    width: 22px;
    height: 22px;
    border: 2px solid var(--border);
    border-radius: 6px;
    appearance: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.service-toggle:checked {
    background: var(--primary);
    border-color: var(--primary);
}

.service-toggle:checked::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 12px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.service-toggle:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.service-toggle:hover:not(:disabled) {
    border-color: var(--primary-border);
}

/* ========== CREDITS PAGE ========== */
.balance-display {
    text-align: center;
    padding: 32px 20px;
    margin-bottom: 28px;
}

.balance-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.balance-amount {
    font-size: 48px;
    font-weight: 900;
    color: var(--primary);
    line-height: 1.2;
}

.balance-currency {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-muted);
    margin-left: 4px;
}

.topup-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.topup-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 20px 16px;
    background: var(--bg-section);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.topup-btn:hover {
    border-color: var(--primary-border);
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.topup-btn:active {
    transform: translateY(0);
}

.topup-credits {
    font-size: 24px;
    font-weight: 800;
    color: var(--text);
}

.topup-price {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

/* ========== SETTINGS PAGE ========== */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 24px;
}

@media (max-width: 768px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

.settings-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
}

@media (min-width: 480px) {
    .settings-actions {
        flex-direction: row;
        justify-content: flex-end;
    }

    .settings-actions .btn {
        width: auto;
    }
}

.phone-group {
    display: flex;
    gap: 8px;
}

.phone-group .phone-prefix {
    width: 110px;
    flex-shrink: 0;
}

.phone-group .phone-number {
    flex: 1;
}

/* ========== INVITE FORM (legacy, overridden by page styles) ========== */
.invite-services {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

/* ========== LOADING STATE ========== */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

/* ========== EMPTY STATE ========== */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.flex-1 {
    flex: 1;
}

/* ========== DIVIDER ========== */
.divider-h {
    width: 1px;
    background: var(--border);
}

.divider {
    display: flex;
    align-items: center;
    margin: 24px 0;
}

.divider.small {
    margin: 4px 0;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.divider span {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ========== ANIMATIONS ========== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.4s ease;
}

.animate-slide-up {
    animation: slideUp 0.5s ease;
}

/* ========== UTILITIES ========== */
.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

.text-small {
    font-size: 13px;
}

.mt-4 {
    margin-top: 16px;
}

.mt-6 {
    margin-top: 24px;
}

.mb-4 {
    margin-bottom: 16px;
}

.mb-6 {
    margin-bottom: 24px;
}

[hidden],
.hidden:not(.hidden-override) {
    display: none !important;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 640px) {
    .panel {
        padding: 20px 16px;
        border-radius: var(--radius-lg);
    }

    .page-title {
        font-size: 20px;
    }

    .stat-value {
        font-size: 24px;
    }

    .balance-amount {
        font-size: 36px;
    }

    .members-table {
        font-size: 13px;
    }

    .members-table th,
    .members-table td {
        padding: 10px 8px;
    }

    .form-input {
        padding: 12px 14px;
        font-size: 16px;
    }

    .btn {
        padding: 12px 20px;
    }

    /* Page tabs - horizontální scroll na mobilu */
    .page-tabs {
        display: flex;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .page-tabs::-webkit-scrollbar {
        display: none;
    }

    .page-tab {
        padding: 7px 12px;
        font-size: 12px;
        flex-shrink: 0;
    }
}

/* ========== Přepínač organizací v účtu ========== */
.topbar-org-nadpis {
    padding: 6px 10px 2px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
}

.topbar-org-polozka {
    width: 100%;
    border: 0;
    background: none;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
}

.topbar-org-polozka[disabled] {
    cursor: default;
    opacity: .65;
}

.topbar-org-polozka[disabled]:hover {
    background: none;
}

.topbar-org-nazev {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-org-znacka {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(239, 68, 68, .1);
    color: #dc2626;
}

.topbar-org-znacka--ok {
    background: rgba(16, 185, 129, .1);
    color: #059669;
}

/* ==========================================================================
   LEVÝ PANEL (od 2026-09-08)
   ========================================================================== */

:root {
    --sidebar-w: 248px;
}

.sidebar-collapsed {
    --sidebar-w: 76px;
}

/* Jen stránky se Sidebar komponentou mají <body class="je-prehled"> - viz Page.php::hasSidebar(). */
body.je-prehled {
    padding-left: var(--sidebar-w);
    transition: padding-left var(--transition-base);
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    z-index: 150;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    transition: width var(--transition-base);
    overflow: hidden;
}

.sidebar-head {
    height: 64px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text);
    min-width: 0;
}

.sidebar-brand img {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    object-fit: contain;
}

.sidebar-brand-name {
    font-weight: 700;
    font-size: 18px;
    white-space: nowrap;
}

.sidebar-nav {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 12px;
}

.sidebar-group + .sidebar-group {
    margin-top: 18px;
}

.sidebar-group-label {
    padding: 0 12px 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: var(--text-muted);
    white-space: nowrap;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.sidebar-link + .sidebar-link {
    margin-top: 2px;
}

.sidebar-link:hover {
    background: var(--bg);
}

.sidebar-link.active {
    background: var(--primary-light);
    color: var(--primary);
}

.sidebar-link-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    flex-shrink: 0;
    color: var(--text-muted);
}

.sidebar-link.active .sidebar-link-icon {
    color: var(--primary);
}

.sidebar-link-label {
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-foot {
    flex-shrink: 0;
    border-top: 1px solid var(--border);
    padding: 12px;
}

.sidebar-collapse {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.sidebar-collapse:hover {
    background: var(--bg);
    color: var(--text);
}

.sidebar-collapse .sidebar-collapse-icon {
    flex-shrink: 0;
    transition: transform var(--transition-base);
}

.sidebar-collapsed .sidebar-brand-name,
.sidebar-collapsed .sidebar-group-label,
.sidebar-collapsed .sidebar-link-label,
.sidebar-collapsed .sidebar-collapse-label {
    display: none;
}

.sidebar-collapse-label {
    margin-bottom: -2px;
}

.sidebar-collapsed .sidebar-link,
.sidebar-collapsed .sidebar-collapse {
    justify-content: center;
}

.sidebar-collapsed .sidebar-head {
    justify-content: center;
    padding: 0 12px;
}

.sidebar-collapsed .sidebar-collapse .sidebar-collapse-icon {
    transform: rotate(180deg);
}

.sidebar-collapsed .sidebar-group + .sidebar-group {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.topbar-brand {
    display: none;
}

.no-sidebar .topbar-brand {
    display: flex;
}

/* ========== Kredit v horní liště ========== */
.topbar-credit {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 12px;
    margin-right: 4px;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--bg-card);
    text-decoration: none;
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

.topbar-credit:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
}

.topbar-credit svg {
    color: var(--success);
    flex-shrink: 0;
}

.topbar-credit-mena {
    color: var(--text-muted);
    font-weight: 600;
}

.topbar-credit:hover .topbar-credit-mena {
    color: inherit;
}

/* ==========================================================================
   Pod 1024 px: panel se schová do zásuvky pod hamburgerem
   ========================================================================== */
@media (max-width: 1024px) {
    .topbar-credit,
    .topbar-nav,
    .topbar-apps-btn,
    .topbar-apps-panel,
    .topbar-account {
        display: none !important;
    }

    :root,
    .sidebar-collapsed {
        --sidebar-w: 0px;
    }

    .sidebar {
        display: none;
    }

    .topbar-brand {
        display: flex;
    }

    .topbar-toggle {
        display: flex;
    }

    .no-sidebar .topbar-toggle {
        display: none;
    }

    .topbar-mob-drawer {
        display: block;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        border-top: 1px solid var(--border);
        background: var(--bg-card);
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        transform: translateY(-4px);
        transition: max-height .25s ease, opacity .2s ease, transform .2s ease;
        z-index: 150;
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    }

    .topbar-mob-drawer.open {
        max-height: 80vh;
        opacity: 1;
        transform: translateY(0);
        overflow-y: auto;
    }

    .topbar-mob-link.active {
        background: var(--primary-light);
        color: var(--primary);
    }

    .main-content--dash,
    body.je-prehled .topbar-inner {
        max-width: 1600px;
    }

    /* ===== Mobile drawer user info ===== */
    .mob-drawer-user {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 16px 20px;
    }

    .mob-drawer-user-info {
        min-width: 0;
        flex: 1;
    }

    .mob-drawer-user-org {
        font-size: 15px;
        font-weight: 700;
        color: var(--text);
        line-height: 1.3;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mob-drawer-user-email {
        font-size: 12px;
        color: var(--text-muted);
        line-height: 1.3;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .topbar-mob-account {
        display: flex;
        flex-direction: column;
        gap: 4px;
        padding: 8px 16px 16px;
    }

    /* ===== Bottom navigation bar ===== */
    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 200;
        background: rgba(255, 255, 255, 0.97);
        backdrop-filter: blur(12px);
        border-top: 1px solid var(--border);
        padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
    }

    .bottom-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 3px;
        padding: 6px 4px;
        text-decoration: none;
        color: var(--text-muted);
        font-size: 11px;
        font-weight: 600;
        border-radius: var(--radius-sm);
        line-height: 1;
        transition: all var(--transition-fast);
        -webkit-tap-highlight-color: transparent;
    }

    /* Ikony jsou nerdfont glyfy (Icon::nf), ne <svg> jako ve wopro.cz/acc/ -
       bez vlastního font-size by zdědily 11px z .bottom-nav-item labelu. */
    .bottom-nav-item .nf {
        font-size: 19px;
    }

    .bottom-nav-item.active {
        color: var(--primary);
    }

    .bottom-nav-item.active svg {
        color: var(--primary);
    }

    .bottom-nav-item:active {
        background: var(--primary-light);
    }

    .bottom-nav-label {
        line-height: 1;
    }
}

.bottom-nav-vice {
    border: none;
    background: none;
    font-family: inherit;
    cursor: pointer;
}

@media (max-width: 640px) {
    .topbar-credit {
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* ========== Přepínač organizací v účtu (levý panel) ========== */
.sidebar-manager {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 6px;
    border-radius: var(--radius-sm);
    background: var(--bg);
    min-width: 0;
}

.sidebar-manager-foto {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 13px;
    font-weight: 800;
}

.sidebar-manager-foto img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sidebar-manager-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.sidebar-manager-jmeno {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-manager-tel {
    font-size: 11.5px;
    color: var(--text-muted);
    text-decoration: none;
    white-space: nowrap;
}

.sidebar-manager-tel:hover {
    color: var(--primary);
}

.sidebar-collapsed .sidebar-manager {
    justify-content: center;
    padding: 8px 0;
    background: none;
}

.sidebar-collapsed .sidebar-manager-text {
    display: none;
}

/* ==========================================================================
   Horní lišta: obsah doprava (od 2026-09-10)
   ========================================================================== */
.topbar-right {
    margin-left: auto;
}

.topbar-credit {
    gap: 5px;
    padding: 8px 14px;
}

.topbar-credit-hodnota {
    font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Levý panel: skládací sekce (od 2026-09-10)
   ========================================================================== */

.sidebar-group + .sidebar-group {
    margin-top: 4px;
}

.sidebar-group-hlava {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--text);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--transition-fast);
}

.sidebar-group-hlava:hover {
    background: var(--bg);
}

.sidebar-group.ma-aktivni .sidebar-group-hlava {
    color: var(--primary);
}

.sidebar-group.ma-aktivni .sidebar-group-hlava .sidebar-link-icon {
    color: var(--primary);
}

.sidebar-group-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    text-transform: none;
    letter-spacing: 0;
    font-size: 13.5px;
    color: inherit;
    padding: 0;
}

.sidebar-group-sipka {
    display: flex;
    flex-shrink: 0;
    color: var(--text-muted);
    transition: transform var(--transition-fast);
}

.sidebar-group.je-otevrena .sidebar-group-sipka {
    transform: rotate(180deg);
}

.sidebar-group-obsah {
    padding-left: 14px;
    margin-left: 20px;
    border-left: 1px solid var(--border);
}

.sidebar-group:not([data-sekce]) .sidebar-group-obsah {
    padding-left: 0;
    margin-left: 0;
    border-left: none;
}

.sidebar-group-obsah .sidebar-link {
    padding: 8px 12px;
    font-size: 13.5px;
    font-weight: 600;
}

.sidebar-collapsed .sidebar-group-hlava {
    display: none;
}

.sidebar-collapsed .sidebar-group-obsah {
    padding-left: 0;
    margin-left: 0;
    border-left: none;
}

.sidebar-collapsed .sidebar-group-obsah[hidden] {
    display: block !important;
}

.sidebar-collapsed .sidebar-group + .sidebar-group {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

/* ==========================================================================
   PATIČKA (components/layout/Footer) - sdílená Home/NotFound/Overview,
   bez Sidebar, proto tu žádný --sidebar-w offset není potřeba.
   ========================================================================== */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 28px 24px;
}

.site-footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.site-footer-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
    font-size: 15px;
}

.site-footer-brand img {
    width: 24px;
    height: 24px;
}

.site-footer-copy {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
}
