/* ==========================================================================
   POS CV GLOBAL UMMAH BERKAH - COMPACT MOBILE-FIRST DESIGN SYSTEM
   Palette: Blue (#0099E6), Emerald (#10B981), Lime (#C8E636)
   Compact Layout: 15% Font Size Reduction, 50% Margin/Padding Cut
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Outfit:wght@400;500;600;700;800;900&display=swap');

:root {
  /* Brand Colors */
  --primary: #0099E6;
  --primary-dark: #0077B6;
  --primary-light: #E0F2FE;
  --primary-glow: rgba(0, 153, 230, 0.25);

  --secondary: #10B981;
  --secondary-dark: #059669;
  --secondary-light: #D1FAE5;
  --secondary-glow: rgba(16, 185, 129, 0.25);

  --accent: #C8E636;
  --accent-dark: #84CC16;
  --accent-light: #F7FEE7;
  --accent-glow: rgba(200, 230, 54, 0.35);

  /* Functional Colors */
  --danger: #EF4444;
  --danger-light: #FEE2E2;
  --warning: #F59E0B;
  --warning-light: #FEF3C7;
  --info: #3B82F6;
  --info-light: #EFF6FF;

  /* Neutral Dark / Slate */
  --dark: #0F172A;
  --dark-surface: #1E293B;
  --dark-muted: #64748B;
  --dark-border: #334155;

  /* Neutral Light */
  --bg-page: #F8FAFC;
  --bg-card: rgba(255, 255, 255, 0.95);
  --bg-card-elevated: #FFFFFF;
  --border-light: #E2E8F0;
  --border-subtle: #F1F5F9;

  /* Typography */
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-heading: 'Outfit', var(--font-sans);

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 3px 5px -1px rgba(0, 0, 0, 0.06), 0 1px 3px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 6px 10px -2px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.03);
  --shadow-xl: 0 12px 18px -4px rgba(0, 0, 0, 0.09), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-primary: 0 6px 14px -2px var(--primary-glow);
  --shadow-secondary: 0 6px 14px -2px var(--secondary-glow);
  --shadow-accent: 0 6px 14px -2px var(--accent-glow);

  /* Gradients */
  --grad-primary: linear-gradient(135deg, #0099E6 0%, #00B4D8 50%, #10B981 100%);
  --grad-ocean: linear-gradient(135deg, #0099E6 0%, #0284C7 100%);
  --grad-emerald: linear-gradient(135deg, #10B981 0%, #059669 100%);
  --grad-lime: linear-gradient(135deg, #C8E636 0%, #84CC16 100%);
  --grad-sunset: linear-gradient(135deg, #F59E0B 0%, #EF4444 100%);
  --grad-dark: linear-gradient(135deg, #0F172A 0%, #1E293B 100%);
  --grad-glass: linear-gradient(135deg, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.85) 100%);

  /* Transitions */
  --tr-fast: all 0.12s cubic-bezier(0.4, 0, 0.2, 1);
  --tr-normal: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --tr-bounce: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Sizing & Layout (Compact 50% cut on paddings/margins) */
  --nav-height: 52px;
  --header-height: 48px;
  --max-app-width: 520px;
}

/* Base Reset & Styling */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  font-family: var(--font-sans);
  background-color: #E6EDF5;
  color: var(--dark);
  font-size: 13px; /* Reduced by ~15% from 15px */
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* Desktop Centered Mobile Shell */
.app-viewport {
  width: 100%;
  max-width: var(--max-app-width);
  margin: 0 auto;
  min-height: 100vh;
  background-color: var(--bg-page);
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 0 35px rgba(0, 0, 0, 0.08);
}

@media (min-width: 1024px) {
  body {
    background: linear-gradient(135deg, #DCE7F3 0%, #C9DBEE 100%);
    padding: 10px 0;
  }
  .app-viewport {
    border-radius: 20px;
    overflow: hidden;
    min-height: calc(100vh - 20px);
    border: 1px solid rgba(255, 255, 255, 0.8);
  }
}

/* Typography Utility (Compact) */
h1, h2, h3, h4, h5, h6, .font-heading {
  font-family: var(--font-heading);
  letter-spacing: -0.02em;
  font-weight: 700;
  color: var(--dark);
  line-height: 1.2;
}

h1 { font-size: 20px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
h4 { font-size: 12.5px; }
h5, h6 { font-size: 11px; }

p, span, div, label {
  font-size: 12.5px;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--tr-fast);
}

/* Top Header (Compact) */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-light);
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-logo {
  height: 28px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 1px 3px rgba(0, 153, 230, 0.2));
}

.header-title-box {
  display: flex;
  flex-direction: column;
}

.header-title {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.1;
  background: var(--grad-ocean);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-subtitle {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--dark-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.role-badge.role-admin {
  background: linear-gradient(135deg, #0099E6, #0077B6);
  color: #fff;
  box-shadow: 0 1px 5px rgba(0, 153, 230, 0.3);
}

.role-badge.role-owner {
  background: linear-gradient(135deg, #8B5CF6, #6D28D9);
  color: #fff;
  box-shadow: 0 1px 5px rgba(139, 92, 246, 0.3);
}

.role-badge.role-operator {
  background: linear-gradient(135deg, #10B981, #059669);
  color: #fff;
  box-shadow: 0 1px 5px rgba(16, 185, 129, 0.3);
}

/* Main Content Area (Compact 50% Margin/Padding Cut) */
.app-content {
  flex: 1;
  padding: 8px 8px calc(var(--nav-height) + 12px) 8px;
  overflow-y: auto;
}

/* Bottom Navigation Bar (Compact) */
.bottom-nav {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 4px;
  z-index: 50;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.04);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--dark-muted);
  font-size: 9.5px;
  font-weight: 600;
  padding: 3px 6px;
  border-radius: 10px;
  transition: var(--tr-fast);
  text-decoration: none;
  gap: 2px;
  position: relative;
}

.nav-item i {
  font-size: 17px;
  transition: var(--tr-bounce);
}

.nav-item.active {
  color: var(--primary);
}

.nav-item.active i {
  transform: translateY(-1px) scale(1.08);
  color: var(--primary);
  filter: drop-shadow(0 1px 4px var(--primary-glow));
}

.nav-item.active::after {
  content: '';
  position: absolute;
  bottom: 1px;
  width: 12px;
  height: 2px;
  background: var(--grad-ocean);
  border-radius: 999px;
}

/* Floating Action Center Button (Compact) */
.nav-fab-wrap {
  position: relative;
  top: -10px;
}

.nav-fab {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--grad-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  box-shadow: 0 4px 12px var(--primary-glow), 0 1px 4px rgba(0,0,0,0.1);
  border: 2px solid #fff;
  transition: var(--tr-bounce);
  cursor: pointer;
  text-decoration: none;
}

.nav-fab:hover, .nav-fab:active {
  transform: scale(1.06) rotate(90deg);
  color: #fff;
}

/* Cards & Glassmorphism (Compact 50% Cut) */
.card-gug {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 12px;
  padding: 8px 10px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-md);
  transition: var(--tr-normal);
}

.card-gug:hover {
  box-shadow: var(--shadow-lg);
}

.card-hero {
  background: var(--grad-dark);
  color: #fff;
  border-radius: 14px;
  padding: 10px 12px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  margin-bottom: 10px;
}

.card-hero::before {
  content: '';
  position: absolute;
  top: -30px;
  right: -30px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
  pointer-events: none;
}

.card-hero::after {
  content: '';
  position: absolute;
  bottom: -20px;
  left: -20px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
}

/* Stat Cards Grid (Compact) */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}

.stat-box {
  background: #fff;
  border-radius: 10px;
  padding: 7px 9px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: var(--tr-fast);
}

.stat-box:active {
  transform: scale(0.98);
}

.stat-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  margin-bottom: 4px;
}

.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--secondary-light); color: var(--secondary); }
.stat-icon.lime { background: var(--accent-light); color: var(--accent-dark); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-icon.amber { background: var(--warning-light); color: var(--warning); }

.stat-label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--dark-muted);
  margin-bottom: 1px;
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 800;
  color: var(--dark);
  line-height: 1.15;
}

.stat-sub {
  font-size: 9.5px;
  color: var(--dark-muted);
  margin-top: 2px;
}

/* Buttons (Compact) */
.btn-gug {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: var(--tr-normal);
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

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

.btn-primary-gug {
  background: var(--grad-ocean);
  color: #fff;
  box-shadow: var(--shadow-primary);
}
.btn-primary-gug:hover { color: #fff; opacity: 0.95; }

.btn-success-gug {
  background: var(--grad-emerald);
  color: #fff;
  box-shadow: var(--shadow-secondary);
}
.btn-success-gug:hover { color: #fff; opacity: 0.95; }

.btn-accent-gug {
  background: var(--grad-lime);
  color: var(--dark);
  box-shadow: var(--shadow-accent);
}

.btn-outline-gug {
  background: transparent;
  color: var(--dark);
  border: 1.2px solid var(--border-light);
}
.btn-outline-gug:hover {
  background: #fff;
  border-color: var(--primary);
  color: var(--primary);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 3px 7px;
  font-size: 10.5px;
  border-radius: 6px;
}

/* Form Inputs (Compact) */
.form-group {
  margin-bottom: 8px;
}

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 3px;
}

.form-label span.req {
  color: var(--danger);
}

.form-control-gug, .form-select-gug {
  width: 100%;
  padding: 6px 9px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--dark);
  background-color: #fff;
  border: 1.2px solid var(--border-light);
  border-radius: 8px;
  transition: var(--tr-fast);
  outline: none;
}

.form-control-gug:focus, .form-select-gug:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
  background-color: #fff;
}

textarea.form-control-gug {
  min-height: 55px;
  resize: vertical;
}

/* Transaction List Item (Compact) */
.trx-item {
  background: #fff;
  border-radius: 10px;
  padding: 7px 9px;
  margin-bottom: 5px;
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: var(--tr-fast);
}

.trx-item:active {
  background-color: #F8FAFC;
}

.trx-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.trx-info {
  flex: 1;
  min-width: 0;
}

.trx-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trx-meta {
  font-size: 10.5px;
  color: var(--dark-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 1px;
}

.trx-amount {
  text-align: right;
  flex-shrink: 0;
}

.trx-val {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 800;
}

.trx-val.income { color: var(--secondary-dark); }
.trx-val.expense { color: var(--danger); }

.badge-status {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 700;
}

.badge-lunas {
  background: var(--secondary-light);
  color: var(--secondary-dark);
}

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

/* Quick Filter Pills (Compact) */
.filter-scroll {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 6px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.filter-scroll::-webkit-scrollbar {
  display: none;
}

.filter-pill {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  background: #fff;
  color: var(--dark-muted);
  border: 1px solid var(--border-light);
  white-space: nowrap;
  cursor: pointer;
  transition: var(--tr-fast);
  text-decoration: none;
}

.filter-pill.active {
  background: var(--grad-ocean);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 1px 5px var(--primary-glow);
}

/* Alert Boxes (Compact) */
.alert-gug {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  animation: slideDown 0.3s ease-out;
}

.alert-success {
  background: var(--secondary-light);
  color: #065F46;
  border: 1px solid #A7F3D0;
}

.alert-danger {
  background: var(--danger-light);
  color: #991B1B;
  border: 1px solid #FECACA;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Modal Bottom Sheet (Compact) */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(3px);
  z-index: 100;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

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

.modal-sheet {
  background: #fff;
  width: 100%;
  max-width: var(--max-app-width);
  border-radius: 18px 18px 0 0;
  padding: 12px 14px 18px 14px;
  max-height: 85vh;
  overflow-y: auto;
  animation: sheetSlideUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes sheetSlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.sheet-handle {
  width: 32px;
  height: 3px;
  background: var(--border-light);
  border-radius: 999px;
  margin: 0 auto 8px auto;
}

/* Quick Action Grid in Dashboard (Compact) */
.action-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin-bottom: 10px;
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 3px;
  background: #fff;
  border-radius: 10px;
  border: 1px solid var(--border-light);
  color: var(--dark);
  text-decoration: none;
  gap: 3px;
  box-shadow: var(--shadow-sm);
  transition: var(--tr-fast);
}

.action-btn:active {
  transform: scale(0.95);
  background-color: var(--primary-light);
}

.action-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

.action-text {
  font-size: 9.5px;
  font-weight: 700;
  text-align: center;
  line-height: 1.15;
}

/* Table styling (Compact) */
.table-responsive-gug {
  width: 100%;
  overflow-x: auto;
  border-radius: 10px;
}

.table-gug {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.table-gug th {
  background: #F1F5F9;
  padding: 6px 8px;
  font-weight: 700;
  text-align: left;
  color: var(--dark-muted);
  border-bottom: 1px solid var(--border-light);
}

.table-gug td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

/* Utility Helpers (Compact Spacing) */
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.p-1 { padding: 4px; }
.p-2 { padding: 8px; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
