:root{
    --bg:#0b1220;
    --panel:#111a2b;
    --panel2:#172237;
    --text:#e8edf7;
    --muted:#91a0b8;
    --accent:#4f8cff;
    --border:#25334d;
    --good:#2ecb89;
    --warn:#f3b33d;
    --bad:#ef5d68;
}

*{
    box-sizing:border-box;
}

html{
    scroll-behavior:smooth;
}

body{
    margin:0;
    background:#0d1423;
    color:var(--text);
    font-family:Inter,Segoe UI,Arial,sans-serif;
}

img{
    max-width:100%;
    height:auto;
}

a{
    color:inherit;
}

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

/* =========================
   SIDEBAR
========================= */

.sidebar{
    width:230px;
    background:#080e19;
    border-right:1px solid var(--border);
    padding:18px 14px;
    position:fixed;
    top:0;
    left:0;
    bottom:0;
    z-index:40;
    overflow-y:auto;
}

/* =========================
   BRAND / LOGO
========================= */

.brand{
    display:flex;
    align-items:center;
    gap:9px;
    padding:4px 8px 20px;
    overflow:hidden;
}

.brand img,
.brand-logo{
    width:34px !important;
    height:34px !important;
    max-width:34px !important;
    max-height:34px !important;
    object-fit:contain;
    object-position:center;
    display:block;
    flex:0 0 34px;
}

.brand div,
.brand-text{
    display:flex;
    flex-direction:column;
    justify-content:center;
    gap:2px;
    min-width:0;
    overflow:hidden;
}

.brand b{
    font-size:13px;
    line-height:1.15;
    color:var(--text);
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}

.brand span{
    font-size:10px;
    line-height:1.15;
    color:var(--muted);
    font-weight:600;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}

/* =========================
   NAVIGATION
========================= */

nav{
    display:grid;
    gap:5px;
}

nav a{
    color:#b6c1d4;
    text-decoration:none;
    padding:11px 12px;
    border-radius:8px;
    transition:background .15s ease,color .15s ease;
}

nav a:hover,
nav a.active{
    background:var(--panel2);
    color:#fff;
}

/* =========================
   MAIN LAYOUT
========================= */

.main{
    margin-left:230px;
    width:calc(100% - 230px);
    min-width:0;
}

.topbar{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:16px;
    padding:20px 26px;
    border-bottom:1px solid var(--border);
    background:#0d1423;
    position:sticky;
    top:0;
    z-index:20;
}

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

.topbar small{
    color:var(--muted);
}

.page-heading{
    min-width:0;
}

.userbadge{
    background:var(--panel);
    border:1px solid var(--border);
    padding:9px 12px;
    border-radius:8px;
    white-space:nowrap;
}

.content{
    padding:24px;
}

/* =========================
   GRID / CARDS
========================= */

.grid{
    display:grid;
    gap:16px;
}

.kpis{
    grid-template-columns:repeat(4,minmax(0,1fr));
}

.card{
    background:var(--panel);
    border:1px solid var(--border);
    border-radius:12px;
    padding:18px;
    min-width:0;
}

.card h3{
    margin-top:0;
}

.kpi .label{
    color:var(--muted);
    font-size:12px;
    text-transform:uppercase;
}

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

.row{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:16px;
    margin-top:16px;
}

/* =========================
   DASHBOARD CHART
========================= */

.chart-card{
    min-height:360px;
}

.chart-card canvas{
    width:100% !important;
    max-height:300px;
}

/* =========================
   TABLES
========================= */

.table-wrap{
    overflow:auto;
    border:1px solid var(--border);
    border-radius:10px;
}

table{
    width:100%;
    border-collapse:collapse;
    min-width:900px;
    background:var(--panel);
}

th,
td{
    padding:11px 12px;
    border-bottom:1px solid var(--border);
    text-align:left;
    vertical-align:middle;
}

th{
    font-size:12px;
    color:var(--muted);
    text-transform:uppercase;
    background:#0e1727;
    position:sticky;
    top:0;
    z-index:2;
}

tr:last-child td{
    border-bottom:0;
}

/* =========================
   BADGES
========================= */

.badge{
    display:inline-block;
    padding:4px 8px;
    border-radius:999px;
    font-size:12px;
    background:#263753;
    white-space:nowrap;
}

.badge.good{
    background:#173d32;
    color:#65e0ae;
}

.badge.warn{
    background:#4a3817;
    color:#ffd06a;
}

.badge.bad{
    background:#4a2025;
    color:#ff939b;
}

/* =========================
   BUTTONS
========================= */

.btn{
    display:inline-block;
    border:0;
    border-radius:8px;
    padding:9px 12px;
    background:var(--accent);
    color:#fff;
    text-decoration:none;
    cursor:pointer;
    transition:opacity .15s ease,transform .15s ease;
}

.btn:hover{
    opacity:.92;
}

.btn:active{
    transform:translateY(1px);
}

.btn.secondary{
    background:#273651;
}

.btn.danger{
    background:#8e2f3a;
}

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

/* =========================
   FORMS
========================= */

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

.form-group{
    display:grid;
    gap:6px;
}

.form-group.full{
    grid-column:1/-1;
}

label{
    color:var(--muted);
    font-size:13px;
}

input,
select,
textarea{
    width:100%;
    background:#0a1220;
    color:#fff;
    border:1px solid #2c3c57;
    border-radius:8px;
    padding:10px;
    outline:none;
}

input:focus,
select:focus,
textarea:focus{
    border-color:var(--accent);
    box-shadow:0 0 0 2px rgba(79,140,255,.12);
}

textarea{
    min-height:90px;
    resize:vertical;
}

/* =========================
   PROGRESS
========================= */

.progress{
    height:9px;
    background:#26334b;
    border-radius:99px;
    overflow:hidden;
}

.progress>span{
    display:block;
    height:100%;
    background:var(--accent);
}

/* =========================
   ALERTS
========================= */

.alert{
    padding:11px 13px;
    border-radius:8px;
    margin-bottom:14px;
    background:#22314a;
}

.alert.success{
    background:#173d32;
}

.alert.error{
    background:#4a2025;
}

.muted{
    color:var(--muted);
}

/* =========================
   SECTION TITLES / PLANNING
========================= */

.planning-head,
.section-title{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:16px;
    margin-bottom:16px;
}

.planner-filter{
    min-width:300px;
}

.planning-table input,
.planning-table select{
    min-width:145px;
    padding:7px;
}

.planning-table td:nth-child(2){
    min-width:150px;
}

/* =========================
   GANTT TIMELINE
========================= */

.timeline{
    overflow:auto;
}

.gantt{
    min-width:1050px;
}

.gantt-axis{
    display:grid;
    grid-template-columns:180px 1fr;
    min-height:36px;
}

.axis-track{
    position:relative;
    display:flex;
    justify-content:space-between;
    align-items:center;
    color:var(--muted);
    font-size:11px;
    border-bottom:1px solid var(--border);
}

.gantt-row{
    display:grid;
    grid-template-columns:180px 1fr;
    align-items:center;
    min-height:44px;
    border-bottom:1px solid var(--border);
}

.gantt-track{
    position:relative;
    height:24px;
    background:#0b1321;
    border-radius:5px;
    overflow:visible;
}

.gantt-bar{
    position:absolute;
    height:18px;
    top:3px;
    border-radius:4px;
    background:var(--accent);
    min-width:4px;
}

.gantt-bar.delayed{
    background:var(--bad);
}

.gantt-bar.complete{
    background:var(--good);
}

.gantt-bar em{
    font-style:normal;
    font-size:10px;
    line-height:18px;
    padding:0 6px;
    white-space:nowrap;
    overflow:hidden;
    display:block;
    text-overflow:ellipsis;
}

.today-line{
    position:absolute;
    top:0;
    height:100%;
    border-left:2px solid var(--warn);
    z-index:3;
}

.today-line b{
    position:absolute;
    top:-4px;
    left:4px;
    color:var(--warn);
    font-size:10px;
}

.unplanned{
    position:absolute;
    left:8px;
    top:5px;
    color:var(--muted);
    font-size:11px;
}

.legend{
    display:flex;
    gap:14px;
    flex-wrap:wrap;
    font-size:12px;
    color:var(--muted);
}

.lg{
    display:inline-block;
    width:10px;
    height:10px;
    border-radius:2px;
    margin-right:4px;
    background:var(--accent);
}

.lg.complete{
    background:var(--good);
}

.lg.delay{
    background:var(--bad);
}

/* =========================
   RESPONSIVE - TABLET
========================= */

@media(max-width:1100px){

    .kpis{
        grid-template-columns:repeat(2,minmax(0,1fr));
    }

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

/* =========================
   RESPONSIVE - SMALL TABLET
========================= */

@media(max-width:900px){

    .sidebar{
        width:72px;
        padding:18px 8px;
    }

    .brand{
        justify-content:center;
        padding:4px 0 18px;
    }

    .brand img,
    .brand-logo{
        width:30px !important;
        height:30px !important;
        max-width:30px !important;
        max-height:30px !important;
        flex:0 0 30px;
    }

    .brand div,
    .brand-text{
        display:none;
    }

    .sidebar nav a{
        font-size:0;
        text-align:center;
        padding:10px 6px;
    }

    .sidebar nav a::before{
        content:'•';
        font-size:22px;
    }

    .main{
        margin-left:72px;
        width:calc(100% - 72px);
    }

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

    .content{
        padding:14px;
    }

    .planning-head,
    .section-title{
        align-items:flex-start;
        flex-direction:column;
    }

    .planner-filter{
        min-width:100%;
        width:100%;
    }

    .legend{
        flex-wrap:wrap;
    }
}

/* =========================
   RESPONSIVE - MOBILE
========================= */

@media(max-width:560px){

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

    .topbar{
        padding:14px;
    }

    .topbar h1{
        font-size:18px;
    }

    .userbadge{
        display:none;
    }

    .card{
        padding:14px;
    }

    .kpi .value{
        font-size:24px;
    }
}