:root {
    --primary:       #1a56db;
    --primary-dark:  #1241a8;
    --primary-light: #e8effe;
    --success:       #16a34a;
    --warning:       #d97706;
    --danger:        #dc2626;
    --surface:       #ffffff;
    --surface-2:     #f8fafc;
    --border:        #e2e8f0;
    --text:          #0f172a;
    --text-muted:    #64748b;
    --header-h:      56px;
    --bottom-nav-h:  60px;
    --radius:        10px;
    --shadow-sm:     0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
    --shadow-md:     0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.05);
    --font:          'DM Sans', sans-serif;
    --transition:    220ms cubic-bezier(.4,0,.2,1);
}

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

body.app-body {
    font-family: var(--font);
    background: var(--surface-2);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

/* HEADER (mobile + desktop top bar) */
.app-header {
    height: var(--header-h);
    background: var(--surface) !important;
    border-bottom: 1px solid var(--border) !important;
    box-shadow: var(--shadow-sm);
}

.app-header .navbar-brand {
    font-weight: 700;
    font-size: .95rem;
    color: var(--text) !important;
    display: flex;
    align-items: center;
    gap: .5rem;
    white-space: nowrap;
}

@media (max-width: 380px) {
    .app-header .navbar-brand {
        font-size: .8rem;
    }
}

.app-header .brand-icon {
    width: 28px;
    height: 28px;
    background: var(--primary);
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.app-header .navbar-nav .nav-link {
    font-size: .85rem;
    font-weight: 500;
    color: var(--text-muted);
    border-radius: 7px;
    padding: .4rem .75rem !important;
    transition: background var(--transition), color var(--transition);
}

.app-header .navbar-nav .nav-link:hover,
.app-header .navbar-nav .nav-link.active {
    background: var(--primary-light);
    color: var(--primary);
}

.app-header .navbar-nav .nav-link.disabled {
    color: #cbd5e1;
}

.app-header .navbar-nav .nav-link.disabled:hover {
    background: none;
}

.btn-nav-logout {
    font-size: .8rem;
    font-weight: 600;
    border: 1.5px solid var(--border);
    border-radius: 7px;
    padding: .3rem .85rem;
    color: var(--text);
    background: transparent;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.btn-nav-logout:hover {
    background: var(--surface-2);
    border-color: var(--primary);
    color: var(--primary);
}

/* MAIN CONTENT */
.app-main--shell {
    max-width: 640px;
    margin: 0 auto;
}

@media (max-width: 767.98px) {
    .app-main--shell {
        padding-bottom: calc(var(--bottom-nav-h) + 1rem);
    }
}

/* PAGE HEADER */
.page-header {
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: .15rem;
}

.page-header .text-muted {
    font-size: .85rem;
}

/* BOTTOM NAV (mobile only) */
.app-bottom-nav {
    height: var(--bottom-nav-h);
    background: var(--surface) !important;
    border-top: 1px solid var(--border) !important;
    box-shadow: 0 -2px 8px rgba(0,0,0,.04);
    padding: 0 !important;
}

.app-bottom-nav .nav-link {
    min-height: var(--bottom-nav-h);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .15rem;
    font-size: .68rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: color var(--transition);
}

.app-bottom-nav .nav-link svg { flex-shrink: 0; }

.app-bottom-nav .nav-link.active {
    color: var(--primary);
}

.app-bottom-nav .nav-link.disabled {
    color: #cbd5e1;
}

/* CARDS */
.card {
    border: 1px solid var(--border) !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow-sm) !important;
    background: var(--surface);
}

/* BUTTONS */
.btn {
    font-weight: 600;
    font-size: .85rem;
    border-radius: 7px;
    transition: all var(--transition);
}

.btn-lg { font-size: .92rem; padding: .7rem 1rem; }

.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: #fff; }
.btn-outline-secondary { color: var(--text-muted); border-color: var(--border); }
.btn-outline-secondary:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }

/* FORM CONTROLS */
.form-control, .form-select {
    border-color: var(--border);
    border-radius: 7px;
    font-size: .9rem;
    color: var(--text);
    font-family: var(--font);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,86,219,.12);
}

.form-label {
    font-size: .82rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: .35rem;
}

/* input with a leading icon, used on auth pages */
.input-icon-group { position: relative; }

.input-icon-group .input-icon {
    position: absolute;
    left: .75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    display: flex;
    pointer-events: none;
}

.input-icon-group .form-control { padding-left: 2.3rem; }

/* ALERTS */
.alert { border-radius: var(--radius); font-size: .875rem; }
.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert-danger  { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.alert-info    { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }

/* BADGES */
.badge { font-size: .7rem; font-weight: 600; padding: .3em .65em; border-radius: 5px; }
.badge.text-bg-light { background: var(--surface-2) !important; color: var(--text-muted) !important; }

/* AUTH CARD (login / cadastro / password reset) */
.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    padding: 1rem;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    border-radius: 16px !important;
    overflow: hidden;
}

.auth-card .auth-card-header {
    background: var(--primary);
    padding: 2rem 1.75rem 1.75rem;
    text-align: center;
}

.auth-card .auth-card-icon {
    width: 52px;
    height: 52px;
    background: rgba(255,255,255,.15);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto .9rem;
}

.auth-card .auth-card-title {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: .2rem;
}

.auth-card .auth-card-subtitle {
    color: rgba(255,255,255,.7);
    font-size: .8rem;
}

.auth-card .card-body { padding: 1.75rem; }

.auth-card .auth-card-footer {
    padding: .9rem 1.75rem;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: .8rem;
    color: var(--text-muted);
}

.auth-card .auth-card-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}
