/* ============================================================
   SecureVault - Design System & Styles
   ============================================================ */

:root {
    /* Colors - Dark Theme */
    --bg-primary: #0f0f23;
    --bg-secondary: #1a1a2e;
    --bg-tertiary: #16213e;
    --bg-card: #1e1e3a;
    --bg-card-hover: #252547;
    --bg-input: #12122a;
    --bg-modal: #1a1a35;

    --text-primary: #e8e8f0;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;

    --accent-primary: #6366f1;
    --accent-primary-hover: #818cf8;
    --accent-primary-light: rgba(99, 102, 241, 0.15);

    --border-color: #2d2d52;
    --border-light: #363660;

    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --sidebar-width: 260px;
    --sidebar-collapsed: 60px;
    --topbar-height: 64px;

    --transition: 0.2s ease;
}

/* ============================================================
   THEME: Light
   ============================================================ */
[data-theme="light"] {
    --bg-primary: #f5f5f9;
    --bg-secondary: #ffffff;
    --bg-tertiary: #eef0f5;
    --bg-card: #ffffff;
    --bg-card-hover: #f0f2f7;
    --bg-input: #f8f9fc;
    --bg-modal: #ffffff;
    --text-primary: #1a1a2e;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --accent-primary: #6366f1;
    --accent-primary-hover: #4f46e5;
    --accent-primary-light: rgba(99, 102, 241, 0.1);
    --border-color: #e2e8f0;
    --border-light: #cbd5e1;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .auth-page {
    background: radial-gradient(ellipse at 50% 0%, #e0e7ff 0%, var(--bg-primary) 70%);
}

[data-theme="light"] .cc-preview {
    background: linear-gradient(135deg, #e8e8f4 0%, #d1d5f0 100%);
}

/* ============================================================
   THEME: Ocean
   ============================================================ */
[data-theme="ocean"] {
    --bg-primary: #0a192f;
    --bg-secondary: #112240;
    --bg-tertiary: #1d3557;
    --bg-card: #162a4a;
    --bg-card-hover: #1e3a5f;
    --bg-input: #0d1e38;
    --bg-modal: #142640;
    --text-primary: #ccd6f6;
    --text-secondary: #8892b0;
    --text-muted: #607b96;
    --accent-primary: #64ffda;
    --accent-primary-hover: #4de8c3;
    --accent-primary-light: rgba(100, 255, 218, 0.1);
    --border-color: #233554;
    --border-light: #2d4a6f;
    --success: #64ffda;
    --warning: #f7c948;
    --info: #57aef1;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.6);
}

[data-theme="ocean"] .auth-page {
    background: radial-gradient(ellipse at 50% 0%, #1d3557 0%, var(--bg-primary) 70%);
}

[data-theme="ocean"] .cc-preview {
    background: linear-gradient(135deg, #112240 0%, #1d3557 100%);
}

[data-theme="ocean"] .btn-primary {
    background: var(--accent-primary);
    color: #0a192f;
}

[data-theme="ocean"] .btn-primary:hover {
    box-shadow: 0 4px 12px rgba(100, 255, 218, 0.3);
}

/* ============================================================
   THEME: Forest
   ============================================================ */
[data-theme="forest"] {
    --bg-primary: #0f1a0f;
    --bg-secondary: #1a2e1a;
    --bg-tertiary: #1e3a1e;
    --bg-card: #1c2f1c;
    --bg-card-hover: #24402a;
    --bg-input: #0d170d;
    --bg-modal: #1a2e1a;
    --text-primary: #d4e6d4;
    --text-secondary: #8faa8f;
    --text-muted: #5e7a5e;
    --accent-primary: #4ade80;
    --accent-primary-hover: #22c55e;
    --accent-primary-light: rgba(74, 222, 128, 0.12);
    --border-color: #2d4a2d;
    --border-light: #3d5f3d;
    --success: #4ade80;
    --warning: #fbbf24;
    --info: #60a5fa;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.6);
}

[data-theme="forest"] .auth-page {
    background: radial-gradient(ellipse at 50% 0%, #1e3a1e 0%, var(--bg-primary) 70%);
}

[data-theme="forest"] .cc-preview {
    background: linear-gradient(135deg, #1c2f1c 0%, #2d4a2d 100%);
}

[data-theme="forest"] .btn-primary {
    background: var(--accent-primary);
    color: #0f1a0f;
}

[data-theme="forest"] .btn-primary:hover {
    box-shadow: 0 4px 12px rgba(74, 222, 128, 0.3);
}

/* ============================================================
   THEME: Sunset (Crépuscule)
   ============================================================ */
[data-theme="sunset"] {
    --bg-primary: #1a0f0f;
    --bg-secondary: #2e1a1a;
    --bg-tertiary: #3a2020;
    --bg-card: #2f1c1c;
    --bg-card-hover: #3d2828;
    --bg-input: #1f1212;
    --bg-modal: #2e1a1a;
    --text-primary: #f5e6e0;
    --text-secondary: #c4a89a;
    --text-muted: #8a6e62;
    --accent-primary: #f97316;
    --accent-primary-hover: #fb923c;
    --accent-primary-light: rgba(249, 115, 22, 0.12);
    --border-color: #4a2c2c;
    --border-light: #5e3838;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #f97316;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.6);
}

[data-theme="sunset"] .auth-page {
    background: radial-gradient(ellipse at 50% 0%, #3a2020 0%, var(--bg-primary) 70%);
}

[data-theme="sunset"] .cc-preview {
    background: linear-gradient(135deg, #2f1c1c 0%, #4a2c2c 100%);
}

/* ============================================================
   THEME: Nord (Ice Blue)
   ============================================================ */
[data-theme="nord"] {
    --bg-primary: #2e3440;
    --bg-secondary: #3b4252;
    --bg-tertiary: #434c5e;
    --bg-card: #3b4252;
    --bg-card-hover: #434c5e;
    --bg-input: #2e3440;
    --bg-modal: #3b4252;
    --text-primary: #eceff4;
    --text-secondary: #d8dee9;
    --text-muted: #7b88a1;
    --accent-primary: #88c0d0;
    --accent-primary-hover: #8fbcbb;
    --accent-primary-light: rgba(136, 192, 208, 0.12);
    --border-color: #4c566a;
    --border-light: #5a657a;
    --success: #a3be8c;
    --warning: #ebcb8b;
    --danger: #bf616a;
    --info: #81a1c1;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.35);
}

[data-theme="nord"] .auth-page {
    background: radial-gradient(ellipse at 50% 0%, #434c5e 0%, var(--bg-primary) 70%);
}

[data-theme="nord"] .cc-preview {
    background: linear-gradient(135deg, #3b4252 0%, #4c566a 100%);
}

/* ============================================================
   THEME PICKER UI
   ============================================================ */

.theme-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    font-size: .8rem;
    color: var(--text-secondary);
}

.theme-option:hover {
    border-color: var(--accent-primary);
    background: var(--accent-primary-light);
}

.theme-option.active {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-light);
    color: var(--accent-primary);
    font-weight: 600;
}

.theme-preview {
    width: 100%;
    aspect-ratio: 16/10;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
}

.theme-preview .tp-sidebar {
    width: 30%;
    height: 100%;
}

.theme-preview .tp-content {
    flex: 1;
    padding: 6%;
    display: flex;
    flex-direction: column;
    gap: 8%;
}

.theme-preview .tp-bar {
    height: 16%;
    border-radius: 3px;
}

.theme-preview .tp-cards {
    flex: 1;
    display: flex;
    gap: 6%;
}

.theme-preview .tp-card {
    flex: 1;
    border-radius: 3px;
}

/* Theme preview swatches */
.theme-prev-dark { background: #0f0f23; }
.theme-prev-dark .tp-sidebar { background: #1a1a2e; }
.theme-prev-dark .tp-bar { background: #2d2d52; }
.theme-prev-dark .tp-card { background: #1e1e3a; }

.theme-prev-light { background: #f5f5f9; }
.theme-prev-light .tp-sidebar { background: #ffffff; }
.theme-prev-light .tp-bar { background: #e2e8f0; }
.theme-prev-light .tp-card { background: #ffffff; border: 1px solid #e2e8f0; }

.theme-prev-ocean { background: #0a192f; }
.theme-prev-ocean .tp-sidebar { background: #112240; }
.theme-prev-ocean .tp-bar { background: #233554; }
.theme-prev-ocean .tp-card { background: #162a4a; }

.theme-prev-forest { background: #0f1a0f; }
.theme-prev-forest .tp-sidebar { background: #1a2e1a; }
.theme-prev-forest .tp-bar { background: #2d4a2d; }
.theme-prev-forest .tp-card { background: #1c2f1c; }

.theme-prev-sunset { background: #1a0f0f; }
.theme-prev-sunset .tp-sidebar { background: #2e1a1a; }
.theme-prev-sunset .tp-bar { background: #4a2c2c; }
.theme-prev-sunset .tp-card { background: #2f1c1c; }

.theme-prev-nord { background: #2e3440; }
.theme-prev-nord .tp-sidebar { background: #3b4252; }
.theme-prev-nord .tp-bar { background: #4c566a; }
.theme-prev-nord .tp-card { background: #3b4252; }

/* Favorite badge */
.nav-badge-fav {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

/* ============================================================
   RESET & BASE
   ============================================================ */

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--accent-primary-hover);
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

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

.btn-primary:hover {
    background: var(--accent-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-outline:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: var(--accent-primary-light);
}

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

.btn-danger:hover {
    background: #dc2626;
}

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

.btn-full {
    width: 100%;
    justify-content: center;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}

.btn-icon:hover {
    background: var(--accent-primary-light);
    color: var(--accent-primary);
}

/* ============================================================
   FORMS
   ============================================================ */

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

.form-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group label i {
    font-size: 0.75rem;
    opacity: 0.7;
}

.form-group small {
    display: block;
    margin-top: 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

input[type="text"],
input[type="password"],
input[type="url"],
input[type="email"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
    transition: all var(--transition);
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-light);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

input[type="color"] {
    width: 100%;
    height: 42px;
    padding: 4px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    cursor: pointer;
}

input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border-color);
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    border: 2px solid var(--bg-primary);
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239ca3af' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

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

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

.password-input-wrapper {
    display: flex;
    align-items: center;
    gap: 4px;
}

.password-input-wrapper input {
    flex: 1;
}

.password-input-wrapper .toggle-password,
.password-input-wrapper .btn-icon {
    flex-shrink: 0;
}

/* Password Strength Bar */
.password-strength {
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

.strength-fill {
    height: 100%;
    width: 0%;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.strength-danger { background: var(--danger); }
.strength-warning { background: var(--warning); }
.strength-good { background: var(--info); }
.strength-excellent { background: var(--success); }

/* ============================================================
   ALERTS
   ============================================================ */

.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    margin-bottom: 16px;
    line-height: 1.5;
}

.alert i {
    margin-top: 2px;
    flex-shrink: 0;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #93c5fd;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fcd34d;
}

/* ============================================================
   AUTH PAGES (Login / Register / Install)
   ============================================================ */

.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: radial-gradient(ellipse at 50% 0%, #1a1a4e 0%, var(--bg-primary) 70%);
}

.auth-container {
    width: 100%;
    max-width: 440px;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 40px 32px;
    box-shadow: var(--shadow-lg);
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 16px;
    background: var(--accent-primary-light);
    color: var(--accent-primary);
    margin-bottom: 16px;
}

.logo-icon svg {
    width: 30px;
    height: 30px;
}

.auth-logo-img {
    width: auto;
    height: 120px;
    max-width: 280px;
    object-fit: contain;
    margin-bottom: 8px;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
}

.auth-logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.auth-logo .subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 4px;
}

.auth-form {
    margin-top: 24px;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    font-size: 0.875rem;
    color: var(--text-muted);
}

.install-info {
    margin-bottom: 24px;
}

.install-info h3 {
    font-size: 1rem;
    margin-bottom: 12px;
}

.install-info p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 12px;
}

.install-info ul {
    list-style: none;
    padding: 0;
}

.install-info li {
    padding: 6px 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ============================================================
   DASHBOARD LAYOUT
   ============================================================ */

.dashboard-page {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

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

.logo-small {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1rem;
}

.logo-small svg {
    color: var(--accent-primary);
}

.sidebar-logo-img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    flex-shrink: 0;
}

/* Sidebar close button */
.sidebar-close-btn {
    color: var(--text-muted);
    transition: all var(--transition);
}

.sidebar-close-btn:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    backdrop-filter: blur(2px);
}

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

/* Sidebar collapsed state (desktop) */
.sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar.collapsed ~ .main-content,
.sidebar.collapsed ~ .sidebar-overlay ~ .main-content {
    margin-left: 0;
}

/* Toggle button in topbar */
.sidebar-toggle-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-size: 1.125rem;
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
    background: var(--accent-primary-light);
    color: var(--accent-primary);
}

/* Show toggle btn when sidebar is collapsed on desktop */
.sidebar.collapsed ~ .sidebar-overlay ~ .main-content .sidebar-toggle-btn,
.sidebar.collapsed ~ .main-content .sidebar-toggle-btn {
    display: flex;
}

.sidebar-toggle {
    display: none;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.875rem;
    transition: all var(--transition);
    text-decoration: none;
    margin-bottom: 2px;
}

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

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

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 0.875rem;
}

.nav-badge {
    margin-left: auto;
    font-size: 0.6875rem;
    font-weight: 600;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 22px;
    text-align: center;
}

.nav-badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.nav-divider {
    height: 1px;
    background: var(--border-color);
    margin: 12px 14px;
}

.nav-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 14px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.nav-section-title .btn-icon {
    width: 24px;
    height: 24px;
    font-size: 0.625rem;
}

.sidebar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-primary-light);
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.user-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Topbar */
.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--topbar-height);
}

.sidebar-toggle-mobile {
    display: none;
}

.search-bar {
    flex: 1;
    max-width: 500px;
    position: relative;
    display: flex;
    align-items: center;
}

.search-bar i {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.search-bar input {
    width: 100%;
    padding: 9px 14px 9px 40px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.875rem;
    outline: none;
    transition: all var(--transition);
}

.search-bar input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-light);
}

.search-bar kbd {
    position: absolute;
    right: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.6875rem;
    color: var(--text-muted);
    font-family: inherit;
}

.topbar-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* Content Area */
.content-area {
    flex: 1;
    padding: 24px;
}

.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.content-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.item-count {
    font-size: 0.8125rem;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 4px 12px;
    border-radius: 20px;
}

/* Password List */
.password-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.password-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
}

.password-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.card-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    font-weight: 700;
    flex-shrink: 0;
    text-transform: uppercase;
}

.card-info {
    flex: 1;
    min-width: 0;
}

.card-title {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title .fa-star {
    font-size: 0.75rem;
    color: var(--warning);
}

.card-subtitle {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-category {
    font-size: 0.6875rem;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--accent-primary-light);
    color: var(--accent-primary);
    white-space: nowrap;
}

.card-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity var(--transition);
}

.password-card:hover .card-actions {
    opacity: 1;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--accent-primary-light);
    color: var(--accent-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 1.125rem;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 24px;
}

/* ============================================================
   MODALS
   ============================================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    padding: 20px;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-modal);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: scale(0.95) translateY(10px);
    transition: transform 0.25s ease;
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-sm {
    max-width: 420px;
}

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

.modal-header h3 {
    font-size: 1.0625rem;
    font-weight: 600;
}

.modal-body {
    padding: 20px 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 16px;
}

/* Detail Modal */
.detail-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
    min-width: 100px;
}

.detail-value {
    font-size: 0.875rem;
    color: var(--text-primary);
    word-break: break-all;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: flex-end;
    text-align: right;
}

.detail-value a {
    color: var(--accent-primary);
}

.detail-actions {
    display: flex;
    gap: 8px;
    padding-top: 16px;
    justify-content: flex-end;
}

/* Generated Password Display */
.generated-password-display {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
}

.generated-password-display code {
    flex: 1;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 1rem;
    color: var(--accent-primary);
    word-break: break-all;
    letter-spacing: 0.05em;
}

.generator-options {
    margin-bottom: 16px;
}

/* ============================================================
   TOASTS
   ============================================================ */

.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    font-size: 0.875rem;
    animation: slideIn 0.3s ease forwards;
    max-width: 360px;
}

.toast.toast-success { border-left: 3px solid var(--success); }
.toast.toast-error   { border-left: 3px solid var(--danger); }
.toast.toast-info    { border-left: 3px solid var(--info); }

.toast.removing {
    animation: slideOut 0.3s ease forwards;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to   { transform: translateX(100%); opacity: 0; }
}

/* ============================================================
   SCROLLBAR
   ============================================================ */

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .sidebar-toggle-btn {
        display: flex !important;
    }

    .main-content {
        margin-left: 0;
    }

    .topbar-actions span {
        display: none;
    }

    .search-bar kbd {
        display: none;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .card-actions {
        opacity: 1;
    }

    .content-area {
        padding: 16px;
    }

    .modal {
        margin: 10px;
        max-height: 85vh;
    }
}

@media (max-width: 480px) {
    .auth-card {
        padding: 28px 20px;
    }

    .topbar {
        padding: 10px 12px;
    }

    .browse-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ============================================================
   BROWSE GRID (NordPass Home)
   ============================================================ */

.browse-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}

.browse-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.browse-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.browse-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.browse-label {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.3;
}

.browse-count {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* ============================================================
   ITEM LIST (generic for all item types)
   ============================================================ */

.item-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.item-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
}

.item-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.item-card .card-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    font-weight: 700;
    flex-shrink: 0;
    text-transform: uppercase;
}

.item-card .card-info {
    flex: 1;
    min-width: 0;
}

.item-card .card-title {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.item-card .card-subtitle {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item-card .card-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity var(--transition);
}

.item-card:hover .card-actions {
    opacity: 1;
}

/* Trash item styling */
.item-card.trash-card {
    opacity: 0.7;
}

.item-card.trash-card:hover {
    opacity: 1;
}

.trash-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Shared items */
.shared-badge {
    font-size: 0.6875rem;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-primary);
}

/* Credit card visual */
.cc-preview {
    background: linear-gradient(135deg, #1e1e3a 0%, #2d2d52 100%);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 16px;
    font-family: 'SF Mono', 'Fira Code', monospace;
}

.cc-preview .cc-number {
    font-size: 1.125rem;
    letter-spacing: 0.15em;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.cc-preview .cc-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Import preview */
.import-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
    margin-top: 12px;
}

.import-preview-table th {
    background: var(--bg-input);
    padding: 8px 10px;
    text-align: left;
    color: var(--text-muted);
    font-weight: 500;
    border-bottom: 1px solid var(--border-color);
}

.import-preview-table td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================================
   Attachments (pièces jointes)
   ============================================================ */

.attach-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    transition: background .15s;
}

.attach-item:hover {
    background: var(--bg-hover);
}

.attach-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.attach-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--accent-primary-light);
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1rem;
}

.attach-thumb {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--border-color);
    cursor: pointer;
}

.attach-thumb:hover {
    opacity: .8;
}

.attach-name {
    font-size: .85rem;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

.attach-meta {
    font-size: .7rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.attach-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

#attachmentUploadProgress {
    text-align: center;
    padding: 12px;
    color: var(--accent-primary);
    font-size: .85rem;
}

/* Attachment hint in creation modals */
.attach-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--accent-primary-light);
    color: var(--accent-primary);
    font-size: .8rem;
    margin-top: 4px;
    margin-bottom: 8px;
}

.attach-hint i {
    font-size: .9rem;
    flex-shrink: 0;
}

/* ============================================================
   SECURITY AUDIT
   ============================================================ */

.security-score-card {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 24px;
    background: var(--bg-input);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
}

.security-score-circle {
    position: relative;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: conic-gradient(
        var(--score-color) calc(var(--score-pct) * 3.6deg),
        var(--border-color) calc(var(--score-pct) * 3.6deg)
    );
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.security-score-circle::before {
    content: '';
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    background: var(--bg-input);
}

.security-score-value {
    position: relative;
    z-index: 1;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.security-score-label {
    position: relative;
    z-index: 1;
    font-size: .65rem;
    color: var(--text-muted);
}

.security-score-info h4 {
    font-size: 1.125rem;
    margin-bottom: 4px;
}

.security-score-info p {
    font-size: .85rem;
    color: var(--text-secondary);
}

.security-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.security-stat {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.security-stat-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .9rem;
    flex-shrink: 0;
}

.security-stat strong {
    display: block;
    font-size: 1.125rem;
    color: var(--text-primary);
    line-height: 1.2;
}

.security-stat span {
    font-size: .7rem;
    color: var(--text-muted);
}

.security-hibp-section {
    margin-bottom: 20px;
    padding-top: 4px;
}

.security-issues-title {
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.security-issues-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 280px;
    overflow-y: auto;
}

.security-issue-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}

.security-issue-item:hover {
    background: var(--bg-card-hover);
}

.security-issue-info {
    min-width: 0;
    flex: 1;
}

.security-issue-info strong {
    display: block;
    font-size: .85rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.security-issue-info span {
    font-size: .75rem;
    color: var(--text-muted);
}

.security-issue-badges {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.security-badge {
    font-size: .65rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.security-badge i {
    font-size: .55rem;
}

.security-badge-danger {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger);
}

.security-badge-warning {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warning);
}

.security-badge-info {
    background: rgba(59, 130, 246, 0.12);
    color: var(--info);
}

/* ============================================================
   ACTIVITY LOG
   ============================================================ */

.activity-log-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.activity-date-separator {
    font-size: .75rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 10px 0 6px;
    text-transform: uppercase;
    letter-spacing: .03em;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 4px;
}

.activity-log-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}

.activity-log-item:hover {
    background: var(--bg-input);
}

.activity-log-danger {
    background: rgba(239, 68, 68, 0.05);
}

.activity-log-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

.activity-log-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .9rem;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
}

.activity-log-content {
    flex: 1;
    min-width: 0;
}

.activity-log-content strong {
    display: block;
    font-size: .85rem;
    color: var(--text-primary);
}

.activity-log-content span {
    font-size: .75rem;
    color: var(--text-muted);
}

.activity-log-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
}

.activity-log-meta span:first-child {
    font-size: .8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.activity-log-meta span:last-child {
    font-size: .65rem;
    color: var(--text-muted);
    font-family: 'SF Mono', 'Fira Code', monospace;
}

@media (max-width: 768px) {
    .security-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .security-score-card {
        flex-direction: column;
        text-align: center;
    }

    .security-issue-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .security-issue-badges {
        justify-content: flex-start;
    }
}

/* ============================================================
   CHAT SÉCURISÉ
   ============================================================ */

.chat-modal {
    max-width: 700px;
    height: 75vh;
    max-height: 600px;
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Chat fullscreen mode */
.chat-modal.chat-fullscreen {
    position: fixed;
    inset: 0;
    max-width: none;
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0;
    margin: 0;
    border: none;
    z-index: 1001;
}

.chat-modal.chat-fullscreen .chat-contacts-panel {
    width: 300px;
}

.chat-modal.chat-fullscreen .chat-messages-body {
    padding: 20px 32px;
}

.chat-modal.chat-fullscreen .chat-msg {
    max-width: 60%;
}

.chat-modal.chat-fullscreen .chat-attach-preview img {
    max-width: 320px;
    max-height: 260px;
}

.chat-container {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;
}

/* Contacts panel */
.chat-contacts-panel {
    width: 240px;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.chat-contacts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    font-size: .8125rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.chat-collapse-btn {
    width: 28px;
    height: 28px;
    font-size: .7rem;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.chat-collapse-btn:hover {
    color: var(--accent-primary);
    background: var(--accent-primary-light);
}

/* Contact search bar */
.chat-search-bar {
    position: relative;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.chat-search-bar i {
    position: absolute;
    left: 22px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: .75rem;
    pointer-events: none;
}

.chat-search-bar input {
    width: 100%;
    padding: 7px 10px 7px 30px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: .8rem;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition);
}

.chat-search-bar input:focus {
    border-color: var(--accent-primary);
}

.chat-search-bar input::placeholder {
    color: var(--text-muted);
    font-size: .75rem;
}

/* Collapsed contacts bar */
.chat-contacts-collapsed {
    width: 46px;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 10px;
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.chat-contacts-collapsed .btn-icon {
    width: 32px;
    height: 32px;
    font-size: .8rem;
    color: var(--text-muted);
    transition: all var(--transition);
}

.chat-contacts-collapsed .btn-icon:hover {
    color: var(--accent-primary);
    background: var(--accent-primary-light);
}

.chat-contacts-list {
    flex: 1;
    overflow-y: auto;
}

.chat-contact-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background var(--transition);
    border-bottom: 1px solid var(--border-color);
}

.chat-contact-item:hover {
    background: var(--accent-primary-light);
}

.chat-contact-item.active {
    background: var(--accent-primary-light);
    border-left: 3px solid var(--accent-primary);
}

.chat-contact-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-primary-light);
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: .875rem;
    flex-shrink: 0;
}

.chat-contact-info {
    flex: 1;
    min-width: 0;
}

.chat-contact-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
}

.chat-contact-username {
    font-size: .8125rem;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-contact-time {
    font-size: .6875rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.chat-contact-preview {
    font-size: .75rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-unread-badge {
    background: var(--danger);
    color: white;
    font-size: .625rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    flex-shrink: 0;
}

.chat-empty-contacts {
    text-align: center;
    padding: 30px 16px;
    color: var(--text-muted);
    font-size: .8125rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.chat-empty-contacts small {
    color: var(--text-muted);
    font-size: .75rem;
    line-height: 1.4;
}

/* Messages panel */
.chat-messages-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
}

.chat-messages-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.chat-back-btn {
    display: none;
}

.chat-contact-name {
    font-weight: 600;
    font-size: .9375rem;
    color: var(--text-primary);
    flex: 1;
}

.chat-encryption-badge {
    font-size: .6875rem;
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
    padding: 3px 8px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.chat-messages-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat-welcome,
.chat-loading,
.chat-empty-messages {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: .875rem;
    margin: auto;
}

.chat-date-separator {
    text-align: center;
    margin: 12px 0;
}

.chat-date-separator span {
    font-size: .6875rem;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 3px 12px;
    border-radius: 10px;
}

/* Message bubbles */
.chat-msg {
    display: flex;
    flex-direction: column;
    max-width: 80%;
}

.chat-msg-mine {
    align-self: flex-end;
    align-items: flex-end;
}

.chat-msg-theirs {
    align-self: flex-start;
    align-items: flex-start;
}

.chat-msg-bubble {
    padding: 8px 14px;
    border-radius: 16px;
    font-size: .875rem;
    line-height: 1.45;
    word-break: break-word;
}

.chat-msg-mine .chat-msg-bubble {
    background: var(--accent-primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-msg-theirs .chat-msg-bubble {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.chat-msg-time {
    font-size: .625rem;
    color: var(--text-muted);
    margin-top: 3px;
    padding: 0 4px;
    display: flex;
    align-items: center;
    gap: 3px;
}

/* Chat attachments in messages */
.chat-attachment {
    margin-bottom: 6px;
    max-width: 100%;
}

.chat-attach-preview {
    display: block;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 4px;
}

.chat-attach-preview img {
    display: block;
    max-width: 220px;
    max-height: 180px;
    width: auto;
    height: auto;
    border-radius: 12px;
    object-fit: cover;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: opacity var(--transition);
}

.chat-attach-preview img:hover {
    opacity: .85;
}

.chat-attach-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 2px 0;
}

.chat-attach-file {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.chat-attach-file > i {
    font-size: 1.25rem;
    color: var(--accent-primary);
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}

.chat-attach-file > div {
    flex: 1;
    min-width: 0;
}

.chat-attach-filename {
    display: block;
    font-size: .8125rem;
    font-weight: 500;
    color: var(--accent-primary);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 180px;
    transition: color var(--transition);
}

.chat-attach-filename:hover {
    color: var(--accent-primary-hover);
    text-decoration: underline;
}

.chat-attach-meta {
    font-size: .6875rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 1px;
}

.chat-attach-meta i {
    font-size: .6rem;
}

/* Expired attachment */
.chat-attach-expired {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 12px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.15);
    color: var(--text-muted);
    font-size: .8rem;
    font-style: italic;
}

.chat-attach-expired i {
    color: var(--danger);
    font-size: .85rem;
    flex-shrink: 0;
}

.chat-attach-expired span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Attach button (paperclip) in input */
.chat-attach-btn {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    font-size: .95rem;
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}

.chat-attach-btn:hover {
    color: var(--accent-primary);
    background: var(--accent-primary-light);
}

/* Upload progress */
.chat-upload-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--accent-primary-light);
    color: var(--accent-primary);
    font-size: .8rem;
    font-weight: 500;
    border-top: 1px solid var(--border-color);
}

.chat-upload-progress i {
    font-size: .85rem;
}

/* Delete conversation button */
#chatDeleteConvBtn {
    width: 32px;
    height: 32px;
}

#chatDeleteConvBtn:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Chat input */
.chat-input-area {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.chat-input-area textarea {
    flex: 1;
    padding: 8px 14px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: inherit;
    font-size: .875rem;
    resize: none;
    outline: none;
    max-height: 120px;
    min-height: 38px;
    line-height: 1.4;
    transition: border-color var(--transition);
}

.chat-input-area textarea:focus {
    border-color: var(--accent-primary);
}

.chat-send-btn {
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Chat responsive */
@media (max-width: 768px) {
    .chat-modal {
        max-width: 100%;
        height: 85vh;
        max-height: none;
        margin: 0;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }

    .chat-contacts-panel {
        width: 100%;
        border-right: none;
    }

    .chat-contacts-collapsed {
        display: none !important;
    }

    .chat-collapse-btn {
        display: none;
    }

    .chat-back-btn {
        display: flex;
    }

    .chat-msg {
        max-width: 90%;
    }

    .chat-attach-preview img {
        max-width: 180px;
        max-height: 140px;
    }

    .chat-attach-filename {
        max-width: 140px;
    }
}

/* ============================================================
   CHAT BACKGROUND PICKER
   ============================================================ */

.chat-bg-picker {
    position: absolute;
    top: 46px;
    right: 12px;
    z-index: 100;
    width: 280px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
    padding: 0;
    animation: chatBgFadeIn 0.2s ease-out;
}

@keyframes chatBgFadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.chat-bg-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-primary);
}

.chat-bg-picker-header i {
    color: #a78bfa;
    margin-right: 6px;
}

.chat-bg-section {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
}

.chat-bg-section:last-child {
    border-bottom: none;
}

.chat-bg-label {
    font-size: .7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.chat-bg-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.chat-bg-swatch {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 8px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all .2s;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    position: relative;
    overflow: hidden;
}

.chat-bg-swatch:hover {
    border-color: var(--accent-primary);
    transform: scale(1.08);
}

.chat-bg-swatch.active {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px var(--accent-primary-light);
}

.chat-bg-swatch.active::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    font-size: .55rem;
    color: white;
    background: var(--accent-primary);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    bottom: 2px;
    right: 2px;
}

.chat-bg-pattern {
    background: #1a1a2e !important;
}

/* Chat background applied styles */
.chat-messages-body.chat-bg-custom {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.chat-messages-body.chat-bg-pattern-dots {
    background-color: var(--bg-primary);
    background-image: radial-gradient(circle, rgba(255,255,255,.06) 1px, transparent 1px);
    background-size: 20px 20px;
}

.chat-messages-body.chat-bg-pattern-grid {
    background-color: var(--bg-primary);
    background-image:
        linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
    background-size: 24px 24px;
}

.chat-messages-body.chat-bg-pattern-diagonal {
    background-color: var(--bg-primary);
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 14px,
        rgba(255,255,255,.04) 14px,
        rgba(255,255,255,.04) 15px
    );
}

.chat-messages-body.chat-bg-pattern-hexagon {
    background-color: var(--bg-primary);
    background-image:
        linear-gradient(30deg, rgba(255,255,255,.04) 12%, transparent 12.5%, transparent 87%, rgba(255,255,255,.04) 87.5%),
        linear-gradient(150deg, rgba(255,255,255,.04) 12%, transparent 12.5%, transparent 87%, rgba(255,255,255,.04) 87.5%),
        linear-gradient(30deg, rgba(255,255,255,.04) 12%, transparent 12.5%, transparent 87%, rgba(255,255,255,.04) 87.5%),
        linear-gradient(150deg, rgba(255,255,255,.04) 12%, transparent 12.5%, transparent 87%, rgba(255,255,255,.04) 87.5%),
        linear-gradient(60deg, rgba(255,255,255,.02) 25%, transparent 25.5%, transparent 75%, rgba(255,255,255,.02) 75%),
        linear-gradient(60deg, rgba(255,255,255,.02) 25%, transparent 25.5%, transparent 75%, rgba(255,255,255,.02) 75%);
    background-size: 40px 70px;
    background-position: 0 0, 0 0, 20px 35px, 20px 35px, 0 0, 20px 35px;
}

/* Image background overlay to keep text readable */
.chat-messages-body.chat-bg-image::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.25);
    pointer-events: none;
    z-index: 0;
}

.chat-messages-body.chat-bg-image {
    position: relative;
}

.chat-messages-body.chat-bg-image > * {
    position: relative;
    z-index: 1;
}

@media (max-width: 768px) {
    .chat-bg-picker {
        width: 260px;
        right: 4px;
    }
}

/* ============================================================
   EMERGENCY ACCESS
   ============================================================ */

.emergency-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.emergency-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.emergency-section-title {
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.emergency-section-title i {
    font-size: .8rem;
}

.emergency-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    transition: background var(--transition);
}

.emergency-item:hover {
    background: var(--bg-card-hover);
}

.emergency-item-alert {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.05);
}

.emergency-item-alert:hover {
    background: rgba(239, 68, 68, 0.1);
}

.emergency-item-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.emergency-item-info strong {
    display: block;
    font-size: .85rem;
    color: var(--text-primary);
}

.emergency-item-info span {
    display: block;
    font-size: .75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.emergency-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-primary-light);
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: .875rem;
    flex-shrink: 0;
}

.emergency-add-form {
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border: 1px dashed var(--border-color);
}

.emergency-status {
    font-size: .7rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

.emergency-status i {
    font-size: .6rem;
}

.emergency-status-pending {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warning);
}

.emergency-status-granted {
    background: rgba(16, 185, 129, 0.12);
    color: var(--success);
}

.emergency-status-denied {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger);
}

@media (max-width: 768px) {
    .emergency-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .emergency-add-form [style*="display:flex"] {
        flex-direction: column;
    }
}

/* ============================================================
   PANIC MODE
   ============================================================ */

.panic-section {
    padding: 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: border-color var(--transition);
}

.panic-section:hover {
    border-color: var(--border-light);
}

.panic-section-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.panic-section-header h4 {
    color: var(--text-primary);
}

.panic-section-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* Wipe confirmation modal */
.wipe-warning {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: .85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.wipe-warning i {
    color: var(--danger);
    font-size: 1.2rem;
    flex-shrink: 0;
    margin-top: 2px;
}

/* ============================================================
   AUTO-BACKUP
   ============================================================ */

.backup-settings-card {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 16px;
}

.backup-settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
}

.backup-settings-row:last-child {
    border-bottom: none;
}

.backup-settings-row strong {
    font-size: .85rem;
    color: var(--text-primary);
}

.backup-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    transition: background var(--transition);
}

.backup-item:hover {
    background: var(--bg-card-hover);
}

.backup-item-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.backup-item-info strong {
    display: block;
    font-size: .8rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.backup-item-info span {
    display: block;
}

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

/* ============================================================
   SECURITY ALERT BANNER
   ============================================================ */

.security-alert-banner {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 20px;
    margin-bottom: 20px;
    border-radius: var(--radius-lg);
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.25);
    animation: alertSlideIn 0.4s ease-out;
}

@keyframes alertSlideIn {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.security-alert-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.security-alert-content {
    flex: 1;
    min-width: 0;
}

.security-alert-content strong {
    display: block;
    font-size: .9rem;
    color: var(--danger);
    margin-bottom: 4px;
}

.security-alert-content p {
    font-size: .85rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

.security-alert-content code {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: .8rem;
    font-family: 'Courier New', monospace;
}

.security-alert-dismiss {
    flex-shrink: 0;
    color: var(--text-muted);
    opacity: 0.6;
    transition: opacity .2s;
}

.security-alert-dismiss:hover {
    opacity: 1;
    color: var(--danger);
}

@media (max-width: 768px) {
    .security-alert-banner {
        flex-wrap: wrap;
        padding: 14px;
        gap: 10px;
    }
    .security-alert-icon {
        width: 32px;
        height: 32px;
        font-size: .95rem;
    }
    .security-alert-dismiss {
        position: absolute;
        top: 10px;
        right: 10px;
    }
    .security-alert-banner {
        position: relative;
        padding-right: 40px;
    }
}

/* Notes sécurisées : rendu HTML propre à partir du Markdown saisi */
.note-html-content {
    font-size: .9rem;
    line-height: 1.65;
    color: var(--text-secondary);
    padding: 8px 0 16px;
    border-bottom: 1px solid var(--border-color);
    overflow-wrap: anywhere;
}
.note-html-content h1,.note-html-content h2,.note-html-content h3,
.note-html-content h4,.note-html-content h5,.note-html-content h6 {
    color: var(--text-primary);
    line-height: 1.25;
    margin: 1.1em 0 .45em;
    font-weight: 700;
}
.note-html-content h1 { font-size: 1.55rem; }
.note-html-content h2 { font-size: 1.3rem; }
.note-html-content h3 { font-size: 1.1rem; }
.note-html-content h4,.note-html-content h5,.note-html-content h6 { font-size: 1rem; }
.note-html-content h1:first-child,.note-html-content h2:first-child,.note-html-content h3:first-child { margin-top: 0; }
.note-html-content p { margin: 0 0 .8em; }
.note-html-content p:last-child { margin-bottom: 0; }
.note-html-content ul,.note-html-content ol { margin: .45em 0 .9em; padding-left: 1.5rem; }
.note-html-content li { margin: .25em 0; }
.note-html-content strong { color: var(--text-primary); font-weight: 700; }
.note-html-content a { color: var(--accent-primary); text-decoration: underline; }
.note-html-content hr { border: 0; border-top: 1px solid var(--border-color); margin: 1rem 0; }
.note-html-content code { padding: 2px 5px; border-radius: 5px; background: var(--bg-tertiary); font-family: monospace; font-size: .86em; }
.note-html-content pre { margin: .8em 0; padding: 12px; border-radius: 8px; background: var(--bg-tertiary); overflow-x: auto; }
.note-html-content pre code { padding: 0; background: transparent; }


/* Détails > Notes : utilise toute la largeur disponible, y compris à gauche */
.detail-row-note {
    display: block;
    padding: 14px 0;
}
.detail-row-note .detail-label {
    display: block;
    min-width: 0;
    margin: 0 0 10px;
    font-weight: 600;
}
.detail-row-note .detail-note-value {
    display: block;
    width: 100%;
    max-width: none;
    text-align: left;
    justify-content: flex-start;
    word-break: normal;
    overflow-wrap: anywhere;
}
.detail-row-note .note-html-content {
    width: 100%;
    box-sizing: border-box;
    padding: 0 0 10px;
}
