:root {
    --primary: #B3261E;
    --on-primary: #FFFFFF;
    --primary-container: #F9DEDC;
    --on-primary-container: #410E0B;
    --secondary: #775652;
    --background: #FFFBFF;
    --on-background: #201A19;
    --surface: #FFFBFF;
    --on-surface: #201A19;
    --surface-variant: #F4DDDA;
    --on-surface-variant: #534341;
    --outline: #857370;
    --error: #B3261E;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Roboto', sans-serif;
}

body {
    background-image: url('app_background.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: var(--on-background);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
nav {
    width: 280px;
    background-color: var(--surface-variant);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: width 0.3s;
}

nav.collapsed {
    width: 80px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-radius: 24px;
    cursor: pointer;
    color: var(--on-surface-variant);
    text-decoration: none;
    transition: background 0.2s;
}

.nav-item:hover {
    background-color: rgba(0,0,0,0.05);
}

.nav-item.active {
    background-color: var(--secondary-container);
    color: var(--on-secondary-container);
    font-weight: 500;
}

.nav-item i {
    margin-right: 12px;
    width: 24px;
    text-align: center;
}

.nav-logo {
    width: 40px;
    height: 40px;
    border-radius: 8px;
}

.login-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 16px;
    border-radius: 16px;
}

/* Main Content Area */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

header {
    height: 64px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--surface);
    border-bottom: 1px solid var(--outline);
}

.view-container {
    padding: 24px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Cards & Elements */
.card {
    background-color: var(--surface);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid var(--outline);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.btn-primary {
    background-color: var(--primary);
    color: var(--on-primary);
    border: none;
    padding: 10px 24px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
}

.btn-primary:hover {
    opacity: 0.9;
}

/* Map Container */
#map {
    height: 400px;
    width: 100%;
    border-radius: 12px;
    margin-bottom: 16px;
    z-index: 1;
}

/* Auth Overlay */
#auth-overlay {
    position: fixed;
    inset: 0;
    background: var(--background);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 32px;
    text-align: center;
}

input {
    width: 100%;
    padding: 12px;
    margin: 8px 0;
    border: 1px solid var(--outline);
    border-radius: 8px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    background: var(--surface);
    width: 90%;
    max-width: 500px;
    padding: 24px;
    border-radius: 12px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

.btn-text {
    background: none;
    border: none;
    padding: 10px 16px;
    cursor: pointer;
    color: var(--primary);
    font-weight: 500;
}

/* Checkpoint List */
.checkpoint-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--outline);
    gap: 12px;
}

.checkpoint-item:last-child {
    border-bottom: none;
}

.seq-badge {
    background: var(--primary-container);
    color: var(--on-primary-container);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.9rem;
    color: var(--on-surface-variant);
}

select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--outline);
    border-radius: 8px;
    background: var(--surface);
}

/* Alerts */
.alert-card {
    padding: 12px;
    border-left: 4px solid var(--primary);
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
}

.alert-card:hover {
    background: var(--surface-variant);
}

.alert-dismiss {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 1.2rem;
    color: var(--outline);
    background: none;
    border: none;
    cursor: pointer;
}

.alert-dismiss:hover {
    color: var(--primary);
}

/* Filter Bar */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    background: var(--primary-container);
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-group label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--on-primary-container);
}

.filter-bar select, .filter-bar input {
    padding: 8px;
    border: 1px solid var(--outline);
    border-radius: 8px;
    background: var(--surface);
    min-width: 150px;
}

.filter-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
}

/* Responsive */
@media (max-width: 768px) {
    nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100% !important;
        height: 64px;
        flex-direction: row;
        justify-content: space-around;
        padding: 0;
        z-index: 100;
    }
    .nav-item {
        flex-direction: column;
        padding: 8px;
        border-radius: 0;
    }
    .nav-item i { margin: 0; }
    .nav-item span { font-size: 10px; }
    main { padding-bottom: 64px; }
}
