:root {
    --primary: #6366f1;
    --primary-dark: #4338ca;
    --primary-light: #818cf8;
    --secondary: #ec4899;
    --accent: #f43f5e;
    --bg: #f8fafc;
    --vibrant-gradient: linear-gradient(135deg, #6366f1 0%, #ec4899 50%, #f43f5e 100%);
    --bg-gradient: linear-gradient(135deg, #e0e7ff 0%, #fce7f3 50%, #ffe4e6 100%);
    --surface: rgba(255, 255, 255, 0.9);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: rgba(226, 232, 240, 0.8);
    --depth-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --soft-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --inset-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
    --radius-lg: 20px;
    --radius-md: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-gradient);
    color: var(--text-main);
    overflow-x: hidden;
    min-height: 100vh;
}

#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    background: var(--surface);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.05);
}

/* Glassmorphism Classes */
.glass {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

/* Header */
.main-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 16px 20px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.branding {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-box {
    background: var(--vibrant-gradient);
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.icon-white {
    color: white;
    width: 20px;
    height: 20px;
}

h1 {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.1;
}

.status-indicator {
    font-size: 0.7rem;
    color: #10b981;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
}

.pulse {
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse-animation 2s infinite;
}

@keyframes pulse-animation {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.header-btn {
    background: var(--bg);
    border: none;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    box-shadow: var(--soft-shadow);
    cursor: pointer;
}

/* View Container */
.view-container {
    flex: 1;
    padding: 20px;
    padding-bottom: 90px;
}

.view-title {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 24px;
}

/* Cards & Forms (Depth Effects) */
.glass-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--depth-shadow);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.section-title {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    margin-left: 4px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    width: 18px;
    height: 18px;
}

.form-input {
    width: 100%;
    padding: 14px;
    padding-left: 44px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #f8fafc;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-main);
    box-shadow: var(--inset-shadow);
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-light);
    background: white;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Calculation Result Box */
.calc-preview {
    background: var(--vibrant-gradient);
    border-radius: var(--radius-md);
    padding: 16px;
    color: white;
    display: flex;
    justify-content: space-around;
    margin: 10px 0 20px;
    box-shadow: 0 10px 20px -10px rgba(236, 72, 153, 0.4);
}

.calc-item {
    text-align: center;
}

.calc-val {
    display: block;
    font-size: 1.4rem;
    font-weight: 800;
}

.calc-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 600;
    opacity: 0.9;
}

/* Button */
.btn-primary {
    width: 100%;
    padding: 16px;
    border-radius: var(--radius-md);
    background: var(--vibrant-gradient);
    color: white;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 8px 20px -6px rgba(99, 102, 241, 0.5);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-primary:active {
    transform: scale(0.96);
    filter: brightness(0.9);
}

/* Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 600px;
    display: flex;
    justify-content: space-around;
    padding: 12px 10px 30px;
    z-index: 1000;
    border-top: 1px solid var(--border);
}

@media (max-width: 600px) {

    #app,
    .bottom-nav {
        width: 100%;
    }
}

.nav-item {
    background: none;
    border: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    width: 20%;
    transition: all 0.3s ease;
}

.nav-item i {
    width: 22px;
    height: 22px;
}

.nav-item span {
    font-size: 0.7rem;
    font-weight: 600;
}

.nav-item.active {
    color: var(--primary);
}

.nav-item:active {
    transform: scale(0.9);
    opacity: 0.7;
}

.nav-item.active i {
    transform: translateY(-4px);
    stroke-width: 2.5px;
}

/* History Cards */
.record-card {
    background: white;
    border-radius: var(--radius-md);
    padding: 18px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    box-shadow: var(--soft-shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.card-left h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
}

.card-left p {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}

.card-right {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.card-hours {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-muted);
}

.card-extras {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--accent);
    display: block;
}

.card-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.action-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg);
    color: var(--text-muted);
    box-shadow: var(--soft-shadow);
}

.action-btn i {
    width: 16px;
    height: 16px;
}

.action-btn.view {
    color: var(--primary);
    background: #eef2ff;
}

.action-btn.edit {
    color: #0891b2;
    background: #ecfeff;
}

.action-btn.delete {
    color: var(--accent);
    background: #fff1f2;
}

.action-btn:active {
    transform: scale(0.85);
    background: #e2e8f0;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-card {
    width: 100%;
    max-width: 450px;
    animation: modal-up 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modal-up {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h3 {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-main);
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px;
}

/* Calendar Grid */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    text-align: center;
}

.cal-day-name {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    padding-bottom: 8px;
}

.cal-day {
    aspect-ratio: 1;
    background: var(--bg);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: #000;
    position: relative;
    border: 1px solid transparent;
}

.cal-day.has-data {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.1) 0%, rgba(244, 63, 94, 0.05) 100%);
    border-color: transparent;
    box-shadow: none;
}

.cal-dot {
    position: absolute;
    bottom: 6px;
    width: 4px;
    height: 4px;
    background: var(--primary);
    border-radius: 50%;
}

.cal-route-text {
    font-size: 0.55rem;
    color: #000;
    position: absolute;
    bottom: 6px;
    max-width: 90%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 800;
}

/* Loader */
.loader-overlay {
    position: fixed;
    inset: 0;
    background: white;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--primary-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Utility */
.hidden {
    display: none !important;
}

/* Collapsible History Groups */
.month-group {
    margin-bottom: 20px;
}

.month-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background: white;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--soft-shadow);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    user-select: none;
    margin-top: 10px;
}

.month-header:active {
    transform: scale(0.98);
}

.month-header h3 {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary);
    margin: 0;
}

.month-header .chevron {
    transition: transform 0.3s ease;
    color: var(--text-muted);
}

.month-group.active .chevron {
    transform: rotate(180deg);
}

.month-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    opacity: 0;
    margin-top: 10px;
}

.month-group.active .month-content {
    max-height: 2000px;
    /* Large enough for many records */
    opacity: 1;
}

/* Inset inputs logic */
.inset-box {
    box-shadow: var(--inset-shadow);
    border: 1px solid var(--border);
    background: #f8fafc;
}