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

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f5f5f7;
    color: #111827;
}

a {
    color: #2563eb;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.topbar {
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: #2563eb;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.brand-title {
    font-weight: 600;
    font-size: 0.9rem;
}

.brand-subtitle {
    font-size: 0.75rem;
    color: #6b7280;
}

.nav {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.nav-link {
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    font-size: 0.85rem;
    color: #374151;
    border: 1px solid transparent;
}

.nav-link:hover {
    background: #f3f4f6;
    text-decoration: none;
}

.nav-link.active {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

.page {
    max-width: 960px;
    margin: 1.25rem auto 2.5rem;
    padding: 0 1rem;
    display: grid;
    gap: 1rem;
}

.card {
    background: #ffffff;
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
    padding: 1rem 1.2rem;
    box-shadow: 0 8px 12px rgba(15, 23, 42, 0.03);
}

.card-header {
    margin-bottom: 0.5rem;
}

.card-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
}

.card-subtitle {
    margin: 0.2rem 0 0;
    font-size: 0.85rem;
    color: #6b7280;
}

.grid {
    display: grid;
    gap: 0.75rem;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.field {
    display: grid;
    gap: 0.25rem;
}

.field label {
    font-size: 0.85rem;
    font-weight: 500;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
textarea,
select {
    width: 100%;
    border-radius: 0.5rem;
    border: 1px solid #d1d5db;
    padding: 0.5rem 0.6rem;
    font: inherit;
}

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

input:focus,
textarea:focus,
select:focus {
    outline: 2px solid #2563eb;
    outline-offset: 1px;
    border-color: #2563eb;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    padding: 0.5rem 0.9rem;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid transparent;
    cursor: pointer;
    background: #2563eb;
    color: #ffffff;
}

.btn:hover {
    background: #1d4ed8;
}

.btn-secondary {
    background: #ffffff;
    color: #111827;
    border-color: #d1d5db;
}

.btn-secondary:hover {
    background: #f3f4f6;
}

.btn-danger {
    background: #dc2626;
}

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.15rem 0.5rem;
    font-size: 0.75rem;
    background: #eff6ff;
    color: #1d4ed8;
}

.text-muted {
    font-size: 0.8rem;
    color: #6b7280;
}

.footer {
    border-top: 1px solid #e5e7eb;
    padding: 0.75rem 1rem 1.5rem;
    text-align: center;
    font-size: 0.8rem;
    color: #6b7280;
}

/* Calendar */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.35rem;
    font-size: 0.8rem;
}

.calendar-day {
    min-height: 60px;
    padding: 0.35rem;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.calendar-day-header {
    font-weight: 600;
    color: #6b7280;
}

.calendar-day-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.calendar-day-link:hover .calendar-day {
    border-color: #2563eb;
}

.calendar-day-significant {
    border-color: #f97316;
    background: #fff7ed;
}

/* Auth page */
.auth-container {
    max-width: 420px;
    margin: 3rem auto;
    padding: 0 1rem;
}

.auth-header {
    margin-bottom: 1rem;
}

.auth-title {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
}

.auth-subtitle {
    margin: 0.25rem 0 0;
    font-size: 0.9rem;
    color: #6b7280;
}

.alert {
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.alert-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #ecfdf3;
    color: #166534;
    border: 1px solid #bbf7d0;
}

@media (max-width: 640px) {
    .topbar-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .nav {
        width: 100%;
        justify-content: flex-start;
        overflow-x: auto;
    }
}
.floating-export {
    position: fixed;
    right: 0;
    top: 40%;
    background: #2563eb;
    color: white;
    padding: 0.6rem 1rem;
    border-radius: 8px 0 0 8px;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    z-index: 2000;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    transition: background 0.2s, transform 0.2s;
}

.floating-export:hover {
    background: #1d4ed8;
    transform: translateX(-3px);
}
/* ----------------------------------------------------- */
/* EXPORT MODAL / POP-OUT PANEL                           */
/* ----------------------------------------------------- */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0; 
    left: 0;
    width: 100%; 
    height: 100%;
    background: rgba(0,0,0,0.35);
    backdrop-filter: blur(2px);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

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

.modal-content {
    background: #ffffff;
    padding: 1.5rem;
    border-radius: 0.75rem;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
}

.export-grid {
    display: grid;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.export-range {
    display: grid;
    gap: 0.5rem;
    grid-template-columns: 1fr 1fr auto;
    align-items: center;
}
