/* ==========================================================================
   KOPERASI SATRIA MAJU JAYA - CORE STYLESHEET
   Design Tokens:
   - Primary Blue: #0969F9
   - Navy: #0B1F3A
   - Background: #F5F7FB
   - Surface: #FFFFFF
   - Secondary Text: #64748B
   - Border: #E2E8F0
   ========================================================================== */

:root {
  --color-primary: #0969F9;
  --color-primary-hover: #0756CC;
  --color-navy: #0B1F3A;
  --color-bg: #F5F7FB;
  --color-surface: #FFFFFF;
  --color-text: #0B1F3A;
  --color-muted: #64748B;
  --color-border: #E2E8F0;
  
  --color-success: #10B981;
  --color-success-bg: #ECFDF5;
  --color-success-text: #065F46;

  --color-warning: #F59E0B;
  --color-warning-bg: #FFFBEB;
  --color-warning-text: #92400E;

  --color-danger: #EF4444;
  --color-danger-bg: #FEF2F2;
  --color-danger-text: #991B1B;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-sm: 0 1px 2px 0 rgba(11, 31, 58, 0.05);
  --shadow-md: 0 4px 12px -2px rgba(11, 31, 58, 0.08);
  --shadow-lg: 0 10px 25px -3px rgba(11, 31, 58, 0.1);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  min-width: 320px;
}

button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }

a {
  color: inherit;
  text-decoration: none;
}

/* ==========================================================================
   LAYOUT STRUCTURE
   ========================================================================== */

.app-wrapper {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* Sidebar for desktop */
.sidebar {
  display: none;
  width: 260px;
  background-color: var(--color-navy);
  color: #FFFFFF;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  padding: 24px 16px;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px 24px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 24px;
}

.sidebar-logo img {
  height: 44px;
  width: auto;
  border-radius: 8px;
}

.sidebar-logo-text {
  display: flex;
  flex-direction: column;
}

.sidebar-logo-text .brand {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #FFFFFF;
}

.sidebar-logo-text .sub {
  font-size: 11px;
  color: #94A3B8;
  font-weight: 500;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  color: #94A3B8;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s ease;
}

.sidebar-link:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
}

.sidebar-link.active {
  background-color: var(--color-primary);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(9, 105, 249, 0.3);
}

.sidebar-link svg {
  width: 20px;
  height: 20px;
}

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-bottom: calc(80px + var(--safe-bottom));
}

@media (min-width: 1024px) {
  .sidebar {
    display: flex;
  }
  .main-content {
    margin-left: 260px;
    padding-bottom: 40px;
  }
}

/* ==========================================================================
   TOP HEADER BAR
   ========================================================================== */

.topbar {
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--color-border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 68px;
  box-shadow: 0 1px 3px rgba(11, 31, 58, 0.02);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-brand img {
  height: 36px;
  width: 36px;
  border-radius: 9px;
  object-fit: cover;
  border: 1px solid rgba(226, 232, 240, 0.8);
  box-shadow: 0 1px 2px rgba(11, 31, 58, 0.04);
}

.topbar-brand-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--color-navy);
  line-height: 1.2;
}

.topbar-brand-subtitle {
  display: none;
  font-size: 11px;
  color: var(--color-muted);
  font-weight: 500;
  line-height: 1.2;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: #EFF6FF;
  color: var(--color-primary);
  border: 1px solid #BFDBFE;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
}

.role-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
  flex-shrink: 0;
}

.date-badge {
  font-size: 12px;
  color: var(--color-muted);
  font-weight: 500;
}

/* ==========================================================================
   BOTTOM NAVIGATION (MODERN AESTHETIC PWA DOCK)
   ========================================================================== */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(64px + var(--safe-bottom));
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-top: 1px solid rgba(226, 232, 240, 0.85);
  box-shadow: 0 -4px 20px rgba(11, 31, 58, 0.06), 0 -1px 3px rgba(11, 31, 58, 0.02);
  display: flex;
  align-items: flex-start;
  justify-content: space-around;
  z-index: 40;
  padding: 6px 6px calc(6px + var(--safe-bottom)) 6px;
  user-select: none;
  -webkit-user-select: none;
}

@media (min-width: 1024px) {
  .bottom-nav {
    display: none;
  }
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #64748B;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: -0.01em;
  padding: 2px 8px;
  min-width: 58px;
  height: 52px;
  border-radius: 12px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

/* Keep the primary payment action in the middle of the five-slot mobile dock. */
.bottom-nav > .bottom-nav-item,
.bottom-nav > .bottom-nav-fab-wrap,
.bottom-nav > .bottom-nav-logout-form {
  flex: 1 1 0;
}

.bottom-nav-logout-form { display: flex; min-width: 0; }
.bottom-nav-logout { border: 0; background: transparent; cursor: pointer; width: 100%; }

.bottom-nav-item:active {
  transform: scale(0.92);
}

.bottom-nav-item .nav-icon-wrap {
  width: 40px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.bottom-nav-item svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.9;
  color: #94A3B8;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.bottom-nav-item span {
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.1;
  color: #64748B;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Active State: Soft Pill Highlight & Vibrant Blue */
.bottom-nav-item.active {
  color: var(--color-primary);
}

.bottom-nav-item.active .nav-icon-wrap {
  background: #EFF6FF;
}

.bottom-nav-item.active svg {
  color: var(--color-primary);
  stroke-width: 2.3;
}

.bottom-nav-item.active span {
  color: var(--color-primary);
  font-weight: 700;
}

/* Staff Floating Action Button (FAB) in Bottom Nav */
.bottom-nav-fab-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav-fab {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0969F9 0%, #0284C7 100%);
  color: #FFFFFF !important;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px -1px rgba(9, 105, 249, 0.45), 0 2px 4px rgba(9, 105, 249, 0.2);
  margin-top: -16px;
  border: 3.5px solid #FFFFFF;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-decoration: none;
}

.bottom-nav-fab:active {
  transform: translateY(2px) scale(0.92);
  box-shadow: 0 3px 8px rgba(9, 105, 249, 0.35);
}

.bottom-nav-fab svg {
  width: 24px;
  height: 24px;
  stroke: #FFFFFF;
  stroke-width: 2.5;
}

.bottom-nav-fab-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-primary);
  margin-top: 3px;
  line-height: 1.1;
}

/* Highlighted Floating Action in Bottom Nav (legacy) */
.bottom-nav-action {
  color: #FFFFFF !important;
  background: linear-gradient(135deg, #0969F9 0%, #0284C7 100%);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px -1px rgba(9, 105, 249, 0.45);
  margin-top: -16px;
  border: 3.5px solid #FFFFFF;
}

.bottom-nav-action svg {
  width: 24px;
  height: 24px;
  margin-bottom: 0;
}

/* ==========================================================================
   PAGE CONTAINER & TYPOGRAPHY
   ========================================================================== */

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 16px;
}

@media (min-width: 768px) {
  .container {
    padding: 28px 24px;
  }
}

.page-header {
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (min-width: 640px) {
  .page-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-navy);
  letter-spacing: -0.02em;
}

.page-subtitle {
  font-size: 14px;
  color: var(--color-muted);
}

/* ==========================================================================
   CARDS & SURFACES
   ========================================================================== */

.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  margin-bottom: 16px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

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

/* ==========================================================================
   HERO STAT CARDS (MOCKUP 1 & 2 ACCORDANCE)
   ========================================================================== */

.hero-banner-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.hero-banner-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

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

.hero-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #ECFDF5;
  color: #10B981;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-banner-text .label {
  font-size: 13px;
  color: var(--color-muted);
  font-weight: 500;
}

.hero-banner-text .amount {
  font-size: 24px;
  font-weight: 800;
  color: var(--color-navy);
  letter-spacing: -0.02em;
}

.hero-banner-text .meta {
  font-size: 12px;
  color: var(--color-muted);
}

/* Stat Cards Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px 12px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-card-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}

.stat-card-icon.blue { background: #EFF6FF; color: var(--color-primary); }
.stat-card-icon.amber { background: #FFFBEB; color: var(--color-warning); }
.stat-card-icon.red { background: #FEF2F2; color: var(--color-danger); }

.stat-card .label {
  font-size: 12px;
  color: var(--color-muted);
  font-weight: 500;
  line-height: 1.2;
}

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

/* Quick Action Buttons Grid */
.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.quick-action-btn {
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  color: var(--color-primary);
  border-radius: var(--radius-md);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 600;
  font-size: 13px;
  transition: all 0.2s;
  min-height: 48px;
  text-align: center;
}

.quick-action-btn:hover {
  background: #DBEAFE;
}

/* ==========================================================================
   BUTTONS & FORMS
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 44px;
  touch-action: manipulation;
}

.btn-primary {
  background: var(--color-primary);
  color: #FFFFFF;
}

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

.btn-secondary {
  background: #FFFFFF;
  border-color: var(--color-border);
  color: var(--color-navy);
}

.btn-secondary:hover {
  background: #F8FAFC;
  border-color: #CBD5E1;
}

.btn-danger {
  background: #FEF2F2;
  border-color: #FECACA;
  color: var(--color-danger);
}

.btn-danger:hover {
  background: #FEE2E2;
}

.btn-block {
  width: 100%;
}

.form-group {
  margin-bottom: 16px;
}

.form-step-label { display: flex; align-items: center; gap: 8px; color: var(--color-primary); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 10px; }
.form-step-label span:first-child { display: inline-flex; align-items: center; justify-content: center; width: 21px; height: 21px; border-radius: 50%; background: #eaf2ff; color: var(--color-primary); font-size: 11px; }
.payment-form-card { box-shadow: 0 10px 26px rgba(11,31,58,.06); }
.selected-loan-card { box-shadow: inset 0 0 0 1px rgba(9,105,249,.03); }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-navy);
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 11px 14px;
  font-size: 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: #FFFFFF;
  color: var(--color-navy);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  min-height: 44px;
  -webkit-appearance: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(9, 105, 249, 0.15);
}

.form-input::placeholder {
  color: #94A3B8;
}

.form-help {
  font-size: 12px;
  color: var(--color-muted);
  margin-top: 4px;
}

.input-with-icon {
  position: relative;
}

.input-with-icon .input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #94A3B8;
  pointer-events: none;
}

.input-with-icon .form-input {
  padding-left: 42px;
}

/* ==========================================================================
   BADGES & STATUS
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
}

.badge-lunas {
  background: var(--color-success-bg);
  color: var(--color-success-text);
  border: 1px solid #A7F3D0;
}

.badge-belum-bayar {
  background: var(--color-warning-bg);
  color: var(--color-warning-text);
  border: 1px solid #FDE68A;
}

.badge-telat-bayar {
  background: var(--color-danger-bg);
  color: var(--color-danger-text);
  border: 1px solid #FECACA;
}

.badge-aktif {
  background: var(--color-success-bg);
  color: var(--color-success-text);
  border: 1px solid #A7F3D0;
}

.badge-nonaktif {
  background: #F1F5F9;
  color: #475569;
  border: 1px solid #CBD5E1;
}

.badge-tercatat {
  background: var(--color-success-bg);
  color: var(--color-success-text);
  border: 1px solid #A7F3D0;
}

.badge-dibatalkan {
  background: #FEE2E2;
  color: #991B1B;
  border: 1px solid #FCA5A5;
}

/* Avatar circle */
.avatar-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #E0E7FF;
  color: #3730A3;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}

/* ==========================================================================
   TABLES & LIST CARDS (RESPONSIVE)
   ========================================================================== */

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}

.data-table th {
  background: #F8FAFC;
  color: var(--color-muted);
  font-weight: 600;
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-navy);
  vertical-align: middle;
}

.data-table tr:hover td {
  background-color: #F8FAFC;
}

/* Mobile cards list */
.list-card-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
  gap: 12px;
  transition: background 0.15s;
}

.list-card-item:last-child {
  border-bottom: none;
}

.list-card-item:hover {
  background-color: #F8FAFC;
}

/* ==========================================================================
   ALERTS & FEEDBACK
   ========================================================================== */

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-success {
  background: var(--color-success-bg);
  color: var(--color-success-text);
  border: 1px solid #A7F3D0;
}

.alert-error {
  background: var(--color-danger-bg);
  color: var(--color-danger-text);
  border: 1px solid #FECACA;
}

.alert-info {
  background: #EFF6FF;
  color: #1E40AF;
  border: 1px solid #BFDBFE;
}

/* ==========================================================================
   PWA INSTALL BANNER & OFFLINE TOAST
   ========================================================================== */

#offline-banner {
  display: none;
  background-color: #EF4444;
  color: #FFFFFF;
  text-align: center;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 50;
}

.pwa-install-banner {
  display: none;
  background: #0B1F3A;
  color: #FFFFFF;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 8px 20px rgba(11, 31, 58, .14);
}

.pwa-install-copy { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pwa-install-title { font-weight: 750; font-size: 13px; }
.pwa-install-subtitle { font-size: 11px; opacity: .72; margin-top: 1px; }
.pwa-install-button { padding: 7px 13px; font-size: 12px; min-height: 34px; flex-shrink: 0; }
.offline-dot { width: 7px; height: 7px; background: #fecaca; border-radius: 50%; box-shadow: 0 0 0 3px rgba(254,202,202,.18); }

/* ==========================================================================
   DESKTOP VS MOBILE TOGGLE UTILITIES
   ========================================================================== */

.desktop-only {
  display: block !important;
}

.mobile-only {
  display: none !important;
}

@media (max-width: 767px) {
  .desktop-only,
  .desktop-only.table-responsive {
    display: none !important;
  }
  .mobile-only,
  .mobile-only.mobile-card-list {
    display: block !important;
  }
}

/* ==========================================================================
   MOBILE CARD LIST COMPONENTS (NATIVE-LIKE PWA FEEL)
   ========================================================================== */

.mobile-card-list {
  display: flex;
  flex-direction: column;
}

.mobile-card-item {
  display: flex;
  flex-direction: column;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
  background: #FFFFFF;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.mobile-card-item:last-child {
  border-bottom: none;
}

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

.mobile-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.mobile-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-navy);
  line-height: 1.3;
}

.mobile-card-sub {
  font-size: 12px;
  color: var(--color-muted);
  margin-bottom: 8px;
}

.mobile-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--color-border);
  font-size: 13px;
}

/* Compact transaction rows for the mobile report feed. */
.report-tx-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

@media (max-width: 767px) {
  .report-tx-card {
    padding: 11px 12px;
    border-radius: 12px;
    gap: 8px;
  }

  .report-tx-main { gap: 9px !important; }
  .report-tx-icon { width: 34px !important; height: 34px !important; border-radius: 9px !important; }
  .report-tx-icon svg { width: 17px; height: 17px; }
  .report-tx-name { font-size: 13px !important; }
  .report-tx-meta { font-size: 10px !important; margin-top: 1px; }
  .report-tx-detail { display: none; }
  .report-tx-side { min-width: 94px; }
  .report-tx-side .badge { padding: 2px 6px; font-size: 9px; }
  .report-tx-side > div:nth-child(2) { font-size: 12px !important; margin-top: 2px; }
  .report-tx-side > div:last-child { margin-top: 3px !important; gap: 3px !important; }
  .report-tx-side .btn { min-height: 22px !important; padding: 2px 6px !important; font-size: 9px !important; }
}

/* ==========================================================================
   MOBILE APPLICATION SHELL & RESPONSIVE POLISH (< 768px)
   ========================================================================== */

@media (max-width: 767px) {
  body {
    font-size: 14px;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: none;
  }

  .topbar {
    background: #0b0b0d;
    border-bottom-color: #242428;
    padding: 13px 18px;
    min-height: 66px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .18);
  }

  .topbar-brand {
    gap: 11px;
  }

  .topbar-brand-subtitle {
    display: none;
  }

  .topbar-brand-title {
    color: #ffffff;
  }

  .topbar-actions {
    gap: 8px;
  }

  .role-badge {
    background: #1d1d22;
    border-color: #36363d;
    color: #dbeafe;
    padding: 5px 9px;
    font-size: 11px;
  }

  .topbar-brand img {
    border-color: #36363d;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .28);
  }

  /* Form inputs optimized for touch without iOS zoom */
  .form-input, .form-select, .form-textarea {
    font-size: 16px !important;
    min-height: 46px;
  }

  .btn {
    min-height: 44px;
    font-size: 14px;
  }

  .btn:active, .quick-action-btn:active, .stat-card:active, .list-card-item:active {
    transform: scale(0.98);
  }

  .container {
    padding: 14px 12px;
  }

  .main-content {
    padding-bottom: calc(76px + var(--safe-bottom));
  }

  .page-header {
    margin-bottom: 16px;
    gap: 4px;
  }

  .page-title {
    font-size: 20px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.02em;
  }

  .page-subtitle {
    font-size: 13px;
    line-height: 1.4;
    color: var(--color-muted);
  }

  .card {
    border-radius: 14px;
    padding: 16px 14px;
    margin-bottom: 14px;
  }

  /* Hero banner on mobile */
  .hero-banner-card {
    padding: 16px 14px;
    border-radius: 16px;
    margin-bottom: 14px;
  }

  .hero-banner-left {
    gap: 12px;
  }

  .hero-icon-box {
    width: 44px;
    height: 44px;
    border-radius: 12px;
  }

  .hero-banner-text .amount {
    font-size: 22px;
  }

  /* 3-stat cards grid on mobile */
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
  }

  .stat-card {
    padding: 12px 6px;
    border-radius: 12px;
    text-align: center;
    align-items: center;
    gap: 2px;
  }

  .stat-card-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    margin-bottom: 4px;
  }

  .stat-card .label {
    font-size: 11px;
    line-height: 1.2;
  }

  .stat-card .value {
    font-size: 19px;
  }

  /* Quick action buttons */
  .quick-actions-grid {
    gap: 8px;
    margin-bottom: 18px;
  }

  .quick-action-btn {
    min-height: 64px;
    padding: 10px 6px;
    font-size: 12px;
    border-radius: 12px;
  }

  .quick-action-btn svg {
    width: 20px;
    height: 20px;
  }

  /* Table responsive smooth scroll */
  .table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
  }

  /* List items */
  .list-card-item {
    padding: 12px 14px;
  }

  /* Alerts */
  .alert {
    margin-bottom: 12px;
    padding: 11px 14px;
    font-size: 13px;
  }

  /* PWA install banner */
  .pwa-install-banner {
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: 14px;
  }

  /* Payment submit floating bar */
  .payment-submit-wrap {
    position: sticky;
    bottom: calc(68px + var(--safe-bottom));
    padding-top: 10px;
    background: linear-gradient(180deg, rgba(245, 247, 251, 0), var(--color-bg) 25%);
    z-index: 10;
  }

  .payment-submit-wrap .btn {
    min-height: 48px;
    box-shadow: 0 6px 16px rgba(9, 105, 249, 0.25);
  }
}

/* ==========================================================================
   PRINT STYLES FOR A4 PORTRAIT
   ========================================================================== */

@media print {
  body {
    background: #FFFFFF !important;
    font-size: 11pt !important;
  }
  .sidebar, .topbar, .bottom-nav, .no-print, .btn, .page-header .btn {
    display: none !important;
  }
  .main-content {
    margin: 0 !important;
    padding: 0 !important;
  }
  .container {
    max-width: 100% !important;
    padding: 0 !important;
  }
  .print-page {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    page-break-after: avoid;
  }
}
