/* Modern Mobile App CSS Design System - Daily P&L Ledger */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --bg-app: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #26334d;
  --bg-card-alt: #0f172a80;
  --border-color: #334155;
  --border-glow: #475569;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --color-deposit: #22c55e;
  --color-deposit-bg: rgba(34, 197, 94, 0.12);
  --color-bonus: #f59e0b;
  --color-bonus-bg: rgba(245, 158, 11, 0.12);
  --color-withdrawal: #ef4444;
  --color-withdrawal-bg: rgba(239, 68, 68, 0.12);
  --color-net: #3b82f6;
  
  --gradient-primary: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  --gradient-deposit: linear-gradient(135deg, #22c55e 0%, #15803d 100%);
  --gradient-card: linear-gradient(180deg, #1e293b 0%, #182232 100%);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-pill: 9999px;
  
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.25);
  
  --nav-height: 68px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  overflow-x: hidden;
}

/* Mobile Frame Container */
#app {
  width: 100%;
  max-width: 540px;
  min-height: 100vh;
  background: var(--bg-app);
  display: flex;
  flex-direction: column;
  position: relative;
  padding-bottom: calc(var(--nav-height) + 20px);
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.6);
}

/* App Header Bar */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 0%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(96, 165, 250, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* View Container */
.view-body {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: fadeIn 0.25s ease-out;
}

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

/* Bottom Mobile Navigation Bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 540px;
  height: var(--nav-height);
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 6px;
  z-index: 1000;
}

.nav-item {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.nav-item svg {
  width: 22px;
  height: 22px;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-item.active {
  color: #60a5fa;
}

.nav-item.active svg {
  transform: translateY(-2px) scale(1.1);
  stroke: #60a5fa;
}

.nav-item.active::after {
  content: '';
  position: absolute;
  top: 0;
  width: 32px;
  height: 3px;
  background: var(--gradient-primary);
  border-radius: 0 0 4px 4px;
  box-shadow: 0 2px 8px #3b82f6;
}

/* Date Selector Navigation Bar */
.date-selector-card {
  background: var(--gradient-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.date-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.date-btn:active {
  transform: scale(0.92);
  background: rgba(255, 255, 255, 0.15);
}

.date-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  position: relative;
}

.date-main {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.date-sub {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.date-native-picker {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.today-chip {
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(96, 165, 250, 0.3);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.today-chip:active {
  transform: scale(0.95);
}

/* Master P&L Dashboard Summary Card */
.dashboard-card {
  background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.dashboard-card::before {
  content: '';
  position: absolute;
  top: -50px;
  right: -50px;
  width: 140px;
  height: 140px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, transparent 70%);
  pointer-events: none;
}

.pnl-hero {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--border-color);
}

.pnl-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.pnl-amount {
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.pnl-amount.positive {
  color: var(--color-deposit);
  text-shadow: 0 0 20px rgba(34, 197, 94, 0.25);
}

.pnl-amount.negative {
  color: var(--color-withdrawal);
  text-shadow: 0 0 20px rgba(239, 68, 68, 0.25);
}

.pnl-amount.zero {
  color: var(--text-primary);
}

.pnl-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.pnl-item {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pnl-item-label {
  font-size: 0.73rem;
  color: var(--text-muted);
  font-weight: 600;
}

.pnl-item-val {
  font-size: 1.05rem;
  font-weight: 700;
}

.val-deposit { color: var(--color-deposit); }
.val-bonus { color: var(--color-bonus); }
.val-total-in { color: #60a5fa; }
.val-withdrawal { color: var(--color-withdrawal); }

/* Quick Entry Section */
.entry-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.section-title {
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot-deposit { background: var(--color-deposit); box-shadow: 0 0 8px var(--color-deposit); }
.dot-bonus { background: var(--color-bonus); box-shadow: 0 0 8px var(--color-bonus); }
.dot-withdrawal { background: var(--color-withdrawal); box-shadow: 0 0 8px var(--color-withdrawal); }

/* Quick Entry Input Form */
.quick-input-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
}

.input-row {
  display: flex;
  gap: 8px;
}

.app-input {
  flex: 1;
  background: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  outline: none;
  transition: all 0.2s ease;
}

.app-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.app-input::placeholder {
  color: var(--text-muted);
}

.btn-add {
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: none;
  font-weight: 700;
  font-size: 0.9rem;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-add:active {
  transform: scale(0.96);
}

.btn-deposit { background: var(--gradient-deposit); box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3); }
.btn-bonus { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3); }
.btn-withdrawal { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3); }

/* Itemized Lists */
.entry-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.entry-item {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.15s ease;
}

.entry-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-glow);
}

.entry-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.entry-person {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.entry-note {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.entry-amount-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.entry-val {
  font-size: 0.95rem;
  font-weight: 800;
}

.btn-del {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-del:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
}

.empty-state {
  text-align: center;
  padding: 16px;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-style: italic;
}

/* Segmented Pills for Reports */
.segmented-bar {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  padding: 4px;
  display: flex;
  gap: 4px;
}

.seg-btn {
  flex: 1;
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.seg-btn.active {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 2px 10px rgba(59, 130, 246, 0.4);
}

/* Report Cards */
.report-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.report-card:hover {
  border-color: var(--border-glow);
}

.report-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 10px;
}

.report-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.report-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

.badge-net-pos {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.3);
}

.badge-net-neg {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.3);
}

/* Fund Availability Badges (+ve vs -ve) */
.badge-fund-positive {
  background: rgba(34, 197, 94, 0.18);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.4);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-fund-negative {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.report-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  text-align: center;
}

.stat-box {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 4px;
}

.stat-lbl {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 2px;
}

.stat-num {
  font-size: 0.82rem;
  font-weight: 700;
}

/* Agent Ledger Card */
.agent-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

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

.agent-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.agent-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: white;
  font-size: 0.9rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.agent-balance-box {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.balance-lbl {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.balance-val {
  font-size: 1.3rem;
  font-weight: 800;
}

/* Utility Toast */
.toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: 90%;
  max-width: 480px;
}

.toast {
  background: #1e293b;
  color: white;
  border: 1px solid var(--border-color);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideDown 0.3s ease-out;
}

.toast-success { border-left: 4px solid var(--color-deposit); }
.toast-error { border-left: 4px solid var(--color-withdrawal); }

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

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease-out;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-md);
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary {
  background: var(--gradient-primary);
  border: none;
  color: white;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
}

/* Quick help callout box */
.help-box {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 0.8rem;
  color: #93c5fd;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.help-title {
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}
