:root{
    --page:#f3f5f8;
    --surface:#ffffff;
    --surface-alt:#f8fafc;
    --surface-strong:#eef2f7;
    --border:#d8dee8;
    --border-strong:#b9c2d0;
    --text:#172033;
    --muted:#647085;
    --heading:#0f172a;
    --primary:#1f5fbf;
    --primary-dark:#174a96;
    --success:#198754;
    --warning:#c77700;
    --danger:#c93434;
    --shadow:0 8px 24px rgba(15,23,42,.08);
    --radius:8px;
    --control:42px;
}

*{
    box-sizing:border-box;
}

html,
body{
    min-height:100%;
    margin:0;
    padding:0;
}

body{
    background:var(--page);
    color:var(--text);
    font-family:Arial, Helvetica, sans-serif;
    font-size:14px;
    line-height:1.45;
}

body.menu-open{
    overflow:hidden;
}

.login-page{
    min-height:100vh;
    background:#eef2f7;
}

.login-shell{
    min-height:100vh;
    width:100%;
    display:grid;
    place-items:center;
    padding:18px;
}

.login-panel{
    width:min(440px, 100%);
    padding:24px;
    background:#ffffff;
    border:1px solid var(--border);
    border-radius:var(--radius);
    box-shadow:var(--shadow);
}

.login-head{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:18px;
    margin-bottom:18px;
}

.login-head h1{
    margin:0;
    font-size:24px;
    line-height:1.15;
}

.login-kicker{
    margin:0 0 6px;
    color:var(--muted);
    font-size:12px;
    font-weight:800;
    letter-spacing:.08em;
    text-transform:uppercase;
}

.login-langs{
    display:flex;
    gap:6px;
}

.login-langs a{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-width:42px;
    min-height:36px;
    border:1px solid var(--border);
    border-radius:6px;
    background:var(--surface-alt);
    color:var(--text);
    font-weight:800;
    text-decoration:none;
}

.login-langs a:hover{
    background:var(--surface-strong);
}

.login-panel .field{
    margin-bottom:12px;
}

.login-submit{
    width:100%;
    margin-top:4px;
}

a{
    color:var(--primary);
    text-decoration:none;
}

a:hover{
    color:var(--primary-dark);
    text-decoration:underline;
}

.desktop-only{
    display:inline-flex !important;
}

.mobile-only{
    display:none !important;
}

.page-shell{
    width:100%;
    max-width:none;
    margin:0;
    padding:14px;
}

.card,
.table-card,
.panel{
    width:100%;
    margin:0 0 14px;
    padding:16px;
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:var(--radius);
    box-shadow:var(--shadow);
    color:var(--text);
}

.page-title{
    margin:0 0 12px;
    color:var(--heading);
    font-size:24px;
    line-height:1.2;
    font-weight:800;
}

.section-title{
    margin:0 0 12px;
    color:var(--heading);
    font-size:18px;
    line-height:1.25;
    font-weight:800;
}

h1,
h2,
h3,
h4{
    color:var(--heading);
}

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

.topbar{
    position:sticky;
    top:0;
    z-index:3000;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    width:100%;
    min-height:58px;
    margin:0 0 14px;
    padding:10px 14px;
    background:#073262;
    border:1px solid #101827;
    border-radius:0;
    box-shadow:0 6px 18px rgba(15,23,42,.16);
}

.topbar__left,
.topbar__right{
    display:flex;
    align-items:center;
    gap:10px;
}

.topbar__right{
    margin-left:auto;
}

.topbar__brand{
    color:#ffffff;
    font-size:18px;
    font-weight:800;
    white-space:nowrap;
}

.topbar__brand:hover{
    color:#ffffff;
    text-decoration:none;
}

.topbar__langs{
    display:flex;
    align-items:center;
    gap:6px;
}

.topbar__langs a,
.topbar__logout,
.site-menu__logout{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-height:38px;
    padding:0 12px;
    border-radius:6px;
    border:1px solid rgba(255,255,255,.16);
    background:rgba(255,255,255,.08);
    color:#eef2f7;
    font-weight:700;
    text-decoration:none;
}

.topbar__langs a:hover,
.topbar__logout:hover,
.site-menu__logout:hover{
    background:rgba(255,255,255,.14);
    color:#ffffff;
    text-decoration:none;
}

.menu-toggle{
    display:none !important;
    width:42px;
    height:42px;
    padding:0 10px;
    border:1px solid rgba(255,255,255,.18);
    border-radius:6px;
    background:rgba(255,255,255,.08);
    cursor:pointer;
    flex-direction:column;
    justify-content:center;
    gap:5px;
}

.menu-toggle span{
    display:block;
    width:100%;
    height:2px;
    border-radius:999px;
    background:#ffffff;
}

.menu-overlay{
    position:fixed;
    inset:0;
    z-index:2500;
    background:rgba(15,23,42,.48);
    opacity:0;
    pointer-events:none;
    transition:opacity .2s ease;
}

.menu-overlay.is-open{
    opacity:1;
    pointer-events:auto;
}

.site-menu{
    flex:1 1 auto;
    min-width:0;
}

.site-menu__inner,
.site-menu__body{
    width:100%;
}

.site-menu__body{
    display:flex;
    align-items:center;
    gap:6px;
}

.site-menu__link,
.site-menu__group > summary{
    display:flex;
    align-items:center;
    justify-content:center;
    min-height:38px;
    padding:0 12px;
    border:1px solid transparent;
    border-radius:6px;
    color:#e5eaf2;
    font-size:14px;
    font-weight:700;
    text-decoration:none;
    white-space:nowrap;
    cursor:pointer;
}

.site-menu__link:hover,
.site-menu__group > summary:hover{
    background:rgba(255,255,255,.10);
    color:#ffffff;
    text-decoration:none;
}

.site-menu__link.is-active,
.site-menu__submenu a.is-active{
    background:#ffffff;
    color:#162033;
}

.site-menu__group{
    position:relative;
}

.site-menu__group > summary{
    list-style:none;
}

.site-menu__group > summary::-webkit-details-marker{
    display:none;
}

.site-menu__group > summary::after{
    content:"▾";
    margin-left:7px;
    font-size:12px;
}

.site-menu__submenu{
    display:none;
}

.site-menu__group[open] > .site-menu__submenu{
    position:absolute;
    top:calc(100% + 8px);
    left:0;
    z-index:5000;
    display:grid;
    gap:4px;
    min-width:240px;
    padding:8px;
    background:#ffffff;
    border:1px solid var(--border);
    border-radius:var(--radius);
    box-shadow:0 18px 42px rgba(15,23,42,.20);
}

.site-menu__submenu a{
    display:block;
    padding:10px 12px;
    border-radius:6px;
    color:var(--text);
    font-weight:700;
    text-decoration:none;
}

.site-menu__submenu a:hover{
    background:var(--surface-strong);
    text-decoration:none;
}

.site-menu__header{
    display:none;
}

.filter-grid,
.form-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit, minmax(220px, 1fr));
    gap:12px;
    align-items:end;
}

.field label,
.form-field label{
    display:block;
    margin-bottom:6px;
    color:var(--heading);
    font-weight:800;
}

input[type="text"],
input[type="search"],
input[type="number"],
input[type="date"],
input[type="month"],
input[type="email"],
input[type="file"],
input[type="password"],
select,
textarea{
    width:100%;
    max-width:100%;
    min-height:var(--control);
    padding:9px 11px;
    border:1px solid var(--border-strong);
    border-radius:6px;
    background:#ffffff;
    color:var(--text);
    font:inherit;
    outline:none;
}

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

input:focus,
select:focus,
textarea:focus{
    border-color:var(--primary);
    box-shadow:0 0 0 3px rgba(31,95,191,.12);
}

input::placeholder,
textarea::placeholder{
    color:#98a2b3;
}

fieldset{
    border:1px solid var(--border);
    border-radius:var(--radius);
    padding:14px;
    background:var(--surface-alt);
}

legend{
    padding:0 8px;
    color:var(--heading);
    font-weight:800;
}

.checkbox-line,
.check-row{
    display:flex;
    align-items:center;
    gap:9px;
    min-height:42px;
    padding:9px 10px;
    border:1px solid var(--border);
    border-radius:6px;
    background:#ffffff;
    color:var(--text);
    font-weight:700;
}

.checkbox-line input,
.check-row input{
    flex:0 0 auto;
}

.btn-row,
.page-actions,
.form-actions,
.footer-actions,
.action-inline{
    display:flex;
    flex-wrap:wrap;
    gap:8px;
    align-items:center;
}

.page-actions{
    margin-bottom:12px;
}

.form-actions,
.footer-actions{
    margin-top:16px;
}

button,
.btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-height:var(--control);
    padding:0 14px;
    border:1px solid transparent;
    border-radius:6px;
    cursor:pointer;
    font:inherit;
    font-weight:800;
    text-decoration:none;
    white-space:nowrap;
}

.btn:hover{
    text-decoration:none;
}

.btn-primary,
button[type="submit"]{
    background:var(--primary);
    color:#ffffff;
}

.btn-primary:hover,
button[type="submit"]:hover{
    background:var(--primary-dark);
    color:#ffffff;
}

.btn-secondary{
    background:#ffffff;
    color:var(--text);
    border-color:var(--border-strong);
}

.btn-secondary:hover{
    background:var(--surface-strong);
    color:var(--text);
}

.btn-success{
    background:var(--success);
    color:#ffffff;
}

.btn-warning{
    background:var(--warning);
    color:#ffffff;
}

.btn-danger{
    background:var(--danger);
    color:#ffffff;
}

.status-line{
    display:flex;
    flex-wrap:wrap;
    gap:8px;
    margin:10px 0 12px;
    color:var(--muted);
}

.msg{
    margin:0 0 12px;
    padding:11px 12px;
    border-radius:6px;
    font-weight:800;
}

.msg-success{
    color:#0f5132;
    background:#d1e7dd;
    border:1px solid #badbcc;
}

.msg-error{
    color:#842029;
    background:#f8d7da;
    border:1px solid #f5c2c7;
}

.table-wrap{
    width:100%;
    overflow:auto;
    border:1px solid var(--border);
    border-radius:var(--radius);
    background:#ffffff;
}

table{
    width:100%;
    border-collapse:collapse;
}

.dashboard-table,
.modal-table{
    min-width:1040px;
}

th,
td,
.dashboard-table th,
.dashboard-table td,
.modal-table th,
.modal-table td{
    padding:10px;
    border-bottom:1px solid var(--border);
    text-align:left;
    vertical-align:top;
    color:var(--text);
    background:#ffffff;
    text-align: center;
    vertical-align: center;
}

th,
.dashboard-table th,
.modal-table th{
    position:sticky;
    top:0;
    z-index:2;
    background:var(--surface-strong);
    color:var(--heading);
    font-size:13px;
    font-weight:800;
    white-space:nowrap;
}

tbody tr:hover td{
    background:#f9fbfd;
}

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

.pagination{
    display:flex;
    flex-wrap:wrap;
    gap:6px;
    margin-top:12px;
}

.pagination a,
.pagination strong{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-width:36px;
    min-height:36px;
    padding:0 10px;
    border:1px solid var(--border);
    border-radius:6px;
    background:#ffffff;
    color:var(--text);
}

.pagination strong{
    background:var(--primary);
    color:#ffffff;
    border-color:var(--primary);
}

dialog{
    width:min(1200px, calc(100vw - 24px));
    max-width:1200px;
    padding:0;
    border:0;
    border-radius:var(--radius);
    background:#ffffff;
    color:var(--text);
    box-shadow:0 24px 70px rgba(15,23,42,.28);
}

dialog::backdrop{
    background:rgba(15,23,42,.48);
}

.modal-shell{
    padding:16px;
}

.modal-body{
    max-height:75vh;
    overflow:auto;
}

.modal-actions{
    display:flex;
    justify-content:flex-end;
    margin-top:12px;
}

.meter-combo{
    position:relative;
}

.meter-combo-trigger{
    width:100%;
    min-height:var(--control);
    padding:9px 40px 9px 11px;
    border:1px solid var(--border-strong);
    border-radius:6px;
    background:#ffffff;
    color:var(--text);
    text-align:left;
    cursor:pointer;
    position:relative;
}

.meter-combo-caret{
    position:absolute;
    right:12px;
    top:50%;
    transform:translateY(-50%);
}

.meter-combo-dropdown{
    position:absolute;
    top:calc(100% + 6px);
    left:0;
    right:0;
    z-index:2000;
    overflow:hidden;
    background:#ffffff;
    border:1px solid var(--border);
    border-radius:var(--radius);
    box-shadow:0 18px 42px rgba(15,23,42,.20);
}

.meter-combo-search{
    border:0;
    border-bottom:1px solid var(--border);
    border-radius:0;
}

.meter-combo-list{
    max-height:320px;
    overflow:auto;
}

.meter-combo-option{
    display:block;
    width:100%;
    min-height:0;
    padding:10px 12px;
    border:0;
    border-bottom:1px solid var(--border);
    border-radius:0;
    background:#ffffff;
    color:var(--text);
    text-align:left;
    cursor:pointer;
}

.meter-combo-option:hover,
.meter-combo-option.is-selected{
    background:#edf4ff;
}

.meter-combo-empty{
    padding:10px 12px;
    color:var(--muted);
}

.sector-utilities{
    display:grid;
    gap:10px;
}

.utility-row{
    padding:12px;
    border:1px solid var(--border);
    border-radius:var(--radius);
    background:#ffffff;
}

.utility-check{
    min-height:0;
    margin:0;
    padding:0;
    border:0;
}

.meter-inline-fields{
    display:grid;
    grid-template-columns:repeat(4, minmax(150px, 1fr));
    gap:10px;
    margin-top:12px;
    padding-top:12px;
    border-top:1px solid var(--border);
}

.readonly-box{
    min-height:var(--control);
    padding:9px 11px;
    border:1px solid var(--border);
    border-radius:6px;
    background:var(--surface-alt);
}

.form-section{
    margin-top:12px;
    padding:14px;
    border:1px solid var(--border);
    border-radius:var(--radius);
    background:var(--surface-alt);
}

.form-help{
    margin:8px 0 0;
    color:var(--muted);
}

@media (max-width:900px){
    .desktop-only{
        display:none !important;
    }

    .mobile-only{
        display:inline-flex !important;
    }

    .page-shell{
        padding:10px;
    }

    .topbar{
        min-height:56px;
        padding:8px 10px;
    }

    .topbar__langs a{
        min-height:38px;
        padding:0 10px;
    }

    .menu-toggle{
        display:inline-flex !important;
    }

    .site-menu{
        position:fixed;
        inset:0 auto 0 0;
        z-index:3100;
        width:min(360px, 88vw);
        transform:translateX(-100%);
        transition:transform .22s ease;
        background:#162033;
        box-shadow:18px 0 40px rgba(15,23,42,.28);
    }

    .site-menu.is-open{
        transform:translateX(0);
    }

    .site-menu__inner{
        height:100%;
        overflow:auto;
        padding:14px;
    }

    .site-menu__header{
        display:flex;
        align-items:center;
        justify-content:space-between;
        margin-bottom:12px;
        color:#ffffff;
    }

    .site-menu__title{
        font-size:18px;
        font-weight:800;
    }

    .menu-close{
        width:40px;
        height:40px;
        border:1px solid rgba(255,255,255,.18);
        border-radius:6px;
        background:rgba(255,255,255,.08);
        color:#ffffff;
        font-size:26px;
        line-height:1;
        cursor:pointer;
    }

    .site-menu__body{
        display:grid;
        gap:8px;
    }

    .site-menu__link,
    .site-menu__group > summary,
    .site-menu__logout{
        justify-content:space-between;
        width:100%;
        min-height:44px;
        background:rgba(255,255,255,.06);
        border-color:rgba(255,255,255,.10);
        color:#ffffff;
    }

    .site-menu__group[open] > .site-menu__submenu{
        position:static;
        min-width:0;
        margin-top:6px;
        background:rgba(255,255,255,.06);
        border-color:rgba(255,255,255,.10);
        box-shadow:none;
    }

    .site-menu__submenu a{
        color:#ffffff;
    }

    .site-menu__submenu a:hover,
    .site-menu__submenu a.is-active{
        background:#ffffff;
        color:#162033;
    }

    .site-menu__logout.mobile-only{
        display:flex !important;
    }

    .meter-inline-fields{
        grid-template-columns:repeat(2, minmax(140px, 1fr));
    }
}

@media (max-width:760px){
    body{
        font-size:13px;
    }

    .card,
    .table-card,
    .panel{
        padding:12px;
    }

    .page-title{
        font-size:21px;
    }

    .section-title{
        font-size:17px;
    }

    .filter-grid,
    .form-grid,
    .meter-inline-fields{
        grid-template-columns:1fr;
    }

    .btn-row .btn,
    .btn-row button,
    .page-actions .btn,
    .form-actions .btn,
    .form-actions button,
    .footer-actions .btn,
    .footer-actions button{
        flex:1 1 100%;
    }

    .table-wrap{
        border:0;
        background:transparent;
        overflow:visible;
    }

    .dashboard-table{
        min-width:0;
    }

    .dashboard-table thead{
        display:none;
    }

    .dashboard-table,
    .dashboard-table tbody,
    .dashboard-table tr,
    .dashboard-table td{
        display:block;
        width:100%;
    }

    .dashboard-table tr{
        margin-bottom:10px;
        border:1px solid var(--border);
        border-radius:var(--radius);
        background:#ffffff;
        box-shadow:0 4px 14px rgba(15,23,42,.06);
        overflow:hidden;
    }

    .dashboard-table td{
        padding:8px 10px;
        border-bottom:1px solid var(--border);
        background:#ffffff;
    }

    .dashboard-table td:last-child{
        border-bottom:0;
    }

    .dashboard-table td::before{
        content:attr(data-label);
        display:block;
        margin-bottom:2px;
        color:var(--muted);
        font-size:11px;
        font-weight:800;
        text-transform:uppercase;
    }
}
