* {
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: #f4f7fb;
    color: #223046;
    overflow-x: hidden;
}

a {
    color: #1e5eff;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

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

.sidebar {
    width: 280px;
    background: linear-gradient(180deg, #ffffff 0%, #eef4ff 100%);
    border-right: 1px solid #dce5f3;
    padding: 24px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    padding: 14px 12px;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 14px 34px rgba(34, 48, 70, 0.08);
    margin-bottom: 24px;
}

.sidebar-brand-inline {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.sidebar-brand-logo {
    width: 100%;
    max-width: 230px;
    height: auto;
}

.sidebar-brand-mark {
    width: 88px;
    height: 88px;
    border-radius: 22px;
    background: #f7f8fc;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 28px rgba(34, 48, 70, 0.08);
}

.sidebar-brand-mark-small {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    flex: 0 0 52px;
}

.sidebar-brand-mark img {
    width: 64px;
    height: 64px;
}

.sidebar-brand-mark-small img {
    width: 34px;
    height: 34px;
}

.sidebar-brand-text strong {
    display: block;
    font-size: 1.8rem;
    line-height: 1.1;
    color: #0f2752;
}

.sidebar-brand-text span {
    display: block;
    font-size: 0.82rem;
    line-height: 1.45;
    color: #5f7392;
    margin-top: 8px;
}

.sidebar-brand-text-inline strong {
    font-size: 1.55rem;
    margin: 0;
}

.nav-group {
    margin-bottom: 18px;
}

.nav-group-title {
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #7c8aa0;
    padding: 8px 12px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    color: #2f425e;
    border-radius: 14px;
    margin-bottom: 6px;
    transition: 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
    background: #1e5eff;
    color: #fff;
    box-shadow: 0 10px 24px rgba(30, 94, 255, 0.2);
}

.icon-chip {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(30, 94, 255, 0.12);
    font-size: 0.75rem;
    font-weight: 700;
}

.nav-link.active .icon-chip,
.nav-link:hover .icon-chip {
    background: rgba(255, 255, 255, 0.16);
}

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

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

.topbar > div:first-child {
    display: flex;
    align-items: center;
    gap: 14px;
}

.page-heading h1 {
    margin: 0;
    font-size: 1.6rem;
}

.page-heading p {
    margin: 4px 0 0;
    color: #7a869a;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 14px 34px rgba(34, 48, 70, 0.08);
}

.topbar-user span {
    display: block;
    font-size: 0.85rem;
    color: #78869c;
}

.topbar-user-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.username-availability {
    min-height: 20px;
    font-size: 0.88rem;
    font-weight: 700;
}

.username-availability-used,
.username-availability-invalid {
    color: #b42318;
}

.username-availability-available {
    color: #166534;
}

.username-availability-checking {
    color: #1d4ed8;
}

.menu-toggle {
    display: none;
    border: 0;
    background: #fff;
    border-radius: 12px;
    padding: 10px 12px;
    box-shadow: 0 14px 34px rgba(34, 48, 70, 0.08);
    cursor: pointer;
}

.stats-grid,
.card-grid,
.capacity-grid {
    display: grid;
    gap: 18px;
}

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

.dashboard-filter {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.dashboard-filter-form {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border: 1px solid #d8e1ef;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 12px 28px rgba(34, 48, 70, 0.07);
}

.dashboard-filter-form label {
    color: #365074;
    font-size: 0.9rem;
    font-weight: 700;
}

.dashboard-filter-form select {
    min-width: 92px;
    border: 1px solid #d8e1ef;
    border-radius: 10px;
    padding: 8px 32px 8px 10px;
    background: #fbfcff;
    color: #102348;
    font: inherit;
}

.chart-filter-form {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.chart-filter-form label {
    color: #365074;
    font-size: 0.9rem;
    font-weight: 700;
}

.chart-filter-form select {
    min-width: 118px;
    border: 1px solid #d8e1ef;
    border-radius: 10px;
    padding: 8px 32px 8px 10px;
    background: #fbfcff;
    color: #102348;
    font: inherit;
}

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

.card-grid-mutasi-ba {
    grid-template-columns: minmax(280px, 1fr) minmax(0, 3fr);
    align-items: start;
}

.card-grid-mutasi-bhp {
    grid-template-columns: minmax(320px, 1fr) minmax(0, 2fr);
    align-items: start;
}

.card-grid-riwayat-bhp {
    grid-template-columns: minmax(320px, 1fr) minmax(0, 2fr);
    align-items: start;
}

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

.card-grid-upload-data {
    grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
    align-items: start;
}

.card-grid-kwh-check {
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
    align-items: start;
}

.kwh-stopwatch {
    display: grid;
    gap: 18px;
}

.kwh-timer {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 112px;
    border-radius: 18px;
    background: #f5f8ff;
    border: 1px solid #d8e1ef;
    color: #081f45;
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: 0;
    font-variant-numeric: tabular-nums;
}

.kwh-sample-count {
    display: grid;
    gap: 6px;
    padding: 16px;
    border-radius: 16px;
    background: #fffaf1;
    border: 1px solid #ffe1b5;
}

.kwh-sample-count span,
.kwh-sample-count small {
    color: #5f7392;
    font-weight: 600;
}

.kwh-sample-count strong {
    color: #081f45;
    font-size: 2.2rem;
    line-height: 1;
}

.kwh-phase-inputs {
    display: grid;
    gap: 14px;
}

.kwh-phase-card {
    display: grid;
    gap: 14px;
    padding: 14px;
    border: 1px solid #d8e1ef;
    border-radius: 16px;
    background: #fbfcff;
}

.kwh-phase-card h3 {
    margin: 0;
    color: #0f2752;
    font-size: 1rem;
}

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

.kwh-big-action {
    min-height: 112px;
    border: 0;
    border-radius: 18px;
    color: #fff;
    font: inherit;
    font-size: 1.3rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 16px 34px rgba(34, 48, 70, 0.14);
}

.kwh-big-action:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.kwh-big-start {
    background: #1f9d57;
}

.kwh-big-sampling {
    background: #1e5eff;
}

.kwh-big-stop {
    background: #d64545;
}

.kwh-reset-button {
    width: 100%;
}

.meter-error-danger {
    border-color: #fecaca;
}

.meter-error-danger strong,
.meter-error-danger span,
.meter-error-danger small {
    color: #b42318;
}

.meter-error-warning {
    border-color: #fed7aa;
}

.meter-error-warning strong,
.meter-error-warning span,
.meter-error-warning small {
    color: #b45309;
}

.summary-card.meter-error-danger strong,
.summary-card.meter-error-danger span,
.summary-card.meter-error-danger small {
    color: #b42318;
}

.summary-card.meter-error-warning strong,
.summary-card.meter-error-warning span,
.summary-card.meter-error-warning small {
    color: #b45309;
}

.meter-inline-notice {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    font-weight: 700;
    line-height: 1.35;
}

.meter-inline-danger {
    background: #ffe4e4;
    color: #b42318;
}

.meter-inline-warning {
    background: #fff0dd;
    color: #b45309;
}

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

.formula-grid div {
    display: grid;
    gap: 8px;
    padding: 16px;
    border-radius: 16px;
    border: 1px solid #d8e1ef;
    background: #fbfcff;
}

.formula-grid strong {
    color: #0f2752;
    font-size: 1.05rem;
}

.formula-grid span {
    color: #5f7392;
    line-height: 1.45;
}

.capacity-grid {
    grid-template-columns: minmax(0, 1fr);
    margin-bottom: 18px;
}

.stat-card,
.card {
    background: #fff;
    border-radius: 24px;
    padding: 22px;
    box-shadow: 0 16px 40px rgba(34, 48, 70, 0.08);
}

.stat-card {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 18px 44px rgba(34, 48, 70, 0.12);
}

.stat-card::before {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 1;
    pointer-events: none;
}

.stat-card > * {
    position: relative;
    z-index: 1;
}

.stat-card-ba::before {
    background: linear-gradient(135deg, #f7fbff 0%, #d2e3ff 58%, #a9c8ff 100%);
}

.stat-card-bhp::before {
    background: linear-gradient(135deg, #f4fff9 0%, #cff6e0 58%, #9fe4bf 100%);
}

.stat-card-rak::before {
    background: linear-gradient(135deg, #fffaf1 0%, #ffe1b5 58%, #ffc978 100%);
}

.stat-card-ordner::before {
    background: linear-gradient(135deg, #fbf7ff 0%, #e2d2ff 58%, #c4a5ff 100%);
}

.capacity-card {
    display: grid;
    gap: 14px;
    background: linear-gradient(135deg, #f8fbff 0%, #e0ecff 55%, #c6dbff 100%);
    border: 1px solid #bdd3ff;
    box-shadow: 0 18px 44px rgba(30, 94, 255, 0.12);
}

.capacity-summary strong {
    display: block;
    font-size: 2rem;
    color: #0b2250;
}

.capacity-summary span {
    display: block;
    margin-top: 6px;
    color: #415674;
}

.capacity-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    padding: 8px 12px;
    border-radius: 999px;
    background: #1e5eff;
    color: #ffffff;
    font-weight: 700;
    box-shadow: 0 12px 28px rgba(30, 94, 255, 0.22);
}

.card-ba-list {
    background: linear-gradient(180deg, #ffffff 0%, #edf5ff 100%);
    border: 1px solid #cadeff;
}

.card-bhp-list {
    background: linear-gradient(180deg, #ffffff 0%, #edfdf5 100%);
    border: 1px solid #ccefdc;
}

.capacity-bar {
    width: 100%;
    height: 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.7);
    overflow: hidden;
    border: 1px solid rgba(96, 131, 192, 0.18);
}

.capacity-bar-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #1e5eff 0%, #3b82f6 45%, #60a5fa 100%);
}

.capacity-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    color: #365074;
    font-weight: 700;
}

.stat-card span,
.stat-card small {
    display: block;
}

.stat-card span {
    color: #1e3a63;
    font-weight: 700;
}

.stat-card small {
    color: #365074;
    font-weight: 600;
}

.stat-card strong {
    display: block;
    font-size: 2rem;
    margin: 10px 0 6px;
    color: #081f45;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

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

.section-head h2 {
    margin: 0;
    font-size: 1.15rem;
}

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

.form-grid.one-column {
    grid-template-columns: minmax(0, 1fr);
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field-hidden {
    display: none !important;
}

.field label {
    font-weight: 600;
    color: #33445f;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    border: 1px solid #d8e1ef;
    border-radius: 14px;
    padding: 12px 14px;
    font: inherit;
    background: #fbfcff;
}

.triple-field {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 12px;
}

.field-inline {
    justify-content: center;
}

.field-inline label {
    font-weight: 500;
}

.form-block {
    margin-top: 18px;
}

.block-label {
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
    color: #33445f;
}

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

.checkbox-card {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 14px 16px;
    border: 1px solid #d8e1ef;
    border-radius: 16px;
    background: #fbfcff;
}

.checkbox-card-wide {
    grid-column: span 2;
}

.rack-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
    gap: 10px;
}

.rack-frame {
    max-height: 420px;
    overflow-y: auto;
    padding: 12px;
    border-radius: 20px;
    border: 1px solid #d8e1ef;
    background: linear-gradient(180deg, #fcfdff 0%, #f4f8ff 100%);
}

.rack-card {
    display: grid;
    gap: 5px;
    min-height: 128px;
    padding: 12px;
    border-radius: 16px;
    border: 1px solid #d8e1ef;
    background: #fbfcff;
    cursor: pointer;
}

.rack-card input {
    display: none;
}

.rack-card strong {
    font-size: 0.94rem;
    color: #0f2752;
}

.rack-card span {
    color: #5f7392;
    font-size: 0.82rem;
}

.rack-card:has(input:checked) {
    border-color: #1e5eff;
    box-shadow: 0 0 0 2px rgba(30, 94, 255, 0.12);
    background: #eef4ff;
}

.rack-card-disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f4f4f4;
}

.qr-result-card {
    max-width: 1120px;
}

.qr-download-preview {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.qr-print-layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 18px;
    align-items: stretch;
}

.qr-box {
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 22px 18px;
    border-radius: 24px;
    background: #ffffff;
    border: 1px solid #d8e1ef;
}

.qr-box img {
    width: 100%;
    max-width: 220px;
    margin: 0 auto;
}

.qr-code-text {
    margin-top: 14px;
    font-weight: 700;
    color: #0f2752;
    word-break: break-word;
    font-size: 1.45rem;
    line-height: 1.3;
}

.qr-meta {
    display: grid;
    gap: 12px;
    align-content: center;
}

.qr-meta div {
    display: grid;
    gap: 4px;
    padding: 16px 18px;
    border-radius: 18px;
    background: #ffffff;
    border: 1px solid #d8e1ef;
}

.qr-meta strong {
    color: #0f2752;
}

.qr-meta span {
    color: #5f7392;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.qr-scanner-box {
    position: relative;
    min-height: 240px;
    border: 1px solid #d8e1ef;
    border-radius: 20px;
    overflow: hidden;
    background: linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%);
}

.qr-scanner-video {
    display: block;
    width: 100%;
    min-height: 240px;
    max-height: 320px;
    object-fit: cover;
    background: #0f2752;
}

.qr-scanner-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    text-align: center;
    color: #5f7392;
    font-weight: 600;
    background: linear-gradient(180deg, rgba(248, 251, 255, 0.92) 0%, rgba(238, 244, 255, 0.92) 100%);
}

.qr-scanner-actions {
    margin-top: 12px;
}

.qr-scanner-help {
    display: block;
    margin-top: 4px;
    color: #5f7392;
    line-height: 1.5;
}

.otp-request-card {
    max-width: 760px;
}

.otp-result-panel {
    margin-top: 24px;
    padding: 28px;
    border-radius: 24px;
    background: linear-gradient(135deg, #f8fbff 0%, #e3efff 52%, #d0e3ff 100%);
    border: 1px solid #bfd5ff;
    text-align: center;
    box-shadow: 0 18px 42px rgba(30, 94, 255, 0.12);
}

.otp-result-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 110px;
    padding: 7px 14px;
    border-radius: 999px;
    background: #1e5eff;
    color: #fff;
    font-size: 0.86rem;
    font-weight: 700;
}

.otp-code-display {
    margin-top: 18px;
    font-size: clamp(2.8rem, 10vw, 5rem);
    line-height: 1;
    letter-spacing: 0.18em;
    font-weight: 800;
    color: #0b2250;
}

.otp-meta {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 16px;
    color: #365074;
    font-weight: 600;
}

.otp-countdown-wrap {
    margin-top: 20px;
    display: grid;
    gap: 8px;
}

.otp-countdown-label {
    color: #4b6384;
    font-weight: 700;
}

.otp-countdown-wrap strong {
    font-size: clamp(1.8rem, 8vw, 3rem);
    color: #c81e1e;
    line-height: 1;
}

.otp-helper-note {
    margin-top: 18px;
    color: #365074;
    font-weight: 700;
    line-height: 1.6;
}

.form-actions,
.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.form-actions {
    margin-top: 18px;
}

.inline-search {
    display: flex;
    gap: 12px;
    align-items: center;
}

.inline-search input {
    flex: 1;
}

.lookup-results {
    display: grid;
    gap: 12px;
    margin-bottom: 18px;
}

.lookup-results-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    color: #51657f;
    font-weight: 700;
}

.lookup-result-list {
    display: grid;
    gap: 12px;
}

.lookup-result-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid #d8e1ef;
    background: #fbfcff;
}

.lookup-result-card-active {
    border-color: #8ab3ff;
    background: linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%);
    box-shadow: 0 10px 26px rgba(30, 94, 255, 0.1);
}

.lookup-result-copy {
    display: grid;
    gap: 4px;
}

.lookup-result-copy strong {
    color: #0f2752;
}

.lookup-result-copy span {
    color: #5f7392;
    line-height: 1.45;
}

.lookup-result-photo {
    width: 90px;
    height: 90px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #d8e1ef;
    background: #f6f9ff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #7b8aa1;
    font-size: 0.82rem;
    font-weight: 700;
}

.lookup-result-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-summary-grid {
    display: grid;
    gap: 16px;
}

.detail-summary-card {
    padding: 18px;
    border-radius: 20px;
    border: 1px solid #d8e1ef;
    background: linear-gradient(180deg, #fbfcff 0%, #f5f9ff 100%);
}

.detail-summary-card strong {
    display: block;
    font-size: 1.15rem;
    color: #0f2752;
}

.detail-summary-copy {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.detail-summary-copy span {
    color: #5f7392;
    line-height: 1.5;
}

.detail-summary-photo {
    width: 100%;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid #d8e1ef;
    background: #f6f9ff;
}

.detail-summary-photo img {
    width: 100%;
    max-height: 280px;
    object-fit: cover;
}

.detail-summary-empty {
    padding: 18px;
    border-radius: 18px;
    border: 1px dashed #cbd7ea;
    background: #f9fbff;
    color: #6b7c94;
    text-align: center;
}

.confirm-lookup-form {
    margin-top: 4px;
    padding: 16px 18px;
    border-radius: 20px;
    border: 1px solid #d8e1ef;
    background: linear-gradient(180deg, #fbfcff 0%, #f5f9ff 100%);
}

.info-action-box {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 50px;
    flex-wrap: wrap;
}

.status-popup-copy {
    padding: 16px 18px;
    border-radius: 18px;
    line-height: 1.6;
    font-weight: 700;
}

.status-popup-copy-success {
    background: #e6f8ee;
    color: #166b3d;
}

.status-popup-copy-danger {
    background: #ffebee;
    color: #a22035;
}

.status-popup-copy-warning {
    background: #fff4dd;
    color: #8a5a02;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 16px;
    border: 0;
    border-radius: 14px;
    font-weight: 600;
    cursor: pointer;
}

.btn-primary {
    background: #1e5eff;
    color: #fff;
}

.btn-success {
    background: #1f9d57;
    color: #fff;
}

.btn-danger {
    background: #d64545;
    color: #fff;
}

.btn-warning {
    background: #f39c12;
    color: #fff;
}

.btn-info {
    background: #2d7ff9;
    color: #fff;
}

.btn-soft-info {
    background: #d9ecff;
    color: #1d4ed8;
}

.btn-light {
    background: #edf2fb;
    color: #29405f;
}

.btn-sm {
    padding: 8px 12px;
    font-size: 0.88rem;
}

.full-width {
    width: 100%;
}

.table-responsive {
    overflow-x: auto;
}

.table-toolbar {
    display: grid;
    gap: 14px;
    margin-bottom: 18px;
    padding: 16px 18px;
    border: 1px solid #d8e1ef;
    border-radius: 20px;
    background: linear-gradient(180deg, #fbfcff 0%, #f6f9ff 100%);
}

.table-toolbar-grid {
    display: grid;
    gap: 14px;
}

.table-toolbar-grid-ba {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.table-toolbar-grid-bhp {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.table-toolbar-grid-user {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.table-toolbar-grid-ordner {
    grid-template-columns: minmax(0, 1fr);
}

.table-toolbar-grid-single {
    grid-template-columns: minmax(0, 1fr);
}

.table-toolbar-grid-ba-history {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.table-toolbar-grid-bhp-history {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.table-toolbar-grid-log-gudang {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.table-toolbar-grid-monitoring-bhp {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.table-toolbar-grid-electric-history,
.table-toolbar-grid-anomaly {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.table-toolbar-grid-anomaly {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.table-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    color: #5f7392;
    font-weight: 600;
}

.sortable-table-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: inherit;
    font-weight: 800;
    text-decoration: none;
}

.sortable-table-link:hover {
    color: #2861ff;
}

.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.pagination-pages {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pagination-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: 12px;
    background: #edf2fb;
    color: #29405f;
    font-weight: 700;
}

.pagination-link.active {
    background: #1e5eff;
    color: #fff;
}

.btn-disabled {
    pointer-events: none;
    opacity: 0.55;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 39, 82, 0.34);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 60;
    overflow-y: auto;
}

.modal-overlay.open {
    display: flex;
}

.modal-card {
    width: min(580px, 100%);
    max-height: calc(100vh - 40px);
    background: #fff;
    border-radius: 26px;
    padding: 24px;
    box-shadow: 0 24px 64px rgba(15, 39, 82, 0.18);
    overflow-y: auto;
}

.modal-card-large {
    width: min(920px, 100%);
}

.modal-overlay-top {
    align-items: flex-start;
}

.user-modal-card {
    width: min(620px, 100%);
    max-height: calc(100dvh - 40px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.user-modal-form {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
}

.user-modal-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 6px;
}

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

th,
td {
    padding: 12px 10px;
    border-bottom: 1px solid #e6edf8;
    text-align: left;
    vertical-align: top;
}

th {
    color: #6d7c90;
    font-size: 0.86rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 999px;
    background: #eef4ff;
    color: #2554c7;
    font-size: 0.85rem;
}

.badge-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 88px;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 0.84rem;
    font-weight: 700;
}

.badge-status-penuh {
    background: #ffe4e4;
    color: #b42318;
}

.badge-status-kosong {
    background: #e7f8ee;
    color: #166534;
}

.badge-status-terisi {
    background: #e8f0ff;
    color: #1d4ed8;
}

.badge-status-danger {
    background: #ffe4e4;
    color: #b42318;
}

.badge-status-success {
    background: #e7f8ee;
    color: #166534;
}

.badge-status-info {
    background: #e8f0ff;
    color: #1d4ed8;
}

.badge-status-warning {
    background: #fff0dd;
    color: #b45309;
}

.scan-preview-wrap {
    border: 1px solid #d8e1ef;
    border-radius: 18px;
    overflow: hidden;
    background: #f6f9ff;
}

.scan-preview-frame {
    display: block;
    width: 100%;
    height: 70vh;
    min-height: 520px;
    border: 0;
    background: #fff;
}

.photo-preview-wrap {
    border: 1px solid #d8e1ef;
    border-radius: 18px;
    overflow: hidden;
    background: #f6f9ff;
    padding: 18px;
    text-align: center;
}

.photo-preview-wrap img {
    max-height: 70vh;
    margin: 0 auto;
    border-radius: 14px;
}

.alerts {
    display: grid;
    gap: 12px;
    margin-bottom: 18px;
}

.alert {
    padding: 14px 16px;
    border-radius: 16px;
    font-weight: 500;
}

.alert-success {
    background: #e6f8ee;
    color: #166b3d;
}

.alert-danger {
    background: #ffebee;
    color: #a22035;
}

.alert-warning {
    background: #fff4dd;
    color: #8a5a02;
}

.empty-state {
    text-align: center;
    color: #7f8ea2;
    padding: 18px;
}

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

.summary-card,
.electric-chart-wrap {
    background: #fff;
    border: 1px solid #d8e1ef;
    border-radius: 18px;
}

.summary-card {
    padding: 18px;
    box-shadow: 0 14px 34px rgba(34, 48, 70, 0.06);
}

.summary-card span,
.summary-card small {
    display: block;
    color: #5f7392;
    font-weight: 600;
}

.summary-card strong {
    display: block;
    margin: 8px 0;
    color: #0f2752;
    font-size: 1.25rem;
    overflow-wrap: anywhere;
}

.electric-chart-wrap {
    padding: 12px;
    overflow-x: auto;
    background: linear-gradient(180deg, #fbfcff 0%, #f6f9ff 100%);
}

.electric-chart {
    display: block;
    width: 100%;
    height: auto;
}

.lokasi-map-head {
    align-items: center;
    gap: 14px;
}

.lokasi-map-actions {
    margin: 0;
}

.lokasi-map-frame {
    border: 1px solid #d8e1ef;
    border-radius: 18px;
    overflow: hidden;
    background: #f6f9ff;
    min-height: 420px;
}

.lokasi-map-frame iframe {
    display: block;
    width: 100%;
    min-height: 420px;
    border: 0;
}

.petugas-map {
    width: 100%;
    min-height: 560px;
    border: 1px solid #d8e1ef;
    border-radius: 18px;
    overflow: hidden;
    background: #f6f9ff;
}

.petugas-pin {
    background: transparent;
    border: 0;
}

.petugas-pin span {
    position: relative;
    display: block;
    width: 26px;
    height: 26px;
    border: 3px solid #fff;
    border-radius: 50% 50% 50% 0;
    box-shadow: 0 8px 18px rgba(15, 39, 82, 0.3);
    transform: rotate(-45deg);
}

.petugas-pin span::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    top: 6px;
    left: 6px;
    border-radius: 50%;
    background: #fff;
}

.petugas-pin span b {
    position: absolute;
    top: 3px;
    left: 0;
    z-index: 1;
    width: 20px;
    color: #fff;
    font-size: 0.68rem;
    line-height: 20px;
    text-align: center;
    transform: rotate(45deg);
}

.petugas-pin span:has(b)::after {
    display: none;
}

.electric-chart .chart-grid line {
    stroke: #dce5f3;
    stroke-width: 1;
}

.electric-chart .chart-grid text,
.electric-chart .chart-labels text {
    fill: #6d7c90;
    font-size: 12px;
}

.electric-chart .chart-average line {
    stroke: #16a34a;
    stroke-width: 3;
    stroke-dasharray: 10 8;
}

.electric-chart .chart-average text {
    fill: #15803d;
    font-size: 13px;
    font-weight: 700;
}

.electric-chart polyline {
    fill: none;
    stroke: #1e5eff;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.electric-chart .chart-points circle {
    fill: #fff;
    stroke: #1e5eff;
    stroke-width: 3;
}

.electric-chart .chart-point-max circle {
    fill: #ecfdf5;
    stroke: #16a34a;
    stroke-width: 5;
}

.electric-chart .chart-point-min circle {
    fill: #fef2f2;
    stroke: #dc2626;
    stroke-width: 5;
}

.electric-chart .chart-point-max text {
    fill: #15803d;
    font-size: 13px;
    font-weight: 800;
}

.electric-chart .chart-point-min text {
    fill: #b91c1c;
    font-size: 13px;
    font-weight: 800;
}

.analysis-copy {
    margin: 14px 0 0;
    color: #365074;
    line-height: 1.65;
    font-weight: 600;
}

.upload-template-note,
.upload-guide {
    display: grid;
    gap: 8px;
    padding: 16px;
    border: 1px solid #d8e1ef;
    border-radius: 16px;
    background: #f6f9ff;
    color: #365074;
}

.upload-template-note strong {
    color: #0f2752;
}

.upload-template-note span {
    font-family: Consolas, "Courier New", monospace;
    overflow-wrap: anywhere;
}

.upload-template-button {
    width: fit-content;
    margin-top: 6px;
}

.upload-guide p {
    margin: 0;
    line-height: 1.6;
}

.footer {
    color: #718097;
    padding: 18px 4px 0;
}

.login-body {
    min-height: 100vh;
    background: radial-gradient(circle at top left, #dbe7ff 0%, #f4f7fb 45%, #f8fbff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-shell {
    width: min(560px, 100%);
    display: flex;
    justify-content: center;
}

.login-panel {
    width: 100%;
    background: rgba(255, 255, 255, 0.96);
    border-radius: 30px;
    padding: 38px 34px;
    box-shadow: 0 24px 60px rgba(34, 48, 70, 0.12);
}

.login-brand {
    margin-bottom: 22px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0;
}

.login-brand-mark {
    width: 128px;
    height: 128px;
    border-radius: 26px;
    background: #f7f8fc;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 16px 40px rgba(34, 48, 70, 0.12);
}

.login-brand-mark img {
    width: 92px;
    height: 92px;
}

.login-brand-logo {
    width: min(510px, 100%);
    height: auto;
}

.login-brand-copy {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.login-brand-copy h1 {
    margin: 0;
    font-size: 2.25rem;
    color: #0f2752;
}

.login-brand-copy p {
    max-width: 360px;
    margin: 6px 0 0;
    color: #5f7392;
    line-height: 1.55;
    font-size: 0.95rem;
}

.intro-card {
    margin-top: 20px;
}

.login-panel > p {
    text-align: center;
}

@media (max-width: 1080px) {
    .app-layout {
        display: block;
    }

    .sidebar {
        width: 260px;
    }

    .stats-grid,
    .card-grid,
    .form-grid,
    .triple-field,
    .checkbox-grid,
    .rack-grid,
    .qr-print-layout,
    .table-toolbar-grid-ba,
    .table-toolbar-grid-bhp,
    .table-toolbar-grid-user,
    .table-toolbar-grid-rak,
    .table-toolbar-grid-ordner,
    .table-toolbar-grid-ba-history,
    .table-toolbar-grid-bhp-history,
    .table-toolbar-grid-log-gudang,
    .table-toolbar-grid-monitoring-bhp,
    .table-toolbar-grid-electric-history,
    .table-toolbar-grid-anomaly,
    .summary-grid,
    .dashboard-electric-grid,
    .card-grid-kwh-check,
    .card-grid-upload-data {
        grid-template-columns: minmax(0, 1fr);
    }

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

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

@media (max-width: 860px) {
    .sidebar {
        position: fixed;
        left: -320px;
        width: min(300px, calc(100vw - 34px));
        z-index: 20;
        transition: left 0.2s ease;
        box-shadow: 18px 0 50px rgba(15, 39, 82, 0.18);
    }

    .sidebar.open {
        left: 0;
    }

    .main-content {
        padding: 18px;
    }

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

    .topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .topbar > div:first-child,
    .topbar-user {
        align-items: flex-start;
    }

    .topbar-user {
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .topbar-user-actions {
        width: 100%;
        justify-content: stretch;
    }

    .topbar-user-actions .btn {
        flex: 1 1 150px;
    }

    .page-heading h1 {
        font-size: 1.35rem;
    }

    .page-heading p {
        font-size: 0.9rem;
    }
}

@media (max-width: 768px) {
    .section-head {
        align-items: stretch;
        flex-direction: column;
    }

    .lookup-result-card {
        grid-template-columns: minmax(0, 1fr);
    }

    .lookup-result-photo {
        width: 100%;
        height: 180px;
    }

    .info-action-box .btn {
        width: 100%;
    }

    .table-responsive {
        overflow: visible;
    }

    .electric-chart-wrap {
        padding: 8px;
    }

    .electric-chart .chart-grid text,
    .electric-chart .chart-labels text {
        font-size: 14px;
    }

    .responsive-table thead {
        display: none;
    }

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

    .responsive-table tbody {
        display: grid;
        gap: 14px;
    }

    .responsive-table tr {
        border: 1px solid #d8e1ef;
        border-radius: 18px;
        background: #fff;
        padding: 8px 0;
        box-shadow: 0 12px 28px rgba(34, 48, 70, 0.06);
    }

    .responsive-table td {
        border-bottom: 1px solid #edf2fb;
        padding: 12px 14px;
    }

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

    .responsive-table td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 6px;
        color: #6d7c90;
        font-size: 0.8rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }

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

    .responsive-table td.actions::before {
        width: 100%;
    }

    .responsive-table .empty-state-cell {
        text-align: center;
        border-bottom: 0;
        padding: 18px;
    }

    .responsive-table .empty-state-cell::before {
        content: none;
    }

    .compact-mobile-table {
        display: table;
        min-width: 360px;
    }

    .table-responsive:has(.compact-mobile-table) {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .compact-mobile-table thead {
        display: table-header-group;
    }

    .compact-mobile-table tbody {
        display: table-row-group;
    }

    .compact-mobile-table tr {
        display: table-row;
        border: 0;
        border-radius: 0;
        padding: 0;
        box-shadow: none;
        background: transparent;
    }

    .compact-mobile-table th,
    .compact-mobile-table td {
        display: table-cell;
        width: auto;
        padding: 11px 10px;
        border-bottom: 1px solid #e6edf8;
    }

    .compact-mobile-table td::before {
        content: none;
    }

    .pagination-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .pagination-pages {
        justify-content: center;
    }

    .form-actions {
        align-items: stretch;
    }

    .form-actions .btn {
        width: 100%;
    }
}

@media (max-width: 560px) {
    body {
        background: #f7f9fd;
    }

    .dashboard-filter {
        justify-content: stretch;
    }

    .dashboard-filter-form {
        width: 100%;
        justify-content: flex-end;
        flex-wrap: wrap;
    }

    .dashboard-filter-form select {
        flex: 1;
        min-width: 120px;
    }

    .chart-filter-form {
        width: 100%;
        justify-content: flex-end;
        flex-wrap: wrap;
    }

    .chart-filter-form select {
        flex: 1;
        min-width: 130px;
    }

    .lokasi-map-actions {
        width: 100%;
    }

    .lokasi-map-actions .btn {
        flex: 1;
    }

    .main-content {
        padding: 14px 12px;
    }

    .sidebar {
        padding: 18px 12px;
    }

    .sidebar-brand {
        margin-bottom: 16px;
        padding: 12px;
    }

    .sidebar-brand-logo {
        max-width: 210px;
    }

    .topbar {
        gap: 12px;
        margin-bottom: 16px;
    }

    .topbar > div:first-child {
        gap: 10px;
    }

    .topbar-user {
        padding: 12px;
        border-radius: 14px;
    }

    .menu-toggle {
        min-width: 44px;
        min-height: 44px;
        padding: 10px;
    }

    .page-heading h1 {
        font-size: 1.18rem;
        line-height: 1.25;
        overflow-wrap: anywhere;
    }

    .stats-grid,
    .summary-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
    }

    .stat-card,
    .card,
    .summary-card {
        padding: 16px;
    }

    .stat-card,
    .summary-card,
    .card,
    .table-toolbar {
        border-radius: 16px;
    }

    .stat-card strong {
        font-size: 1.55rem;
    }

    .kwh-timer {
        min-height: 88px;
        font-size: 2.2rem;
    }

    .kwh-big-action {
        min-height: 96px;
        font-size: 1.15rem;
        border-radius: 16px;
    }

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

    .lokasi-map-frame,
    .lokasi-map-frame iframe,
    .petugas-map {
        min-height: 340px;
    }

    .section-head {
        gap: 10px;
        margin-bottom: 12px;
    }

    .section-head h2 {
        font-size: 1rem;
    }

    .field input,
    .field select,
    .field textarea {
        min-height: 46px;
        border-radius: 12px;
        padding: 11px 12px;
    }

    .btn {
        min-height: 44px;
        border-radius: 12px;
        padding: 10px 14px;
    }

    .table-toolbar {
        padding: 14px;
    }

    .table-meta {
        font-size: 0.9rem;
    }

    .responsive-table tr {
        border-radius: 14px;
    }

    .responsive-table td {
        padding: 10px 12px;
    }

    .electric-chart {
        min-width: 0;
    }

    .analysis-copy,
    .upload-guide p {
        font-size: 0.94rem;
    }

    .login-body {
        align-items: flex-start;
        padding: 18px 12px;
    }

    .login-panel {
        border-radius: 22px;
        padding: 24px 18px;
    }

    .login-brand {
        margin-bottom: 16px;
    }

    .login-brand-logo {
        width: min(360px, 100%);
    }
}

@media (max-width: 380px) {
    .main-content {
        padding: 12px 10px;
    }

    .page-heading h1 {
        font-size: 1.05rem;
    }

    .page-heading p,
    .topbar-user span {
        font-size: 0.82rem;
    }

    .btn,
    .field input,
    .field select,
    .field textarea {
        font-size: 0.92rem;
    }

    .login-panel {
        padding: 20px 14px;
    }
}
