/* ============================================================================
   CONSOLIDATED SITE STYLES - Main CSS for TheUIThingApp
   This file consolidates all component-scoped CSS from Razor pages
   ============================================================================ */

/* ============================================================================
   GLOBAL VARIABLES AND BASE STYLES
   ============================================================================ */

/* Variables */
:root {
    /* --- Brand palette (tier 1: the few colors you normally override) ---
       Cosma Group (colori dal logo-cosmagroup.svg). */
    --primary-color: #005ca9; /* blu Cosma */
    --primary-color-dark: #004a87;
    --secondary-color: #f39200; /* arancio Cosma */
    --success-green: #3dcb6c; /* semantico, non-brand */
    --error-red: #e20b14; /* rosso Cosma */
    --border-color: #ddd;
    --text-primary: #1d1d1b; /* near-black del wordmark */
    --text-secondary: #878787; /* grigio Cosma */
    --input-bg: #fff;
    --shadow-light: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 4px 8px rgba(0, 0, 0, 0.15);
    /* --- Semantic surfaces (tier 2: one knob per area, defaulting to the
           palette above). Override just these to retheme a single area without
           touching the base palette. --- */
    --app-bg: #f5f5f5; /* sfondo generale (pagine auth) */
    --main-bg: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-color-dark) 100%); /* sfondo area app / home */

    --appbar-bg: var(--primary-color); /* barra superiore */
    --appbar-text: #ffffff;
    --sidebar-bg: var(--primary-color); /* sidebar */
    --sidebar-text: #ffffff;
    --sidebar-active-bg: var(--secondary-color);
    --sidebar-active-text: var(--primary-color);
    --surface-bg: #ffffff; /* card / pannelli in prima pagina */
    --title-color: var(--primary-color); /* titoli */
    --title-on-main: #ffffff; /* titoli sopra --main-bg (hero) */

    --text-color: var(--text-primary); /* testi */
    --text-muted: var(--text-secondary);
    --text-on-accent: #ffffff; /* testo sopra superfici colorate (bottoni, badge, header) */

    /* --- Neutrals (tier 2: secondary surfaces, borders, faint text) --- */
    --surface-alt: #f5f5f5; /* pannelli / toolbar attenuati */
    --surface-hover: #f9f9f9; /* hover di righe / elementi di lista */
    --border-muted: #eee; /* bordi e separatori leggeri */
    --placeholder-color: #aaa; /* placeholder degli input */
    --text-faint: #999; /* stati vuoti / disabilitati */
    --overlay-bg: rgba(0, 0, 0, 0.45); /* backdrop di dialog / sidebar mobile */
    --info-color: #2196F3; /* messaggi informativi */
    --shadow-card: 0 4px 12px rgba(0, 0, 0, 0.15); /* elevazione delle card in home */

    /* --- Elevation (ombre aggiuntive, una per ruolo) --- */
    --shadow-appbar: 0 2px 4px rgba(0, 0, 0, 0.2); /* barra superiore */
    --shadow-card-hover: 0 8px 24px rgba(0, 0, 0, 0.2); /* card in hover */
    --shadow-raised: 0 6px 20px rgba(0, 0, 0, 0.2); /* bottone rialzato in hover */
    --shadow-modal: 0 8px 32px rgba(0, 0, 0, 0.2); /* card modali (logout) */
    --shadow-dialog: 0 8px 32px rgba(0, 0, 0, 0.25); /* dialog */
    --shadow-sidebar-btn: 2px 0 6px rgba(0, 0, 0, 0.2); /* pulsante espansione sidebar (lato) */
    --shadow-sidebar-btn-portrait: 0 2px 6px rgba(0, 0, 0, 0.25); /* stesso pulsante in portrait */

    /* --- Misc surfaces / text --- */
    --hover-overlay: rgba(0, 0, 0, 0.04); /* hover neutro (bottoni secondari) */
    --appbar-text-muted: #e8e8e8; /* testo attenuato nella barra (username) */
    --text-label: #555; /* etichette dei form */
    --dialog-text: #212529; /* testo dei dialog */
    --border-on-accent: color-mix(in srgb, var(--text-on-accent) 20%, transparent); /* separatori su superfici colorate */

    /* --- Components --- */
    --btn-neutral-bg: #6c757d; /* bottone secondario (config) */
    --btn-neutral-bg-hover: #5a6268;
    --btn-danger-bg: #dc3545; /* bottone pericolo (config) */
    --btn-danger-bg-hover: #c82333;
    --btn-success-bg-hover: #2fb55d; /* hover del bottone success */
    --chat-user-bg: #e3f2fd; /* bolla chat utente */
    --chat-user-text: #1565c0;
    --spinner-track: #f3f3f3; /* traccia dello spinner */
    --scrollbar-thumb: #888; /* thumb scrollbar chat/allegati */
    --scrollbar-thumb-hover: #555;

    /* --- Assets (override with a url() to swap per tenant) --- */
    --logo: url('/assets/local/images/logo-cosma-white.svg'); /* logo nella barra superiore */
}

/* Global Body Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: var(--app-bg);
}

/* Base link color: themed via variables so links follow the brand palette
       instead of the browser default blue. Only color is set here (not
       text-decoration) so existing components keep their own underline behavior.
       Components with their own color (.nav-link, .app-card, buttons) override it. */
a {
    color: var(--primary-color);
}

    a:hover {
        color: var(--primary-color-dark);
    }

/* Container */
.register-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 2rem 1rem;
}

/* Card */
.register-card {
    background: var(--surface-bg);
    border-radius: 8px;
    box-shadow: var(--shadow-medium);
    padding: 2rem;
    width: 100%;
    max-width: 480px;
    margin-top: 1.5rem;
}

/* Title */
.register-title {
    color: var(--text-primary);
    font-size: 1.75rem;
    font-weight: 500;
    margin: 0 0 0.5rem 0;
}

.register-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0 0 1.5rem 0;
    line-height: 1.5;
}

/* Alerts */
.alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-icon {
    flex-shrink: 0;
}

.alert-error {
    background-color: color-mix(in srgb, var(--error-red) 10%, transparent);
    color: var(--error-red);
    border-left: 3px solid var(--error-red);
}

.alert-success {
    background-color: color-mix(in srgb, var(--success-green) 10%, transparent);
    color: var(--success-green);
    border-left: 3px solid var(--success-green);
}

/* Form */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

/* Input Wrapper */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 12px;
    color: var(--text-secondary);
    pointer-events: none;
}

/* Form Input */
.form-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    color: var(--text-primary);
    background-color: var(--input-bg);
    transition: all 0.2s ease;
    outline: none;
}

    .form-input:focus {
        border-color: var(--primary-color);
        box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary-color) 10%, transparent);
    }

    .form-input::placeholder {
        color: var(--placeholder-color);
    }

    .form-input:invalid:not(:placeholder-shown) {
        border-color: var(--error-red);
    }

/* Validation Message */
.validation-message {
    display: block;
    color: var(--error-red);
    font-size: 0.8rem;
    margin-top: 0.375rem;
    min-height: 1.2rem;
}

/* Button Group */
.button-group {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* Buttons */
.btn {
    flex: 1;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.02857em;
}

    .btn:disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }

.btn-primary {
    background-color: var(--primary-color);
    color: var(--text-on-accent);
    box-shadow: var(--shadow-light);
}

    .btn-primary:hover:not(:disabled) {
        background-color: var(--primary-color-dark);
        box-shadow: var(--shadow-medium);
        transform: translateY(-1px);
    }

    .btn-primary:active:not(:disabled) {
        transform: translateY(0);
    }

.btn-secondary {
    background-color: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

    .btn-secondary:hover:not(:disabled) {
        background-color: var(--hover-overlay);
        border-color: var(--text-secondary);
    }

/* Responsive */
@@media (max-width: 768px) {
    .register-container {
        padding: 1rem 0.75rem;
    }

    .register-card {
        padding: 1.5rem;
        margin-top: 1rem;
    }

    .register-title {
        font-size: 1.5rem;
    }

    .button-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}

@@media (max-width: 480px) {
    .register-card {
        padding: 1.25rem;
    }

    .register-title {
        font-size: 1.35rem;
    }

    .form-input {
        font-size: 0.95rem;
        padding: 0.625rem 0.875rem 0.625rem 2.5rem;
    }

    .input-icon {
        left: 10px;
        width: 18px;
        height: 18px;
    }
}



/* Layout-specific styles - scoped to MainLayout */
.app-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-bar {
    background-color: var(--appbar-bg);
    color: var(--appbar-text);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    gap: 1rem;
    box-shadow: var(--shadow-appbar);
    height: 64px;
    flex-shrink: 0;
    z-index: 1100;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--appbar-text);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

    .icon-btn:hover {
        background-color: color-mix(in srgb, var(--secondary-color) 20%, transparent); /* Secondary color transparent */
    }

    .icon-btn:active {
        background-color: color-mix(in srgb, var(--secondary-color) 30%, transparent);
    }

.app-logo {
    /* content overrides the <img> src so the logo is driven by the --logo
       variable; the element's own src/alt stay as fallback and accessibility. */
    content: var(--logo);
    height: 28px;
    width: auto;
    margin: 0 0.5rem;
}

.app-title {
    font-size: 1.25rem;
    font-weight: 500;
    margin-left: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--appbar-text);
}

.user-name {
    font-size: 0.8rem;
    color: var(--appbar-text-muted);
    padding: 0.3rem 0.75rem;
    background: color-mix(in srgb, var(--secondary-color) 15%, transparent);
    border-radius: 20px;
}

.spacer {
    flex: 1;
}

.main-content-full {
    flex: 1;
    background: var(--main-bg);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

@media (max-width: 600px) {
    .app-bar {
        padding: 0 0.5rem;
    }

    .app-title {
        font-size: 0.9rem;
    }

    .user-name {
        display: none;
    }
}

/* ============================================================================
   HOME PAGE STYLES
   ============================================================================ */

/* Home page styles */
.home-container {
    min-height: 100%;
    padding: 2rem 1rem;
    width: 100%;
}

.home-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    width: 100%;
}

/* Home Tabs */
.home-tabs {
    display: flex;
    gap: 0.5rem;
    margin: 2rem 0 1.5rem 0;
    background: var(--surface-bg);
    border-radius: 12px;
    padding: 0.5rem;
    box-shadow: var(--shadow-card);
}

.home-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

    .home-tab:hover {
        background: color-mix(in srgb, var(--primary-color) 10%, transparent);
        color: var(--primary-color);
    }

    .home-tab.active {
        background: var(--primary-color);
        color: var(--text-on-accent);
    }

    .home-tab .tab-icon {
        flex-shrink: 0;
    }

/* Apps Grid */
.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.app-card {
    background: var(--surface-bg);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

    .app-card::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 4px;
        background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
        transform: scaleX(0);
        transition: transform 0.3s ease;
    }

    .app-card:hover {
        transform: translateY(-4px);
        box-shadow: var(--shadow-card-hover);
    }

        .app-card:hover::before {
            transform: scaleX(1);
        }

.app-card-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-color-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-on-accent);
    transition: all 0.3s ease;
}

.app-card:hover .app-card-icon {
    background: var(--secondary-color);
    color: var(--primary-color);
    transform: scale(1.1);
}

.app-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--title-color);
    margin: 0;
}

.app-card-description {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
}

.app-card-arrow {
    margin-top: auto;
    color: var(--primary-color);
    transition: transform 0.3s ease;
}

.app-card:hover .app-card-arrow {
    transform: translateX(8px);
}

/* Home Actions */
.home-actions {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}

.btn-home-action {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 2rem;
    background: var(--surface-bg);
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    color: var(--primary-color);
    font-size: 1.1rem;
    font-weight: 600;
    text-decoration: none;
    box-shadow: var(--shadow-card);
    transition: all 0.3s ease;
}

    .btn-home-action:hover {
        background: var(--primary-color);
        color: var(--text-on-accent);
        transform: translateY(-2px);
        box-shadow: var(--shadow-raised);
    }

    .btn-home-action .arrow-icon {
        transition: transform 0.3s ease;
    }

    .btn-home-action:hover .arrow-icon {
        transform: translateX(4px);
    }

.btn-login {
    background: var(--primary-color);
    color: var(--text-on-accent);
    border-color: var(--primary-color);
}

    .btn-login:hover {
        background: var(--secondary-color);
        color: var(--primary-color);
        border-color: var(--secondary-color);
    }

/* Welcome Card */
.welcome-card {
    text-align: center;
    padding: 3rem 2rem;
}

.welcome-title {
    font-size: 1.75rem;
    font-weight: 500;
    color: var(--title-color);
    margin: 0 0 1.5rem 0;
}

.welcome-card .intro-text {
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.welcome-card .home-actions {
    margin-top: 2rem;
}

/* ============================================================================
   CONFIG PAGE STYLES
   ============================================================================ */

/* Config page with navigation sidebar */
.config-page-with-nav {
    display: flex;
    height: 100%;
    gap: 1rem;
    padding: 1rem;
}

.config-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    border-radius: 8px;
    box-shadow: var(--shadow-medium);
    overflow-y: auto;
}

.config-main-content {
    flex: 1;
    overflow-y: auto;
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1rem 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
    cursor: pointer;
    font-size: 0.95rem;
}

    .nav-link:hover {
        background-color: color-mix(in srgb, var(--secondary-color) 20%, transparent);
    }

    .nav-link.active {
        background-color: var(--sidebar-active-bg) !important;
        color: var(--sidebar-active-text) !important;
        font-weight: 600;
    }

        .nav-link.active .nav-icon {
            color: var(--sidebar-active-text) !important;
        }

.nav-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    color: currentColor;
}

.nav-divider {
    height: 1px;
    background-color: color-mix(in srgb, var(--sidebar-text) 12%, transparent);
    margin: 0.5rem 0;
}

/* Config editor page styles */
.config-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--surface-bg);
    border-radius: 8px;
    box-shadow: var(--shadow-medium);
    overflow: hidden;
}

.config-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 2rem 1rem 2rem;
    background-color: var(--surface-alt);
    border-bottom: 1px solid var(--border-color);
}

.config-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--title-color);
}

.config-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background-color: var(--surface-alt);
    border-bottom: 1px solid var(--border-color);
}

.monaco-host {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.message {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.9rem;
}

.message-icon {
    flex-shrink: 0;
}

.message-info {
    background-color: color-mix(in srgb, var(--info-color) 10%, transparent);
    color: var(--info-color);
    border: 1px solid color-mix(in srgb, var(--info-color) 30%, transparent);
}

.message-success {
    background-color: color-mix(in srgb, var(--success-green) 10%, transparent);
    color: var(--success-green);
    border-left: 3px solid var(--success-green);
}

.message-error {
    background-color: color-mix(in srgb, var(--error-red) 10%, transparent);
    color: var(--error-red);
    border: 1px solid color-mix(in srgb, var(--error-red) 30%, transparent);
}

/* Tabs */
.config-tabs {
    display: flex;
    gap: 0.25rem;
    padding: 0 2rem;
    background-color: var(--surface-alt);
    border-bottom: 2px solid var(--border-color);
}

.config-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s;
}

    .config-tab:hover {
        background-color: color-mix(in srgb, var(--primary-color) 5%, transparent);
        color: var(--primary-color);
    }

    .config-tab.active {
        color: var(--primary-color);
        border-bottom-color: var(--primary-color);
        background-color: var(--surface-bg);
    }

.tab-icon {
    flex-shrink: 0;
}

/* Content area */
.config-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.apps-editor-container {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

.editor-section {
    max-width: 1200px;
    margin: 0 auto;
}

.section-title {
    margin: 0 0 1.5rem 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--title-color);
}

.app-card {
    background: var(--surface-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.app-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: var(--surface-alt);
    border-bottom: 1px solid var(--border-color);
}

.app-name-input {
    flex: 1;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
}

.app-card-body {
    padding: 1.5rem;
}

.form-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

    .form-row label {
        min-width: 140px;
        font-weight: 500;
        color: var(--text-label);
    }

.form-input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

    .form-input:focus {
        outline: none;
        border-color: var(--primary-color);
        box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary-color) 10%, transparent);
    }

.reports-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-muted);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

    .section-header h5 {
        margin: 0;
        font-size: 1rem;
        font-weight: 600;
        color: var(--text-primary);
    }

.reports-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.report-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--surface-alt);
    border: 1px solid var(--border-muted);
    border-radius: 4px;
}

.report-name-input {
    flex: 2;
}

.report-id-input {
    flex: 3;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.85rem;
}

.btn-block {
    width: 100%;
    justify-content: center;
    margin-top: 1rem;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.btn-secondary {
    background-color: var(--btn-neutral-bg);
    color: var(--text-on-accent);
}

    .btn-secondary:hover {
        background-color: var(--btn-neutral-bg-hover);
    }

.btn-danger {
    background-color: var(--btn-danger-bg);
    color: var(--text-on-accent);
}

    .btn-danger:hover {
        background-color: var(--btn-danger-bg-hover);
    }

.access-matrix-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 1.5rem;
}

.matrix-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--surface-alt);
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.new-user-form {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

    .new-user-form .form-input {
        min-width: 250px;
    }

.yaml-editor-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.matrix-scroll {
    flex: 1;
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.access-matrix {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface-bg);
}

    .access-matrix thead {
        position: sticky;
        top: 0;
        z-index: 10;
        background: var(--primary-color);
        color: var(--text-on-accent);
    }

    .access-matrix th {
        padding: 1rem;
        text-align: left;
        font-weight: 600;
        border-bottom: 2px solid var(--primary-color-dark);
    }

        .access-matrix th.row-header {
            min-width: 200px;
            position: sticky;
            left: 0;
            background: var(--primary-color);
            z-index: 11;
        }

        .access-matrix th.app-column {
            min-width: 140px;
            text-align: center;
            border-left: 1px solid var(--border-on-accent);
        }

        .access-matrix th.action-column {
            width: 100px;
            text-align: center;
            border-left: 1px solid var(--border-on-accent);
        }

    .access-matrix tbody tr {
        transition: background-color 0.15s;
    }

        .access-matrix tbody tr:hover {
            background-color: var(--surface-hover);
        }

    .access-matrix td {
        padding: 0.75rem 1rem;
        border-bottom: 1px solid var(--border-muted);
    }

.user-row {
    background-color: var(--surface-bg);
}

.user-name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: sticky;
    left: 0;
    background: var(--surface-bg);
    z-index: 5;
    font-weight: 500;
    color: var(--text-primary);
}

.user-row:hover .user-name {
    background-color: var(--surface-hover);
}

.row-icon {
    flex-shrink: 0;
    opacity: 0.7;
}

.access-cell {
    text-align: center;
    border-left: 1px solid var(--border-muted);
}

    .access-cell input[type="checkbox"] {
        width: 18px;
        height: 18px;
        cursor: pointer;
        accent-color: var(--primary-color);
    }

.action-cell {
    text-align: center;
    border-left: 1px solid var(--border-muted);
}

.loading, .no-data {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-faint);
    font-size: 1.1rem;
}

/* Button styles */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 500;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon {
    flex-shrink: 0;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--text-on-accent);
}

    .btn-primary:hover {
        background-color: var(--primary-color-dark);
    }

.btn-success {
    background-color: var(--success-green);
    color: var(--text-on-accent);
}

    .btn-success:hover {
        background-color: var(--btn-success-bg-hover);
    }

.btn:active {
    transform: translateY(1px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================================================
   REPORTS PAGE STYLES
   ============================================================================ */


/* ===== Generic Tabs System (for Reports page) ===== */
.tabs {
    position: relative;
    width: 100%;
    background: var(--surface-bg);
    border-radius: 8px;
    box-shadow: var(--shadow-medium);
    overflow: hidden;
}

.tabs-header {
    display: flex;
    gap: 0;
    position: relative;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) transparent;
}

    .tabs-header::-webkit-scrollbar {
        height: 4px;
    }

    .tabs-header::-webkit-scrollbar-thumb {
        background: var(--primary-color);
        border-radius: 2px;
    }

.tab {
    flex: 1;
    min-width: 120px;
    padding: 1rem 1.5rem;
    border: none;
    background: var(--surface-bg);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    position: relative;
    text-align: center;
}

    .tab:hover {
        color: var(--primary-color);
        background: color-mix(in srgb, var(--primary-color) 5%, transparent);
    }

    .tab.active {
        background: var(--secondary-color);
        color: var(--primary-color);
        font-weight: 600;
    }

.tab-slider {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 4px;
    background: var(--secondary-color);
    transition: transform 0.3s ease;
    width: calc(100% / var(--tab-count, 1));
}

/* Reports page styles - unified report + chat view with sidebar navigation */

.reports-page-with-nav {
    display: flex;
    height: 100%;
    gap: 1rem;
    padding: 1rem;
}

/* ---- Sidebar Navigation ---- */

.reports-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    border-radius: 8px;
    box-shadow: var(--shadow-medium);
    overflow: hidden;
    position: relative;
    transition: width 0.25s ease;
    /* Firefox scrollbar */
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--secondary-color) 35%, transparent) transparent;
}

    .reports-sidebar.toggled {
        width: 0;
        min-width: 0;
        padding: 0;
    }

    .reports-sidebar::-webkit-scrollbar {
        width: 4px;
    }

    .reports-sidebar::-webkit-scrollbar-track {
        background: transparent;
    }

    .reports-sidebar::-webkit-scrollbar-thumb {
        background: color-mix(in srgb, var(--secondary-color) 35%, transparent);
        border-radius: 4px;
    }

        .reports-sidebar::-webkit-scrollbar-thumb:hover {
            background: color-mix(in srgb, var(--secondary-color) 65%, transparent);
        }

.sidebar-expand-btn {
    position: fixed;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    z-index: 100;
    background: var(--sidebar-bg);
    border: none;
    border-radius: 0 6px 6px 0;
    width: 18px;
    height: 48px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--sidebar-text);
    box-shadow: var(--shadow-sidebar-btn);
    transition: left 0.25s ease;
}

    .sidebar-expand-btn:hover {
        background: var(--primary-color-dark);
    }

/* Desktop: sidebar is open by default, so the expand button only appears once toggled (collapsed) */
.reports-page-with-nav:has(.reports-sidebar.toggled) .sidebar-expand-btn {
    display: flex;
}

.sidebar-collapse-btn {
    align-self: flex-end;
    background: transparent;
    border: none;
    color: color-mix(in srgb, var(--sidebar-text) 70%, transparent);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.25rem;
    flex-shrink: 0;
}

    .sidebar-collapse-btn:hover {
        color: var(--sidebar-text);
        background: color-mix(in srgb, var(--secondary-color) 20%, transparent);
    }

.sidebar-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 2.5rem 0.5rem 1rem;
    transition: opacity 0.2s ease;
    overflow-y: auto;
    height: 100%;
    box-sizing: border-box;
}

/* .nav-link (+ :hover/.active), .nav-icon and .nav-divider are shared with the
   config sidebar and defined once in the CONFIG PAGE STYLES section above. Only
   the reports-specific rules live here. */
.nav-link-child {
    padding-left: 3rem;
    font-size: 0.9rem;
}

.nav-group {
    display: flex;
    flex-direction: column;
}

.nav-group-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    color: var(--sidebar-text);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    text-align: left;
}

    .nav-group-header:hover {
        background-color: color-mix(in srgb, var(--secondary-color) 20%, transparent);
    }

.nav-group-title {
    flex: 1;
}

.expand-icon {
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.nav-group.expanded .expand-icon {
    transform: rotate(180deg);
}

.nav-group-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.nav-group.expanded .nav-group-content {
    max-height: 1000px;
    margin-top: 0.25rem;
}

/* ---- Main Content Area ---- */

.reports-main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 0;
}

.reports-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 0.5rem;
}

/* ---- Report accordion list inside sidebar ---- */

.report-nav-list {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    margin: 0.15rem 0 0.25rem 0;
}

.report-nav-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.35rem 0.75rem 0.35rem 3.5rem;
    color: color-mix(in srgb, var(--sidebar-text) 75%, transparent);
    background: color-mix(in srgb, var(--secondary-color) 6%, transparent);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.80rem;
    width: 100%;
    box-sizing: border-box;
    transition: background-color 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-user-select: none;
    user-select: none;
}

    .report-nav-item * {
        cursor: pointer;
        color: inherit;
    }

    .report-nav-item:hover {
        background-color: color-mix(in srgb, var(--secondary-color) 18%, transparent);
        color: var(--sidebar-text);
    }

    .report-nav-item.active {
        background-color: color-mix(in srgb, var(--secondary-color) 40%, transparent);
        color: var(--sidebar-text);
        font-weight: 600;
    }

        .report-nav-item.active * {
            color: var(--sidebar-text);
        }

/* ---- Action bar (mode toggle + clear, replaces tab-toolbar) ---- */

.action-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    min-height: 44px;
}

/* ---- Tab toolbar (tabs + mode toggle) ---- */

.tab-toolbar {
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
    flex-shrink: 0;
}

    .tab-toolbar .tabs {
        flex: 1;
        min-width: 0;
    }

.mode-toggle-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 1.25rem;
    background: var(--surface-bg);
    border: none;
    border-radius: 8px;
    box-shadow: var(--shadow-medium);
    color: var(--primary-color);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

    .mode-toggle-btn:hover {
        background: var(--primary-color);
        color: var(--text-on-accent);
    }

    .mode-toggle-btn.active {
        background: var(--secondary-color);
        color: var(--primary-color);
        font-weight: 600;
    }

.clear-chat-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 1.25rem;
    background: var(--surface-bg);
    border: none;
    border-radius: 8px;
    box-shadow: var(--shadow-medium);
    color: var(--error-red);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

    .clear-chat-btn:hover:not(:disabled) {
        background: var(--error-red);
        color: var(--text-on-accent);
    }

    .clear-chat-btn:disabled {
        opacity: 0.4;
        cursor: not-allowed;
    }

/* ---- Visibility helpers ---- */

.d-none {
    display: none !important;
}

/* ---- Report view ---- */

.report-view {
    flex: 1;
    overflow: hidden;
    background: var(--surface-bg);
    border-radius: 8px;
    box-shadow: var(--shadow-medium);
}

/* ---- Chat view ---- */

.chat-view {
    flex: 1;
    overflow: hidden;
}

.chat-grid {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 1rem;
    height: 100%;
    overflow: hidden;
}

/* Chat Panel */
.chat-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    gap: 1rem;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    background: var(--surface-alt);
    border-radius: 8px;
    box-shadow: var(--shadow-light);
}

.messages-paper {
    background: var(--surface-bg);
    padding: 1rem;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Chat Messages */
.chat-message {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 70%;
}

    .chat-message.user {
        align-self: flex-start;
    }

    .chat-message.ai {
        align-self: flex-end;
    }

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 0 0.5rem;
}

.chat-author {
    font-weight: 600;
}

.chat-time {
    font-size: 0.75rem;
    opacity: 0.7;
}

.chat-bubble {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    word-wrap: break-word;
    line-height: 1.5;
}

.chat-message.user .chat-bubble {
    background-color: var(--chat-user-bg);
    color: var(--chat-user-text);
    border-bottom-left-radius: 4px;
}

.chat-message.ai .chat-bubble {
    background-color: var(--surface-alt);
    color: var(--text-primary);
    border-bottom-right-radius: 4px;
}

/* Input */
.input-bubble {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--surface-bg);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    flex: 1;
}

.chat-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1rem;
    padding: 0.5rem;
    background: transparent;
}

    .chat-input::placeholder {
        color: var(--placeholder-color);
    }

.send-btn {
    background: var(--primary-color);
    color: var(--text-on-accent);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

    .send-btn:hover:not(:disabled) {
        background: var(--primary-color-dark);
        transform: scale(1.05);
    }

    .send-btn:disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }

/* Loading Spinner */
.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--spinner-track);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Attachments Panel */
.attachments-panel {
    background: var(--surface-bg);
    border-radius: 8px;
    box-shadow: var(--shadow-light);
    padding: 1rem;
    overflow-y: auto;
}

.attachment-item {
    padding: 0.75rem;
    background: var(--surface-alt);
    border-radius: 6px;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: background 0.2s;
}

    .attachment-item:hover {
        background: var(--surface-hover);
    }

.attachment-icon {
    color: var(--primary-color);
    flex-shrink: 0;
}

.attachment-name {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Scrollbar */
.messages-container::-webkit-scrollbar,
.attachments-panel::-webkit-scrollbar {
    width: 8px;
}

.messages-container::-webkit-scrollbar-track,
.attachments-panel::-webkit-scrollbar-track {
    background: var(--surface-hover);
    border-radius: 10px;
}

.messages-container::-webkit-scrollbar-thumb,
.attachments-panel::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 10px;
}

    .messages-container::-webkit-scrollbar-thumb:hover,
    .attachments-panel::-webkit-scrollbar-thumb:hover {
        background: var(--scrollbar-thumb-hover);
    }

/* Responsive */
@media (max-width: 768px) {
    .chat-grid {
        grid-template-columns: 1fr;
    }

    .attachments-panel {
        display: none;
    }

    .chat-message {
        max-width: 85%;
    }

    .messages-container {
        height: calc(100vh - 200px);
    }

    .mode-toggle-btn span {
        display: none;
    }

    /* Mobile sidebar: overlay, closed by default (opposite of the desktop default) */
    .reports-page-with-nav {
        padding: 0.5rem;
    }

    .reports-sidebar {
        position: fixed;
        top: 64px;
        left: 0;
        bottom: 0;
        z-index: 200;
        border-radius: 0 8px 8px 0;
        width: 0;
    }

        .reports-sidebar.toggled {
            width: 260px;
        }

    .sidebar-expand-btn {
        display: flex;
        top: calc(64px + 50%);
        transform: translateY(-50%);
    }

    .reports-page-with-nav:has(.reports-sidebar.toggled) .sidebar-expand-btn {
        display: none;
    }

    .sidebar-backdrop.visible {
        display: block;
    }
}

/* Touch device: sidebar overlay, closed by default (più affidabile di max-width per rilevare mobile) */
@media (pointer: coarse) {
    .reports-page-with-nav {
        padding: 0.5rem;
    }

    .reports-sidebar {
        position: fixed;
        top: 64px;
        left: 0;
        bottom: 0;
        z-index: 200;
        border-radius: 0 8px 8px 0;
        width: 0;
    }

        .reports-sidebar.toggled {
            width: 260px;
        }

    .sidebar-expand-btn {
        display: flex;
        top: calc(64px + 50%);
        transform: translateY(-50%);
    }

    .reports-page-with-nav:has(.reports-sidebar.toggled) .sidebar-expand-btn {
        display: none;
    }

    .sidebar-backdrop.visible {
        display: block;
    }
}

/* Portrait on touch devices: sidebar slides down from top instead of from the side, closed by default */
@media (orientation: portrait) and (pointer: coarse) {
    .reports-sidebar {
        top: 64px;
        left: 0;
        right: 0;
        bottom: auto;
        width: 100% !important;
        min-width: 0 !important;
        max-height: 65vh;
        border-radius: 0 0 12px 12px;
        overflow-y: auto;
        transform: translateY(-100%);
        transition: transform 0.3s ease !important;
    }

        .reports-sidebar.toggled {
            width: 100% !important;
            min-width: 0 !important;
            transform: translateY(0);
        }

    .sidebar-expand-btn {
        top: 64px;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        border-radius: 0 0 8px 8px;
        width: 48px;
        height: 20px;
        box-shadow: var(--shadow-sidebar-btn-portrait);
    }
}

/* Backdrop for mobile sidebar. Visibility is scoped to the mobile media queries above,
   so on desktop (.toggled = manually collapsed) no dark overlay ever appears. */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--overlay-bg);
    z-index: 199;
    cursor: pointer; /* required for iOS Safari to fire click/tap events on div */
}

/* ============================================================================
   LOGOUT PAGE STYLES
   ============================================================================ */

/* Logout page styles */
.logout-container {
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.logout-card {
    background: var(--surface-bg);
    border-radius: 16px;
    padding: 3rem;
    box-shadow: var(--shadow-modal);
    max-width: 400px;
    width: 100%;
    text-align: center;
}

.logout-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-color-dark));
    border-radius: 50%;
    color: var(--text-on-accent);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

.logout-title {
    font-size: 1.75rem;
    font-weight: 500;
    color: var(--title-color);
    margin: 0 0 0.75rem 0;
}

.logout-message {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.6;
}

/* ============================================================================
   LOGIN PAGE STYLES
   ============================================================================ */

/* Login page styles */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 64px);
    padding: 2rem 1rem;
}

.login-card {
    background: var(--surface-bg);
    border-radius: 8px;
    box-shadow: var(--shadow-medium);
    padding: 2.5rem;
    width: 100%;
    max-width: 480px;
}

.login-title {
    color: var(--text-primary);
    font-size: 1.75rem;
    font-weight: 500;
    margin: 0 0 0.5rem 0;
    text-align: center;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0 0 2rem 0;
    line-height: 1.5;
    text-align: center;
}

.form-footer {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-align: center;
}

.form-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

    .form-link:hover {
        text-decoration: underline;
    }

.json-panel {
    background-color: var(--surface-alt);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1rem;
    max-height: 400px;
    overflow: auto;
    margin-top: 1rem;
}

    .json-panel pre {
        margin: 0;
        font-family: 'Courier New', monospace;
        font-size: 0.85rem;
        white-space: pre-wrap;
        word-break: break-all;
    }

/* ============================================================================
   REGISTER PAGE STYLES
   ============================================================================ */

/* Register page styles */
.register-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 64px);
    padding: 2rem 1rem;
}

.register-card {
    background: var(--surface-bg);
    border-radius: 8px;
    box-shadow: var(--shadow-medium);
    padding: 2.5rem;
    width: 100%;
    max-width: 480px;
}

.register-title {
    color: var(--text-primary);
    font-size: 1.75rem;
    font-weight: 500;
    margin: 0 0 2rem 0;
    text-align: center;
}

/* ============================================================================
   SELECT REALM PAGE STYLES
   ============================================================================ */

/* Select realm page styles */
.select-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 64px);
    padding: 2rem 1rem;
}

.select-card {
    background: var(--surface-bg);
    border-radius: 8px;
    box-shadow: var(--shadow-medium);
    padding: 2.5rem;
    width: 100%;
    max-width: 600px;
}

.select-title {
    color: var(--text-primary);
    font-size: 1.75rem;
    font-weight: 500;
    margin: 0 0 1rem 0;
    text-align: center;
}

.realm-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.realm-btn {
    width: 100%;
    padding: 1rem 1.5rem;
    background: var(--surface-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

    .realm-btn:hover {
        border-color: var(--primary-color);
        background-color: color-mix(in srgb, var(--primary-color) 5%, transparent);
        transform: translateY(-2px);
        box-shadow: var(--shadow-medium);
    }

/* ============================================================================
   CMS CONTENT BLOCKS STYLES
   ============================================================================ */

/* Hero Section */
.hero-section {
    text-align: center;
    padding: 3rem 2rem;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    margin: 0 auto 2rem auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 100%;
}

.hero-logo {
    max-width: 150px;
    height: auto;
    margin: 0 auto 1.5rem auto;
    display: block;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--title-on-main);
    margin: 0 0 1rem 0;
    line-height: 1.2;
    text-align: center;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--title-on-main);
    margin: 0 0 1.5rem 0;
    line-height: 1.5;
    text-align: center;
}

.hero-divider {
    width: 80px;
    height: 4px;
    background: var(--secondary-color);
    margin: 1rem auto;
    border-radius: 2px;
}


/* Content Card */
.content-card {
    background: var(--surface-bg);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow-card);
    margin-bottom: 2rem;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-muted);
}

.card-icon {
    flex-shrink: 0;
    color: var(--primary-color);
}

.card-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--title-color);
    margin: 0;
    line-height: 1.3;
}

.card-text {
    font-size: 1rem;
    color: var(--text-color);
    line-height: 1.7;
    margin: 0 0 1rem 0;
}

    .card-text:last-child {
        margin-bottom: 0;
    }

.intro-text {
    font-size: 1.1rem;
    color: var(--text-muted);
    line-height: 1.7;
    margin: 0 0 1rem 0;
}

    .intro-text:last-child {
        margin-bottom: 0;
    }

    .intro-text a {
        color: var(--primary-color);
        text-decoration: none;
        font-weight: 500;
        border-bottom: 2px solid transparent;
        transition: border-color 0.2s;
    }

        .intro-text a:hover {
            border-bottom-color: var(--primary-color);
        }
/* Feature List */
.feature-list {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.feature-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.75rem;
    background: color-mix(in srgb, var(--primary-color) 3%, transparent);
    border-radius: 8px;
    transition: all 0.2s ease;
}

    .feature-item:hover {
        background: color-mix(in srgb, var(--primary-color) 8%, transparent);
        transform: translateX(4px);
    }

.check-icon {
    flex-shrink: 0;
    color: var(--success-green);
    margin-top: 0.125rem;
}

.feature-item div {
    flex: 1;
    font-size: 1rem;
    color: var(--text-color);
    line-height: 1.6;
}

.feature-item strong {
    color: var(--primary-color);
    font-weight: 600;
}
/* Responsive adjustments for CMS blocks */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1.1rem;
    }

    .hero-section {
        padding: 2rem 1.5rem;
    }

    .content-card {
        padding: 1.5rem;
    }

    .card-title {
        font-size: 1.25rem;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .feature-item {
        padding: 0.625rem;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 1.75rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .hero-logo {
        max-width: 120px;
    }

    .card-text,
    .intro-text,
    .feature-item div {
        font-size: 0.95rem;
    }
}







/* ===== Config page — Dialog overlay ===== */
.dialog-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay-bg);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dialog-box {
    background: var(--surface-bg);
    border-radius: 8px;
    padding: 24px;
    min-width: 340px;
    max-width: 480px;
    box-shadow: var(--shadow-dialog);
    display: flex;
    flex-direction: column;
    gap: 14px;
    color: var(--dialog-text);
}

.dialog-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dialog-text);
}

.dialog-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 4px;
}

/* role-select inside dialogs */
.user-roles-editor .role-select {
    border: 1px solid var(--primary-color);
    border-radius: 3px;
    padding: 2px 6px;
    font-size: 0.82rem;
    color: var(--primary-color);
    background: var(--surface-alt);
    cursor: pointer;
    max-width: 200px;
}

.user-roles-editor .role-add-row {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}
