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

:root {
  --primary: #00a86b;
  --primary-dark: #008756;
  --primary-light: #e8f7f1;
  --red: #e74c3c;
  --red-light: #fde8e7;
  --green: #2ecc71;
  --green-light: #e8f9f0;
  --dark: #2c3e50;
  --gray: #7f8c8d;
  --light-gray: #f8f9fa;
  --border: #e2e8f0;
  --radius: 12px;
  --font: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body {
  background: #f1f5f9;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--dark);
}

/* --- Mobile Frame Simulator (Desktop only) --- */
#app-simulator {
  width: 400px;
  height: 820px;
  background: #ffffff;
  border-radius: 40px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 40px rgba(0,0,0,0.1) inset;
  border: 12px solid #1e293b;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Smartphone Speaker / Camera Notch */
#app-simulator::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 140px;
  height: 24px;
  background: #1e293b;
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 16px;
  z-index: 1000;
}

#app-viewport {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  padding-top: 15px; /* Offset for notch */
}

/* Responsive: Full Screen on actual Mobile Devices */
@media (max-width: 480px) {
  body {
    background: #ffffff;
  }
  #app-simulator {
    width: 100%;
    height: 100%;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }
  #app-simulator::before {
    display: none;
  }
  #app-viewport {
    padding-top: 0;
  }
}

/* --- Navigation & Router Screens --- */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #ffffff;
  display: none;
  flex-direction: column;
  z-index: 10;
  overflow: hidden;
}

.screen.active {
  display: flex;
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0.9;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Back navigation animation */
.screen.active.back-nav {
  animation: slideInBack 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideInBack {
  from {
    transform: translateX(-100%);
    opacity: 0.9;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* --- 1. Login Screen --- */
#screen-login {
  justify-content: center;
  align-items: center;
  padding: 30px;
  background: linear-gradient(135deg, #e8f7f1 0%, #ffffff 100%);
  text-align: center;
}

.login-brand {
  margin-bottom: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.login-logo {
  width: 96px;
  height: 96px;
  background: linear-gradient(135deg, var(--primary) 0%, #00df89 100%);
  border-radius: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 8px 16px rgba(0, 168, 107, 0.3);
  margin-bottom: 20px;
}

.login-logo ion-icon {
  font-size: 48px;
  color: white;
}

.login-brand h1 {
  font-size: 32px;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 8px;
}

.login-brand p {
  color: var(--gray);
  font-size: 15px;
  max-width: 260px;
}

.login-actions {
  width: 100%;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.btn {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius);
  border: none;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  transition: all 0.2s ease;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 10px rgba(0, 168, 107, 0.2);
}

.btn-primary:active {
  background: var(--primary-dark);
  transform: scale(0.98);
}

.btn-google {
  background: white;
  color: #5f6368;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.btn-google:active {
  background: var(--light-gray);
  transform: scale(0.98);
}

.btn-google img {
  width: 20px;
  height: 20px;
}

.demo-notice {
  margin-top: 30px;
  font-size: 12px;
  color: var(--gray);
}

/* --- 2. Dashboard Screen --- */
.app-header {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: white;
  position: sticky;
  top: 0;
  z-index: 50;
}

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

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #000000;
  color: #ffffff;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 600;
  font-size: 14px;
  border: 1.5px solid #000000;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-info h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--dark);
}

.profile-info p {
  font-size: 11px;
  color: var(--gray);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}

.header-btn {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--dark);
  cursor: pointer;
  display: flex;
  align-items: center;
}

/* Sync Badge styles */
.sync-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 20px;
  cursor: pointer;
}

.sync-badge.synced {
  background: var(--green-light);
  color: var(--green);
}

.sync-badge.pending {
  background: var(--red-light);
  color: var(--red);
}

.sync-badge.offline {
  background: #fecaca;
  color: #dc2626;
}

.sync-badge.local {
  background: var(--light-gray);
  color: var(--gray);
  border: 1px solid var(--border);
}

.sync-badge.syncing ion-icon {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  100% { transform: rotate(360deg); }
}

.scroll-container {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  background: var(--light-gray);
  padding: 16px;
  padding-bottom: 80px; /* Spacer for FAB */
}

/* Net Balance Card */
.net-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.net-title {
  font-size: 13px;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.net-amount {
  font-size: 28px;
  font-weight: 700;
}

.net-amount.receivable {
  color: var(--red);
}

.net-amount.payable {
  color: var(--green);
}

.net-amount.settled {
  color: var(--dark);
}

.net-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  border-top: 1px dashed var(--border);
  padding-top: 12px;
}

.split-box p {
  font-size: 12px;
  color: var(--gray);
}

.split-box span {
  font-size: 16px;
  font-weight: 600;
  display: block;
}

.split-box.owes-you span {
  color: var(--red);
}

.split-box.you-owe span {
  color: var(--green);
}

/* Search and Filters */
.search-filter-box {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.search-bar {
  position: relative;
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 12px;
}

.search-bar ion-icon {
  font-size: 20px;
  color: var(--gray);
  margin-right: 8px;
}

.search-bar input {
  width: 100%;
  border: none;
  padding: 12px 0;
  outline: none;
  font-size: 14px;
  background: transparent;
}

.filter-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  justify-content: center;
}

.filter-tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  background: white;
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab.active {
  background: var(--primary);
  color: white !important;
  border-color: var(--primary);
  box-shadow: 0 4px 10px rgba(0, 168, 107, 0.25);
}

/* Contact List */
.contacts-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.contact-card {
  background: white;
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.contact-card:active {
  transform: scale(0.98);
  box-shadow: var(--shadow);
}

.contact-main {
  display: flex;
  align-items: center;
  gap: 12px;
}

.contact-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 600;
  font-size: 16px;
}

.contact-details h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--dark);
  display: flex;
  align-items: center;
  gap: 6px;
}

.relationship-badge {
  font-size: 10px;
  font-weight: 500;
  background: #f1f5f9;
  color: #475569;
  padding: 2px 6px;
  border-radius: 4px;
}

.contact-details p {
  font-size: 12px;
  color: var(--gray);
  margin-top: 2px;
}

.contact-balance {
  text-align: right;
}

.contact-balance span {
  font-size: 15px;
  font-weight: 700;
  display: block;
}

.contact-balance p {
  font-size: 10px;
  color: var(--gray);
  margin-top: 2px;
}

.contact-balance.receivable span {
  color: var(--red);
}

.contact-balance.payable span {
  color: var(--green);
}

.contact-balance.settled span {
  color: var(--gray);
}

/* Floating Action Button (FAB) */
.fab {
  position: absolute;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 28px;
  background: var(--primary);
  color: white;
  border: none;
  font-size: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 6px 16px rgba(0, 168, 107, 0.4);
  cursor: pointer;
  z-index: 40;
  transition: transform 0.2s ease;
}

.fab:active {
  transform: scale(0.92);
}

/* --- 3. Contact Ledger Screen --- */
.ledger-header {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 50;
}

.ledger-back-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.back-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--dark);
  cursor: pointer;
  display: flex;
  align-items: center;
}

.ledger-profile {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ledger-profile h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--dark);
}

.ledger-profile p {
  font-size: 11px;
  color: var(--gray);
}

.ledger-actions {
  display: flex;
  gap: 12px;
}

.circle-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--light-gray);
  border: 1px solid var(--border);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 18px;
  color: var(--dark);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.circle-icon-btn:active {
  background: var(--border);
}

.ledger-summary-strip {
  background: #ffffff;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ledger-summary-strip p {
  font-size: 13px;
  font-weight: 500;
  color: var(--gray);
}

.ledger-summary-strip h4 {
  font-size: 16px;
  font-weight: 700;
}

.ledger-summary-strip.receivable h4 {
  color: var(--red);
}

.ledger-summary-strip.payable h4 {
  color: var(--green);
}

.ledger-summary-strip.settled h4 {
  color: var(--dark);
}

.ledger-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  background: #f8fafc;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Empty State */
.empty-ledger {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--gray);
  text-align: center;
  padding: 40px 20px;
  gap: 10px;
}

.empty-ledger ion-icon {
  font-size: 48px;
  color: var(--border);
}

/* Date separator */
.date-separator {
  text-align: center;
  margin: 10px 0;
}

.date-separator span {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray);
  background: #e2e8f0;
  padding: 4px 10px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Transaction Card Item */
.tx-card {
  max-width: 80%;
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.03);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tx-card.gave {
  align-self: flex-end;
  background: var(--red-light);
  border: 1px solid rgba(231, 76, 60, 0.15);
  border-top-right-radius: 4px;
}

.tx-card.got {
  align-self: flex-start;
  background: var(--green-light);
  border: 1px solid rgba(46, 204, 113, 0.15);
  border-top-left-radius: 4px;
}

.tx-header-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.tx-category-tag {
  font-size: 10px;
  font-weight: 600;
  background: rgba(0,0,0,0.05);
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  color: var(--dark);
}

.tx-time {
  font-size: 10px;
  color: var(--gray);
}

.tx-body {
  font-size: 14px;
  color: var(--dark);
  font-weight: 400;
}

.tx-footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
  border-top: 1px dashed rgba(0, 0, 0, 0.05);
  padding-top: 6px;
}

.tx-amount {
  font-size: 18px;
  font-weight: 700;
}

.tx-card.gave .tx-amount {
  color: var(--red);
}

.tx-card.got .tx-amount {
  color: var(--green);
}

.tx-balance {
  font-size: 11px;
  color: var(--gray);
}

/* Double ticks for sync confirmation */
.tx-sync-tick {
  font-size: 12px;
  color: var(--gray);
  display: flex;
  align-items: center;
}

.tx-sync-tick.synced {
  color: var(--primary);
}

/* Sticky Bottom Action Bar */
.ledger-footer {
  background: white;
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  z-index: 50;
}

.btn-gave {
  background: var(--red-light);
  color: var(--red);
  border: 1px solid rgba(231, 76, 60, 0.3);
}

.btn-gave:active {
  background: #fcd5d2;
}

.btn-got {
  background: var(--green-light);
  color: var(--green);
  border: 1px solid rgba(46, 204, 113, 0.3);
}

.btn-got:active {
  background: #cbf3db;
}

/* --- 4. Sliders, Modals & Bottom Sheets --- */
.backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  z-index: 80;
  display: none;
}

.bottom-sheet {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: white;
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  box-shadow: 0 -10px 25px -5px rgba(0, 0, 0, 0.15);
  z-index: 90;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  max-height: 85%;
}

.bottom-sheet.open {
  transform: translateY(0);
}

.sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 10px auto;
  flex-shrink: 0;
}

.sheet-header {
  padding: 8px 20px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.sheet-header h3 {
  font-size: 18px;
  font-weight: 600;
}

.sheet-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--gray);
  cursor: pointer;
  display: flex;
  align-items: center;
}

.sheet-body {
  padding: 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Form Styles */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--dark);
}

.form-input {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  outline: none;
  font-size: 15px;
  background: var(--light-gray);
  transition: border-color 0.2s ease;
}

.form-input:focus {
  border-color: var(--primary);
  background: white;
}

/* Custom Large Amount Input */
.amount-input-box {
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 2px solid var(--border);
  padding: 10px 0;
  margin: 10px 0;
}

.amount-symbol {
  font-size: 32px;
  font-weight: 700;
  color: var(--dark);
  margin-right: 8px;
}

.amount-input-field {
  width: 180px;
  border: none;
  outline: none;
  font-size: 40px;
  font-weight: 700;
  text-align: center;
  color: var(--dark);
  background: transparent;
}

.amount-input-field::placeholder {
  color: var(--border);
}

/* Category grid for Transactions */
.category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.category-chip {
  background: var(--light-gray);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.category-chip.selected {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
  font-weight: 600;
}

/* Relationship selectors */
.relation-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.relation-chip {
  background: var(--light-gray);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.relation-chip.selected {
  background: var(--dark);
  color: white;
  border-color: var(--dark);
}

/* --- 5. Settings Screen --- */
.settings-list {
  display: flex;
  flex-direction: column;
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 20px;
}

.settings-item {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  text-decoration: none;
  color: var(--dark);
  transition: background 0.2s ease;
}

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

.settings-item:active {
  background: var(--light-gray);
}

.settings-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  font-weight: 500;
}

.settings-item-left ion-icon {
  font-size: 20px;
  color: var(--gray);
}

.settings-item-right {
  display: flex;
  align-items: center;
  font-size: 18px;
  color: var(--gray);
  gap: 6px;
}

.settings-item-right span {
  font-size: 13px;
}

/* --- Toast Notification --- */
.toast {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #1e293b;
  color: white;
  padding: 10px 20px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Utility layout styles */
.text-danger {
  color: var(--red) !important;
}

.text-success {
  color: var(--green) !important;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.06); opacity: 0.85; }
}

/* --- Dark Mode Variables and Overrides --- */
[data-theme="dark"] {
  --dark: #f8fafc;
  --light-gray: #000000;
  --border: #222222;
  --light: #111111;
  --gray: #94a3b8;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
  --green: #2ecc71;
  --green-light: rgba(46, 204, 113, 0.15);
  --red: #ff6b6b;
  --red-light: rgba(231, 76, 60, 0.15);
}

[data-theme="dark"] body {
  background: #000000;
  color: #f8fafc;
}

[data-theme="dark"] #app-simulator {
  background: #000000;
  border-color: #111111;
}

[data-theme="dark"] #app-viewport {
  background: #000000;
}

[data-theme="dark"] .screen {
  background: #000000;
  color: #f8fafc;
}

[data-theme="dark"] .app-header {
  background: #111111;
  border-bottom-color: #222222;
}

[data-theme="dark"] .bottom-nav {
  background: #111111;
  border-top-color: #222222;
}

[data-theme="dark"] .bottom-sheet {
  background: #111111;
  color: #f8fafc;
}

[data-theme="dark"] .bottom-sheet::before {
  background: #475569;
}

[data-theme="dark"] .net-card {
  background: #111111;
  border-color: #222222;
}

[data-theme="dark"] .contact-card {
  background: #111111;
  border-bottom-color: #111111;
}

[data-theme="dark"] .search-bar {
  background: #111111;
  border-color: #222222;
}

[data-theme="dark"] .search-bar input {
  color: #f8fafc;
}

[data-theme="dark"] .form-input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: #111111;
  color: #f8fafc;
  border-color: #222222;
}

[data-theme="dark"] .form-input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
  border-color: var(--primary);
  background: #000000;
}

[data-theme="dark"] .circle-icon-btn {
  background: #111111;
  color: #f8fafc;
}

[data-theme="dark"] .ledger-summary-strip {
  background: #111111;
  border-bottom-color: #222222;
}

[data-theme="dark"] .ledger-scroll {
  background: #000000;
}

[data-theme="dark"] .tx-card {
  background: #111111;
  border-color: #222222;
}

[data-theme="dark"] .tx-card.gave {
  background: rgba(231, 76, 60, 0.15);
  border-color: rgba(231, 76, 60, 0.3);
}

[data-theme="dark"] .tx-card.got {
  background: rgba(46, 204, 113, 0.15);
  border-color: rgba(46, 204, 113, 0.3);
}

[data-theme="dark"] .category-chip,
[data-theme="dark"] .relation-chip {
  background: #111111;
  border-color: #222222;
  color: #94a3b8;
}

[data-theme="dark"] .category-chip.selected {
  background: rgba(0, 168, 107, 0.15);
  color: var(--primary);
  border-color: var(--primary);
}

[data-theme="dark"] .relation-chip.selected {
  background: #f8fafc;
  color: #000000;
  border-color: #f8fafc;
}

[data-theme="dark"] .settings-item {
  border-bottom-color: #111111;
}

[data-theme="dark"] .ledger-footer {
  background: #111111;
  border-top-color: #222222;
}

[data-theme="dark"] .theme-card {
  background: #111111;
  border-color: #222222;
}

[data-theme="dark"] #screen-splash {
  background: #000000 !important;
}

[data-theme="dark"] #screen-splash h2 {
  color: #f8fafc !important;
}

[data-theme="dark"] .tab {
  background: #111111;
  color: #94a3b8;
  border-color: #222222;
}

[data-theme="dark"] .tab.active {
  background: var(--primary);
  color: white !important;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(0, 168, 107, 0.45);
}

[data-theme="dark"] .btn-google {
  background: #111111;
  color: #f8fafc;
  border-color: #222222;
}

[data-theme="dark"] .btn-google:active {
  background: #000000;
}

[data-theme="dark"] .btn-gave {
  background: rgba(231, 76, 60, 0.15);
  color: #ff6b6b;
  border-color: rgba(231, 76, 60, 0.45);
}

[data-theme="dark"] .btn-gave:active {
  background: rgba(231, 76, 60, 0.25);
}

[data-theme="dark"] .btn-got {
  background: rgba(46, 204, 113, 0.15);
  color: #2ecc71;
  border-color: rgba(46, 204, 113, 0.45);
}

[data-theme="dark"] .btn-got:active {
  background: rgba(46, 204, 113, 0.25);
}

[data-theme="dark"] .settings-list {
  background: #111111;
  border-color: #222222;
}

[data-theme="dark"] .settings-item {
  border-bottom-color: #222222;
  color: #f8fafc;
}

[data-theme="dark"] .settings-item:active {
  background: #000000;
}

[data-theme="dark"] #screen-login {
  background: #000000;
}

@media (max-width: 480px) {
  [data-theme="dark"] body {
    background: #000000;
  }
}

[data-theme="dark"] .ledger-header {
  background: #111111;
  border-bottom-color: #222222;
}

[data-theme="dark"] .sync-badge.offline {
  background: rgba(231, 76, 60, 0.15);
  color: #ff6b6b;
}

[data-theme="dark"] .relationship-badge {
  background: #111111;
  color: #cbd5e1;
}

.text-primary {
  color: var(--primary) !important;
}

/* ================= PDF INVOICE LAYOUT ================= */
.invoice-layout {
  width: 800px;
  min-height: 1131px; /* A4 aspect ratio at 800px width */
  background: var(--dark);
  color: var(--light-gray);
  padding: 40px;
  font-family: var(--font);
  box-sizing: border-box;
}

.invoice-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--border);
  padding-bottom: 20px;
  margin-bottom: 30px;
}

.invoice-brand h1 {
  font-size: 28px;
  color: var(--primary);
  margin: 0;
}

.invoice-meta {
  text-align: right;
  color: var(--gray);
}

.invoice-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 30px;
}

.invoice-table th {
  text-align: left;
  padding: 12px;
  background: var(--light);
  color: var(--gray);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.invoice-table th.right { text-align: right; }
.invoice-table td.right { text-align: right; font-weight: 600; }

.invoice-table td {
  padding: 16px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--light-gray);
}

.invoice-summary {
  display: flex;
  justify-content: space-between;
  background: var(--light);
  padding: 20px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.invoice-summary h3 { margin: 0; color: var(--gray); font-size: 14px; }
.invoice-summary h2 { margin: 5px 0 0 0; color: var(--light-gray); font-size: 24px; }

[data-theme="dark"] .invoice-layout {
  background: #000000;
  color: #f8fafc;
}

[data-theme="dark"] .invoice-table td {
  color: #f8fafc;
}

[data-theme="dark"] .invoice-summary h2 {
  color: #f8fafc;
}
