:root {
  --emerald-main: #064e3b;
  --emerald-dark: #033528;
  --emerald-soft: rgba(6, 78, 59, 0.08);
  --gold-accent: #d4af37;
  --gold-soft: rgba(212, 175, 55, 0.16);
  --surface-canvas: #f6f8f7;
  --surface-card: #ffffff;
  --ink-primary: #0f1c18;
  --ink-secondary: #5c6f68;
  --line-soft: #e2e8e5;
  --shadow-soft: 0 8px 24px rgba(6, 78, 59, 0.05);
  --shadow-card-hover: 0 12px 28px rgba(6, 78, 59, 0.09);
  --radius-xl: 18px;
  --radius-md: 12px;
}

body {
  font-family: 'Poppins', system-ui, -apple-system, sans-serif;
  background-color: var(--surface-canvas);
  color: var(--ink-primary);
  margin: 0;
  padding-bottom: 88px;
}

/* Desktop Sidebar */
.app-sidebar {
  width: 264px;
  min-height: 100vh;
  background: linear-gradient(180deg, var(--emerald-main) 0%, var(--emerald-dark) 100%);
  color: #ffffff;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1030;
  padding: 1.75rem 1.25rem;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(212, 175, 55, 0.25);
}

.brand-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 1.4rem;
  margin-bottom: 1.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-badge {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: var(--gold-soft);
  border: 1px solid rgba(212, 175, 55, 0.45);
  color: var(--gold-accent);
  display: grid;
  place-items: center;
  font-size: 1.2rem;
}

.sidebar-nav .nav-link {
  color: rgba(255, 255, 255, 0.76);
  border-radius: var(--radius-md);
  padding: 0.78rem 1rem;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.92rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.sidebar-nav .nav-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-nav .nav-link.active {
  background: #ffffff;
  color: var(--emerald-main);
  font-weight: 600;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.16);
}

.sidebar-nav .nav-link.active i {
  color: var(--gold-accent);
}

/* Main Area */
.app-main {
  margin-left: 0;
}

@media (min-width: 992px) {
  body {
    padding-bottom: 2rem;
  }
  .app-main {
    margin-left: 264px;
  }
}

.app-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem;
}

@media (min-width: 992px) {
  .app-container {
    padding: 2rem 2.25rem;
  }
}

/* Mobile Header */
.mobile-header {
  background: var(--surface-card);
  border-bottom: 1px solid var(--line-soft);
  position: sticky;
  top: 0;
  z-index: 1020;
}

/* Buttons */
.btn-emerald {
  background-color: var(--emerald-main);
  border-color: var(--emerald-main);
  color: #ffffff;
  border-radius: var(--radius-md);
  font-weight: 500;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  transition: all 0.2s ease;
}

.btn-emerald:hover,
.btn-emerald:focus {
  background-color: var(--emerald-dark);
  border-color: var(--emerald-dark);
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-gold-outline {
  background-color: var(--gold-soft);
  border: 1px solid rgba(212, 175, 55, 0.55);
  color: var(--emerald-main);
  border-radius: var(--radius-md);
  font-weight: 600;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

.btn-gold-outline:hover {
  background-color: var(--emerald-main);
  border-color: var(--emerald-main);
  color: #ffffff;
}

/* Summary Cards */
.metric-card {
  background: var(--surface-card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-xl);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow-soft);
  height: 100%;
}

.metric-card-hero {
  background: linear-gradient(135deg, var(--emerald-main) 0%, var(--emerald-dark) 100%);
  color: #ffffff;
  border: 1px solid rgba(212, 175, 55, 0.35);
}

.metric-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
}

/* Filter & Search */
.pill-tab {
  border-radius: 999px;
  padding: 0.48rem 1.05rem;
  font-size: 0.84rem;
  font-weight: 500;
  border: 1px solid var(--line-soft);
  background: var(--surface-card);
  color: var(--ink-secondary);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.pill-tab.active,
.pill-tab:hover {
  background: var(--emerald-main);
  border-color: var(--emerald-main);
  color: #ffffff;
}

.search-field-wrap {
  position: relative;
}

.search-field-wrap i {
  position: absolute;
  left: 0.95rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-secondary);
}

.search-field {
  background: var(--surface-card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  min-height: 44px;
  padding-left: 2.5rem;
}

.search-field:focus {
  border-color: var(--emerald-main);
  box-shadow: 0 0 0 3px var(--emerald-soft);
}

/* Tagihan Cards */
.invoice-card {
  background: var(--surface-card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-xl);
  padding: 1.2rem 1.3rem;
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.invoice-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
  border-color: rgba(212, 175, 55, 0.45);
}

.avatar-circle {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--emerald-soft);
  border: 1px solid rgba(6, 78, 59, 0.14);
  color: var(--emerald-main);
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.chip-status {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.34rem 0.75rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.chip-unpaid {
  background: var(--gold-soft);
  color: #7c5800;
  border: 1px solid rgba(212, 175, 55, 0.4);
}

.chip-paid {
  background: #e6f4ef;
  color: var(--emerald-main);
}

/* Mobile Bottom Nav */
.mobile-bottom-bar {
  background: var(--surface-card);
  border-top: 1px solid var(--line-soft);
  box-shadow: 0 -6px 20px rgba(6, 78, 59, 0.06);
  z-index: 1030;
}

.mobile-bottom-bar .bottom-link {
  color: var(--ink-secondary);
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.5rem 0.2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  transition: color 0.2s ease;
}

.mobile-bottom-bar .bottom-link i {
  font-size: 1.22rem;
}

.mobile-bottom-bar .bottom-link.active {
  color: var(--emerald-main);
  font-weight: 600;
}

.mobile-bottom-bar .bottom-link.active i {
  color: var(--gold-accent);
}


/* Ukuran Tombol Kompak & Konsisten */
.btn-emerald,
.btn-gold-outline {
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.44rem 0.85rem;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  line-height: 1.25;
  white-space: nowrap;
}

.btn-sm.btn-emerald,
.btn-sm.btn-gold-outline,
.btn-compact {
  font-size: 0.78rem;
  padding: 0.34rem 0.68rem;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  line-height: 1.2;
  white-space: nowrap;
}

.btn-icon-sq {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Grup Aksi Responsif agar Tidak Pecah Berantakan di HP */
.page-action-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.item-action-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

@media (max-width: 575.98px) {
  .page-action-bar > * {
    flex: 1 1 auto;
  }
  .page-action-bar form.period-picker-form {
    flex: 1 1 100%;
  }
  .item-action-group {
    width: 100%;
    justify-content: flex-end;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--line-soft);
  }
}