:root {
    /* Light Mode Palette */
    --bg-gradient: linear-gradient(135deg, #f0f9ff 0%, #e0e7ff 100%);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --card-bg: rgba(255, 255, 255, 0.85);

    --primary: #4f46e5;
    --primary-hover: #4338ca;

    --text: #1e293b;
    --text-muted: #64748b;

    --danger: #ef4444;
    --success: #10b981;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.05), 0 4px 6px -4px rgb(0 0 0 / 0.05);
}

body.dark-mode {
    --bg-gradient: #000000;
    --glass-bg: rgba(0, 0, 0, 0.8);
    --glass-border: rgba(255, 255, 255, 0.08);
    --card-bg: rgba(18, 18, 18, 0.95);

    --text: #eeeeee;
    --text-muted: #aaaaaa;

    --shadow-sm: 0 1px 2px 0 rgb(255 255 255 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5);

    /* Fix native controls like date picker */
    color-scheme: dark;
}

body.dark-mode .nav-btn:hover,
body.dark-mode .nav-btn.active {
    background: #202020;
    color: #ffffff;
}

body.dark-mode .glass-nav {
    background: #000000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
    background: #121212;
    border-color: #333;
    color: white;
}

body.dark-mode .header-row,
body.dark-mode .glass-table th,
body.dark-mode .glass-table tr:hover,
body.dark-mode .list-item,
body.dark-mode .inline-form,
body.dark-mode .btn-secondary,
body.dark-mode .stat-card,
body.dark-mode .tags-input-container,
body.dark-mode .suggestion-list,
body.dark-mode .header-row {
    background: #0a0a0a;
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .glass-table td {
    color: #cbd5e1;
    border-bottom: 1px solid #333;
}

body.dark-mode .suggestion-item:hover {
    background: #1e1e1e;
}

body.dark-mode .background-globes {
    opacity: 0.3;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
}

body {
    background: var(--bg-gradient);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Background Animation - Subtle shifting shapes */
.background-globes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;

    /* Default to none/hidden via JS, but keep base styles */
    /* background: url('assets/fundocast.png') repeat center center; */
    /* background-size: 150px; */
    opacity: 0.15;
    /* Subtle */
}

/* Layout & Views */
.view-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
    position: absolute;
    width: 100%;
}

.view-container.active {
    opacity: 1;
    pointer-events: all;
    position: relative;
}

.hidden {
    display: none !important;
}

/* Components */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);

    .logo-area img {
        max-width: 180px;
        margin-bottom: 1.5rem;
    }

    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
}

/* Toast System */
.toast {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-left: 5px solid var(--primary);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: slideInRight 0.3s ease-out forwards;
    min-width: 300px;
    font-weight: 500;
}

.toast.success {
    border-left-color: var(--success);
}

.toast.error {
    border-left-color: var(--danger);
}

.toast i {
    font-size: 1.5rem;
}

.toast.success i {
    color: var(--success);
}

.toast.error i {
    color: var(--danger);
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.btn-primary,
.btn-secondary,
.btn-small {
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary:active,
.btn-secondary:active,
.btn-small:active {
    transform: scale(0.95);
}

/* CSS Cleanup */

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 8px -1px rgba(79, 70, 229, 0.3);
}

.btn-secondary {
    background: white;
    color: var(--text);
    border: 1px solid #e2e8f0;
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.btn-small {
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
    border-radius: 8px;
}

.danger {
    background-color: #fee2e2;
    color: #b91c1c;
}

.danger:hover {
    background-color: #fecaca;
}

input,
select,
textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    margin-top: 0.5rem;
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    color: var(--text);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Login View */
#login-view {
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.8) 0%, transparent 100%);
}

#dashboard-view {
    justify-content: flex-start;
}

.login-card {
    width: 100%;
    max-width: 420px;
    text-align: center;
}

.logo-area {
    margin-bottom: 2.5rem;
}

.logo-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
    background: linear-gradient(135deg, var(--primary), #818cf8);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-card h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.login-subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.input-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.input-group label {
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
}

/* Dashboard */
.glass-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 5%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.nav-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-brand img {
    height: 160px;
    /* Increased from 120px */
}

.nav-links {
    display: flex;
    gap: 0.5rem;
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.6rem 1.2rem;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s;
}

.nav-btn:hover {
    color: var(--primary);
    background: #f0f9ff;
}

/* Notification Button Special Hover */
.notification-btn i {
    transition: transform 0.2s ease;
}

.notification-btn:hover i {
    transform: scale(1.1) rotate(15deg);
    color: var(--primary);
}

.nav-btn.active {
    color: var(--primary);
    background: #e0e7ff;
    font-weight: 600;
}

.content-area {
    padding: 3rem 2%;
    max-width: 1600px;
    /* Increased for wider tables */
    margin: 0 auto;
    width: 100%;
    flex: 1;
    /* Ensure content expands to push footer if needed */
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Forms */
.form-card {
    max-width: 900px;
    /* Wider form card */
    margin: 0 auto;
}

.card-header {
    margin-bottom: 2rem;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 1rem;
}

.card-header h2 {
    font-size: 1.5rem;
    color: var(--text);
}

.row {
    display: flex;
    gap: 1.5rem;
}

.row .input-group {
    flex: 1;
}

.large-btn {
    width: 100%;
    margin-top: 1.5rem;
    font-size: 1.1rem;
    padding: 1rem;
}

.readonly {
    background: #f1f5f9;
    color: var(--text-muted);
    border-color: #e2e8f0;
}

/* Result Box */
.result-box {
    margin-top: 2rem;
    padding: 2.5rem;
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 1px solid #a7f3d0;
    border-radius: 20px;
    text-align: center;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.big-number {
    display: block;
    font-size: 5rem;
    font-weight: 800;
    color: var(--success);
    margin: 1rem 0;
    line-height: 1;
    text-shadow: 0 2px 4px rgba(16, 185, 129, 0.1);
}

.number-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

#res-tipo {
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #047857;
    letter-spacing: 2px;
    background: rgba(255, 255, 255, 0.6);
    padding: 0.5rem 1.2rem;
    border-radius: 30px;
}

/* Table Section */
.wide-card {
    width: 100%;
    padding: 0;
    overflow: hidden;
    background: white;
    /* Ensure solid background for table */
    border: 1px solid #e2e8f0;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.header-row h2 {
    font-size: 1.25rem;
    color: var(--text);
    font-weight: 700;
}

.btn-icon-text {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: white;
    border: 1px solid #cbd5e1;
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon-text:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #f0f9ff;
}

.table-responsive {
    overflow-x: auto;
}

.glass-table {
    width: 100%;
    border-collapse: collapse;
}

.glass-table th {
    text-align: left;
    padding: 1rem 2rem;
    background: white;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #f1f5f9;
}

.glass-table td {
    padding: 1.25rem 2rem;
    /* More breathing room */
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    font-size: 0.95rem;
    vertical-align: middle;
}

.glass-table tr:hover {
    background: #f8fafc;
}

.glass-table tr:last-child td {
    border-bottom: none;
}

/* Status Badges */
.status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.status-ativo {
    background: #dcfce7;
    color: #15803d;
}

.status-cancelado {
    background: #fee2e2;
    color: #b91c1c;
}

/* Admin */
.inline-form {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.inline-form input,
.inline-form select {
    margin: 0;
    flex: 1;
    background: white;
}

.inline-form button {
    flex: 0 0 auto;
}

/* Utilities */
.error-msg {
    color: var(--danger);
    margin-top: 0.5rem;
    font-size: 0.9rem;
    text-align: left;
}

@media (max-width: 768px) {
    .row {
        flex-direction: column;
        gap: 0;
    }

    .glass-nav {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .nav-links {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        /* Allow wrapping on small screens */
    }

    .glass-table th,
    .glass-table td {
        padding: 0.75rem 1rem;
        /* Smaller padding on mobile */
    }
}

/* Stat Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.stat-card h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.stat-card .value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
}

/* Table Optimization */
.glass-table td.full-text {
    white-space: normal;
    max-width: none;
}

/* Config Lists */
.list-area ul {
    list-style: none;
    padding: 0;
    margin-top: 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.list-item {
    background: white;
    border: 1px solid #e2e8f0;
    padding: 1rem;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

.list-item span {
    font-weight: 500;
    color: var(--text);
}

.list-item-details {
    display: flex;
    flex-direction: column;
}

.list-item-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Components */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 24px;
    /* More rounded */
    padding: 2.5rem;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    /* Deeper shadow */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Custom Tags Input */
.tags-input-container {
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 0.5rem 2.5rem 0.5rem 0.5rem;
    /* Space for arrow */
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    min-height: 48px;
    position: relative;
    transition: all 0.2s;
    cursor: text;
    align-items: center;
}

.tags-input-container:hover {
    border-color: #94a3b8;
}

.tags-input-container:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
    /* Nicer ring */
}

.tags-input-arrow {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    cursor: pointer;
    font-size: 0.8rem;
    pointer-events: all;
    /* Ensure click */
    transition: color 0.2s;
}

.tags-input-arrow:hover {
    color: var(--primary);
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    color: #3730a3;
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.tag-close {
    cursor: pointer;
    font-weight: 800;
    font-size: 1rem;
    line-height: 1;
    color: #4338ca;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.tag-close:hover {
    opacity: 1;
}

.tags-input {
    border: none !important;
    box-shadow: none !important;
    flex: 1;
    min-width: 120px;
    padding: 0.25rem !important;
    margin: 0 !important;
    font-size: 1rem;
    background: transparent !important;
}

.suggestion-list {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    width: 100%;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.05);
    display: none;
    padding: 0.5rem;
}

.suggestion-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    transition: background 0.2s, color 0.2s;
    border-radius: 8px;
    /* Rounded items */
    margin-bottom: 2px;
}

.suggestion-item:hover {
    background: #f1f5f9;
    color: var(--primary);
}

.suggestion-item span {
    font-weight: 500;
}

.suggestion-item small {
    color: var(--text-muted);
}

/* Print Styles */
@media print {

    .glass-nav,
    .inline-form,
    .btn-icon-text,
    .btn-primary,
    .btn-secondary,
    .admin-only,
    #search-input,
    #search-type {
        display: none !important;
    }

    .view-container {
        position: static;
        opacity: 1;
        display: block;
    }

    .tab-content {
        display: block !important;
        /* Show content */
    }

    .glass-card {
        box-shadow: none;
        border: none;
        padding: 0;
    }

    .content-area {
        padding: 0;
        margin: 0;
    }

    body {
        background: white;
        color: black;
    }

    .glass-table th {
        background-color: #eee !important;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
}

/* Date Filter Styles */
.date-filter-wrapper {
    display: flex;
    align-items: center;
    gap: 5px;
    background: white;
    padding: 0 10px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
}

.date-filter-wrapper small {
    color: #888;
}

.date-filter-wrapper input[type="date"] {
    border: none;
    padding: 0.5rem 0;
    margin: 0;
    font-size: 0.9rem;
    background: transparent;
    box-shadow: none;
}

.date-filter-wrapper input[type="date"]:focus {
    box-shadow: none;
}

/* Dark Mode Overrides for Date Filter */
body.dark-mode .date-filter-wrapper {
    background: #0a0a0a;
    border-color: #333;
}

body.dark-mode .date-filter-wrapper small {
    color: #94a3b8;
}

/* Clickable Number Link */
.number-link {
    color: var(--primary);
    text-decoration: none;
    cursor: pointer;
    font-weight: 700;
    transition: color 0.2s;
    background: transparent;
    border: none;
    font-size: 1.1em;
    padding: 0;
}

.number-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

body.dark-mode .number-link {
    color: #818cf8;
}

body.dark-mode .number-link:hover {
    color: #a5b4fc;
}

/* Notifications */
.notification-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-right: 15px;
}

.notification-btn {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    position: relative;
}

.notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: #ef4444;
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    animation: bounce 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes bounce {
    0% {
        transform: scale(0);
    }

    100% {
        transform: scale(1);
    }
}

.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 300px;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    display: none;
    backdrop-filter: blur(16px);
    overflow: hidden;
}

.notification-dropdown.active {
    display: block;
    animation: fadeIn 0.2s ease-out;
}

.notification-header {
    padding: 10px 15px;
    border-bottom: 1px solid var(--glass-border);
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-list {
    max-height: 300px;
    overflow-y: auto;
}

.notification-item {
    padding: 10px 15px;
    border-bottom: 1px solid var(--glass-border);
    cursor: pointer;
    transition: background 0.2s;
    font-size: 0.9em;
}

.notification-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.notification-item .notif-title {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 3px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.notification-item .notif-meta {
    font-size: 0.8em;
    color: var(--text-muted);
}

.empty-notif {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
}

/* Philosophical Quote */
.philosophical-quote {
    font-size: 1.5rem;
    font-weight: 800;
    text-align: center;
    margin: 2rem 0;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 2px;
    padding: 1rem;
    border-top: 2px solid var(--glass-border);
    border-bottom: 2px solid var(--glass-border);
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.1), transparent);
}

body.dark-mode .philosophical-quote {
    color: #ffd700;
    /* Gold for dark mode */
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.1), transparent);
}

/* Simple Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    padding: 2rem;
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    color: var(--text);
    box-shadow: var(--shadow-lg);
}

.modal-content h3 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: var(--primary);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 1.5rem;
}

/* Compact Filters */
.filter-input-small {
    padding: 0.4rem;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
}

body.dark-mode .filter-input-small {
    background: rgba(0, 0, 0, 0.5);
    color: var(--text);
    border-color: #333;
}

/* Scrollbar for filter row */
::-webkit-scrollbar {
    height: 6px;
    width: 6px;
}

::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.5);
    border-radius: 3px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

/* Paper Editor Styles */
.paper-editor {
    background: white;
    padding: 40px;
    border: 1px solid #ddd;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-top: 10px;
    font-family: "Times New Roman", Times, serif;
    color: black;
    line-height: 1.5;
    border-radius: 4px;
}

.paper-header {
    display: flex;
    align-items: center;
    border-bottom: 2px solid black;
    padding-bottom: 10px;
    margin-bottom: 20px;
    gap: 15px;
}

.paper-header-text {
    text-align: right;
    width: 100%;
    font-weight: bold;
    font-size: 11pt;
}

.paper-title {
    text-align: center;
    font-weight: bold;
    font-size: 14pt;
    margin: 20px 0;
}

.paper-input {
    border: none;
    border-bottom: 1px dotted #999;
    padding: 0 5px;
    font-family: inherit;
    font-size: inherit;
    color: blue;
    /* Highlight input */
    background: rgba(0, 0, 0, 0.02);
    outline: none;
    text-align: center;
    font-weight: bold;
}

.paper-input:focus {
    background: rgba(255, 255, 0, 0.1);
    border-bottom: 1px solid blue;
}

.paper-input::placeholder {
    color: #ccc;
    font-weight: normal;
    font-size: 0.8em;
}

.paper-body {
    text-align: justify;
}

.paper-signature {
    text-align: center;
    margin-top: 40px;
    border-top: 1px solid black;
    width: 300px;
    margin-left: auto;
    margin-right: auto;
    padding-top: 5px;
}

/* Mobile Responsiveness (iPhone/Android) */
@media (max-width: 768px) {
    .content-area {
        padding: 1rem 0.5rem;
    }

    .glass-nav {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.8rem;
    }

    .nav-brand img {
        height: 60px;
        /* Smaller logo on mobile */
    }

    .nav-links {
        width: 100%;
        overflow-x: auto;
        display: flex;
        gap: 0.5rem;
        padding-bottom: 10px;
        -webkit-overflow-scrolling: touch;
        border-bottom: 1px solid var(--glass-border);
    }

    .nav-btn {
        flex: 0 0 auto;
        font-size: 0.85rem;
        padding: 0.5rem 1rem;
    }

    .nav-user {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        /* Center items on mobile */
        gap: 15px;
        margin-top: 1rem;
        font-size: 0.9rem;
        flex-wrap: nowrap;
        /* Prevent wrapping */
    }

    .glass-card {
        padding: 1.5rem 1rem;
        border-radius: 12px;
    }

    .header-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 1rem;
    }

    .header-row>div {
        width: 100%;
        overflow-x: auto;
    }

    /* Filters on mobile */
    .filter-input-small {
        min-width: 100px;
    }

    /* Paper Editor Mobile - Maintain Flow */
    .paper-editor {
        padding: 20px 15px;
        font-size: 0.9rem;
        overflow-x: auto;
        /* Allow scroll if paper is too wide */
    }

    .paper-header {
        flex-direction: column;
        text-align: center;
    }

    .paper-header img {
        height: 60px !important;
        margin-bottom: 5px;
    }

    .paper-header-text {
        text-align: center;
        font-size: 0.9rem;
    }

    .paper-input {
        width: auto !important;
        /* Allow inline flow */
        min-width: 50px;
        max-width: 100%;
        display: inline-block;
    }

    /* Stack form groups but keep internal layout if simple */
    .row {
        flex-direction: column;
    }

    .input-group {
        width: 100%;
    }
}

/* Toast Notifications */
.toast {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    transform: translateX(0);
    animation: slideInRight 0.3s ease-out forwards;
    cursor: pointer;
    font-weight: 500;
    color: #1e293b;
    /* Dark text for light mode */
    z-index: 10001;
    border-left: 4px solid transparent;
    /* Placeholder */
}

.toast i {
    font-size: 1.25rem;
}

.toast.success {
    border-left-color: var(--primary);
}

.toast.success i {
    color: var(--primary);
}

.toast.error {
    border-left-color: var(--danger);
}

.toast.error i {
    color: var(--danger);
}

.toast.info {
    border-left-color: #3b82f6;
}

.toast.info i {
    color: #3b82f6;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOutRight {
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Dark Mode Toasts - High Contrast */
body.dark-mode .toast {
    background: #1e293b;
    /* Deep slate */
    color: #f1f5f9;
    /* Light text */
    border: 1px solid #334155;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

/* Document Type Colors (Badges/Text) */
.type-badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.8rem;
    display: inline-block;
}

.type-portaria {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.type-decreto {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.type-oficio {
    color: #eab308;
    background: rgba(234, 179, 8, 0.1);
    border: 1px solid rgba(234, 179, 8, 0.2);
}

/* Rich Notification Card */
.notification-card {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.15);
    padding: 1.2rem;
    width: 300px;
    /* Position is handled by container now */
    position: relative;
    font-family: 'Outfit', sans-serif;
    border: 1px solid rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(10px);
    overflow: hidden;
}

body.dark-mode .notification-card {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
}

.notif-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--text-muted);
}

.notif-body {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 0.5rem;
}

.notif-badge {
    background: #3b82f6;
    color: white;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: bold;
}

.notif-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
}

.notif-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

@keyframes slideInTop {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Skeleton Loader */
.skeleton {
    background-color: #e2e8f0;
    border-radius: 4px;
    animation: pulse 1.5s infinite ease-in-out;
}

body.dark-mode .skeleton {
    background-color: #334155;
}

@keyframes pulse {
    0% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.6;
    }
}

.skeleton-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

body.dark-mode .toast.success {
    border-left-color: #4ade80;
}

body.dark-mode .toast.success i {
    color: #4ade80;
}

body.dark-mode .toast.error {
    border-left-color: #f87171;
}

body.dark-mode .toast.error i {
    color: #f87171;
}

body.dark-mode .toast.info {
    border-left-color: #60a5fa;
}

/* Notification Badge & Dropdown */
.notification-container {
    position: relative;
    margin: 0 5px;
}

/* Weather Widget */
.weather-widget {
    background: rgba(255, 255, 255, 0.15) !important;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
    cursor: default;
    color: var(--text-main);
    /* Ensure visibility in dark/light mode */
}

.weather-widget:hover {
    background: rgba(255, 255, 255, 0.25) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.weather-widget i {
    color: var(--primary);
}

.notification-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    position: relative;
    color: var(--text);
    padding: 5px;
}

/* Social Bubbles (Background) */
#social-bubbles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    /* Behind main content (which usually has relative/z-index) */
    pointer-events: none;
    /* Don't block clicks */
    overflow: hidden;
}

.social-bubble {
    position: absolute;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    opacity: 0.6;
    border: 2px solid rgba(255, 255, 255, 0.4);
    transition: transform 0.3s ease;
    animation: floatBubble 25s infinite ease-in-out;
}

@keyframes floatBubble {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }

    33% {
        transform: translate(30px, -50px) rotate(10deg);
    }

    66% {
        transform: translate(-20px, 20px) rotate(-5deg);
    }

    100% {
        transform: translate(0, 0) rotate(0deg);
    }
}

/* Ensure Main Content stays on top */
.view-container {
    position: relative;
    z-index: 10;
}

.glass-card,
.login-card {
    position: relative;
    z-index: 1;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

.toggle-switch input:checked+.toggle-slider {
    background-color: var(--primary);
}

.toggle-switch input:checked+.toggle-slider:before {
    transform: translateX(24px);
}

/* Rain Container */
#rain-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
    display: none;
    /* Hidden by default */
}

#rain-container.active {
    display: block;
}

/* Weather Effects Container (legacy) */
#weather-effects-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    /* Above bubbles (0) but below content (100) */
    pointer-events: none;
    overflow: hidden;
}

/* Rain Effect */
.raindrop {
    position: absolute;
    width: 2px;
    height: 50px;
    background: linear-gradient(to bottom, transparent, rgba(174, 194, 224, 0.5));
    animation: fall linear infinite;
}

@keyframes fall {
    to {
        transform: translateY(100vh);
    }
}

/* Wind Effect (stronger bubble movement) */
.windy .social-bubble {
    animation-duration: 10s !important;
}

@keyframes floatBubbleWindy {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }

    25% {
        transform: translate(60px, -30px) rotate(15deg);
    }

    50% {
        transform: translate(-40px, 40px) rotate(-10deg);
    }

    75% {
        transform: translate(50px, -20px) rotate(8deg);
    }

    100% {
        transform: translate(0, 0) rotate(0deg);
    }
}

/* Notification Dropdown Styles */
.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    width: 350px;
    max-height: 400px;
    overflow-y: auto;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 9999 !important;
    /* Above everything */
}

.notification-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.notification-header {
    padding: 1rem;
    border-bottom: 1px solid var(--glass-border);
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-list {
    padding: 0.5rem;
}

.notification-item {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    position: relative;
    transition: background 0.2s;
}

.notification-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

.notification-container {
    position: relative;
    z-index: 9999 !important;
    /* Ensure container is also high */
}

/* Wallpaper Preview Items */
.wallpaper-item {
    aspect-ratio: 16/9;
    background-size: cover;
    background-position: center;
    border-radius: 8px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s ease;
    position: relative;
}

.wallpaper-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.wallpaper-item.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.wallpaper-item.active::after {
    content: '✓';
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--primary);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    padding: 2px 5px;
    border-radius: 10px;
    font-weight: bold;
    min-width: 18px;
    text-align: center;
}

.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 320px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.2);
    display: none;
    z-index: 2000;
    overflow: hidden;
    margin-top: 10px;
}

body.dark-mode .notification-dropdown {
    background: rgba(30, 41, 59, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
}

.notification-dropdown.active {
    display: block;
    animation: slideUpFade 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.notification-header {
    padding: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(var(--primary-rgb), 0.05);
}

.notification-list {
    max-height: 350px;
    overflow-y: auto;
    padding: 0.5rem;
}

.notification-item {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 10px;
    margin-bottom: 8px;
    padding: 10px 10px 10px 0;
    /* Left padding 0 for the colored bar */
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

body.dark-mode .notification-item {
    background: rgba(255, 255, 255, 0.05);
}

.notification-item:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

body.dark-mode .notification-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.empty-notif {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}