:root{
    --green:#14532d;
    --green-2:#166534;
    --green-3:#22c55e;
    --bg:#f3f4f6;
    --card:#ffffff;
    --text:#111827;
    --muted:#6b7280;
    --border:#e5e7eb;
    --shadow:0 12px 35px rgba(15,23,42,.08);
}

*{box-sizing:border-box}

body{
    margin:0;
    font-family:Arial,Helvetica,sans-serif;
    background:var(--bg);
    color:var(--text);
}

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

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

.sidebar{
    width:270px;
    background:#0f3d23;
    color:white;
    padding:20px 16px;
    position:fixed;
    inset:0 auto 0 0;
    overflow-y:auto;
    transition:.25s ease;
    z-index:50;
}

.sidebar-brand{
    display:flex;
    align-items:center;
    gap:12px;
    padding:8px 8px 22px;
    border-bottom:1px solid rgba(255,255,255,.12);
    margin-bottom:18px;
}

.brand-logo{
    width:44px;
    height:44px;
    border-radius:14px;
    display:grid;
    place-items:center;
    background:linear-gradient(135deg,var(--green-3),#bbf7d0);
    color:#052e16;
    font-weight:900;
}

.sidebar-brand strong{
    display:block;
    font-size:16px;
}

.sidebar-brand span{
    display:block;
    font-size:12px;
    opacity:.75;
    margin-top:3px;
}

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

.sidebar-nav a{
    display:flex;
    align-items:center;
    gap:12px;
    padding:12px 13px;
    border-radius:12px;
    color:rgba(255,255,255,.82);
    font-size:14px;
}

.sidebar-nav a:hover,
.sidebar-nav a.active{
    background:rgba(255,255,255,.12);
    color:white;
}

.sidebar-nav span{
    width:22px;
    text-align:center;
}

.sidebar-nav em{
    font-style:normal;
}

.main{
    margin-left:270px;
    width:calc(100% - 270px);
    min-height:100vh;
    display:flex;
    flex-direction:column;
}

.topbar{
    min-height:78px;
    background:white;
    border-bottom:1px solid var(--border);
    padding:14px 26px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:18px;
    position:sticky;
    top:0;
    z-index:20;
}

.topbar h1{
    margin:0;
    font-size:22px;
}

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

.menu-toggle{
    display:none;
    border:0;
    background:#ecfdf5;
    color:var(--green);
    width:42px;
    height:42px;
    border-radius:12px;
    font-size:20px;
    cursor:pointer;
}

.topbar-user{
    display:flex;
    align-items:center;
    gap:11px;
    white-space:nowrap;
}

.user-avatar{
    width:42px;
    height:42px;
    border-radius:50%;
    background:var(--green);
    color:white;
    display:grid;
    place-items:center;
    font-weight:bold;
}

.topbar-user strong{
    display:block;
    font-size:14px;
}

.topbar-user a{
    display:block;
    color:var(--muted);
    font-size:12px;
    margin-top:3px;
}

.content{
    padding:26px;
    flex:1;
}

.dashboard-grid{
    display:grid;
    grid-template-columns:repeat(4,minmax(0,1fr));
    gap:18px;
    margin-bottom:22px;
}

.kpi-card,
.panel{
    background:var(--card);
    border:1px solid var(--border);
    border-radius:18px;
    box-shadow:var(--shadow);
}

.kpi-card{
    padding:20px;
}

.kpi-card span{
    display:block;
    color:var(--muted);
    font-size:13px;
    margin-bottom:10px;
}

.kpi-card strong{
    display:block;
    font-size:26px;
    margin-bottom:8px;
}

.kpi-card small{
    color:var(--muted);
    font-size:12px;
}

.panel{
    padding:24px;
}

.panel-header{
    display:flex;
    justify-content:space-between;
    align-items:flex-start;
    gap:18px;
    border-bottom:1px solid var(--border);
    padding-bottom:18px;
    margin-bottom:22px;
}

.panel h2{
    margin:0 0 6px;
    font-size:24px;
}

.panel p{
    margin:0;
    color:var(--muted);
}

.empty-state{
    padding:38px;
    border-radius:16px;
    background:linear-gradient(135deg,#ecfdf5,#ffffff);
    border:1px dashed #86efac;
    text-align:center;
}

.empty-state h3{
    margin:0 0 8px;
    color:var(--green);
}

.footer{
    padding:18px 26px;
    color:var(--muted);
    font-size:12px;
    text-align:right;
}

body.login-page{
    background:linear-gradient(135deg,#14532d,#22c55e);
}

@media(max-width:1100px){
    .dashboard-grid{
        grid-template-columns:repeat(2,minmax(0,1fr));
    }
}

@media(max-width:820px){
    .sidebar{
        transform:translateX(-100%);
    }

    body.sidebar-open .sidebar{
        transform:translateX(0);
    }

    .main{
        margin-left:0;
        width:100%;
    }

    .menu-toggle{
        display:block;
    }

    .topbar{
        align-items:flex-start;
    }

    .topbar-user{
        display:none;
    }

    .dashboard-grid{
        grid-template-columns:1fr;
    }

    .content{
        padding:18px;
    }
}

.btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-height:40px;
    padding:0 16px;
    border-radius:11px;
    border:1px solid var(--border);
    background:white;
    color:var(--text);
    font-weight:700;
    font-size:14px;
    cursor:pointer;
}

.btn.primary{
    background:var(--green);
    border-color:var(--green);
    color:white;
}

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

.alert{
    padding:14px 16px;
    border-radius:14px;
    margin-bottom:18px;
    font-weight:700;
}

.alert.success{
    background:#dcfce7;
    color:#166534;
    border:1px solid #86efac;
}

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

.detail-grid{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:16px;
}

.detail-grid div{
    background:#f9fafb;
    border:1px solid var(--border);
    border-radius:14px;
    padding:15px;
}

.detail-grid .wide{
    grid-column:1 / -1;
}

.detail-grid span{
    display:block;
    color:var(--muted);
    font-size:12px;
    margin-bottom:7px;
}

.detail-grid strong{
    display:block;
    font-size:15px;
    word-break:break-word;
}

.form-grid{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:18px;
}

.form-grid label{
    display:flex;
    flex-direction:column;
    gap:7px;
}

.form-grid label.wide,
.form-actions.wide{
    grid-column:1 / -1;
}

.form-grid span{
    color:#374151;
    font-weight:700;
    font-size:13px;
}

.form-grid input,
.form-grid textarea{
    width:100%;
    border:1px solid #d1d5db;
    border-radius:12px;
    padding:12px 13px;
    font-size:14px;
    font-family:inherit;
    background:white;
}

.form-grid input:focus,
.form-grid textarea:focus{
    outline:none;
    border-color:var(--green-3);
    box-shadow:0 0 0 4px rgba(34,197,94,.15);
}

.form-actions{
    display:flex;
    justify-content:flex-end;
    gap:12px;
    padding-top:10px;
}

@media(max-width:1100px){
    .detail-grid,
    .form-grid{
        grid-template-columns:repeat(2,minmax(0,1fr));
    }
}

@media(max-width:700px){
    .detail-grid,
    .form-grid{
        grid-template-columns:1fr;
    }
}

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

.data-table{
    width:100%;
    border-collapse:collapse;
    font-size:14px;
}

.data-table th{
    text-align:left;
    color:#374151;
    background:#f9fafb;
    border-bottom:1px solid var(--border);
    padding:13px;
    white-space:nowrap;
}

.data-table td{
    border-bottom:1px solid var(--border);
    padding:13px;
    vertical-align:middle;
}

.data-table td small{
    display:block;
    color:var(--muted);
    margin-top:4px;
}

.data-table tr:hover td{
    background:#f9fafb;
}

.actions{
    text-align:right;
    white-space:nowrap;
}

.actions form{
    display:inline-block;
    margin:0;
}

.btn.small{
    min-height:32px;
    padding:0 11px;
    font-size:12px;
    border-radius:9px;
}

.btn.danger{
    background:#fee2e2;
    border-color:#fecaca;
    color:#991b1b;
}

.badge{
    display:inline-flex;
    align-items:center;
    min-height:26px;
    padding:0 10px;
    border-radius:999px;
    font-weight:800;
    font-size:12px;
}

.badge.ok{
    background:#dcfce7;
    color:#166534;
}

.badge.off{
    background:#f3f4f6;
    color:#6b7280;
}

.check-row{
    flex-direction:row !important;
    align-items:center;
    gap:9px !important;
}

.check-row input{
    width:auto !important;
}

.roles-box{
    background:#f9fafb;
    border:1px solid var(--border);
    border-radius:14px;
    padding:16px;
}

.roles-box strong{
    display:block;
    margin-bottom:12px;
}
