
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0;}
html,body{height:100%;overflow:hidden;}

body{
    font-family:Arial,sans-serif;
    background:#0d1117;
    color:#e2e8f0;
    display:flex;
    flex-direction:column;
}

/* TOPBAR */
.topbar{
    background:#0f766e;
    height:50px;
    padding:0 20px;
    display:flex;
    align-items:center;
    gap:14px;
    flex-shrink:0;
    z-index:100;
}
.status-dot{
    width:9px;
    height:9px;
    border-radius:50%;
    animation:blink 2s infinite;
    flex-shrink:0;
}

/* ONLINE */
.status-dot.online{
    background:#4ade80;
    box-shadow:0 0 6px #4ade80;
}

/* OFFLINE */
.status-dot.offline{
    background:#ef4444;
    box-shadow:0 0 6px #ef4444;
}

@keyframes blink{0%,100%{opacity:1}50%{opacity:.3}}
.topbar-brand{font-size:15px;font-weight:bold;}
.topbar-clock{margin-left:auto;font-size:12px;opacity:.8;font-variant-numeric:tabular-nums;}

/* SHELL */
.shell{display:flex;flex:1;overflow:hidden;}

/* SIDEBAR */
.sidebar{
    width:220px;flex-shrink:0;
    background:#161b22;
    border-right:1px solid #21262d;
    display:flex;flex-direction:column;
    overflow-y:auto;
    padding:14px 10px 14px;
    gap:18px;
    transition:all .3s ease;
}
.sb-title{
    font-size:10px;font-weight:bold;
    text-transform:uppercase;letter-spacing:.08em;
    color:#4a5568;margin-bottom:8px;
}
.sb-foot{
    margin-top:auto;font-size:10px;color:#4a5568;
    text-align:center;padding-top:10px;
    border-top:1px solid #21262d;
}

/* SIDEBAR PANELS */
.sb-panel{
    transition:opacity .22s ease;
    flex:1;
}

/* CARDS  */
.pos-card{
    background:#1e2530;border:1px solid #21262d;
    border-radius:9px;padding:11px 12px;margin-bottom:8px;
}
.pos-label{font-size:10px;color:#4a5568;text-transform:uppercase;letter-spacing:.06em;margin-bottom:4px;}
.pos-link{font-size:12px;color:#2dd4bf;text-decoration:none;font-weight:bold;word-break:break-all;}
.pos-link:hover{text-decoration:underline;}

/*  BADGE  */
.badge{display:inline-block;padding:2px 9px;border-radius:20px;font-size:11px;font-weight:bold;}
.badge-ok{background:#064e3b;color:#6ee7b7;}
.badge-warn{background:#78350f;color:#fde68a;}
.badge-danger{background:#7f1d1d;color:#fca5a5;}

/* STATUS BANNER */
.status-banner{
    display:flex;
    align-items:center;
    gap:8px;
    border-radius:9px;
    padding:10px 12px;
    margin-bottom:4px;
    border:1px solid;
}

.status-dot-lg{
    width:8px;
    height:8px;
    border-radius:50%;
    flex-shrink:0;
    animation:blink 2s infinite;
}

.status-text{
    font-size:12px;
    font-weight:bold;
    letter-spacing:.04em;
}

.status-sub{
    font-size:10px;
    margin-left:auto;
}

/* ONLINE */
.status-banner.online{
    background:#064e3b;
    border-color:#065f46;
}

.status-banner.online .status-dot-lg{
    background:#4ade80;
    box-shadow:0 0 6px #4ade80;
}

.status-banner.online .status-text{
    color:#6ee7b7;
}

.status-banner.online .status-sub{
    color:#34d399;
}

/* OFFLINE */
.status-banner.offline{
    background:#7f1d1d;
    border-color:#991b1b;
}

.status-banner.offline .status-dot-lg{
    background:#ef4444;
    box-shadow:0 0 6px #ef4444;
}

.status-banner.offline .status-text{
    color:#fecaca;
}

.status-banner.offline .status-sub{
    color:#fca5a5;
}

/*  POS DETAIL ROWS  */
.pos-detail{
    display:flex;justify-content:space-between;align-items:center;
    padding:5px 0;border-bottom:1px solid #21262d;
}
.pos-detail:last-child{border-bottom:none;padding-bottom:0;}
.pd-lbl{font-size:10px;color:#4a5568;}
.pd-val{font-size:11px;font-weight:bold;color:#e2e8f0;}
.pd-val.teal{color:#2dd4bf;}
.pd-val.rssi{color:#fb923c;}
.pos-coords-row{margin-bottom:7px;}

/*  SUBMENU ITEMS  */
.submenu-item{
    display:flex;align-items:center;gap:10px;
    padding:11px 12px;border-radius:8px;
    font-size:13px;color:#cbd5e0;text-decoration:none;
    margin-bottom:6px;background:#1e2530;
    border:1px solid #21262d;
    transition:background .15s,color .15s;
}
.submenu-item:hover{background:#1a3a33;color:#2dd4bf;}
.submenu-item.active{background:#1a3a33;color:#2dd4bf;border-color:#0f766e;}

.btn-back{
    display:flex;align-items:center;gap:7px;
    width:100%;background:transparent;
    border:1px solid #21262d;border-radius:8px;
    color:#718096;font-size:12px;padding:8px 12px;
    cursor:pointer;margin-bottom:14px;
    transition:background .15s,color .15s;
    text-align:left;
}
.btn-back:hover{background:#1a2535;color:#e2e8f0;}

/*  MENU BUTTON  */
.menu-btn{font-size:18px;cursor:pointer;margin-right:10px;}

/*  MAIN  */
.main{
    flex:1;overflow-y:auto;
    padding:14px 16px 20px;
    display:flex;flex-direction:column;gap:14px;
}
.row-lbl{
    font-size:10px;font-weight:bold;
    text-transform:uppercase;letter-spacing:.08em;
    color:#4a5568;margin-bottom:6px;
}

/* MAIN PANELS  */
.main-panel{display:none;}
.main-panel.active{display:flex;flex-direction:column;gap:14px;}

/* SENSOR GRID  */
.sensor-grid{
    display:grid;
    grid-template-columns:repeat(6,1fr);
    gap:10px;
}
.s-card{
    background:#161b22;border:1px solid #21262d;
    border-radius:10px;padding:13px 13px 11px;
    cursor:pointer;position:relative;overflow:hidden;
    transition:border-color .2s,background .2s;
}
.s-card:hover{border-color:#0f766e;background:#1a2535;}
.s-card::after{
    content:'';position:absolute;bottom:0;left:0;right:0;
    height:2px;background:#0f766e;
    transform:scaleX(0);transform-origin:left;transition:transform .2s;
}
.s-card:hover::after{transform:scaleX(1);}
.s-arr{position:absolute;top:9px;right:10px;font-size:11px;color:#4a5568;}
.s-name{font-size:10px;color:#4a5568;text-transform:uppercase;letter-spacing:.06em;margin-bottom:6px;}
.s-val{font-size:22px;font-weight:bold;color:#e2e8f0;line-height:1;}
.s-unit{font-size:11px;color:#4a5568;margin-top:3px;}

/*  CHARTS */
.chart-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;}
.c-box{background:#161b22;border:1px solid #21262d;border-radius:10px;padding:11px 13px;}
.c-title{font-size:10px;font-weight:bold;color:#718096;text-transform:uppercase;letter-spacing:.06em;margin-bottom:7px;}

/*  CHART HEADER */
.c-head{
    display:flex;
    align-items:center;
    justify-content:space-between;
    margin-bottom:7px;
}
.c-indicator{
    width:9px;height:9px;
    border-radius:50%;
    flex-shrink:0;
    background:#374151; /* default: abu / unknown */
    transition:background .4s ease, box-shadow .4s ease;
}
.c-indicator.online{
    background:#4ade80;
    box-shadow:0 0 6px #4ade80;
    animation:blink 2s infinite;
}
.c-indicator.offline{
    background:#ef4444;
    box-shadow:0 0 6px #ef4444;
}

/*  LOG TABLE  */
.log-wrap{background:#161b22;border:1px solid #21262d;border-radius:10px;overflow:hidden;}
.log-table{width:100%;border-collapse:collapse;font-size:12px;}
.log-table th{
    background:#1e2530;color:#4a5568;
    font-size:10px;text-transform:uppercase;letter-spacing:.05em;
    font-weight:bold;padding:8px 12px;text-align:left;
    border-bottom:1px solid #21262d;
}
.log-table td{padding:7px 12px;border-bottom:1px solid #21262d;color:#cbd5e0;}
.log-table tr:last-child td{border-bottom:none;}
.log-table tr:hover td{background:#1a2535;}

/*  MODAL */
.modal-overlay{
    display:none;position:fixed;inset:0;
    background:rgba(0,0,0,.65);z-index:500;
    align-items:center;justify-content:center;
}
.modal-overlay.open{display:flex;}
.modal-box{
    background:#161b22;border:1px solid #30363d;border-radius:14px;
    padding:22px;width:92%;max-width:560px;max-height:85vh;overflow-y:auto;
    animation:fadeUp .2s ease;
}
@keyframes fadeUp{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:translateY(0)}}
.m-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:14px;}
.m-title{font-size:14px;font-weight:bold;color:#e2e8f0;}
.m-close{
    background:#21262d;border:1px solid #30363d;color:#718096;cursor:pointer;
    font-size:15px;border-radius:7px;width:30px;height:30px;
    display:flex;align-items:center;justify-content:center;
    transition:background .15s,color .15s;
}
.m-close:hover{background:#30363d;color:#e2e8f0;}
.m-table{width:100%;border-collapse:collapse;font-size:12px;}
.m-table th{
    background:#1e2530;color:#4a5568;
    font-size:10px;text-transform:uppercase;letter-spacing:.05em;
    font-weight:bold;padding:8px 12px;text-align:left;border-bottom:1px solid #21262d;
}
.m-table td{padding:7px 12px;border-bottom:1px solid #21262d;color:#cbd5e0;}
.m-table tr:last-child td{border-bottom:none;}
.m-table tr:hover td{background:#1a2535;}
.m-pager{display:flex;gap:8px;margin-top:12px;justify-content:center;}
.m-pager button{
    padding:6px 16px;border-radius:7px;
    background:#21262d;border:1px solid #30363d;
    color:#e2e8f0;font-size:12px;cursor:pointer;transition:background .15s;
}
.m-pager button:hover{background:#30363d;}
.m-pager button:disabled{opacity:.35;cursor:default;}

/*  TMA SUMMARY  */
.tma-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;}
.tma-card{
    background:#161b22;border:1px solid #21262d;border-radius:10px;
    padding:14px 16px;display:flex;align-items:center;gap:14px;
}
.tma-icon{
    width:38px;height:38px;border-radius:10px;
    display:flex;align-items:center;justify-content:center;
    font-size:16px;flex-shrink:0;
}
.tma-icon-min{background:#1e3a5f;color:#60a5fa;}
.tma-icon-max{background:#3b1f5e;color:#c084fc;}
.tma-icon-rec{background:#064e3b;color:#34d399;}
.tma-icon-rain{background:#1e3a5f;color:#38bdf8;}
.tma-body{display:flex;flex-direction:column;gap:2px;}
.tma-label{font-size:11px;font-weight:bold;color:#718096;text-transform:uppercase;letter-spacing:.04em;}
.tma-val{font-size:22px;font-weight:bold;color:#e2e8f0;line-height:1.2;margin-top:4px;}
.tma-unit{font-size:12px;color:#4a5568;font-weight:normal;}

/*  ADMIN PANEL  */
.admin-header{margin-bottom:20px;}
.admin-title{font-size:16px;font-weight:bold;color:#e2e8f0;margin-bottom:4px;}
.admin-sub{font-size:12px;color:#4a5568;}
.admin-sub code{color:#2dd4bf;font-size:11px;}

.toast{
    display:flex;align-items:center;gap:10px;
    padding:11px 16px;border-radius:9px;
    font-size:13px;margin-bottom:16px;
}
.toast-ok{background:#064e3b;border:1px solid #065f46;color:#6ee7b7;}
.toast-err{background:#7f1d1d;border:1px solid #991b1b;color:#fca5a5;}

.sensor-card{
    background:#161b22;border:1px solid #21262d;
    border-radius:12px;margin-bottom:14px;overflow:hidden;
}
.sensor-head{
    display:flex;align-items:center;gap:10px;
    padding:12px 16px;border-bottom:1px solid #21262d;
    background:#1a2030;
}
.sensor-head-icon{font-size:16px;}
.sensor-head-name{font-size:13px;font-weight:bold;color:#e2e8f0;}
.sensor-head-unit{font-size:11px;color:#4a5568;}

.levels-wrap{padding:14px 16px;display:flex;flex-direction:column;gap:10px;}
.level-row{
    display:grid;
    grid-template-columns:130px 1fr 1fr;
    align-items:center;gap:12px;
}
.level-divider{border:none;border-top:1px solid #21262d;}

.level-badge{
    display:inline-flex;align-items:center;gap:6px;
    padding:5px 10px;border-radius:20px;
    font-size:11px;font-weight:bold;
}
.level-dot{width:6px;height:6px;border-radius:50%;flex-shrink:0;}

.field-wrap{display:flex;flex-direction:column;gap:3px;}
.field-lbl{font-size:10px;color:#4a5568;text-transform:uppercase;letter-spacing:.05em;}
.field-row{display:flex;align-items:center;gap:6px;}
.field-row input{
    width:80px;background:#0d1117;border:1px solid #30363d;
    border-radius:7px;padding:6px 10px;font-size:13px;
    color:#e2e8f0;outline:none;transition:border-color .15s;
    -moz-appearance:textfield;
}
.field-row input::-webkit-inner-spin-button,
.field-row input::-webkit-outer-spin-button{-webkit-appearance:none;}
.field-row input:focus{border-color:#0f766e;}
.field-unit{font-size:11px;color:#4a5568;}

.save-bar{
    display:flex;align-items:center;justify-content:flex-end;
    gap:10px;padding-top:10px;
    border-top:1px solid #21262d;
    margin-top:4px;
}
.save-hint{font-size:11px;color:#4a5568;margin-right:auto;}
.btn-save{
    background:#0f766e;border:none;color:#fff;font-weight:bold;
    font-size:13px;padding:8px 24px;border-radius:8px;cursor:pointer;
    transition:background .15s;
}
.btn-save:hover{background:#0d6b63;}
.btn-reset-form{
    background:transparent;border:1px solid #30363d;color:#718096;
    font-size:13px;padding:8px 16px;border-radius:8px;cursor:pointer;
    transition:background .15s,color .15s;
}
.btn-reset-form:hover{background:#21262d;color:#e2e8f0;}

/*  RESPONSIVE  */
@media(max-width:1200px){
    .sensor-grid{grid-template-columns:repeat(3,1fr);}
    .chart-grid{grid-template-columns:repeat(2,1fr);}
    .tma-grid{grid-template-columns:repeat(2,1fr);}
}
@media(max-width:768px){
    html,body{overflow:auto;}
    .shell{flex-direction:column;}
    .sidebar{width:100%;}
    .sensor-grid{grid-template-columns:repeat(2,1fr);}
    .chart-grid{grid-template-columns:1fr;}
    .tma-grid{grid-template-columns:repeat(2,1fr);}
    .level-row{grid-template-columns:1fr;gap:8px;}
}

/* Pop-up */
/*  AUTH MODAL  */
.auth-overlay{
    display:none;position:fixed;inset:0;
    background:rgba(0,0,0,.75);z-index:600;
    align-items:center;justify-content:center;
}
.auth-overlay.open{display:flex;}
.auth-box{
    background:#161b22;border:1px solid #30363d;
    border-radius:14px;padding:28px 24px;
    width:92%;max-width:340px;
    animation:fadeUp .2s ease;
}
.auth-title{font-size:15px;font-weight:bold;color:#e2e8f0;margin-bottom:4px;}
.auth-sub{font-size:12px;color:#4a5568;margin-bottom:20px;}
.auth-input{
    width:100%;background:#0d1117;border:1px solid #30363d;
    border-radius:8px;padding:9px 12px;font-size:14px;
    color:#e2e8f0;outline:none;margin-bottom:10px;
    transition:border-color .15s;
}
.auth-input:focus{border-color:#0f766e;}
.auth-err{
    font-size:12px;color:#fca5a5;
    margin-bottom:10px;display:none;
}
.auth-btn{
    width:100%;background:#0f766e;border:none;color:#fff;
    font-size:13px;font-weight:bold;padding:9px;
    border-radius:8px;cursor:pointer;transition:background .15s;
}
.auth-btn:hover{background:#0d6b63;}

/* FLAG BADGE  */
.flag{
    display:inline-block;padding:2px 7px;
    border-radius:20px;font-size:10px;font-weight:bold;
    white-space:nowrap;
}
.flag-waspada,.flag-tinggi,.flag-panas
                {background:#7f1d1d;color:#fca5a5;}
.flag-normal,.flag-cerah
                {background:#064e3b;color:#6ee7b7;}
.flag-sedang    {background:#78350f;color:#fde68a;}
.flag-rendah    {background:#1e3a5f;color:#93c5fd;}
.flag-unknown   {background:#1e2530;color:#4a5568;}


/* CSS Login page */

/* Wrapper Body  */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #0d1117;
    background-image: radial-gradient(circle at 50% 30%, #1a2535 0%, #0d1117 70%);
}

/* Card Kontainer Login */
.login-card {
    background: #161b22;
    border: 1px solid #21262d;
    border-radius: 14px;
    width: 100%;
    max-width: 380px;
    padding: 30px 26px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5), 0 0 1px rgba(45, 212, 191, 0.2);
    animation: fadeUp 0.3s ease;
}

/* Header Login */
.login-header {
    text-align: center;
    margin-bottom: 24px;
}

.login-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: bold;
    color: #e2e8f0;
    letter-spacing: 0.05em;
}

.login-subtitle {
    font-size: 11px;
    color: #718096;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Form Styles */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.login-card .auth-input {
    margin-bottom: 0; /* Override margin bawaan auth-input */
    height: 42px;
}

.login-card .auth-input:focus {
    box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.3);
}

.btn-login {
    height: 42px;
    margin-top: 6px;
    font-size: 14px;
    letter-spacing: 0.02em;
}

/* Notification & Footer */
.login-alert {
    padding: 9px 12px;
    font-size: 12px;
    margin-bottom: 18px;
}

.login-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 11px;
    color: #4a5568;
    border-top: 1px solid #21262d;
    padding-top: 16px;
}

/* ==========================================
   LOGIN CARD BACKGROUND BLUR (GLASSMORPHISM)
   ========================================== */
.login-card {
    background: rgba(22, 27, 34, 0.75); /* Warna transparan */
    backdrop-filter: blur(12px); /* Efek blur background di belakang kartu */
    -webkit-backdrop-filter: blur(12px); /* Dukungan browser Safari */
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    width: 100%;
    max-width: 380px;
    padding: 30px 26px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
}

/* ==========================================
   PASSWORD WRAPPER Hide and Show
   ========================================== */
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.password-wrapper .auth-input {
    width: 100%;
    padding-right: 38px; /* Memberikan ruang untuk ikon agar teks tidak tertimpa */
}

.btn-toggle-pwd {
    position: absolute;
    right: 10px; /* Menempel di dalam kanan box input */
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
    transition: color 0.2s ease;
}

.btn-toggle-pwd:hover {
    color: #2dd4bf; /* Berubah warna teal saat kursor menempel */
}