:root {
  --bg-color: #050505;
  --card-bg: #111111;
  --card-border: #222;
  --text-primary: #ffffff;
  --text-secondary: #888888;
  --accent-green: #00b894;
  --accent-red: #ff7675;
  --accent-blue: #3498db;
  --accent-orange: #e67e22;
  --font-main: "Inter", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
*::-webkit-scrollbar {
  display: none;
  width: 0px;
  background: transparent;
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-main);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overscroll-behavior-y: contain;
}

#app-container {
  padding: 15px;
  padding-bottom: 110px;
  flex: 1;
  overflow-y: auto;
}

/* --- HEADER --- */
.bento-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding: 0 5px 10px 5px;
  border-bottom: 1px solid #222;
}
.bento-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}
.bento-header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* --- BENTO GRID --- */
.bento-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.bento-card {
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
  transition: transform 0.1s;
  cursor: pointer;
}
.bento-card.accent-green {
  background: linear-gradient(
    145deg,
    rgba(0, 184, 148, 0.15),
    rgba(0, 0, 0, 0)
  );
  border: 1px solid rgba(0, 184, 148, 0.2);
}
.bento-card.accent-red {
  background: linear-gradient(
    145deg,
    rgba(255, 118, 117, 0.15),
    rgba(0, 0, 0, 0)
  );
  border: 1px solid rgba(255, 118, 117, 0.2);
}
.bento-card:active {
  transform: scale(0.98);
}

.large-card {
  grid-column: span 2;
  padding: 30px;
}
.wide-card {
  grid-column: span 2;
}

.bento-card h3 {
  color: var(--text-secondary);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
  font-weight: 600;
}

.value {
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.5px;
}
.large-card .value {
  font-size: 2.8rem;
  margin: 10px 0;
}

/* Accent Text Colors */
.text-green {
  color: var(--accent-green);
}
.text-red {
  color: var(--accent-red);
}
.text-blue {
  color: var(--accent-blue);
}
.text-orange {
  color: var(--accent-orange);
}

/* --- NAVIGATION --- */
.bottom-nav {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 400px;
  height: 65px;
  background: rgba(30, 30, 30, 0.85);
  backdrop-filter: blur(20px);
  border-radius: 35px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-around;
  align-items: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 100;
}

.nav-item {
  background: none;
  border: none;
  color: #666;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.2s;
  flex: 1;
  min-width: 0;
}
.nav-icon {
  font-size: 1.3rem;
  margin-bottom: 2px;
  transition: transform 0.2s;
}
.nav-label {
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.5px;
}
.nav-item.active {
  color: white;
}
.nav-item.active .nav-icon {
  transform: translateY(-2px);
  color: var(--accent-blue);
}
.nav-item.active .nav-label {
  font-weight: 600;
}

.icon-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
}

/* --- FAB --- */
.fab {
  position: fixed;
  bottom: 110px;
  right: 25px;
  width: 60px;
  height: 60px;
  background-color: var(--text-primary);
  color: black;
  border: none;
  border-radius: 50%;
  font-size: 2.2rem;
  box-shadow: 0 8px 20px rgba(52, 152, 219, 0.4);
  cursor: pointer;
  z-index: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- LOANS MODULE (UPDATED) --- */
.loan-card {
  background: var(--card-bg);
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 15px;
  border: 1px solid var(--card-border);
  position: relative;
  cursor: pointer; /* Indicates clickable */
}
.loan-card:active {
  transform: scale(0.99);
  background: #161616;
}

.loan-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}
.loan-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: white;
}
.loan-emi {
  color: var(--accent-orange);
  font-weight: 700;
  font-size: 1.1rem;
}

.loan-progress-track {
  width: 100%;
  height: 6px;
  background: #222;
  border-radius: 3px;
  margin: 15px 0;
  overflow: hidden;
}
.loan-progress-fill {
  height: 100%;
  background: var(--accent-blue);
  border-radius: 3px;
}

.loan-summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: #888;
}

/* --- LOAN DETAIL MODAL (NEW) --- */
.detail-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 25px;
}
.detail-stat-box {
  background: #111;
  padding: 15px;
  border-radius: 12px;
  border: 1px solid #222;
  text-align: center;
}
.detail-stat-label {
  font-size: 0.75rem;
  color: #666;
  margin-bottom: 5px;
  text-transform: uppercase;
}
.detail-stat-val {
  font-size: 1.1rem;
  font-weight: 600;
  color: white;
}

.schedule-container {
  background: #000;
  border-radius: 12px;
  padding: 0;
  max-height: 250px;
  overflow-y: auto; /* Taller for detail view */
  border: 1px solid #222;
}
.schedule-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.schedule-table th {
  text-align: left;
  color: #666;
  padding: 12px;
  font-size: 0.75rem;
  text-transform: uppercase;
  background: #111;
  position: sticky;
  top: 0;
}
.schedule-table td {
  padding: 12px;
  border-bottom: 1px solid #1a1a1a;
  font-size: 0.85rem;
  color: #ccc;
}
.row-paid {
  color: #444 !important;
  text-decoration: line-through;
}

.btn-group-actions {
  display: flex;
  gap: 10px;
  margin-top: 25px;
}
.btn-action-edit {
  flex: 1;
  background: #222;
  color: white;
  border: none;
  padding: 12px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
}
.btn-action-delete {
  flex: 1;
  background: rgba(231, 76, 60, 0.15);
  color: var(--accent-red);
  border: none;
  padding: 12px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
}

/* --- GLOBAL LIST & MODAL --- */
.list-item {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  padding: 20px;
  border-radius: 16px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.item-left h4 {
  font-size: 1.1rem;
  margin-bottom: 5px;
  font-weight: 500;
}
.item-left p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.item-right {
  text-align: right;
}
.item-right .amt {
  font-weight: 600;
  font-size: 1.2rem;
}
.item-right .sub {
  font-size: 0.85rem;
  margin-top: 4px;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(8px);
}
.hidden {
  display: none !important;
}
.modal-content {
  background: #0a0a0a;
  padding: 25px;
  border-radius: 25px;
  width: 90%;
  max-width: 400px;
  border: 1px solid #333;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  max-height: 85vh;
  overflow-y: auto;
}
.modal-content h2 {
  margin-bottom: 25px;
  font-weight: 600;
}

.form-group {
  margin-bottom: 20px;
  position: relative;
}
.form-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-size: 0.85rem;
}
.form-group input,
.form-group select {
  width: 100%;
  padding: 15px;
  background: #151515;
  border: 1px solid #333;
  border-radius: 12px;
  color: white;
  font-family: var(--font-main);
  font-size: 1rem;
  appearance: none;
  outline: none;
  box-sizing: border-box;
}
.form-group select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 15px center;
  background-size: 15px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 15px;
  margin-top: 25px;
}
.btn-text {
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 12px;
  cursor: pointer;
  font-size: 0.9rem;
}
.btn-primary {
  background: var(--accent-blue);
  border: none;
  color: white;
  padding: 12px 25px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  font-size: 1rem;
}

/* Dashboard List fix */
.simple-list {
  list-style-type: disc;
  list-style-position: outside;
  padding-left: 20px;
  margin-top: 10px;
}
.simple-list li {
  padding-left: 5px;
  color: #ccc;
}

/* Security & Settings (Preserved) */
/* ... (Keep your existing Security/Settings/Pin styles here, they are fine) ... */
.lock-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
.lock-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.pin-dots {
  display: flex;
  gap: 20px;
  margin: 40px auto;
  justify-content: center;
}
.dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #333;
  background: transparent;
  transition: 0.2s;
}
.dot.filled {
  background: var(--accent-green);
  border-color: var(--accent-green);
  border-width: 0;
}
.numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 25px;
  margin: 0 auto;
}
.numpad button {
  width: 75px;
  height: 75px;
  border-radius: 50%;
  border: 1px solid #222;
  background: #111;
  color: white;
  font-size: 1.6rem;
  cursor: pointer;
  transition: 0.1s;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.numpad button:active {
  background: #333;
  transform: scale(0.95);
}
.numpad button.transparent {
  background: transparent;
  border: none;
  cursor: default;
}
.bio-btn {
  margin-top: 30px;
  background: #111;
  border: 1px solid #333;
  color: var(--text-primary);
  padding: 12px 25px;
  border-radius: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.bio-btn:active {
  background: #222;
  transform: scale(0.95);
}
.bio-btn.hidden {
  display: none !important;
}
.forgot-pin-btn {
  margin-top: 30px;
  background: none;
  border: none;
  color: #444;
  font-size: 0.8rem;
  text-decoration: underline;
  cursor: pointer;
}

.settings-container {
  display: flex;
  flex-direction: column;
}
.settings-section {
  padding: 20px;
  background: #111;
  border-radius: 20px;
  border: 1px solid #222;
  margin-bottom: 20px;
}
.settings-section.highlight {
  border-color: #333;
  background: #161616;
}
.settings-section h3 {
  font-size: 0.95rem;
  margin-bottom: 5px;
  color: white;
  font-weight: 600;
}
.settings-section p {
  font-size: 0.85rem;
  color: #888;
  margin-bottom: 15px;
}
.settings-btn-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.settings-btn {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  font-family: var(--font-main);
  display: block;
}
.btn-filled {
  background: white;
  color: black;
  border: none;
}
.btn-filled:active {
  transform: scale(0.98);
  background: #eee;
}
.btn-outlined {
  background: transparent;
  border: 1px solid #333;
  color: #ccc;
}
.btn-outlined:active {
  transform: scale(0.98);
  background: #222;
  border-color: #555;
}

/* --- CUSTOM TOAST NOTIFICATIONS (No more ugly alerts) --- */
#toast-container {
  position: fixed;
  top: 20px; /* Floats at the top */
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999; /* Above everything, even Lock Screen */
  width: auto;
  max-width: 90%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none; /* Let clicks pass through */
}

.toast {
  background: rgba(20, 20, 20, 0.95);
  color: white;
  padding: 12px 24px;
  border-radius: 50px; /* Pill Shape */
  border: 1px solid #333;
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);

  /* Animation */
  animation: toastIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275),
    toastOut 0.3s ease 2.5s forwards;
}

/* Success vs Error Styling (Optional, mostly neutral is best for Bento) */
.toast.error {
  border-color: var(--accent-red);
  color: #ffcccc;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(-20px);
  }
}

/* --- CONFIRMATION MODAL STYLING --- */
.confirm-content {
  background: #1a1a1a; /* Slightly lighter than pure black */
  width: 85%;
  max-width: 320px;
  padding: 25px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
  animation: popIn 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.confirm-content h3 {
  font-size: 1.2rem;
  margin-bottom: 10px;
  color: white;
}
.confirm-content p {
  font-size: 0.95rem;
  color: #aaa;
  margin-bottom: 5px;
  line-height: 1.4;
}

/* Add this to styles.css */

/* Force Transaction Inputs to match global form style */
.txn-grid input {
  width: 100% !important;
  background: #151515 !important;
  border: 1px solid #333 !important;
  border-radius: 12px !important;
  color: white !important;
  padding: 15px !important;
  font-size: 1rem !important;
  outline: none;
}

/* Specific grid layout for the inputs */
.txn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr; /* Two equal columns for Amount/Note */
  gap: 10px;
}

/* Date field spans full width */
.full-width {
  grid-column: span 2;
}
/* --- PEOPLE MODULE MODAL FIXES --- */

/* 1. Toggle Switch (Gave vs Took) */
.txn-toggle-wrapper {
  display: flex;
  background: #000;
  padding: 4px;
  border-radius: 14px;
  margin-bottom: 15px;
  border: 1px solid #333;
}

.type-btn {
  flex: 1;
  padding: 12px;
  text-align: center;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #666;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
  user-select: none; /* Prevents text highlighting */
}

/* Active State: Gave (Green) */
.type-btn.active-give {
  background: rgba(0, 184, 148, 0.15);
  color: var(--accent-green);
  border-color: rgba(0, 184, 148, 0.3);
}

/* Active State: Took (Red/Orange) */
.type-btn.active-take {
  background: rgba(255, 118, 117, 0.15);
  color: var(--accent-red);
  border-color: rgba(255, 118, 117, 0.3);
}

/* 2. Delete Person Button */
.danger-zone {
  margin-top: 25px;
  padding-top: 15px;
  border-top: 1px dashed #333;
  text-align: center;
}

.btn-delete-person {
  color: var(--accent-red);
  background: transparent;
  border: 1px solid #333;
  padding: 12px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%; /* Full width for easy tapping */
  transition: background 0.2s;
}

.btn-delete-person:active {
  background: rgba(255, 118, 117, 0.1);
  border-color: var(--accent-red);
}