/* ISPM E-Billing — Theme (works without Tailwind @apply) */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --ispm-bg: #f0f4f8;
  --ispm-sidebar: #0c1222;
  --ispm-sidebar-hover: #1a2332;
  --ispm-accent: #22c55e;
  --ispm-accent-dark: #16a34a;
  --ispm-accent-glow: rgba(34, 197, 94, 0.35);
  --ispm-card: #ffffff;
  --ispm-text: #0f172a;
  --ispm-muted: #64748b;
  --ispm-border: #e2e8f0;
  --ispm-radius: 16px;
  --ispm-radius-lg: 20px;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html {
  height: auto;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

.ispm-app {
  font-family: var(--font);
  color: var(--ispm-text);
  background: var(--ispm-bg);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  -webkit-font-smoothing: antialiased;
}

/* Mobile: drawer tertutup tidak boleh menangkap tap (penyebab hamburger mati) */
@media (max-width: 1023px) {
  .ispm-sidebar {
    pointer-events: none;
  }
  .ispm-sidebar.ispm-sidebar--open {
    pointer-events: auto;
  }
  body.ispm-sidebar-open {
    overflow: hidden;
  }
  .ispm-mobile-header {
    position: sticky;
    top: 0;
    z-index: 100;
    isolation: isolate;
  }
  .ispm-menu-btn {
    position: relative;
    z-index: 101;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  .ispm-bottom-nav {
    z-index: 90;
  }
  .ispm-drawer-overlay {
    position: fixed;
    inset: 0;
    z-index: 85;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
  }
  .ispm-sidebar.ispm-sidebar--open {
    z-index: 95;
  }
}

.ispm-app::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(34, 197, 94, 0.12), transparent),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(99, 102, 241, 0.08), transparent);
  pointer-events: none;
  z-index: 0;
}

.ispm-shell {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: stretch;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
}

.ispm-content {
  flex: 1;
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
}

/* Sidebar */
.ispm-sidebar {
  display: flex;
  flex-direction: column;
  width: min(100vw - 3rem, 280px);
  max-width: 280px;
  background: linear-gradient(180deg, #0f172a 0%, #0c1222 50%, #0a0f1a 100%);
  border-right: 1px solid rgba(255,255,255,0.06);
  box-shadow: 4px 0 24px rgba(0,0,0,0.15);
  /* Mobile drawer */
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 60;
  height: 100dvh;
  max-height: 100dvh;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
}

.ispm-sidebar.ispm-sidebar--open {
  transform: translateX(0);
}

.ispm-sidebar-nav {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.ispm-sidebar-brand,
.ispm-sidebar-footer {
  flex-shrink: 0;
}

@media (min-width: 1024px) {
  .ispm-sidebar {
    position: sticky;
    top: 0;
    align-self: flex-start;
    width: 270px;
    flex-shrink: 0;
    transform: none !important;
    height: 100dvh;
    max-height: 100dvh;
  }
}

.ispm-sidebar-brand {
  background: linear-gradient(135deg, rgba(34,197,94,0.15), transparent);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.ispm-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  margin: 2px 8px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  color: #94a3b8;
  text-decoration: none;
  transition: all 0.2s ease;
}

.ispm-nav-link:hover {
  background: rgba(255,255,255,0.06);
  color: #f1f5f9;
}

.ispm-nav-link.active {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 14px var(--ispm-accent-glow);
}

.ispm-nav-section {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #475569;
  padding: 16px 20px 6px;
}

/* Mobile header */
.ispm-mobile-header {
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--ispm-border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

/* Cards */
.ispm-card {
  background: var(--ispm-card);
  border-radius: var(--ispm-radius-lg);
  border: 1px solid var(--ispm-border);
  box-shadow: 0 1px 2px rgba(15,23,42,0.04), 0 8px 24px -6px rgba(15,23,42,0.08);
}

.ispm-card-hover:active { transform: scale(0.99); }

/* Stat cards */
.ispm-stat {
  background: var(--ispm-card);
  border-radius: var(--ispm-radius-lg);
  padding: 20px;
  border: 1px solid var(--ispm-border);
  position: relative;
  overflow: hidden;
}

.ispm-stat::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--stat-color, var(--ispm-accent));
}

.ispm-stat-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ispm-muted);
}

.ispm-stat-value {
  font-size: 28px;
  font-weight: 800;
  margin-top: 8px;
  letter-spacing: -0.02em;
}

/* Buttons */
.ispm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 14px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.ispm-btn:active { transform: scale(0.97); }

.ispm-btn-primary {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: #fff;
  box-shadow: 0 4px 14px var(--ispm-accent-glow);
}

.ispm-btn-dark {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  color: #fff;
}

.ispm-btn-outline {
  background: #fff;
  color: #334155;
  border: 2px solid var(--ispm-border);
}

.ispm-btn-block { width: 100%; }

/* Inputs */
.ispm-input, .ispm-select, .ispm-textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  font-family: var(--font);
  font-size: 16px;
  border: 2px solid var(--ispm-border);
  border-radius: 14px;
  background: #fff;
  color: var(--ispm-text);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.ispm-input:focus, .ispm-select:focus, .ispm-textarea:focus {
  border-color: var(--ispm-accent);
  box-shadow: 0 0 0 4px rgba(34,197,94,0.15);
}

.ispm-textarea { min-height: 100px; resize: vertical; }

/* Badges */
.ispm-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: capitalize;
}

.ispm-badge-success { background: #dcfce7; color: #166534; }
.ispm-badge-warning { background: #fef3c7; color: #92400e; }
.ispm-badge-danger { background: #fee2e2; color: #991b1b; }
.ispm-badge-info { background: #e0f2fe; color: #075985; }
.ispm-badge-neutral { background: #f1f5f9; color: #475569; }

/* List item mobile */
.ispm-list-item {
  display: block;
  padding: 16px 18px;
  border-bottom: 1px solid #f1f5f9;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
}

.ispm-list-item:last-child { border-bottom: none; }
.ispm-list-item:active { background: #f8fafc; }

/* Bottom nav */
.ispm-bottom-nav {
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--ispm-border);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.06);
  padding-bottom: env(safe-area-inset-bottom, 8px);
}

.ispm-bottom-nav a, .ispm-bottom-nav button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 4px;
  font-size: 10px;
  font-weight: 700;
  color: #94a3b8;
  text-decoration: none;
  background: none;
  border: none;
  font-family: var(--font);
  cursor: pointer;
}

.ispm-bottom-nav a.active, .ispm-bottom-nav button.active {
  color: var(--ispm-accent-dark);
}

.ispm-bottom-nav svg { width: 24px; height: 24px; }

/* Hero banner */
.ispm-hero {
  background: linear-gradient(135deg, #059669 0%, #047857 40%, #0d9488 100%);
  border-radius: var(--ispm-radius-lg);
  padding: 24px;
  color: #fff;
  box-shadow: 0 8px 30px rgba(5,150,105,0.35);
  margin-bottom: 24px;
}

.ispm-hero-pill {
  display: inline-block;
  background: rgba(255,255,255,0.2);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  margin: 4px 4px 0 0;
  backdrop-filter: blur(4px);
}

/* Table desktop */
.ispm-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.ispm-table th {
  text-align: left;
  padding: 14px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ispm-muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--ispm-border);
}
.ispm-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #f1f5f9;
}
.ispm-table tr:hover td { background: #fafbfc; }

/* Flash */
.ispm-flash {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px;
  border-radius: var(--ispm-radius);
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 500;
}
.ispm-flash-success { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
.ispm-flash-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }

/* Page title desktop */
.ispm-page-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ispm-text);
  margin-bottom: 24px;
}

/* Login page */
.ispm-login-bg {
  min-height: 100vh;
  background: #030712;
  background-image:
    radial-gradient(at 0% 0%, rgba(34,197,94,0.25) 0, transparent 50%),
    radial-gradient(at 100% 100%, rgba(59,130,246,0.15) 0, transparent 50%);
}

.ispm-login-card {
  background: #fff;
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.4);
}

[x-cloak] { display: none !important; }

/* Aliases — halaman lama tetap dapat style baru */
.card, .ispm-card { background: var(--ispm-card); border-radius: var(--ispm-radius-lg); border: 1px solid var(--ispm-border); box-shadow: 0 1px 2px rgba(15,23,42,0.04), 0 8px 24px -6px rgba(15,23,42,0.08); }
.btn-primary, .ispm-btn-primary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 14px; font-family: var(--font); font-size: 14px; font-weight: 700; border: none; cursor: pointer; text-decoration: none; background: linear-gradient(135deg, #22c55e, #16a34a); color: #fff; box-shadow: 0 4px 14px var(--ispm-accent-glow); }
.btn-secondary, .ispm-btn-dark { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 20px; border-radius: 14px; font-weight: 700; border: none; cursor: pointer; background: linear-gradient(135deg, #1e293b, #0f172a); color: #fff; text-decoration: none; font-family: var(--font); font-size: 14px; }
.btn-outline { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 20px; border-radius: 14px; font-weight: 700; background: #fff; border: 2px solid var(--ispm-border); color: #334155; text-decoration: none; font-family: var(--font); }
.input-field, .ispm-input { width: 100%; min-height: 48px; padding: 12px 16px; font-family: var(--font); font-size: 16px; border: 2px solid var(--ispm-border); border-radius: 14px; background: #fff; outline: none; }
.input-field:focus, .ispm-input:focus { border-color: var(--ispm-accent); box-shadow: 0 0 0 4px rgba(34,197,94,0.15); }
.select-field, .ispm-select { width: 100%; min-height: 48px; padding: 12px 16px; font-family: var(--font); font-size: 16px; border: 2px solid var(--ispm-border); border-radius: 14px; background: #fff; outline: none; }
.badge, .ispm-badge { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: capitalize; }
.badge.bg-emerald-100, .ispm-badge-success { background: #dcfce7 !important; color: #166534 !important; }
.badge.bg-amber-100, .ispm-badge-warning { background: #fef3c7 !important; color: #92400e !important; }
.badge.bg-sky-100, .ispm-badge-info { background: #e0f2fe !important; color: #075985 !important; }
.badge.bg-slate-100, .ispm-badge-neutral { background: #f1f5f9 !important; color: #475569 !important; }
.page-title { font-size: 28px; font-weight: 800; letter-spacing: -0.03em; }

/* Override sisa utility lama di dalam panel */
.ispm-main .bg-white.rounded-xl,
.ispm-main .bg-white.rounded-2xl,
.ispm-main .bg-white.rounded-lg {
  background: var(--ispm-card) !important;
  border-radius: var(--ispm-radius-lg) !important;
  border: 1px solid var(--ispm-border) !important;
  box-shadow: 0 1px 2px rgba(15,23,42,0.04), 0 8px 24px -6px rgba(15,23,42,0.08) !important;
}
.ispm-main input[type="text"],
.ispm-main input[type="email"],
.ispm-main input[type="password"],
.ispm-main input[type="number"],
.ispm-main input[type="search"],
.ispm-main input[type="tel"],
.ispm-main input[type="date"],
.ispm-main select,
.ispm-main textarea {
  font-family: var(--font);
  border-radius: 14px !important;
  border-width: 2px !important;
  min-height: 48px;
}
.ispm-main input:focus,
.ispm-main select:focus,
.ispm-main textarea:focus {
  border-color: var(--ispm-accent) !important;
  box-shadow: 0 0 0 4px rgba(34,197,94,0.15) !important;
  outline: none !important;
}
.ispm-main button[type="submit"],
.ispm-main .bg-emerald-600.text-white {
  font-family: var(--font) !important;
  font-weight: 700 !important;
  border-radius: 14px !important;
}

.ispm-main {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
}

@media (min-width: 1024px) {
  .ispm-hide-desktop { display: none !important; }
  .ispm-main { padding-bottom: 32px !important; }
}

@media (max-width: 1023px) {
  .ispm-hide-mobile { display: none !important; }
  .ispm-main {
    padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)) !important;
  }
}
