:root {
  --primary: #0284c7;
  --primary-dark: #0369a1;
  --primary-light: #e0f2fe;
  --secondary: #0f172a;
  --accent: #0ea5e9;
  --success: #16a34a;
  --success-bg: #dcfce7;
  --warning: #d97706;
  --warning-bg: #fef3c7;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --bg-body: #f1f5f9;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 25px -3px rgba(15, 23, 42, 0.12), 0 4px 6px -4px rgba(15, 23, 42, 0.06);
  --sidebar-width: 265px;
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.25s ease;
}

.sidebar-brand {
  padding: 20px 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
}

.brand-text h1 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #fff;
}

.brand-text p {
  font-size: 12px;
  color: #94a3b8;
  font-weight: 500;
}

.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  font-weight: 700;
  padding: 8px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: #cbd5e1;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: all 0.15s ease;
}

.nav-item-left {
  display: flex;
  align-items: center;
  gap: 11px;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  opacity: 0.85;
  flex-shrink: 0;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.nav-item.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}

.nav-badge {
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  min-width: 20px;
  text-align: center;
  animation: pulseBadge 2s infinite;
}

.nav-badge.hidden {
  display: none;
}

@keyframes pulseBadge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(15, 23, 42, 0.5);
}

.db-status-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.db-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f59e0b;
  flex-shrink: 0;
}

.status-dot.connected {
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
}

.db-status-sub {
  font-size: 11px;
  color: #94a3b8;
}

/* Main Content */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

/* Top Header */
.top-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px;
  cursor: pointer;
  color: var(--text-main);
}

.page-title h2 {
  font-size: 19px;
  font-weight: 700;
  color: var(--text-main);
}

.page-title p {
  font-size: 12.5px;
  color: var(--text-muted);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Notification Bell & Dropdown */
.notif-wrapper {
  position: relative;
}

.notif-btn {
  position: relative;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s;
}

.notif-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.notif-btn.has-alert {
  background: var(--danger-bg);
  border-color: #fca5a5;
  color: var(--danger);
}

.notif-count {
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
}

.notif-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 360px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 120;
  display: none;
  overflow: hidden;
}

.notif-dropdown.open {
  display: block;
}

.notif-dropdown-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
}

.notif-dropdown-header h4 {
  font-size: 13.5px;
  font-weight: 700;
}

.notif-dropdown-list {
  max-height: 320px;
  overflow-y: auto;
}

.notif-dropdown-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  transition: background 0.15s;
}

.notif-dropdown-item:hover {
  background: #f8fafc;
}

.notif-dropdown-item:last-child {
  border-bottom: none;
}

.notif-dropdown-footer {
  padding: 10px 16px;
  background: #f8fafc;
  border-top: 1px solid var(--border);
  text-align: center;
}

/* Page Content Container */
.content-area {
  padding: 24px 28px 48px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

.tab-section {
  display: none;
}

.tab-section.active {
  display: block;
}

/* Emergency Water Issue Banner */
.water-alert-banner {
  background: linear-gradient(90deg, #fef2f2 0%, #fff1f2 100%);
  border: 1px solid #fecaca;
  border-left: 5px solid var(--danger);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.water-alert-banner.hidden {
  display: none;
}

.water-alert-info {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.water-alert-icon {
  background: var(--danger);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
}

.water-alert-text h3 {
  font-size: 14.5px;
  font-weight: 700;
  color: #991b1b;
}

.water-alert-text p {
  font-size: 13px;
  color: #b91c1c;
  margin-top: 2px;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.stat-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-icon.amber { background: var(--warning-bg); color: var(--warning); }
.stat-icon.red { background: var(--danger-bg); color: var(--danger); }

.stat-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Cards & Panels */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: 22px;
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.card-title {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.card-body {
  padding: 20px;
}

/* Grid 2 Columns */
.grid-2 {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  text-decoration: none;
  font-family: inherit;
  white-space: nowrap;
}

.btn-sm {
  padding: 6px 11px;
  font-size: 12px;
}

.btn-xs {
  padding: 4px 8px;
  font-size: 11.5px;
  border-radius: 6px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover {
  background: #15803d;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  background: #b91c1c;
}

.btn-warning {
  background: var(--warning);
  color: #fff;
}
.btn-warning:hover {
  background: #b45309;
}

.btn-outline {
  background: #fff;
  border-color: var(--border);
  color: var(--text-main);
}
.btn-outline:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.btn-ghost-danger {
  background: var(--danger-bg);
  color: var(--danger);
}
.btn-ghost-danger:hover {
  background: #fecaca;
}

/* Blok Selector Pills */
.blok-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
  align-items: start;
}

.blok-list-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.blok-list-items {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.blok-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  background: #f8fafc;
}

.blok-item:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.blok-item.active {
  background: var(--primary-light);
  border-color: #7dd3fc;
  color: var(--primary-dark);
}

.blok-item-info h4 {
  font-size: 14px;
  font-weight: 700;
}

.blok-item-info p {
  font-size: 11.5px;
  color: var(--text-muted);
}

.blok-item.active .blok-item-info p {
  color: #0369a1;
}

.blok-item-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.blok-count-badge {
  background: #e2e8f0;
  color: #334155;
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}

.blok-item.active .blok-count-badge {
  background: var(--primary);
  color: #fff;
}

/* Overview Blok Cards on Dashboard */
.blok-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}

.blok-summary-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.15s;
}

.blok-summary-card:hover {
  border-color: var(--primary);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.blok-summary-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.blok-summary-top h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.blok-summary-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Filters & Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.toolbar-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.input-control, .select-control {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text-main);
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
}

.input-control:focus, .select-control:focus, textarea.input-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  background: #f8fafc;
  padding: 11px 14px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 13px 14px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

.data-table tbody tr:hover {
  background: #f8fafc;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
}

.badge-success {
  background: var(--success-bg);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge-info {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.badge-neutral {
  background: #e2e8f0;
  color: #475569;
}

.house-code {
  font-weight: 700;
  color: var(--primary-dark);
  background: var(--primary-light);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12.5px;
  display: inline-block;
}

/* Water Complaint Cards */
.complaint-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.complaint-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow 0.15s;
}

.complaint-card.status-baru {
  border-left: 5px solid var(--danger);
  background: #fffcfc;
}

.complaint-card.status-diproses {
  border-left: 5px solid var(--warning);
}

.complaint-card.status-selesai {
  border-left: 5px solid var(--success);
  opacity: 0.9;
}

.complaint-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.complaint-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.complaint-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.complaint-desc {
  font-size: 13.5px;
  color: #334155;
  background: #f8fafc;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid #f1f5f9;
}

.complaint-response {
  font-size: 12.5px;
  color: #0369a1;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}

.complaint-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
}

.complaint-time {
  font-size: 12px;
  color: var(--text-muted);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

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

.modal-dialog {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

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

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-group label {
  font-size: 12.5px;
  font-weight: 600;
  color: #334155;
}

.form-hint {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Tariff Banner inside Iuran Tab */
.tariff-config-bar {
  background: linear-gradient(90deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1px solid #bae6fd;
  border-radius: var(--radius-md);
  padding: 14px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.tariff-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tariff-badge-big {
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 36px 20px;
  color: var(--text-muted);
}

.empty-state p {
  font-size: 13.5px;
  margin-top: 6px;
}

/* Toast Notification */
.toast-container {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: #0f172a;
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  max-width: 400px;
  animation: slideInUp 0.2s ease;
}

.toast.toast-danger {
  background: #991b1b;
  border-left: 4px solid #f87171;
}

.toast.toast-success {
  background: #14532d;
  border-left: 4px solid #4ade80;
}

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

.code-block {
  background: #0f172a;
  color: #e2e8f0;
  padding: 14px;
  border-radius: var(--radius-sm);
  font-family: monospace;
  font-size: 12px;
  overflow-x: auto;
  line-height: 1.5;
}

/* ========================================================= */
/* LOGIN SCREEN & PORTAL WARGA                               */
/* ========================================================= */
.login-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #0f172a 0%, #0369a1 100%);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}

.login-overlay.hidden {
  display: none;
}

.login-card {
  background: #ffffff;
  width: 100%;
  max-width: 470px;
  border-radius: 18px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.login-card-header {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #fff;
  padding: 24px 26px 20px;
  text-align: center;
}

.login-brand-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin-bottom: 10px;
}

.login-card-header h2 {
  font-size: 20px;
  font-weight: 800;
}

.login-brand-subtitle {
  font-size: 14.5px;
  font-weight: 600;
  color: #e0f2fe;
  margin-top: 2px;
  letter-spacing: 0.3px;
}

.login-card-header p {
  font-size: 13px;
  opacity: 0.9;
  margin-top: 3px;
}

/* Kotak Ucapan Selamat Datang Hangat & Menarik */
.login-welcome-box {
  margin: 18px 24px 0;
  padding: 14px 16px;
  background: linear-gradient(135deg, #f0fdf4 0%, #f0f9ff 100%);
  border: 1px solid #bae6fd;
  border-radius: 12px;
  text-align: left;
}

.welcome-greeting-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 800;
  color: #0369a1;
  margin-bottom: 6px;
}

.welcome-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #0284c7;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.25);
  display: inline-block;
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(2, 132, 199, 0.4); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(2, 132, 199, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(2, 132, 199, 0); }
}

.welcome-greeting-desc {
  font-size: 12.5px;
  color: #475569;
  line-height: 1.55;
  margin: 0;
}

.welcome-feature-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.welcome-pill {
  font-size: 11px;
  font-weight: 700;
  color: #0369a1;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #7dd3fc;
  padding: 3px 9px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.login-role-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #f1f5f9;
  padding: 5px;
  margin: 18px 24px 0;
  border-radius: 10px;
}

.login-role-tab {
  border: none;
  background: transparent;
  padding: 10px 14px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-muted);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  pointer-events: auto;
  position: relative;
  z-index: 10;
}

.login-role-tab.active {
  background: #fff;
  color: var(--primary-dark);
  box-shadow: var(--shadow-sm);
}

.login-role-tab:hover:not(.active) {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.6);
}

.login-card-body {
  padding: 20px 24px 24px;
}

.login-error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fecaca;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 14px;
}

.login-error.hidden {
  display: none;
}

.demo-accounts-box {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}

.demo-accounts-box h5 {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.demo-account-pills {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 250px;
  overflow-y: auto;
  padding-right: 4px;
}

.demo-account-card {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.15s ease;
}

.demo-account-card:hover {
  background: #f0f9ff;
  border-color: #7dd3fc;
}

.demo-account-card.active-user {
  border-color: var(--primary);
  background: var(--primary-light);
}

.demo-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.demo-card-user {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.demo-card-creds {
  font-size: 11.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.demo-card-creds code {
  color: var(--primary-dark);
  font-weight: 700;
  background: #e2e8f0;
  padding: 1px 5px;
  border-radius: 4px;
}

.demo-card-scenario {
  font-size: 11.5px;
  color: #0369a1;
  background: #e0f2fe;
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-block;
}

.demo-card-btns {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.demo-pill-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 11px;
  font-size: 12px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: all 0.15s;
}

.demo-pill-btn:hover {
  background: var(--primary-light);
  border-color: #7dd3fc;
}

/* Portal Warga Profile Hero */
.warga-hero-banner {
  background: linear-gradient(135deg, #0f172a 0%, #0369a1 100%);
  color: #fff;
  border-radius: var(--radius-md);
  padding: 22px 24px;
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  box-shadow: var(--shadow-md);
}

.warga-hero-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.warga-avatar {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
}

.warga-hero-info h3 {
  font-size: 19px;
  font-weight: 800;
}

.warga-hero-info p {
  font-size: 13px;
  color: #bae6fd;
  margin-top: 2px;
}

/* 12-Month Payment Grid for Resident Portal */
.months-grid-12 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.month-status-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.month-status-card.paid {
  border-color: #86efac;
  background: #f0fdf4;
}

.month-status-card.unpaid {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.month-status-card.current-unpaid {
  border-color: #fca5a5;
  background: #fef2f2;
}

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

.month-card-top h4 {
  font-size: 14px;
  font-weight: 700;
}

.user-session-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f1f5f9;
  border: 1px solid var(--border);
  padding: 6px 11px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.btn-label-mobile {
  display: none;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
  z-index: 95;
  display: none;
}

.sidebar-backdrop.open {
  display: block;
}

.sidebar-close-btn {
  display: none;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

/* Mobile Bottom Navigation Bar */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #ffffff;
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.08);
  z-index: 90;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
  justify-content: space-around;
  align-items: center;
}

.mobile-nav-item {
  position: relative;
  flex: 1;
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 4px;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mobile-nav-icon {
  font-size: 18px;
  line-height: 1;
}

.mobile-nav-item.active {
  color: var(--primary);
  background: var(--primary-light);
  font-weight: 700;
}

.mobile-nav-badge {
  position: absolute;
  top: 2px;
  right: calc(50% - 20px);
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 999px;
  min-width: 16px;
  text-align: center;
}

.mobile-nav-badge.hidden {
  display: none;
}

/* Responsive Tablet & Mobile */
@media (max-width: 1024px) {
  .stats-grid,
  .stats-grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .blok-layout {
    grid-template-columns: 1fr;
  }
  .months-grid-12 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: 280px;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-close-btn {
    display: inline-flex;
  }
  .main-wrapper {
    margin-left: 0;
  }
  .mobile-menu-btn {
    display: inline-flex;
    flex-shrink: 0;
  }
  .mobile-bottom-nav {
    display: flex;
  }
  .top-header {
    padding: 10px 14px;
    gap: 8px;
  }
  .page-title h2 {
    font-size: 15.5px;
    line-height: 1.25;
  }
  .page-title p {
    display: none;
  }
  .header-right {
    gap: 6px;
  }
  .user-session-pill {
    display: none;
  }
  .btn-label-desktop {
    display: none;
  }
  .btn-label-mobile {
    display: inline;
  }
  .content-area {
    padding: 14px 14px 92px;
  }
  .stats-grid,
  .stats-grid-3 {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .stat-card {
    padding: 14px 16px;
  }
  .stat-value {
    font-size: 21px;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  /* Horizontal swipeable blok selector on mobile */
  .blok-list-items {
    flex-direction: row;
    overflow-x: auto;
    padding: 10px 12px;
    gap: 8px;
    -webkit-overflow-scrolling: touch;
  }
  .blok-item {
    min-width: 185px;
    flex-shrink: 0;
  }
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .toolbar-group {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }
  .toolbar-group .input-control,
  .toolbar-group .select-control {
    width: 100% !important;
    min-width: 0 !important;
  }
  .input-control,
  .select-control,
  textarea.input-control {
    font-size: 16px; /* Prevents auto-zoom on iOS Safari */
    padding: 10px 12px;
  }
  .water-alert-banner {
    flex-direction: column;
    align-items: stretch;
  }
  .water-alert-banner .btn {
    width: 100%;
  }
  .warga-hero-banner {
    padding: 16px;
    flex-direction: column;
    align-items: stretch;
  }
  .warga-hero-banner > div:last-child {
    width: 100%;
  }
  .warga-hero-banner .btn {
    flex: 1;
  }
  .tariff-config-bar {
    padding: 14px;
    flex-direction: column;
    align-items: stretch;
  }
  .tariff-info {
    flex-direction: column;
    align-items: flex-start;
  }
  .notif-dropdown {
    position: fixed;
    top: 60px;
    left: 12px;
    right: 12px;
    width: auto;
  }
  .months-grid-12 {
    grid-template-columns: 1fr;
  }
  .toast-container {
    bottom: 76px;
    left: 14px;
    right: 14px;
  }
  .toast {
    min-width: 0;
    width: 100%;
    max-width: none;
  }
}

/* Mobile Card Layout for Data Tables & Bottom-Sheet Modals on Phones */
@media (max-width: 640px) {
  .card-header {
    padding: 14px 16px;
  }
  .card-body {
    padding: 14px;
  }
  .data-table thead {
    display: none;
  }
  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }
  .data-table tbody tr {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    padding: 10px 14px;
    box-shadow: var(--shadow-sm);
  }
  .data-table tbody tr:last-child {
    margin-bottom: 0;
  }
  .data-table td {
    padding: 8px 0;
    border-bottom: 1px dashed #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    text-align: right;
  }
  .data-table td:last-child {
    border-bottom: none;
  }
  .data-table td::before {
    content: attr(data-label);
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    text-align: left;
    flex-shrink: 0;
  }
  .data-table td:not([data-label]) {
    display: block;
    text-align: center;
  }
  .data-table td:not([data-label])::before {
    display: none;
  }
  .data-table td.td-actions {
    flex-direction: column;
    align-items: stretch;
    padding-top: 10px;
  }
  .data-table td.td-actions::before {
    margin-bottom: 2px;
  }
  .data-table td.td-actions > div {
    width: 100%;
    justify-content: stretch !important;
  }
  .data-table td.td-actions .btn {
    flex: 1;
    padding: 8px 10px;
    font-size: 12.5px;
  }

  /* Bottom Sheet Modals on Phone */
  .modal-backdrop {
    padding: 0;
    align-items: flex-end;
  }
  .modal-dialog {
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    max-height: 90vh;
  }
  .modal-footer {
    flex-direction: row;
  }
  .modal-footer .btn {
    flex: 1;
    padding: 11px;
  }

  /* Login Card on Phone */
  .login-overlay {
    padding: 12px;
  }
  .login-card-header {
    padding: 18px 18px 16px;
  }
  .login-welcome-box {
    margin: 12px 14px 0;
    padding: 12px 13px;
  }
  .login-role-tabs {
    margin: 12px 14px 0;
  }
  .login-card-body {
    padding: 16px;
  }
}

/* ========================================================= */
/* PENGUMUMAN RT STYLING                                    */
/* ========================================================= */
.announcement-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  transition: all 0.2s ease;
  position: relative;
}

.announcement-card:hover {
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.07);
}

.announcement-card.pinned {
  border-left: 5px solid #f59e0b;
  background: linear-gradient(180deg, #fffbeb 0%, #ffffff 45px);
}

.announcement-card.emergency {
  border-left: 5px solid #ef4444;
  background: linear-gradient(180deg, #fef2f2 0%, #ffffff 45px);
}

.announcement-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.announcement-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-dark);
  margin-top: 4px;
  line-height: 1.4;
}

.announcement-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.announcement-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.announcement-body {
  font-size: 13.5px;
  line-height: 1.65;
  color: #334155;
  margin-top: 12px;
  white-space: pre-line;
  word-break: break-word;
}

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

