:root{
    --bg: #f5f7fb;
    --card: rgba(255,255,255,0.82);
    --card-border: rgba(255,255,255,0.65);
    --text: #111827;
    --muted: #6b7280;
    --primary: #111827;
    --primary-hover: #1f2937;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #d97706;
    --shadow: 0 10px 30px rgba(17, 24, 39, 0.08);
    --radius: 22px;
}

*{
    box-sizing: border-box;
}

html, body{
    margin: 0;
    padding: 0;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
    color: var(--text);
}

a{
    color: inherit;
    text-decoration: none;
}

.container{
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 20px;
}

.auth-wrap{
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-card{
    width: 100%;
    max-width: 430px;
    background: var(--card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow);
    border-radius: var(--radius);
    padding: 28px;
}

.brand{
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
}

.brand-badge{
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

.brand h1{
    font-size: 22px;
    margin: 0;
    line-height: 1.2;
}

.brand p{
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.form-group{
    margin-bottom: 16px;
}

.form-grid{
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 16px;
}

.col-12{ grid-column: span 12; }
.col-6{ grid-column: span 12; }
.col-4{ grid-column: span 12; }

@media (min-width: 768px){
    .col-6{ grid-column: span 6; }
    .col-4{ grid-column: span 4; }
}

label{
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

.input,
.select,
.textarea{
    width: 100%;
    border: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 14px;
    padding: 14px 15px;
    font-size: 15px;
    outline: none;
    transition: 0.2s ease;
}

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

.input:focus,
.select:focus,
.textarea:focus{
    border-color: #c7d2fe;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.08);
}

.btn{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 14px;
    padding: 14px 18px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s ease;
}

.btn-full{
    width: 100%;
}

.btn-primary{
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover{
    background: var(--primary-hover);
}

.btn-light{
    background: #fff;
    color: var(--text);
    border: 1px solid #e5e7eb;
}

.btn-light:hover{
    background: #f9fafb;
}

.alert{
    border-radius: 14px;
    padding: 12px 14px;
    font-size: 14px;
    margin-bottom: 16px;
}

.alert-danger{
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

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

.alert-warning{
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

.app-shell{
    display: flex;
    min-height: 100vh;
}

.sidebar{
    width: 280px;
    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(12px);
    border-right: 1px solid rgba(229,231,235,0.85);
    padding: 22px 18px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-brand{
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
}

.sidebar-brand-title{
    font-weight: 800;
    font-size: 18px;
}

.sidebar-brand-subtitle{
    font-size: 13px;
    color: var(--muted);
    margin-top: 4px;
}

.sidebar-nav{
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-link{
    padding: 12px 14px;
    border-radius: 14px;
    font-weight: 600;
    color: #374151;
    transition: 0.2s ease;
}

.nav-link:hover{
    background: rgba(17,24,39,0.05);
}

.nav-link.active{
    background: #111827;
    color: #fff;
}

.main-content{
    flex: 1;
    padding: 22px;
    min-width: 0;
}

.topbar{
    backdrop-filter: blur(10px);
    background: rgba(255,255,255,0.75);
    border: 1px solid rgba(229,231,235,0.85);
    border-radius: 24px;
    margin-bottom: 22px;
}

.topbar-inner{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 16px 20px;
}

.topbar-left{
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-title{
    font-size: 20px;
    font-weight: 800;
    margin: 0;
}

.topbar-subtitle{
    font-size: 13px;
    color: var(--muted);
    margin-top: 2px;
}

.user-chip{
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    padding: 10px 14px;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.grid{
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 20px;
}

.card{
    grid-column: span 12;
    background: rgba(255,255,255,0.86);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.7);
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: 22px;
}

.card h2{
    margin: 0 0 8px;
    font-size: 20px;
}

.card p{
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.kpi{
    grid-column: span 12;
    background: rgba(255,255,255,0.9);
    border-radius: 24px;
    padding: 22px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255,255,255,0.75);
}

.kpi-label{
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 8px;
}

.kpi-value{
    font-size: 28px;
    font-weight: 800;
}

.quick-links{
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-top: 18px;
}

.quick-link{
    background: #fff;
    border: 1px solid #eef2f7;
    border-radius: 18px;
    padding: 16px;
    transition: 0.2s ease;
}

.quick-link:hover{
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.05);
}

.quick-link strong{
    display: block;
    margin-bottom: 6px;
    font-size: 15px;
}

.quick-link span{
    color: var(--muted);
    font-size: 13px;
}

.logout-link{
    color: var(--danger);
    font-weight: 700;
}

.page-head{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.page-head h1{
    margin: 0;
    font-size: 28px;
}

.page-head p{
    margin: 6px 0 0;
    color: var(--muted);
}

.table-wrap{
    width: 100%;
    overflow-x: auto;
}

.table{
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 850px;
}

.table th,
.table td{
    text-align: left;
    padding: 14px 14px;
    border-bottom: 1px solid #eef2f7;
    vertical-align: middle;
    font-size: 14px;
}

.table th{
    color: var(--muted);
    font-weight: 700;
    font-size: 13px;
}

.badge{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.badge-success{
    background: #ecfdf5;
    color: #166534;
}

.badge-danger{
    background: #fef2f2;
    color: #991b1b;
}

.badge-warning{
    background: #fffbeb;
    color: #92400e;
}

.badge-dark{
    background: #f3f4f6;
    color: #111827;
}

.actions{
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.action-link{
    font-size: 13px;
    font-weight: 700;
    color: #111827;
}

.section-title{
    margin: 0 0 18px;
    font-size: 20px;
    font-weight: 800;
}

.helper-text{
    margin-top: 8px;
    color: var(--muted);
    font-size: 13px;
}

@media (min-width: 768px){
    .kpi.span-4{
        grid-column: span 4;
    }

    .card.span-8{
        grid-column: span 8;
    }

    .card.span-4{
        grid-column: span 4;
    }
}

@media (max-width: 991px){
    .app-shell{
        display: block;
    }

    .sidebar{
        width: 100%;
        height: auto;
        position: relative;
        border-right: 0;
        border-bottom: 1px solid rgba(229,231,235,0.85);
    }

    .main-content{
        padding: 16px;
    }
}

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

    .quick-links{
        grid-template-columns: 1fr;
    }

    .auth-card{
        padding: 22px;
    }

    .page-head h1{
        font-size: 24px;
    }

    .btn-mobile-full{
        width: 100%;
    }
}