/* AWS Monitor — tampilan publik yang tenang, kontras, dan mudah dibaca */

:root {
    --navy: #10264a;
    --navy-2: #173b70;
    --blue: #245bc7;
    --blue-soft: #eaf1ff;
    --ink: #17243a;
    --muted: #68778d;
    --line: #e1e7ef;
    --paper: #ffffff;
    --canvas: #f3f6fa;
    --green: #16824b;
    --amber: #a96608;
    --red: #c33333;
    --radius: 16px;
}

* {
    box-sizing: border-box
}

html {
    scroll-behavior: smooth
}

body {
    margin: 0;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    background: var(--canvas);
    color: var(--ink);
    font-size: 14px;
    line-height: 1.45
}

button,
input,
select {
    font: inherit
}

button,
select {
    cursor: pointer
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 248px;
    background: #fff;
    border-right: 1px solid var(--line);
    padding: 22px 15px 16px;
    display: flex;
    flex-direction: column;
    z-index: 30
}

.brand {
    display: flex;
    gap: 11px;
    align-items: center;
    padding: 3px 9px 23px
}

.brand svg {
    color: var(--blue);
    width: 32px;
    height: 32px;
    stroke-width: 1.8
}

.brand b {
    display: block;
    font-size: 15px;
    letter-spacing: -.02em;
    color: var(--navy)
}

.brand small {
    display: block;
    color: #7e8ba0;
    font-size: 10px;
    margin-top: 3px
}

.role-box {
    background: #f7f9fc;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 17px
}

.role-box span {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .09em;
    color: var(--blue)
}

.role-box small {
    display: block;
    color: var(--muted);
    margin-top: 4px;
    font-size: 11px
}

nav {
    display: grid;
    gap: 4px;
    overflow: auto
}

nav a {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 12px;
    border-radius: 9px;
    text-decoration: none;
    color: #596980;
    font-size: 12px;
    font-weight: 650;
    transition: background .15s, color .15s
}

nav a:hover {
    background: #f4f7fb;
    color: var(--blue)
}

nav a.active {
    background: var(--blue-soft);
    color: var(--blue)
}

nav svg {
    width: 17px;
    height: 17px;
    stroke-width: 1.9
}

.nav-label {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .11em;
    color: #9aa5b4;
    padding: 18px 12px 6px
}

.sidebar-bottom {
    margin-top: auto;
    padding-top: 14px
}

.mqtt {
    display: flex;
    align-items: center;
    gap: 9px;
    background: #f7f9fc;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px;
    font-size: 10px;
    color: var(--muted);
    margin-bottom: 9px
}

.mqtt span {
    flex: 0 0 auto;
    width: 9px;
    height: 9px;
    background: #9aa6b5;
    border-radius: 50%
}

.mqtt .status-dot.online {
    background: #1bcf48;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .13)
}

.mqtt .status-dot.offline {
    background: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, .12)
}

.mqtt label b {
    display: block;
    color: #29384e;
    margin-top: 2px;
    font-size: 11px
}

.login-link,
.logout {
    width: 100%;
    border: 1px solid #dbe3ed;
    background: #fff;
    border-radius: 10px;
    padding: 10px;
    color: #405675;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer
}

.login-link:hover {
    background: #f7f9fc
}

.logout {
    color: var(--red);
    border-color: #f0d4d4;
    margin-top: 7px
}

.content {
    margin-left: 248px;
    padding: 30px clamp(18px, 3vw, 42px);
    min-height: 100vh;
    max-width: 1800px
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;
    margin-bottom: 24px
}

.eyebrow {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .12em;
    color: #7b899e
}

.topbar h1 {
    font-size: clamp(25px, 2.2vw, 32px);
    letter-spacing: -.04em;
    line-height: 1.15;
    margin: 7px 0 7px;
    color: var(--navy)
}

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

.station-picker {
    background: linear-gradient(145deg, #fff 0%, #f8fbff 100%);
    border: 1px solid #dbe5f2;
    border-radius: 16px;
    min-width: 320px;
    max-width: 410px;
    padding: 13px 15px;
    box-shadow: 0 8px 24px rgba(24, 55, 96, .06);
    transition: border-color .2s, box-shadow .2s;
    position: relative
}

.station-picker:hover {
    border-color: #b8cbed;
    box-shadow: 0 10px 28px rgba(24, 55, 96, .10)
}

.station-picker:focus-within {
    border-color: #7ba5f8;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .10)
}

.station-picker-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px
}

.station-picker-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 12px;
    background: #eaf1ff;
    color: #245fe5
}

.station-picker-icon svg {
    width: 19px;
    height: 19px;
    stroke-width: 2
}

.station-picker-head>div {
    min-width: 0;
    flex: 1
}

.station-picker label {
    display: block;
    font-size: 11px;
    color: #243b5d;
    font-weight: 800;
    letter-spacing: .01em;
    text-transform: none;
    margin: 0 0 3px
}

.station-picker-head small {
    display: block;
    font-size: 10px;
    color: #7b8ba3
}

.station-picker-live {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 9px;
    color: #5d6e87;
    background: #eef3fa;
    border-radius: 20px;
    padding: 5px 8px;
    font-weight: 800;
    white-space: nowrap
}

.station-picker-live span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #2563eb;
    box-shadow: 0 0 0 3px #dbe7ff
}

.station-picker select {
    appearance: none;
    -webkit-appearance: none;
    display: block;
    width: 100%;
    min-height: 43px;
    padding: 0 38px 0 12px;
    border: 1px solid #dce5f1;
    border-radius: 11px;
    outline: 0;
    color: #1b3457;
    background: #fff;
    font-size: 12px;
    font-weight: 750;
    line-height: 1.4;
    cursor: pointer;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23576c8b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: background-color .2s, border-color .2s
}

.station-picker select:hover {
    border-color: #b8cbed;
    background-color: #fbfdff
}

.station-picker select option {
    color: #1b3457;
    background: #fff;
    font-weight: 600;
    padding: 10px
}

.page {
    display: none
}

.page.active-page {
    display: block
}

.hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(112deg, #142f5a 0%, #204d88 100%);
    color: #fff;
    border-radius: 17px;
    padding: 26px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 15px;
    min-height: 158px
}

.hero:after {
    content: "";
    position: absolute;
    width: 260px;
    height: 260px;
    right: 10%;
    top: -160px;
    border: 1px solid #ffffff12;
    border-radius: 50%;
    box-shadow: 0 0 0 30px #ffffff06, 0 0 0 65px #ffffff04;
    pointer-events: none
}

.hero>div {
    position: relative;
    z-index: 1
}

.pill {
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    font-weight: 800;
    padding: 6px 9px;
    border-radius: 6px;
    background: #ffffff17;
    border: 1px solid #ffffff2b;
    letter-spacing: .02em
}

.hero h2 {
    font-size: clamp(23px, 2.3vw, 30px);
    letter-spacing: -.035em;
    margin: 11px 0 4px
}

.hero p {
    color: #d4e0f2;
    margin: 0;
    font-size: 12px
}

.last-update {
    text-align: right;
    min-width: 130px
}

.last-update small {
    display: block;
    color: #b7c9e2;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .09em
}

.last-update b {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    font-weight: 650
}

.cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px
}

.sensor-card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 13px;
    padding: 15px 16px;
    min-height: 137px;
    box-shadow: 0 2px 5px #183b6604
}

.sensor-top {
    display: flex;
    justify-content: space-between;
    align-items: center
}

.sensor-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: #edf3ff;
    color: var(--blue)
}

.sensor-icon svg {
    width: 18px;
    height: 18px;
    stroke-width: 1.8
}

.dot {
    width: 7px;
    height: 7px;
    background: #9ba7b6;
    border-radius: 50%
}

.sensor-card small {
    display: block;
    color: #8995a5;
    font-size: 9px;
    margin-top: 12px
}

.sensor-card label {
    display: block;
    color: #586981;
    font-size: 11px;
    margin-top: 3px
}

.sensor-card strong {
    display: block;
    font-size: 23px;
    letter-spacing: -.035em;
    margin-top: 4px;
    color: var(--navy);
    font-weight: 750
}

.two-col {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(280px, .9fr);
    gap: 13px;
    margin-top: 14px
}

.panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 2px 5px #183b6604;
    min-width: 0
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 13px
}

.panel-head b {
    font-size: 14px;
    color: var(--navy);
    letter-spacing: -.01em
}

.panel-head small {
    display: block;
    color: #8793a4;
    font-size: 10px;
    margin-top: 4px
}

.panel canvas {
    max-height: 250px
}

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

.section-head h2 {
    margin: 3px 0 5px;
    font-size: 23px;
    letter-spacing: -.035em;
    color: var(--navy)
}

.section-head select {
    padding: 10px 12px;
    border: 1px solid #dce4ed;
    border-radius: 9px;
    background: #fff;
    font-weight: 650;
    color: #31425b;
    outline: none
}

.risk-list,
.alert-grid {
    display: grid;
    gap: 8px
}

.risk {
    padding: 11px 12px;
    border: 1px solid #edf0f5;
    border-radius: 10px;
    background: #fafbfd;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-size: 11px
}

.risk span {
    color: #64738a;
    line-height: 1.55
}

.risk span b {
    color: #27364e;
    font-size: 12px;
    font-weight: 800
}

.risk>b {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .02em;
    white-space: nowrap
}

.risk b.normal {
    color: var(--green)
}

.risk b.warn {
    color: var(--amber)
}

.risk b.danger {
    color: var(--red)
}

.risk b.unknown {
    color: #69778b
}

#mapView {
    height: 500px;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--line)
}

.chart-panel {
    height: 460px
}

.chart-panel canvas {
    height: 100%!important
}

.table-wrap {
    overflow: auto
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px
}

th,
td {
    text-align: left;
    padding: 12px 13px;
    border-bottom: 1px solid #edf1f5;
    white-space: nowrap
}

th {
    color: #7b889a;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: .06em;
    background: #f8fafc
}

tbody tr:hover {
    background: #fafcff
}

.device-list {
    display: grid;
    gap: 10px
}

.device-row {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 13px
}

.device-row .grow {
    flex: 1;
    min-width: 0
}

.device-row h3 {
    margin: 0;
    font-size: 14px
}

.device-row h3 small {
    font-size: 9px;
    color: #8a96a7;
    margin-left: 5px
}

.device-row p {
    margin: 4px 0 0;
    color: #8290a3;
    font-size: 10px;
    overflow-wrap: anywhere
}

.device-row button {
    border: 1px solid #f0caca;
    background: #fff;
    color: #c33333;
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 10px
}

.primary {
    border: 0;
    border-radius: 9px;
    background: var(--blue);
    color: #fff;
    padding: 10px 13px;
    font-weight: 750;
    cursor: pointer;
    display: flex;
    gap: 7px;
    align-items: center
}

.primary:hover {
    background: #194da9
}

.primary svg {
    width: 15px
}

.alert {
    background: #fff;
    border: 1px solid var(--line);
    border-left: 3px solid #c9d4e3;
    border-radius: 10px;
    padding: 15px
}

.alert b {
    display: block;
    margin-bottom: 5px;
    font-size: 12px;
    color: #29384e
}

.alert p {
    margin: 0;
    color: #758397;
    font-size: 11px
}

.backup-info {
    text-align: center;
    padding: 45px
}

.backup-info svg {
    width: 40px;
    height: 40px;
    color: var(--blue)
}

.backup-info h3 {
    color: var(--navy)
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: #10223f80;
    z-index: 50;
    place-items: center;
    padding: 20px
}

.modal.show {
    display: grid
}

.modal-box {
    width: min(470px, 100%);
    background: #fff;
    border-radius: 15px;
    padding: 24px;
    position: relative;
    box-shadow: 0 20px 70px #0c1f3c40
}

.close {
    position: absolute;
    right: 15px;
    top: 12px;
    border: 0;
    background: transparent;
    font-size: 25px;
    color: #657287
}

.modal form {
    display: grid;
    gap: 10px;
    margin-top: 17px
}

.modal input {
    padding: 12px;
    border: 1px solid #dbe3ed;
    border-radius: 9px;
    min-width: 0
}

.modal input:focus {
    outline: 2px solid #c6d8ff;
    border-color: #7ca4f4
}

.mobile-top {
    display: none
}

.operator-only-page {
    display: none
}

.operator-mode .operator-only-page {
    display: block
}

.operator-mode .operator-only {
    display: block
}

.operator-mode #roleBadge {
    color: var(--green)
}

.operator-mode .login-link {
    display: none
}

@media(max-width:1150px) {
    .content {
        padding: 25px 22px
    }
    .cards {
        grid-template-columns: repeat(2, minmax(0, 1fr))
    }
    .two-col {
        grid-template-columns: 1fr
    }
}

.sensor-explanation {
    font-size: 11px;
    line-height: 1.4;
    color: #64748b;
    margin-top: 6px;
    min-height: 16px
}

.sensor-card {
    height: auto
}

.location-help {
    display: block;
    color: #64748b;
    font-size: 12px;
    line-height: 1.5;
    margin: -5px 0 12px
}


/* Mobile-first usability improvements */

.export-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center
}

.secondary {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--navy);
    border-radius: 9px;
    padding: 10px 13px;
    font-weight: 700;
    cursor: pointer
}

.forecast-card p {
    font-size: 12px;
    line-height: 1.5;
    color: #64748b;
    margin-top: 7px
}

.muted {
    color: #64748b;
    font-size: 13px;
    line-height: 1.6;
    margin-top: 8px
}

@media print {
    .sidebar,
    .mobile-top,
    .topbar,
    .export-actions,
    button {
        display: none!important
    }
    .content {
        margin: 0;
        padding: 0
    }
    .page {
        display: none!important
    }
    #history {
        display: block!important
    }
    .table-wrap {
        overflow: visible
    }
    table {
        font-size: 9pt
    }
    body {
        background: #fff
    }
}


/* Illustrated local forecast and hourly strip */

.forecast-hero {
    display: flex;
    align-items: center;
    gap: 22px;
    overflow: hidden;
    background: linear-gradient(120deg, #12325c, #245a91);
    color: #fff;
    border: 0;
    position: relative;
    margin-bottom: 14px
}

.forecast-hero .forecast-illustration {
    font-size: 76px;
    line-height: 1;
    min-width: 100px;
    text-align: center;
    filter: drop-shadow(0 8px 10px #071b3833)
}

.forecast-hero h3 {
    font-size: clamp(21px, 3vw, 30px);
    margin: 5px 0;
    color: #fff
}

.forecast-hero p {
    color: #e1ebf8;
    margin-top: 5px
}

.forecast-hero .muted {
    color: #d0def0;
    max-width: 700px
}

.forecast-kicker {
    font-size: 11px;
    letter-spacing: .12em;
    font-weight: 800;
    color: #c5dcff
}

.forecast-hourly {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    margin: 14px 0
}

.hour-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 15px 8px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 0
}

.hour-card span,
.hour-card small {
    font-size: 12px;
    color: #64748b
}

.hour-card b {
    font-size: 19px;
    color: #102b4e
}

.hour-card small {
    line-height: 1.3
}

.hour-icon {
    font-size: 30px;
    min-height: 38px;
    display: flex;
    align-items: center
}


/* Indikator kondisi sensor dibuat halus agar data tetap menjadi fokus utama. */

.sensor-card {
    position: relative;
    transition: background-color .2s ease, border-color .2s ease, box-shadow .2s ease;
    box-shadow: 0 1px 2px rgba(15, 35, 65, .025);
}

.sensor-card:hover {
    box-shadow: 0 3px 9px rgba(15, 35, 65, .055)
}

.sensor-card.heat-normal {
    background: #fff;
    border-color: var(--line)
}

.sensor-card.heat-normal .dot {
    background: #258354!important;
    box-shadow: 0 0 0 3px #25835414
}

.sensor-card.heat-warn {
    background: #fffdf8;
    border-color: #e9d7a7;
    box-shadow: 0 1px 2px rgba(15, 35, 65, .025);
}

.sensor-card.heat-warn .sensor-icon {
    background: #f5f0df;
    color: #946b13
}

.sensor-card.heat-warn .dot {
    background: #c89a25!important;
    box-shadow: 0 0 0 3px #c89a2514
}

.sensor-card.heat-warn strong {
    color: var(--navy)
}

.sensor-card.heat-danger {
    background: #fffaf7;
    border-color: #e9c4b4;
    box-shadow: 0 1px 2px rgba(15, 35, 65, .025);
}

.sensor-card.heat-danger .sensor-icon {
    background: #f7e9e2;
    color: #b65e35
}

.sensor-card.heat-danger .dot {
    background: #d97745!important;
    box-shadow: 0 0 0 3px #d9774514
}

.sensor-card.heat-danger strong {
    color: #a64f2b
}

.sensor-card.heat-critical {
    background: #fff8f7;
    border-color: #e7b5b1;
    box-shadow: 0 1px 2px rgba(15, 35, 65, .025);
}

.sensor-card.heat-critical .sensor-icon {
    background: #f7e6e5;
    color: #b83e38
}

.sensor-card.heat-critical .dot {
    background: #c94a43!important;
    box-shadow: 0 0 0 3px #c94a4314
}

.sensor-card.heat-critical strong {
    color: #a8332e
}

.sensor-card.heat-unknown {
    background: #f7f8fa;
    border-color: #e0e5eb
}

.sensor-card.heat-unknown .sensor-icon {
    background: #edf0f4;
    color: #78869a
}

.sensor-card.heat-unknown .dot {
    background: #9ba7b6!important;
    box-shadow: 0 0 0 3px #9ba7b614
}

@media(prefers-reduced-motion:reduce) {
    .sensor-card {
        transition: none
    }
}


/* Teks keterangan/status sensor dibuat lebih tegas dan kontras. */

.sensor-explanation {
    color: #43536a;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
    letter-spacing: 0;
    margin-top: 7px;
    min-height: 18px;
}

.sensor-card.heat-warn .sensor-explanation {
    color: #79580d;
    font-weight: 650
}

.sensor-card.heat-danger .sensor-explanation {
    color: #8f4327;
    font-weight: 700
}

.sensor-card.heat-critical .sensor-explanation {
    color: #982f2b;
    font-weight: 750
}

.sensor-card.heat-unknown .sensor-explanation {
    color: #5d6878;
    font-weight: 600
}

/* Chart analytics refinements */
.chart-panel { position: relative; height: clamp(300px, 48vh, 460px); padding: 22px; overflow: hidden; }
.chart-panel canvas { position: relative; z-index: 1; }
.chart-controls { display:flex; align-items:center; justify-content:flex-end; flex-wrap:wrap; gap:9px; }
.chart-controls label { color:#64748b; font-size:12px; font-weight:700; }
.chart-controls select { min-width:112px; border:1px solid var(--line); border-radius:10px; background:#fff; padding:10px 12px; color:#334155; }
.secondary-btn { border:1px solid var(--line); border-radius:10px; padding:10px 13px; background:#fff; color:#334155; font-weight:700; cursor:pointer; }
.secondary-btn:hover { border-color:#93c5fd; background:#eff6ff; }
.chart-summary { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; margin:14px 0; }
.summary-chip { min-width:0; background:#fff; border:1px solid var(--line); border-radius:12px; padding:13px 15px; }
.summary-chip span { display:block; color:#718096; font-size:11px; margin-bottom:6px; }
.summary-chip b { display:block; color:#1e293b; font-size:17px; overflow-wrap:anywhere; }
.chart-status { color:#718096; font-size:12px; margin-bottom:10px; }
.forecast-note { margin-top:18px; }
.forecast-hourly { align-items:stretch; }
.forecast-hourly .hour-card { min-width:112px; flex:1 0 112px; }
.forecast-card strong { overflow-wrap:anywhere; }
@media(max-width:720px) {
  .chart-controls { justify-content:flex-start; width:100%; }
  .chart-controls select { flex:1; min-width:0; }
  .chart-summary { grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  .summary-chip { padding:11px; }
  .summary-chip b { font-size:15px; }
  .chart-panel { height:340px; padding:13px; }
}
