/* ============================================================================
 * File:        admin.css
 * Project:     Viadux.OCS.AdminWebsite
 * Purpose:     Core stylesheet for the Viadux OCS Admin Panel providing
 *              layout, component, and responsive design rules for the
 *              dashboard shell, sidebar navigation, data tables, modals,
 *              forms, toast notifications, operational strength charts,
 *              unit configuration views, and role/permission management.
 * Author:      KyotoTech
 * Created:     2025
 * ----------------------------------------------------------------------------
 * Revision History:
 *   Date        Author       Description
 * ----------------------------------------------------------------------------
 * Copyright (c) 2026 Viadux GmbH. All Rights Reserved.
 * ============================================================================ */


/* ============================================================================
 * === CSS Custom Properties (Design Tokens) ===
 * Defines the global color palette, shadow levels, and transition defaults
 * used throughout the application for consistent theming.
 * ============================================================================ */

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-muted: #adb5bd;
    
    --accent-color: #c41e3a;
    --accent-hover: #a01829;
    
    --border-color: #dee2e6;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --info: #17a2b8;
    
    --transition: all 0.2s ease;
}


/* ============================================================================
 * === Global Reset & Base Typography ===
 * ============================================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-secondary);
    overflow: hidden;
}

/* ============================================================================
 * === Title Bar ===
 * Fixed-position top header containing the application logo, title,
 * and logout action. Uses the brand accent color as background.
 * ============================================================================ */

.titlebar-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--accent-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-shadow: var(--shadow-md);
    z-index: 1000;
}

.titlebar-left, .titlebar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.titlebar-logo img {
    width: 30px;
    height: 30px;
    filter: brightness(0) invert(1);
}

.titlebar-title {
    font-size: 18px;
    font-weight: 600;
}


@keyframes pulse-critical {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ============================================================================
 * === Organization Selector ===
 * Header-embedded dropdown for switching the active organization context.
 * Uses semi-transparent backgrounds to integrate with the title bar.
 * ============================================================================ */

.org-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 12px;
    border-radius: 6px;
    transition: var(--transition);
}

.org-selector:hover {
    background: rgba(255, 255, 255, 0.15);
}

.org-selector svg {
    flex-shrink: 0;
}

.org-select {
    background: transparent;
    border: none;
    color: white;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    padding: 0;
    min-width: 180px;
}

.org-select option {
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 8px;
}

/* ============================================================================
 * === Connection Banner ===
 * Warning bar positioned directly below the title bar, indicating
 * degraded or lost server connectivity with an animated status dot.
 * ============================================================================ */

.connection-banner {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    padding: 8px 24px;
    background: var(--warning);
    color: #000;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 999;
}

.connection-banner.hidden {
    display: none;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ============================================================================
 * === Application Layout ===
 * Primary flex layout distributing the sidebar and main content area.
 * Accounts for fixed title bar (56px) and footer (36px) heights.
 * ============================================================================ */

.dashboard-layout {
    display: flex;
    height: 100vh;
    padding-top: 56px;
    padding-bottom: 36px;
}

/* ============================================================================
 * === Sidebar Navigation ===
 * Left-hand navigation panel with view-switching links, active state
 * indicator (left accent border), badge counters, organization selector,
 * and separator dividers between navigation groups.
 * ============================================================================ */

.sidebar {
    width: 250px;
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
}

.sidebar-nav {
    padding: 16px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    position: relative;
}

.nav-item:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--bg-secondary);
    color: var(--accent-color);
    font-weight: 500;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent-color);
}

.nav-item .badge {
    margin-left: auto;
    background: var(--accent-color);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

/* --- Navigation Separator --- */
.nav-separator {
    height: 1px;
    background: var(--border-color);
    margin: 12px 24px;
}

/* --- Organization Group Container --- */
.nav-org-group {
    margin: 4px 12px 4px 12px;
    border-left: 3px solid var(--accent-color);
    border-radius: 0 8px 8px 0;
    background: rgba(196, 30, 58, 0.03);
    padding-bottom: 4px;
}

.nav-org-items .nav-item {
    padding-left: 20px;
    font-size: 13.5px;
}

.nav-org-items .nav-item.active::before {
    display: none;
}

/* --- Sidebar Organization Selector --- */
.nav-org-selector {
    padding: 12px 16px 8px;
}

.nav-org-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.nav-org-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}

.nav-org-select:hover {
    border-color: var(--accent-color);
}

.nav-org-select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(196, 30, 58, 0.1);
}

/* ============================================================================
 * === Main Content Area ===
 * Scrollable primary content region with constrained max-width.
 * ============================================================================ */

.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.content-area {
    max-width: 1400px;
    margin: 0 auto;
}

/* --- Content Header (per-view titles) --- */
.content-header {
    margin-bottom: 24px;
}

.content-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.content-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ============================================================================
 * === Toolbar ===
 * Horizontal action bar above content lists with search and action buttons.
 * ============================================================================ */

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.toolbar-left, .toolbar-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ============================================================================
 * === Search Box ===
 * Input with an inline SVG search icon positioned via absolute placement.
 * ============================================================================ */

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box svg {
    position: absolute;
    left: 10px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-box input {
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    min-width: 250px;
    transition: var(--transition);
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(196, 30, 58, 0.1);
}

/* ============================================================================
 * === Cards ===
 * Auto-fill responsive grid of bordered cards used for entity listings
 * (users, organizations, trainings, etc.) with header, meta, and actions.
 * ============================================================================ */

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 12px;
    gap: 8px;
    flex-wrap: wrap;
}

.card-header > div:first-child {
    flex: 1;
    min-width: 0;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-word;
}

.card-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
    word-break: break-all;
}

.card-actions {
    display: flex;
    gap: 4px;
}

.card-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--bg-tertiary);
}

.card-meta-item {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
}

/* ============================================================================
 * === Data Tables ===
 * Sortable data tables with uppercase header labels and hover highlighting.
 * ============================================================================ */

.table-container {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--bg-secondary);
}

th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s ease;
}

th.sortable:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

td {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
}

tr:hover {
    background: var(--bg-secondary);
}

/* ============================================================================
 * === Buttons ===
 * Shared button styles with primary (accent), secondary, success, danger
 * variants, size modifiers (sm), and icon-only mode.
 * ============================================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

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

.btn-primary {
    background: var(--accent-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--border-color);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #218838;
}

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

.btn-danger:hover:not(:disabled) {
    background: #c82333;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-icon {
    padding: 8px;
}

/* ============================================================================
 * === Status Badges ===
 * Pill-shaped inline labels indicating entity states such as pending,
 * approved, rejected, active, or inactive.
 * ============================================================================ */

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
    white-space: nowrap;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-approved {
    background: #d4edda;
    color: #155724;
}

.status-rejected {
    background: #f8d7da;
    color: #721c24;
}

.status-active {
    background: #d4edda;
    color: #155724;
}

.status-inactive {
    background: #e2e3e5;
    color: #383d41;
}

/* ============================================================================
 * === Modal Dialogs ===
 * Full-viewport overlay modals with header, scrollable body, and footer
 * action bar. Supports standard and wide variants. Includes an alternative
 * modal-overlay pattern used for changelog and whitelist dialogs.
 * ============================================================================ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: 8px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-content.modal-wide {
    max-width: 900px;
}

.modal-content.modal-wide .form-control {
    font-size: 14px;
}

.modal-content.modal-wide textarea.form-control {
    min-height: 120px;
    line-height: 1.5;
}

/* --- Privacy Policy Form - Specialized modal form with monospace textarea --- */
.privacy-form .form-group {
    margin-bottom: 20px;
}

.privacy-form .form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.privacy-form .form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.privacy-form .form-control:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.1);
}

.privacy-form textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.privacy-form .privacy-content-textarea {
    min-height: 280px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
    font-size: 13px;
    line-height: 1.6;
}

/* --- Modal Overlay (alternative pattern for changelog, whitelist, etc.) --- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-overlay .modal {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    bottom: auto;
    background: var(--bg-primary);
    border-radius: 8px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.modal-overlay .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-overlay .modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.modal-overlay .modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    line-height: 1;
}

.modal-overlay .modal-close:hover {
    color: var(--text-primary);
}

.modal-overlay .modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-overlay .modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ============================================================================
 * === Form Controls ===
 * Standard form elements including labels, text inputs, selects, textareas,
 * and help text used in modal dialogs and inline editing.
 * ============================================================================ */

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 13px;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    transition: var(--transition);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(196, 30, 58, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.form-help {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ============================================================================
 * === Toast Notifications ===
 * Fixed-position notification bar at the bottom-right with slide-in
 * animation. Supports success, error, and warning color variants.
 * ============================================================================ */

.toast {
    position: fixed;
    bottom: 48px;
    right: 24px;
    background: var(--text-primary);
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(20px);
    transition: var(--transition);
    pointer-events: none;
    z-index: 3000;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

.toast.warning {
    background: var(--warning);
    color: #000;
}

/* ============================================================================
 * === Loading Spinner ===
 * Centered spinner animation displayed during asynchronous data fetches.
 * ============================================================================ */

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-spinner p {
    margin-top: 16px;
    color: var(--text-secondary);
}

/* ============================================================================
 * === Empty State ===
 * Placeholder UI shown when a data view contains no records.
 * ============================================================================ */

.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state svg {
    width: 64px;
    height: 64px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* ============================================================================
 * === Mobile Navigation Controls ===
 * Hamburger menu button (hidden on desktop) and sidebar overlay backdrop
 * for the mobile slide-in navigation drawer.
 * ============================================================================ */

.mobile-menu-btn {
    display: none;
    background: transparent;
    border: none;
    color: white;
    padding: 8px;
    cursor: pointer;
    border-radius: 6px;
    transition: var(--transition);
}

.mobile-menu-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Mobile Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1500;
}

.sidebar-overlay.active {
    display: block;
}

/* ============================================================================
 * === App Footer ===
 * Fixed bottom bar (36px) displaying the session countdown timer,
 * current user identity, application version, changelog button,
 * and real-time server connection status indicator.
 * ============================================================================ */

.app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 36px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    font-size: 12px;
    color: var(--text-secondary);
    z-index: 1000;
}

.footer-left,
.footer-center,
.footer-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-left {
    flex: 1;
}

.footer-center {
    flex: 1;
    justify-content: center;
}

.footer-right {
    flex: 1;
    justify-content: flex-end;
}

.app-footer .session-timer {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 4px;
    color: var(--text-secondary);
    background: transparent;
    opacity: 1;
}

.app-footer .session-timer svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.app-footer .session-timer .timer-label {
    white-space: nowrap;
}

.app-footer .session-timer .timer-value {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    min-width: 60px;
}

.app-footer .session-timer.warning {
    background: rgba(255, 193, 7, 0.15);
    color: #856404;
}

.app-footer .session-timer.critical {
    background: rgba(220, 53, 69, 0.15);
    color: var(--danger);
    animation: pulse-critical 1s ease-in-out infinite;
}

.footer-info-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 50%;
    transition: var(--transition);
}

.footer-info-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.footer-separator {
    color: var(--border-color);
    font-size: 12px;
}

.footer-version {
    font-size: 11px;
    color: var(--text-muted);
}

.footer-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
}

.footer-status .status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}

.footer-status .status-indicator.connected {
    background: var(--success);
}

.footer-status .status-indicator.disconnected {
    background: var(--danger);
}

/* ============================================================================
 * === Changelog Modal ===
 * Version history dialog with tagged version blocks and bulleted changes.
 * ============================================================================ */

.changelog-modal {
    max-width: 520px !important;
}

.changelog-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.changelog-modal .modal-close {
    margin-left: auto;
}

.changelog-modal .modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: 60vh;
}

.changelog-version-block {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.changelog-version-block:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.changelog-version-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.changelog-version-tag {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-color);
    background: rgba(196, 30, 58, 0.08);
    padding: 2px 8px;
    border-radius: 4px;
}

.changelog-version-date {
    font-size: 11px;
    color: var(--text-muted);
}

.changelog-changes {
    list-style: none;
    padding: 0;
    margin: 0;
}

.changelog-changes li {
    position: relative;
    padding-left: 16px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.changelog-changes li::before {
    content: '•';
    position: absolute;
    left: 4px;
    color: var(--text-muted);
}

/* ============================================================================
 * === Responsive Breakpoints - Core Layout ===
 * ============================================================================ */

/* --- Tablet (max-width: 1024px) --- */
@media (max-width: 1024px) {
    .titlebar-title {
        font-size: 16px;
    }

    .sidebar {
        width: 220px;
    }

    .main-content {
        padding: 16px;
    }

    .cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

/* --- Mobile (max-width: 768px) - Enables hamburger menu, slide-in sidebar,
       stacked toolbar, and horizontal table scrolling --- */
@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
    }

    .titlebar-header {
        padding: 0 12px;
    }

    .titlebar-title {
        font-size: 14px;
    }

    .titlebar-right .btn span {
        display: none;
    }

    .app-footer {
        padding: 0 12px;
        font-size: 11px;
    }

    .app-footer .session-timer .timer-label {
        display: none;
    }

    .footer-center {
        display: none;
    }

    .sidebar {
        position: fixed;
        top: 56px;
        left: 0;
        bottom: 0;
        width: 280px;
        z-index: 1600;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        display: flex;
        flex-direction: column;
    }

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

    .sidebar-nav {
        flex: 1;
        overflow-y: auto;
    }

    .main-content {
        padding: 12px;
    }

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

    .toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .toolbar-left, .toolbar-right {
        flex-direction: column;
        width: 100%;
    }

    .toolbar-left .btn,
    .toolbar-right .btn {
        width: 100%;
        justify-content: center;
    }

    .search-box {
        width: 100%;
    }

    .search-box input {
        width: 100%;
        min-width: unset;
    }

    .content-title {
        font-size: 20px;
    }

    /* Table responsive */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 600px;
    }

    /* Modal responsive */
    .modal {
        padding: 10px;
    }

    .modal-content {
        max-height: 95vh;
    }

    .modal-header {
        padding: 16px;
    }

    .modal-body {
        padding: 16px;
    }

    .modal-footer {
        padding: 12px 16px;
        flex-wrap: wrap;
    }

    .modal-footer .btn {
        flex: 1;
        min-width: 100px;
    }

    /* Card responsive */
    .card {
        padding: 16px;
    }

    .card-actions {
        flex-wrap: wrap;
    }

    /* Toast responsive */
    .toast {
        left: 12px;
        right: 12px;
        bottom: 48px;
    }
}

/* --- Small Mobile (max-width: 480px) - Reduced title bar height,
       full-width sidebar, and compact table cells --- */
@media (max-width: 480px) {
    .titlebar-header {
        height: 50px;
    }

    .dashboard-layout {
        padding-top: 50px;
    }

    .sidebar {
        top: 50px;
        width: 100%;
    }

    .content-title {
        font-size: 18px;
    }

    .btn-sm {
        padding: 8px 10px;
        font-size: 11px;
    }

    th, td {
        padding: 10px 12px;
        font-size: 12px;
    }
}


/* ============================================================================
 * === Utility Classes ===
 * General-purpose helper classes for visibility, alignment, and spacing.
 * ============================================================================ */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }

/* ============================================================================
 * === Dashboard Styles ===
 * Styles for the operational strength dashboard view including header,
 * strength circles per class, toggle controls, connection status badge,
 * and stale-data warning banner.
 * ============================================================================ */

.dashboard-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 100%;
}

/* --- Dashboard Header --- */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

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

.dashboard-title h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

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

/* --- Toggle Control (test-dummy visibility checkbox) --- */
.toggle-control {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    user-select: none;
}

.toggle-control input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-color);
    cursor: pointer;
}

.toggle-label {
    color: var(--text-secondary);
}

/* --- Connection Status Badge (within dashboard header) --- */
.connection-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    padding: 4px 10px;
    background: var(--bg-secondary);
    border-radius: 12px;
}

.connection-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: none;
}

.connection-status .status-dot.connected {
    background: var(--success);
}

.connection-status .status-dot.disconnected {
    background: var(--danger);
}

.connection-status .status-dot.connecting {
    background: var(--warning);
    animation: pulse 1s ease-in-out infinite;
}

.connection-status .status-text {
    color: var(--text-secondary);
}

/* --- Strength Circles - Color-coded circular indicators per personnel class --- */
.strength-circles {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    flex-wrap: wrap;
}

.strength-circle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 3px solid;
}

.strength-circle.hd {
    border-color: #f97316;
    background: rgba(249, 115, 22, 0.1);
}

.strength-circle.gd {
    border-color: #6b7280;
    background: rgba(107, 114, 128, 0.1);
}

.strength-circle.md {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

.strength-circle.total {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
}

/* Fallback colors for dynamically generated class circles beyond the three defaults */
.strength-circle.class-1 {
    border-color: #9b59b6;
    background: rgba(155, 89, 182, 0.1);
}

.strength-circle.class-2 {
    border-color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
}

.strength-circle.class-3 {
    border-color: #1abc9c;
    background: rgba(26, 188, 156, 0.1);
}

.circle-value {
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
}

.circle-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.strength-info {
    margin-left: auto;
    display: flex;
    align-items: baseline;
    gap: 4px;
    font-size: 13px;
    color: var(--text-secondary);
}

.strength-info .info-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

/* --- Stale Data Warning Banner --- */
.stale-warning {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    font-size: 13px;
    color: #856404;
}

.stale-warning svg {
    flex-shrink: 0;
}

.stale-warning.hidden {
    display: none;
}

/* ============================================================================
 * === Dashboard Chart - MAUI App Style Layout ===
 * Horizontally scrollable availability chart with a sticky Y-axis,
 * grid lines, SVG line/area series, vertical time marker, X-axis labels,
 * and synchronized timeline rows for unit formation indicators.
 * ============================================================================ */

/* Main Wrapper - Flex container for Y-Axis + Scrollable Content */
.dashboard-chart-wrapper {
    display: flex;
    background: #e8e8e8;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

/* Y-Axis - Sticky Left */
.chart-y-axis {
    width: 35px;
    flex-shrink: 0;
    background: #e8e8e8;
    z-index: 10;
}

.y-axis-labels {
    height: 205px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 10px 0;
}

.y-label {
    text-align: right;
    padding-right: 10px;
    font-size: 11px;
    font-weight: 500;
    color: #333;
}

/* Scrollable Chart Container */
.chart-scroll-container {
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    -ms-overflow-style: -ms-autohiding-scrollbar; /* IE/Edge */
    scroll-behavior: smooth;
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: #888 #c8c8c8; /* Firefox */
}

/* Custom scrollbar styling for Webkit browsers (Chrome, Safari, Edge) */
.chart-scroll-container::-webkit-scrollbar {
    height: 5px;
}

.chart-scroll-container::-webkit-scrollbar-track {
    background: #c8c8c8;
    border-radius: 3px;
}

.chart-scroll-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.chart-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* Chart Content - Contains Chart + Timelines */
.chart-content {
    position: relative;
    min-width: 600px;
}

/* Chart Main Area */
.chart-main-area {
    height: 250px;
    position: relative;
    background: #e8e8e8;
}

/* Grid Lines */
.chart-grid-lines {
    position: absolute;
    left: 0;
    right: 0;
    top: 10px;
    bottom: 35px;
    pointer-events: none;
}

.chart-grid-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background: #c8c8c8;
}

/* Chart SVG */
.chart-svg {
    position: absolute;
    left: 0;
    right: 0;
    top: 10px;
    bottom: 35px;
    width: 100%;
    height: auto;
}

/* Vertical Marker Line */
.chart-vertical-marker {
    position: absolute;
    top: 10px;
    bottom: 35px;
    width: 2px;
    background: #2a2a2a;
    pointer-events: none;
    z-index: 5;
}

/* X-Axis */
.chart-x-axis {
    position: absolute;
    bottom: 5px;
    left: 0;
    right: 0;
    height: 30px;
}

.x-label {
    position: absolute;
    font-size: 11px;
    font-weight: 500;
    color: #333;
    transform: translateX(-50%);
}

.x-label.zero {
    transform: none;
    left: 0 !important;
    padding-left: 4px;
}

.x-label::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 6px;
    background: #666;
}

/* ============================================================================
 * === Timelines - MAUI App Style ===
 * Horizontal timeline rows below the chart showing unit formation status
 * icons (special units and tactical units) with SVG bar backgrounds.
 * ============================================================================ */

.timelines-container {
    height: 90px;
    margin-top: 10px;
    margin-bottom: 15px;
    position: relative;
}

.timeline-row {
    height: 40px;
    position: relative;
}

.timeline-row:first-child {
    margin-bottom: 8px;
}

.timeline-svg {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    overflow: visible;
}

.timeline-icons {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
}

/* --- Timeline Icon - Absolutely positioned unit formation indicator --- */
.timeline-icon {
    position: absolute;
    top: 2px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateX(-50%);
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 5;
}

.timeline-icon:hover {
    z-index: 10;
    transform: translateX(-50%) scale(1.1);
}

.timeline-icon img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.timeline-icon .icon-abbr {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: 700;
    color: #fff;
    background: #00315B;
    border-radius: 4px;
}

.timeline-icon.can-form .icon-abbr {
    background: #7cb342;
}

.timeline-icon.cannot-form .icon-abbr {
    background: #c8c8c8;
    opacity: 0.6;
}

/* ============================================================================
 * === Chart Legend ===
 * Horizontal legend bar with color swatches matching the MAUI app palette.
 * ============================================================================ */

.chart-legend {
    display: flex;
    gap: 20px;
    padding: 12px 16px;
    background: #e8e8e8;
    border: 1px solid #c8c8c8;
    border-radius: 4px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #333;
}

.legend-color {
    width: 20px;
    height: 3px;
    border-radius: 1px;
}

/* MAUI exact color mappings for chart line series */
.legend-color.orange { background: #ff9500; }
.legend-color.gray { background: #808080; }
.legend-color.blue { background: #5cacee; }
.legend-color.green { background: #7cb342; }
/* Fallback colors for dynamically generated legend entries */
.legend-color.purple { background: #9b59b6; }
.legend-color.red { background: #e74c3c; }
.legend-color.teal { background: #1abc9c; }

/* --- Dashboard Footer (last-updated timestamp) --- */
.dashboard-footer {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
    padding: 8px 0;
}

/* --- Sub-Navigation Items (indented child links) --- */
.nav-item.nav-item-sub {
    padding-left: 44px;
    font-size: 13px;
}

.nav-item.nav-item-sub::before {
    display: none;
}

.nav-item.nav-item-sub.active::before {
    display: block;
}

/* ============================================================================
 * === Responsive Breakpoints - Dashboard ===
 * ============================================================================ */

/* --- Tablet (max-width: 1024px) --- */
@media (max-width: 1024px) {
    .strength-circles {
        gap: 12px;
    }

    .strength-circle {
        width: 60px;
        height: 60px;
    }

    .circle-value {
        font-size: 18px;
    }

    .chart-content {
        min-width: 500px;
    }

    .chart-legend {
        gap: 12px;
        padding: 10px 12px;
    }
}

@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .dashboard-controls {
        width: 100%;
        justify-content: space-between;
    }

    .strength-circles {
        flex-wrap: wrap;
        justify-content: center;
    }

    .strength-info {
        width: 100%;
        justify-content: center;
        margin-left: 0;
        margin-top: 8px;
    }

    .chart-legend {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    .legend-item {
        font-size: 11px;
    }

    .dashboard-footer {
        flex-direction: column;
        gap: 4px;
        align-items: center;
    }

    /* Chart adjustments for tablet */
    .chart-y-axis {
        width: 30px;
    }

    .y-label {
        font-size: 10px;
        padding-right: 6px;
    }

    .x-label {
        font-size: 10px;
    }

    .chart-content {
        min-width: 450px;
    }
}

@media (max-width: 480px) {
    .strength-circle {
        width: 50px;
        height: 50px;
    }

    .circle-value {
        font-size: 15px;
    }

    .circle-label {
        font-size: 9px;
    }

    .timeline-icon {
        width: 24px;
        height: 24px;
    }

    .timeline-icon img,
    .timeline-icon .icon-abbr {
        width: 22px;
        height: 22px;
    }

    .timeline-icon .icon-abbr {
        font-size: 7px;
    }

    /* Chart adjustments for mobile */
    .chart-main-area {
        height: 200px;
    }

    .y-axis-labels {
        height: 160px;
    }

    .chart-grid-lines,
    .chart-svg,
    .chart-vertical-marker {
        top: 8px;
        bottom: 30px;
    }

    .chart-y-axis {
        width: 28px;
    }

    .y-label {
        font-size: 9px;
        padding-right: 4px;
    }

    .x-label {
        font-size: 9px;
    }

    .chart-content {
        min-width: 400px;
    }

    .timelines-container {
        height: 58px;
        margin-top: 8px;
    }

    .timeline-row {
        height: 28px;
    }

    .chart-legend {
        padding: 8px 10px;
        gap: 6px;
    }

    .legend-item {
        font-size: 10px;
    }

    .legend-color {
        width: 10px;
        height: 10px;
    }
}

/* --- Touch Device Optimizations - Larger hit targets, disabled hover effects --- */
@media (hover: none) and (pointer: coarse) {
    .timeline-icon {
        /* Larger touch targets on touch devices */
        min-width: 32px;
        min-height: 32px;
    }

    .timeline-icon:hover {
        /* Disable hover effects on touch */
        transform: translateX(-50%);
    }

    .timeline-icon:active {
        transform: translateX(-50%) scale(1.1);
    }
}

/* ============================================================================
 * === Unit Configuration View ===
 * Grid-based layout for managing unit (Einheiten) configurations with
 * timeline section groupings, icon previews, requirement tags, and
 * active/inactive state styling.
 * ============================================================================ */

.unit-configs-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.timeline-section {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
}

.timeline-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.units-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.unit-config-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    transition: var(--transition);
}

.unit-config-card:hover {
    box-shadow: var(--shadow-md);
}

.unit-config-card.inactive {
    opacity: 0.6;
    background: var(--bg-tertiary);
}

.unit-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.unit-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 48px;
}

.unit-icon img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

/* Hides abbreviation label when a graphical icon image is present */
.unit-icon img + .unit-abbr {
    display: none;
}

/* Fallback abbreviation box displayed when no icon image is available */
.unit-abbr-box {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
}

.unit-abbr {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-color);
    margin-top: 2px;
}

.unit-updated {
    margin-left: auto;
    font-size: 11px;
    color: var(--text-muted);
}

.unit-info {
    flex: 1;
}

.unit-name {
    font-weight: 600;
    color: var(--text-primary);
}

.unit-meta {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.unit-status {
    font-size: 11px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
}

.unit-status.active {
    background: rgba(40, 167, 69, 0.1);
    color: var(--success);
}

.unit-status.inactive {
    background: rgba(108, 117, 125, 0.1);
    color: var(--text-secondary);
}

.unit-requirements {
    margin-bottom: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.unit-requirements label {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.requirements-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.requirement-tag {
    display: inline-block;
    font-size: 12px;
    padding: 3px 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
}

.unit-actions {
    display: flex;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

/* --- Requirement Row in Unit Config Modal --- */
.requirement-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.requirement-row .form-select,
.requirement-row .form-input {
    margin-bottom: 0;
}

/* --- Form Row (horizontal field layout within modals) --- */
.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

/* --- Unit Config Responsive (max-width: 768px) --- */
@media (max-width: 768px) {
    .units-grid {
        grid-template-columns: 1fr;
    }

    .unit-card-header {
        flex-wrap: wrap;
    }

    .unit-actions {
        flex-wrap: wrap;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }
}

/* ============================================================================
 * === Icon Select with Preview ===
 * Dropdown selector with an adjacent live-preview box for unit icons.
 * ============================================================================ */

.icon-select-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.icon-select-container .form-select {
    flex: 1;
    margin-bottom: 0;
}

.icon-preview {
    width: 48px;
    height: 48px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.icon-preview img {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.icon-preview .no-icon {
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.2;
}

/* ============================================================================
 * === Permissions / Roles ===
 * Scrollable categorized permission list used in the role management modal.
 * Each permission item contains a checkbox, label, and description.
 * ============================================================================ */

.permissions-container {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    background: var(--bg-secondary);
}

.permission-category {
    margin-bottom: 16px;
}

.permission-category:last-child {
    margin-bottom: 0;
}

.permission-category-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-color);
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-color);
}

.permission-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.permission-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
}

.permission-item:hover {
    background: #f0f4f8;
    border-color: var(--accent-color);
}

.permission-item input[type="checkbox"] {
    margin-top: 3px;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    accent-color: var(--accent-color);
}

.permission-label {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.permission-label strong {
    font-size: 13px;
    color: var(--text-primary);
}

.permission-description {
    font-size: 11px;
    color: var(--text-secondary);
}


/* ============================================================================
 * === Map Search (Organization Location Picker) ===
 * Leaflet map integration with Nominatim geocoding for organization forms.
 * ============================================================================ */

.map-search-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 13px;
    color: var(--accent-color);
    background: none;
    border: 1px solid var(--accent-color);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    margin-bottom: 12px;
}

.map-search-toggle:hover {
    background: var(--accent-color);
    color: #fff;
}

.map-search-container {
    display: none;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
    background: var(--bg-secondary);
}

.map-search-container.visible {
    display: block;
}

.map-search-input {
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.map-search-input:focus {
    border-color: var(--accent-color);
}

.map-search-results {
    max-height: 180px;
    overflow-y: auto;
    margin-top: 4px;
    border-radius: 6px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    display: none;
}

.map-search-results.visible {
    display: block;
}

.map-search-result-item {
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
    border-bottom: 1px solid var(--bg-tertiary);
    transition: background 0.15s;
}

.map-search-result-item:last-child {
    border-bottom: none;
}

.map-search-result-item:hover {
    background: var(--bg-tertiary);
}

.map-search-no-results {
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-secondary);
    font-style: italic;
}

.map-container {
    height: 300px;
    margin-top: 8px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.map-container .leaflet-container {
    height: 100%;
    width: 100%;
}
