:root {
  --brand-primary: #01598C;
  --brand-deep: #012B45;
  --brand-mid: #01436B;
  --brand-ice: #A9CEE7;
  --brand-accent: #F76926;

  --glass-bg: rgba(1, 61, 97, 0.44);
  --glass-bg-hover: rgba(1, 75, 118, 0.54);
  --glass-border: rgba(169, 206, 231, 0.34);
  --glass-border-hover: rgba(169, 206, 231, 0.68);

  --text-primary: #F4FAFE;
  --text-secondary: #D4E8F6;
  --text-muted: #A9CEE7;

  --bd-red: #FF3B5C;
  --bd-red-soft: rgba(255, 59, 92, 0.17);
  --bd-text: #FFD5DC;

  --rfu-glow: #38E8B0;
  --radius-box: 22px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text-primary);
  background: radial-gradient(
    circle at 16% 10%,
    #016BA6 0%,
    var(--brand-primary) 34%,
    var(--brand-mid) 66%,
    var(--brand-deep) 100%
  );
  overflow-x: hidden;
  position: relative;
}

/* ===========================
   Ambient Glass Background
   =========================== */
.bg-ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(169, 206, 231, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(169, 206, 231, 0.06) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 85% 75% at 50% 35%, black 25%, transparent 100%);
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(115px);
}

.orb-1 {
  width: 500px;
  height: 500px;
  top: -160px;
  left: -100px;
  opacity: 0.42;
  background: radial-gradient(circle, rgba(169, 206, 231, 0.55), transparent 70%);
}

.orb-2 {
  width: 520px;
  height: 520px;
  bottom: -200px;
  right: -120px;
  opacity: 0.35;
  background: radial-gradient(circle, rgba(1, 89, 140, 0.85), transparent 70%);
}

.orb-3 {
  width: 320px;
  height: 320px;
  top: 12%;
  right: 8%;
  opacity: 0.16;
  background: radial-gradient(circle, rgba(247, 105, 38, 0.65), transparent 72%);
}

/* ===========================
   Page Layout
   =========================== */
.page-wrapper {
  position: relative;
  z-index: 1;
  max-width: 1320px;
  margin: 0 auto;
  padding: 28px 36px 52px;
}

/* ===========================
   Header
   =========================== */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 18px;
}

/* Crisp white frosted badge so original red logo stands out cleanly */
.brand-logo {
  width: 96px;
  height: 70px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: rgba(255, 255, 255, 0.96);
  border: 1.5px solid rgba(169, 206, 231, 0.72);
  border-radius: 14px;
  padding: 5px 7px 4px;
  backdrop-filter: blur(12px);
  box-shadow:
    0 6px 20px rgba(1, 30, 50, 0.34),
    0 0 18px rgba(169, 206, 231, 0.22);
}

.hml-logo-img {
  width: 100%;
  height: 46px;
  object-fit: contain;
  display: block;
}

.hml-logo-caption {
  font-size: 5.7px;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #840B0B;
  line-height: 1;
  white-space: nowrap;
}

.brand-text h1 {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: clamp(1.55rem, 2.2vw, 2.05rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: #FFFFFF;
  text-shadow: 0 2px 18px rgba(1, 43, 69, 0.45);
}

.brand-text .subtitle {
  margin-top: 3px;
  font-size: clamp(0.9rem, 1.1vw, 1.02rem);
  font-weight: 500;
  color: var(--brand-ice);
  letter-spacing: 0.04em;
}

/* Header Meta (Stats + Sync) */
.header-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.stat-pills {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border-radius: 999px;
  background: rgba(1, 49, 79, 0.56);
  border: 1px solid rgba(169, 206, 231, 0.32);
  backdrop-filter: blur(12px);
  font-size: 0.84rem;
  color: var(--brand-ice);
}

.pill strong {
  color: #FFFFFF;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.pill-bd {
  border-color: rgba(255, 59, 92, 0.48);
  background: rgba(255, 59, 92, 0.16);
}

.pill-bd strong {
  color: #FFE4E8;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.dot-rfu {
  background: var(--rfu-glow);
  box-shadow: 0 0 8px var(--rfu-glow);
}

.dot-bd {
  background: var(--bd-red);
  box-shadow: 0 0 8px var(--bd-red);
}

.sync-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sync-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.8rem;
  color: var(--brand-ice);
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(1, 49, 79, 0.52);
  border: 1px solid rgba(169, 206, 231, 0.26);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand-accent);
  box-shadow: 0 0 9px rgba(247, 105, 38, 0.85);
  animation: pulse 2.2s ease-in-out infinite;
}

.sync-status.is-offline .pulse-dot {
  background: #FBBF24;
  box-shadow: 0 0 8px #FBBF24;
  animation: none;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.45;
    transform: scale(0.85);
  }
}

.btn-refresh {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(247, 105, 38, 0.55);
  background: rgba(247, 105, 38, 0.16);
  color: #FFB088;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.btn-refresh svg {
  width: 15px;
  height: 15px;
}

.btn-refresh:hover {
  border-color: var(--brand-accent);
  background: rgba(247, 105, 38, 0.3);
  color: #FFFFFF;
  box-shadow: 0 0 16px rgba(247, 105, 38, 0.45);
}

.btn-refresh.is-spinning svg {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Divider Line (#F76926 minor accent + #A9CEE7 primary glow) */
.header-divider {
  height: 1.5px;
  margin: 22px 0 34px;
  background: linear-gradient(
    90deg,
    var(--brand-accent) 0%,
    rgba(169, 206, 231, 0.78) 18%,
    rgba(169, 206, 231, 0.32) 65%,
    rgba(169, 206, 231, 0.05) 100%
  );
  box-shadow: 0 0 14px rgba(169, 206, 231, 0.35);
}

/* ===========================
   3-Column Section Grid
   =========================== */
.sections-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
  align-items: stretch;
}

.section-column {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Section Heading (Icon + Title centered above box) */
.section-heading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  padding: 2px 8px;
}

.section-icon {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-ice);
  filter: drop-shadow(0 0 10px rgba(169, 206, 231, 0.6));
  flex-shrink: 0;
}

.section-icon-img {
  width: auto;
  height: 48px;
  min-width: 52px;
  max-width: 72px;
  filter: drop-shadow(0 3px 10px rgba(1, 20, 36, 0.55)) drop-shadow(0 0 8px rgba(169, 206, 231, 0.35));
}

.section-icon-img img {
  height: 100%;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  display: block;
}

.section-heading h2 {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: clamp(1.35rem, 1.7vw, 1.62rem);
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #FFFFFF;
  text-shadow: 0 2px 14px rgba(1, 43, 69, 0.45);
}

.section-badge {
  font-size: 0.78rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #FFE6D8;
  background: rgba(247, 105, 38, 0.22);
  border: 1px solid rgba(247, 105, 38, 0.55);
  border-radius: 999px;
  padding: 2px 10px;
  line-height: 1.4;
}

/* ===========================
   Transparent Glass Box
   =========================== */
.glass-box {
  flex: 1;
  min-height: 440px;
  padding: 26px 26px 28px;
  border-radius: var(--radius-box);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(22px) saturate(130%);
  -webkit-backdrop-filter: blur(22px) saturate(130%);
  box-shadow:
    0 14px 40px rgba(1, 24, 41, 0.42),
    0 0 24px rgba(169, 206, 231, 0.08),
    inset 0 1px 0 rgba(169, 206, 231, 0.34);
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
  position: relative;
  overflow: hidden;
}

.glass-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 14%;
  right: 14%;
  height: 1.5px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(169, 206, 231, 0.85) 38%,
    rgba(247, 105, 38, 0.65) 50%,
    rgba(169, 206, 231, 0.85) 62%,
    transparent
  );
  pointer-events: none;
}

.glass-box:hover {
  background: var(--glass-bg-hover);
  border-color: var(--glass-border-hover);
  box-shadow:
    0 18px 46px rgba(1, 24, 41, 0.5),
    0 0 30px rgba(169, 206, 231, 0.16),
    inset 0 1px 0 rgba(169, 206, 231, 0.45);
}

/* ===========================
   Unit List Styling
   =========================== */
.unit-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.unit-item {
  padding: 7px 11px;
  border-radius: 12px;
  transition: background 0.18s ease, border-color 0.18s ease;
  border: 1px solid transparent;
}

.unit-item:hover {
  background: rgba(169, 206, 231, 0.12);
  border-color: rgba(169, 206, 231, 0.26);
}

.unit-item.is-bd {
  background: var(--bd-red-soft);
  border-color: rgba(255, 59, 92, 0.42);
}

.unit-item.is-bd:hover {
  background: rgba(255, 59, 92, 0.23);
  border-color: rgba(255, 59, 92, 0.62);
}

.unit-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: clamp(1.08rem, 1.25vw, 1.24rem);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0.015em;
}

.unit-num {
  min-width: 28px;
  color: var(--brand-ice);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  opacity: 0.92;
}

.unit-code {
  color: #FFFFFF;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.unit-item.is-bd .unit-code {
  color: #FFF5F6;
}

/* Red X Mark for Breakdown (BD/DB) */
.bd-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-left: 2px;
  color: var(--bd-red);
  filter: drop-shadow(0 0 8px rgba(255, 59, 92, 0.85));
  flex-shrink: 0;
}

.bd-mark svg {
  width: 19px;
  height: 19px;
}

/* Issue / Keterangan below Unit Name (indented under unit code) */
.unit-note {
  margin-top: 4px;
  padding-left: 38px;
  font-size: clamp(0.82rem, 0.92vw, 0.9rem);
  line-height: 1.45;
  color: var(--bd-text);
  font-weight: 400;
}

/* Non-BD operational note uses warm minor accent tint (#F76926 soft) */
.unit-item:not(.is-bd) .unit-note {
  color: #FFC6A8;
}

/* Empty & Skeleton States */
.empty-state {
  color: var(--brand-ice);
  font-size: 0.95rem;
  text-align: center;
  padding: 40px 12px;
  opacity: 0.8;
}

.skeleton-item {
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(
    90deg,
    rgba(169, 206, 231, 0.08) 25%,
    rgba(169, 206, 231, 0.22) 50%,
    rgba(169, 206, 231, 0.08) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ===========================
   Responsive Breakpoints
   =========================== */
@media (max-width: 1080px) {
  .page-wrapper {
    padding: 24px 22px 44px;
  }

  .sections-grid {
    gap: 20px;
  }

  .glass-box {
    padding: 22px 20px;
  }
}

@media (max-width: 860px) {
  .sections-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .glass-box {
    min-height: 220px;
  }

  .site-header {
    align-items: flex-start;
  }
}

/* ===========================
   Login View (Centered Glass Box)
   =========================== */
.login-view {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-view[hidden],
.page-wrapper[hidden] {
  display: none !important;
}

.login-card {
  width: 100%;
  max-width: 410px;
  padding: 38px 34px 36px;
  border-radius: 26px;
  background: rgba(1, 56, 90, 0.5);
  border: 1px solid rgba(169, 206, 231, 0.36);
  backdrop-filter: blur(24px) saturate(135%);
  -webkit-backdrop-filter: blur(24px) saturate(135%);
  box-shadow:
    0 22px 60px rgba(1, 20, 36, 0.55),
    0 0 32px rgba(169, 206, 231, 0.1),
    inset 0 1px 0 rgba(169, 206, 231, 0.4);
  position: relative;
  overflow: hidden;
  animation: fadeUp 0.38s ease-out;
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 16%;
  right: 16%;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(169, 206, 231, 0.85) 35%,
    var(--brand-accent) 50%,
    rgba(169, 206, 231, 0.85) 65%,
    transparent
  );
  pointer-events: none;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.login-logo {
  width: 118px;
  height: 86px;
  padding: 7px 9px 5px;
  margin-bottom: 16px;
  border-radius: 16px;
}

.login-logo .hml-logo-img {
  height: 56px;
}

.login-logo .hml-logo-caption {
  font-size: 6.4px;
}

.login-title {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: -0.02em;
}

.login-subtitle {
  margin-top: 4px;
  font-size: 0.9rem;
  color: var(--brand-ice);
  letter-spacing: 0.03em;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

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

.form-group label {
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--brand-ice);
  letter-spacing: 0.02em;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  width: 17px;
  height: 17px;
  color: rgba(169, 206, 231, 0.78);
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.input-icon svg {
  width: 100%;
  height: 100%;
}

.input-wrap input {
  width: 100%;
  padding: 12px 42px 12px 42px;
  border-radius: 12px;
  border: 1px solid rgba(169, 206, 231, 0.3);
  background: rgba(1, 35, 58, 0.56);
  color: #FFFFFF;
  font-family: inherit;
  font-size: 0.96rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.input-wrap input::placeholder {
  color: rgba(169, 206, 231, 0.52);
}

.input-wrap input:focus {
  border-color: var(--brand-ice);
  background: rgba(1, 43, 70, 0.72);
  box-shadow: 0 0 0 3px rgba(169, 206, 231, 0.18);
}

.btn-eye {
  position: absolute;
  right: 10px;
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  color: rgba(169, 206, 231, 0.75);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: color 0.18s ease, background 0.18s ease;
}

.btn-eye:hover {
  color: #FFFFFF;
  background: rgba(169, 206, 231, 0.12);
}

.btn-eye svg {
  width: 17px;
  height: 17px;
}

.login-error {
  font-size: 0.84rem;
  color: #FFE4E8;
  background: rgba(255, 59, 92, 0.2);
  border: 1px solid rgba(255, 59, 92, 0.45);
  border-radius: 10px;
  padding: 9px 12px;
  text-align: center;
}

.btn-login {
  margin-top: 4px;
  width: 100%;
  padding: 13px 18px;
  border-radius: 12px;
  border: 1px solid rgba(247, 105, 38, 0.8);
  background: linear-gradient(135deg, #F76926 0%, #E05514 100%);
  color: #FFFFFF;
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 8px 22px rgba(247, 105, 38, 0.34);
  transition: transform 0.18s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.btn-login svg {
  width: 17px;
  height: 17px;
  transition: transform 0.18s ease;
}

.btn-login:hover {
  filter: brightness(1.06);
  box-shadow: 0 10px 26px rgba(247, 105, 38, 0.48);
  transform: translateY(-1px);
}

.btn-login:hover svg {
  transform: translateX(3px);
}

.btn-login:active {
  transform: translateY(0);
}

/* Logout Button in Dashboard Header */
.btn-logout {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(169, 206, 231, 0.3);
  background: rgba(1, 49, 79, 0.56);
  color: var(--brand-ice);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.btn-logout svg {
  width: 15px;
  height: 15px;
}

.btn-logout:hover {
  border-color: rgba(255, 59, 92, 0.65);
  background: rgba(255, 59, 92, 0.2);
  color: #FFE4E8;
  box-shadow: 0 0 14px rgba(255, 59, 92, 0.32);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.login-card.is-shake {
  animation: shake 0.36s ease-in-out;
}
