/* ============================================
   ROOT VARIABLES & RESET
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700;800&display=swap');

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

:root {
  /* Eye-Comfort Premium Dark Palette — Warm Navy Slate */
  --primary: #52A87E;         /* Warm sage green */
  --primary-light: #74C49A;
  --primary-dark: #32705A;
  --primary-bg-light: rgba(82, 168, 126, 0.10);

  /* Category accents */
  --accent-rent: #4A9E7E;
  --accent-water: #4090C0;
  --accent-electric: #C48A38;
  --accent-internet: #9068F0;
  --accent-ev: #E87038;
  --accent-other: #7A8FA8;

  /* Warm navy backgrounds — far more comfortable than cold pure black */
  --bg-light: #141A24;        /* Warm deep navy — not cold, not black, just right */
  --bg-card: #1B2332;         /* Warm dark card background with slight blue-warmth */
  --bg-card-header: #212C3D;
  --border: rgba(255, 255, 255, 0.07);
  --border-hover: rgba(255, 255, 255, 0.14);

  --text-primary: #E8EFF8;    /* Warm off-white — no eye strain */
  --text-secondary: #B8C8D8;  /* Gentle muted blue-white */
  --text-muted: #7A8FA8;      /* Cool slate muted */

  --shadow-glow: 0 4px 20px rgba(82, 168, 126, 0.06);
  --shadow-card: 0 6px 20px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 14px 32px rgba(0, 0, 0, 0.50);

  /* Success & Warning status variables (Dark default) */
  --status-pos-text: #70B893;
  --status-pos-border: #4F9A75;
  --status-pos-bg: rgba(79, 154, 117, 0.12);
  --status-neg-text: #FA8C50;
  --status-neg-border: #E0672E;
  --status-neg-bg: rgba(224, 103, 46, 0.12);
  --status-empty-text: #70B893;
  --status-empty-border: #4F9A75;
  --status-empty-bg: rgba(79, 154, 117, 0.1);

  /* Theme variables (Dark Default) */
  --bg-header: rgba(20, 26, 36, 0.96);
  --border-header: rgba(255, 255, 255, 0.08);
  --text-header-title: #FFFFFF;

  --select-arrow-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  --select-option-bg: #1B2332;
  --select-option-color: #FFFFFF;

  --bg-month-selector: #1B2333;
  --shadow-month-selector: 0 2px 6px rgba(0,0,0,0.35);
  --bg-popup: #1B2332;
  --bg-btn-secondary: #24303F;
  --bg-btn-secondary-hover: #2D333B;
  --bg-modal: #1B2332;
  --bg-modal-header: #1F242D;
  --bg-modal-footer: #1F242D;
  --bg-export-text: #1F242D;
  --bg-settlement-block: #1B2332;
  --bg-mini-zero: #1E2A3A;
  --bg-settlement-row: #24303F;
  --bg-settlement-row-hover: #2D333B;

  --text-lightbox: #E8EFF8;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --transition: all 0.2s ease-in-out;
  --transition-fast: all 0.1s ease-in-out;
}

body.light-theme {
  --bg-light: #F2F5F8;
  --bg-card: #FFFFFF;
  --bg-card-header: #EAEFF3;
  --border: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(0, 0, 0, 0.15);

  --text-primary: #1F2836;
  --text-secondary: #4A5668;
  --text-muted: #707E94;

  --shadow-glow: 0 4px 20px rgba(82, 168, 126, 0.08);
  --shadow-card: 0 6px 20px rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 10px 28px rgba(0, 0, 0, 0.09);

  /* Primary color overrides in Light mode (richer green, readable text) */
  --primary: #3F8A65;
  --primary-light: #255B41;
  --primary-dark: #3F8A65;
  --primary-bg-light: rgba(63, 138, 101, 0.08);

  /* Category accent overrides in Light mode (darker/richer for text readability) */
  --accent-rent: #2E7D5C;
  --accent-water: #1E70A0;
  --accent-electric: #A06C18;
  --accent-internet: #6A3CD0;
  --accent-ev: #B84D18;
  --accent-other: #5A6E85;

  /* Status overrides in Light mode (high contrast) */
  --status-pos-text: #1B7A4C;
  --status-pos-border: #2E7D32;
  --status-pos-bg: rgba(46, 125, 50, 0.08);
  --status-neg-text: #C44D08;
  --status-neg-border: #D84315;
  --status-neg-bg: rgba(216, 67, 21, 0.08);
  --status-empty-text: #2E7D32;
  --status-empty-border: #2E7D32;
  --status-empty-bg: rgba(46, 125, 50, 0.05);

  /* Light theme overrides */
  --bg-header: rgba(255, 255, 255, 0.95);
  --border-header: rgba(0, 0, 0, 0.08);
  --text-header-title: #1F2836;

  --select-arrow-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231F2836' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  --select-option-bg: #FFFFFF;
  --select-option-color: #1F2836;

  --bg-month-selector: #FFFFFF;
  --shadow-month-selector: 0 2px 6px rgba(0,0,0,0.06);
  --bg-popup: #FFFFFF;
  --bg-btn-secondary: #E4EBF1;
  --bg-btn-secondary-hover: #D7E1EB;
  --bg-modal: #FFFFFF;
  --bg-modal-header: #EAEFF3;
  --bg-modal-footer: #EAEFF3;
  --bg-export-text: #EAEFF3;
  --bg-settlement-block: #FFFFFF;
  --bg-mini-zero: #E4EBF1;
  --bg-settlement-row: #E4EBF1;
  --bg-settlement-row-hover: #D7E1EB;
}

/* Soften gradients on body background in Light Mode */
body.light-theme::before {
  background:
    radial-gradient(ellipse 55% 45% at 15% 10%, rgba(82, 168, 126, 0.05) 0%, transparent 55%),
    radial-gradient(ellipse 45% 50% at 85% 85%, rgba(232, 112, 56, 0.03) 0%, transparent 55%),
    radial-gradient(ellipse 40% 40% at 55% 45%, rgba(64, 144, 192, 0.03) 0%, transparent 65%),
    radial-gradient(ellipse 30% 30% at 70% 20%, rgba(144, 104, 240, 0.02) 0%, transparent 60%);
}

/* ============================================
   BASE
   ============================================ */
html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Sarabun', sans-serif;
  background: var(--bg-light);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* Warm background gradients for visible depth and eye comfort */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 55% 45% at 15% 10%, rgba(82, 168, 126, 0.10) 0%, transparent 55%),
    radial-gradient(ellipse 45% 50% at 85% 85%, rgba(232, 112, 56, 0.07) 0%, transparent 55%),
    radial-gradient(ellipse 40% 40% at 55% 45%, rgba(64, 144, 192, 0.06) 0%, transparent 65%),
    radial-gradient(ellipse 30% 30% at 70% 20%, rgba(144, 104, 240, 0.05) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.app-wrapper {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

/* ============================================
   CARD STYLES
   ============================================ */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}

.glass-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-hover);
}

/* ============================================
   HEADER
   ============================================ */
.app-header {
  background: var(--bg-header);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-header);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0 2rem;
}

.header-content {
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 0;
  gap: 1rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo {
  font-size: 2rem;
  filter: drop-shadow(0 4px 6px rgba(79, 154, 117, 0.2));
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.header-text h1 {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-header-title);
  line-height: 1.2;
}

.header-text p {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Header Right Wrap */
.header-right {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

/* Cloud Sync Status Indicator */
.sync-status {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-month-selector);
  border: 1.5px solid var(--border);
  border-radius: 99px;
  padding: 0.3rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: var(--transition);
  white-space: nowrap;
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.3s;
}

.sync-dot--syncing {
  background: #F8A97A;
  animation: syncPulse 1s ease-in-out infinite;
}
.sync-dot--synced {
  background: #52A87E;
  animation: none;
}
.sync-dot--error {
  background: #E87038;
  animation: none;
}
.sync-dot--offline {
  background: #7A8FA8;
  animation: none;
}

@keyframes syncPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.75); }
}

.sync-status-text {
  font-size: 0.72rem;
}

@media (max-width: 520px) {
  .sync-status-text { display: none; }
  .sync-status { padding: 0.3rem 0.45rem; }
}



/* Theme Toggle Button */
.theme-toggle-btn {
  background: var(--bg-month-selector);
  border: 1.5px solid var(--border);
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: var(--transition);
  box-shadow: var(--shadow-month-selector);
}

.theme-toggle-btn:hover {
  background: var(--primary-bg-light);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.theme-toggle-btn:active {
  transform: translateY(0);
}

body.light-theme .theme-icon-light {
  display: none;
}
body:not(.light-theme) .theme-icon-dark {
  display: none;
}

/* Month Selector */
.month-selector {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-month-selector);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 0.35rem 0.65rem;
  box-shadow: var(--shadow-month-selector);
}

.month-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.3rem;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}

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

.month-display {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-primary);
  min-width: 140px;
  text-align: center;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
  user-select: none;
}

.month-display:hover {
  background: var(--primary-bg-light);
  color: var(--primary-light);
}

/* Month Picker Popup */
.month-picker-popup {
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-popup);
  border: 2px solid var(--primary);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  width: 300px;
  z-index: 300;
  box-shadow: 0 12px 36px rgba(0,0,0,0.35);
  animation: popIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.picker-year-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1.5px solid rgba(255, 255, 255, 0.08);
}

.picker-year-label {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-primary);
}

.picker-nav-btn {
  background: var(--bg-btn-secondary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.picker-nav-btn:hover {
  background: var(--primary);
  color: var(--bg-light);
}

.picker-months-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.picker-month-btn {
  background: var(--bg-btn-secondary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.25rem;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
  text-align: center;
}

.picker-month-btn:hover {
  background: var(--primary-bg-light);
  border-color: var(--primary);
  color: var(--primary-light);
}

.picker-month-btn.active {
  background: var(--primary);
  border-color: var(--primary-light);
  color: var(--bg-light);
  box-shadow: 0 4px 10px rgba(82, 168, 126, 0.28);
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
  max-width: 1300px;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

/* ============================================
   SECTION
   ============================================ */
.section {
  width: 100%;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.section-title h2 {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-primary);
}

.section-icon {
  font-size: 1.4rem;
}

.badge {
  background: var(--bg-card);
  color: var(--primary-light);
  border: 1.5px solid var(--primary);
  border-radius: 100px;
  padding: 0.15rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 700;
}

/* ============================================
   MEMBERS
   ============================================ */
.members-section {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-card);
}

.members-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.member-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-btn-secondary);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0.35rem 0.85rem 0.35rem 0.5rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  transition: var(--transition-fast);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.member-chip:hover {
  border-color: var(--accent-pink);
  background: rgba(197, 107, 130, 0.12);
}

.member-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 800;
  flex-shrink: 0;
}

.member-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0 0 0 0.25rem;
  transition: var(--transition-fast);
}

.member-remove:hover {
  color: var(--accent-pink);
  transform: scale(1.2);
}

/* Inline form */
.inline-form {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.inline-form-actions {
  display: flex;
  gap: 0.5rem;
}

/* ============================================
   SUMMARY CARDS
   ============================================ */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.summary-card {
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border: 1.5px solid var(--border) !important;
  background: var(--bg-card);
}

.summary-card:nth-child(1) { border-top: 5px solid var(--primary) !important; }
.summary-card:nth-child(2) { border-top: 5px solid var(--accent-blue) !important; }
.summary-card:nth-child(3) { border-top: 5px solid var(--accent-ev) !important; }
.summary-card:nth-child(4) { border-top: 5px solid var(--accent-other) !important; }

.summary-icon { font-size: 2.2rem; }

.summary-info {
  display: flex;
  flex-direction: column;
}

.summary-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 700;
}

.summary-value {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-primary);
}

/* ============================================
   EXPENSE COLUMNS
   ============================================ */
.expenses-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

.expense-column {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.column-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 0.25rem;
}

.column-header h2 {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-primary);
}

.column-icon {
  font-size: 1.4rem;
}

.column-sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-left: auto;
  background: var(--bg-card);
  padding: 0.15rem 0.65rem;
  border-radius: 100px;
  border: 1.5px solid var(--border);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* ============================================
   EXPENSE CARD (DARK COZY ACCENT HEADERS)
   ============================================ */
.expense-card {
  overflow: hidden;
  background: var(--bg-card) !important;
  border: 1.5px solid var(--border) !important;
  box-shadow: var(--shadow-card);
}

.expense-card[data-category="rent"] .expense-card-header { background: rgba(58, 142, 110, 0.08); border-bottom: 2.5px solid var(--accent-rent); }
.expense-card[data-category="water"] .expense-card-header { background: rgba(52, 130, 181, 0.08); border-bottom: 2.5px solid var(--accent-water); }
.expense-card[data-category="electric"] .expense-card-header { background: rgba(184, 124, 49, 0.08); border-bottom: 2.5px solid var(--accent-electric); }
.expense-card[data-category="internet"] .expense-card-header { background: rgba(138, 92, 245, 0.08); border-bottom: 2.5px solid var(--accent-internet); }
.expense-card[data-category="ev"] .expense-card-header { background: rgba(224, 103, 46, 0.08); border-bottom: 2.5px solid var(--accent-ev); }
.expense-card[data-category="other"] .expense-card-header { background: rgba(113, 128, 150, 0.08); border-bottom: 2.5px solid var(--accent-other); }

.expense-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.25rem;
}

.expense-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text-primary);
}

.expense-emoji {
  font-size: 1.25rem;
}

.add-item-btn {
  background: var(--bg-btn-secondary);
  border: 1.5px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
  transition: var(--transition-fast);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.add-item-btn:hover {
  background: var(--text-primary);
  color: var(--bg-light);
  border-color: var(--text-primary);
}

/* Expense Items */
.expense-items {
  min-height: 40px;
  padding: 0.25rem 0;
  background: var(--bg-card);
}

.expense-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1.5px solid var(--border);
  transition: var(--transition-fast);
  animation: slideIn 0.25s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}

.expense-item:hover {
  background: var(--bg-btn-secondary-hover);
}

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

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

.item-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0.15rem;
}

.item-payer-tag {
  background: var(--bg-btn-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
}

.item-amount {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--primary-light);
  white-space: nowrap;
}

.item-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.95rem;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.item-delete:hover {
  color: var(--accent-pink);
  background: rgba(197, 107, 130, 0.15);
}

/* Empty state */
.empty-state {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
  padding: 1.5rem;
  font-weight: 600;
}

/* Expense Footer */
.expense-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1.25rem;
  background: var(--bg-card-header);
  border-top: 1.5px solid var(--border);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.expense-split-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  color: var(--text-primary);
}

.split-btn {
  background: var(--bg-btn-secondary);
  border: 1.5px solid var(--border);
  color: var(--text-primary);
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
  font-family: 'Sarabun', sans-serif;
  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.split-btn:hover {
  background: var(--primary-bg-light);
  border-color: var(--primary);
  color: var(--primary-light);
}

.split-count {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary-light);
  min-width: 24px;
  text-align: center;
}

.expense-subtotal {
  font-size: 0.88rem;
  color: var(--text-muted);
  text-align: right;
  font-weight: 650;
}

.expense-subtotal strong {
  font-size: 1.1rem;
  color: var(--text-primary);
  font-weight: 800;
}

.per-person {
  display: block;
  font-size: 0.78rem;
  color: var(--primary-light);
  font-weight: 800;
}

/* ============================================
   TENANT INCOME DEDUCTION CONTROL
   ============================================ */
.tenant-income-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.tenant-input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.15rem 0.4rem;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
}

.currency-prefix {
  font-size: 0.8rem;
  color: var(--accent-rent);
  font-weight: 800;
}

.tenant-input {
  background: none;
  border: none;
  color: var(--text-primary);
  width: 75px;
  font-size: 0.85rem;
  font-weight: 800;
  outline: none;
  font-family: 'Sarabun', sans-serif;
}

/* ============================================
   PER PERSON SUMMARY RECEIPT CARDS
   ============================================ */
.per-person-section {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
}

.per-person-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.5rem;
}

/* Receipt design card */
.person-card {
  background: var(--bg-card-header);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}

.person-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--primary);
}

/* Cute top stripe representing theme */
.person-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent-water) 33%, var(--accent-internet) 66%, var(--accent-ev) 100%);
}

.person-card-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  border-bottom: 2px dashed var(--border);
  padding-bottom: 0.65rem;
}

.person-card-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  flex-shrink: 0;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.5);
}

.person-card-name {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--text-primary);
}

/* Individual bill receipt block */
.receipt-bill-block {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.35rem 0;
}

.receipt-block-title {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--primary-light);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.15rem;
}

.person-breakdown {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding-left: 0.4rem;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.breakdown-label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: 600;
}

.breakdown-amount {
  font-weight: 750;
  color: var(--text-primary);
}

/* Receipts divider dashed line */
.receipt-divider {
  border-top: 1.5px dashed rgba(255, 255, 255, 0.12);
  margin: 0.25rem 0;
}

.receipt-sub-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding-left: 0.4rem;
  font-weight: 600;
}

.receipt-sub-row span:last-child {
  font-weight: 750;
  color: var(--text-secondary);
}

.receipt-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  padding-left: 0.4rem;
  font-weight: 800;
  margin-top: 0.1rem;
}

.receipt-total-row span:last-child {
  font-size: 1rem;
  color: var(--text-primary);
}

/* Net balance badge styled like a receipt stamp */
.person-balance {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 800;
  margin-top: 0.25rem;
}

.balance-positive {
  background: var(--status-pos-bg);
  border: 1.5px solid var(--status-pos-border);
  color: var(--status-pos-text);
}

.balance-negative {
  background: var(--status-neg-bg);
  border: 1.5px solid var(--status-neg-border);
  color: var(--status-neg-text);
}

.balance-zero {
  background: var(--bg-btn-secondary);
  border: 1.5px solid var(--border);
  color: #8B949E;
}

.person-balance-amount {
  font-size: 0.98rem;
  font-weight: 850;
}

.item-payer-tag-none {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
  font-weight: 600;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.55rem 1.15rem;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  font-family: 'Sarabun', sans-serif;
  transition: var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.btn-primary {
  background: var(--primary);
  color: var(--bg-light);
  border: 1.5px solid var(--primary-light);
}

.btn-primary:hover {
  transform: translateY(-1px);
  background: var(--primary-light);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}

.btn-outline:hover {
  background: rgba(79, 154, 117, 0.1);
}

.btn-ghost {
  background: var(--bg-btn-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--bg-btn-secondary-hover);
  color: var(--text-primary);
}

.btn-sm {
  padding: 0.35rem 0.85rem;
  font-size: 0.8rem;
}

/* ============================================
   INPUT FIELDS
   ============================================ */
.input-field {
  width: 100%;
  background: var(--bg-btn-secondary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Sarabun', sans-serif;
  font-size: 0.95rem;
  padding: 0.65rem 1rem;
  transition: var(--transition-fast);
  outline: none;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.5);
  font-weight: 600;
}

.input-field::placeholder {
  color: #718096;
}

.input-field:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 154, 117, 0.2);
}

.select-field {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: var(--select-arrow-icon);
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

.select-field option {
  background: var(--select-option-bg);
  color: var(--select-option-color);
}

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  width: 100%;
  max-width: 480px;
  background: var(--bg-modal);
  border: 2px solid var(--primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-hover);
  animation: modalIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.export-modal {
  max-width: 580px;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.9) translateY(15px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.5rem;
  border-bottom: 1.5px solid var(--border);
  background: var(--bg-modal-header);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
}

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

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.modal-close:hover {
  background: var(--primary-bg-light);
  color: var(--primary-light);
}

.modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  padding: 1rem 1.5rem;
  border-top: 1.5px solid var(--border);
  background: var(--bg-modal-footer);
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-label {
  font-size: 0.88rem;
  font-weight: 750;
  color: var(--text-secondary);
}

/* Export text */
.export-text {
  font-family: 'Sarabun', monospace;
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.8;
  background: var(--bg-export-text);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  font-weight: 600;
}

/* ============================================
   TOAST
   ============================================ */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--primary-dark);
  border: 2px solid var(--primary);
  color: white;
  padding: 0.75rem 1.75rem;
  border-radius: 100px;
  font-size: 0.95rem;
  font-weight: 700;
  z-index: 999;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  transition: var(--transition-slow);
  pointer-events: none;
}

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

.toast.hidden {
  display: block;
  opacity: 0;
  pointer-events: none;
}

/* ============================================
   HIDDEN UTILITY
   ============================================ */
.hidden {
  display: none !important;
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ============================================
   BADGE VARIANTS
   ============================================ */
.badge-green {
  background: var(--status-pos-bg);
  color: var(--status-pos-text);
  border: 1.5px solid var(--status-pos-border) !important;
}

.badge-orange {
  background: var(--status-neg-bg);
  color: var(--status-neg-text);
  border: 1.5px solid var(--status-neg-border) !important;
}

/* ============================================
   SETTLEMENT SECTION & SPLIT BLOCKS
   ============================================ */
.settlement-section {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
}

.settlement-containers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.settlement-block {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--bg-settlement-block);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
}

.settlement-block-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 2px dashed var(--border);
  padding-bottom: 0.65rem;
}

.settlement-block-header h3 {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
}

.block-title-icon {
  font-size: 1.3rem;
}

/* Balance mini cards row */
.balance-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.balance-mini-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.5rem;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  min-width: 66px;
  text-align: center;
  transition: var(--transition);
  animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  background: var(--bg-btn-secondary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.balance-mini-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}

.balance-mini-pos {
  background: var(--status-pos-bg);
  border-color: var(--status-pos-border);
}

.balance-mini-neg {
  background: var(--status-neg-bg);
  border-color: var(--status-neg-border);
}

.balance-mini-zero {
  background: var(--bg-mini-zero);
  border-color: var(--border);
}

.balance-mini-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
}

.balance-mini-name {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.balance-mini-amount {
  font-size: 0.8rem;
  font-weight: 800;
}

.balance-mini-pos .balance-mini-amount { color: var(--status-pos-text); }
.balance-mini-neg .balance-mini-amount { color: var(--status-neg-text); }
.balance-mini-zero .balance-mini-amount { color: var(--text-muted); }

/* Settlement transactions */
.settlement-transactions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.settlement-empty {
  text-align: center;
  color: var(--status-pos-text);
  font-weight: 800;
  padding: 1.25rem;
  background: var(--status-empty-bg);
  border: 2px dashed var(--status-pos-border);
  border-radius: var(--radius);
  font-size: 0.9rem;
}

/* Individual settlement rows */
.settlement-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 1rem;
  background: var(--bg-settlement-row);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 2px 5px rgba(0,0,0,0.15);
  transition: var(--transition);
  animation: slideIn 0.3s ease;
  flex-wrap: wrap;
}

.settlement-row:hover {
  border-color: var(--accent-ev);
  background: var(--bg-settlement-row-hover);
}

/* Checklist paid status row fade out */
.settlement-row.paid-row {
  opacity: 0.45;
  border-color: var(--border) !important;
  background: transparent !important;
  text-decoration: line-through;
}

.settlement-from,
.settlement-to {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 90px;
}

.settlement-to {
  justify-content: flex-end;
  flex-direction: row-reverse;
  text-align: right;
}

.settle-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
  flex-shrink: 0;
}

.settle-name {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.settlement-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.05rem;
  flex-shrink: 0;
}

.arrow-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 800;
}

.arrow-amount {
  font-size: 1rem;
  font-weight: 800;
  color: var(--status-neg-text);
  background: var(--status-neg-bg);
  padding: 0.15rem 0.65rem;
  border-radius: 100px;
  border: 1px solid var(--status-neg-border);
  white-space: nowrap;
}

.arrow-icon {
  font-size: 1rem;
  color: var(--status-neg-border);
}

/* Payment checklist buttons */
.btn-paid-toggle {
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
  font-family: 'Sarabun', sans-serif;
  transition: var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  text-decoration: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  user-select: none;
}

.btn-paid-toggle.unpaid {
  background: var(--bg-btn-secondary-hover);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.btn-paid-toggle.unpaid:hover {
  background: var(--bg-btn-secondary);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.btn-paid-toggle.paid {
  background: var(--status-pos-bg);
  border: 1.5px solid var(--status-pos-border);
  color: var(--status-pos-text);
}

.btn-paid-toggle.paid:hover {
  background: rgba(79, 154, 117, 0.25);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 950px) {
  .settlement-containers-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .expenses-columns {
    grid-template-columns: 1fr;
  }

  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .main-content {
    padding: 1rem;
    gap: 1rem;
  }

  .app-header {
    padding: 0 1rem;
  }

  .header-text h1 {
    font-size: 1.15rem;
  }

  .summary-grid {
    grid-template-columns: 1fr 1fr;
  }

  .month-display {
    min-width: 110px;
    font-size: 0.95rem;
  }

  .settlement-row {
    flex-direction: column;
    text-align: center;
    gap: 0.5rem;
  }

  .settlement-from,
  .settlement-to {
    justify-content: center;
    flex-direction: row;
    text-align: left;
  }
}

/* ============================================
   EV PARTICIPANT CHIPS
   ============================================ */
.ev-footer-custom {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.9rem 1.25rem;
  background: var(--bg-card-header);
  border-top: 1.5px solid var(--border);
}

.ev-participants-control {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ev-part-label {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ev-participant-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.ev-chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: 100px;
  padding: 0.3rem 0.65rem 0.3rem 0.35rem;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: var(--transition-fast);
  font-family: 'Sarabun', sans-serif;
  user-select: none;
}

.ev-chip-active {
  border-color: var(--status-pos-border);
  background: var(--status-pos-bg);
  color: var(--status-pos-text);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.ev-chip-active:hover {
  background: var(--status-pos-bg);
  opacity: 0.95;
  transform: translateY(-1px);
}

.ev-chip-inactive {
  border-color: var(--border);
  background: var(--bg-btn-secondary);
  color: var(--text-muted);
}

.ev-chip-inactive:hover {
  border-color: var(--primary);
  color: var(--text-primary);
  background: var(--primary-bg-light);
}

.ev-chip-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  flex-shrink: 0;
}

.ev-footer-custom .expense-subtotal {
  text-align: right;
  padding-top: 0.5rem;
  border-top: 1.5px dashed var(--border);
}

/* ============================================
   PER-ITEM SPLIT BADGE (Other category)
   ============================================ */
.item-split-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 750;
  color: var(--accent-water);
  background: rgba(52, 130, 181, 0.1);
  border: 1px solid var(--accent-water);
  border-radius: 100px;
  padding: 0.15rem 0.5rem;
}

/* Modal split control */
.modal-split-control {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Modal participants chips container */
.modal-participants-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.25rem 0;
}

/* Other Expenses Settlement display details */
.settlement-other-item {
  border-bottom: 1.5px solid var(--border);
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
}

.settlement-other-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.settlement-other-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.settlement-other-transfers {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding-left: 0.5rem;
}

/* ============================================
   CONFIRM DELETE DIALOG
   ============================================ */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.confirm-overlay.confirm-visible {
  opacity: 1;
}

.confirm-overlay.confirm-visible .confirm-dialog {
  transform: scale(1) translateY(0);
}

.confirm-dialog {
  background: var(--bg-card);
  border: 1px solid rgba(232, 112, 56, 0.35);
  border-radius: var(--radius-lg);
  padding: 2rem 2rem 1.75rem;
  max-width: 380px;
  width: 100%;
  text-align: center;
  transform: scale(0.88) translateY(16px);
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(232, 112, 56, 0.2);
}

.confirm-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
  animation: wobble 0.5s ease 0.15s both;
}

@keyframes wobble {
  0%   { transform: rotate(0deg) scale(0.8); }
  40%  { transform: rotate(-10deg) scale(1.15); }
  70%  { transform: rotate(6deg) scale(1.05); }
  100% { transform: rotate(0deg) scale(1); }
}

.confirm-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.6rem;
}

.confirm-msg {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

.confirm-item-name {
  color: #F0A070;
  font-weight: 700;
  word-break: break-word;
}

.confirm-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.confirm-actions .btn {
  flex: 1;
  max-width: 150px;
}

.btn-danger {
  background: linear-gradient(135deg, #D94040, #B02828);
  color: #fff;
  border: none;
  font-weight: 700;
  border-radius: var(--radius-sm);
  padding: 0.6rem 1.25rem;
  cursor: pointer;
  font-size: 0.9rem;
  font-family: inherit;
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(185, 40, 40, 0.35);
}

.btn-danger:hover {
  background: linear-gradient(135deg, #E85050, #C03030);
  box-shadow: 0 6px 18px rgba(185, 40, 40, 0.5);
  transform: translateY(-1px);
}

.btn-danger:active {
  transform: translateY(0);
}

/* ============================================
   ITEM LAYOUT (right side actions)
   ============================================ */
.item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
  flex-shrink: 0;
}

.item-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* ============================================
   SLIP UPLOAD AREA (in modal)
   ============================================ */
.slip-file-input {
  display: none;
}

.slip-upload-area {
  border: 2px dashed var(--border-hover);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  background: rgba(255,255,255,0.02);
}

.slip-upload-area:hover {
  border-color: var(--primary);
  background: var(--primary-bg-light);
}

.slip-upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 1.25rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  user-select: none;
}

.slip-upload-icon {
  font-size: 2rem;
  line-height: 1;
}

.slip-upload-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  opacity: 0.7;
}

.slip-preview-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
}

.slip-preview-img {
  max-width: 100%;
  max-height: 200px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.slip-remove-btn {
  background: rgba(220, 60, 60, 0.15);
  border: 1px solid rgba(220, 60, 60, 0.35);
  color: #F08080;
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.75rem;
  font-size: 0.78rem;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
}

.slip-remove-btn:hover {
  background: rgba(220, 60, 60, 0.28);
  color: #FF9090;
}

/* ============================================
   SLIP THUMBNAIL (on item rows)
   ============================================ */
.slip-thumb-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  background: var(--primary-bg-light);
  border: 1px solid rgba(82, 168, 126, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.35rem;
  cursor: pointer;
  transition: var(--transition-fast);
  max-width: 56px;
}

.slip-thumb-btn:hover {
  border-color: var(--primary);
  background: rgba(82, 168, 126, 0.18);
  transform: scale(1.05);
}

.slip-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
  display: block;
}

.slip-thumb-label {
  font-size: 0.6rem;
  color: var(--primary-light);
  font-weight: 700;
  white-space: nowrap;
}

/* Inline attach button (📎) */
.slip-attach-inline {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.05);
  border: 1px dashed var(--border-hover);
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition-fast);
  color: var(--text-muted);
  user-select: none;
}

.slip-attach-inline:hover {
  background: var(--primary-bg-light);
  border-color: var(--primary);
  color: var(--primary-light);
}

/* ============================================
   LIGHTBOX
   ============================================ */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transition: opacity 0.22s ease;
}

.lightbox-overlay.lightbox-visible {
  opacity: 1;
}

.lightbox-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.lightbox-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  background: rgba(27, 35, 50, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.lightbox-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60%;
}

.lightbox-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.lightbox-download-btn {
  font-size: 0.82rem;
  padding: 0.35rem 0.85rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.lightbox-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--text-primary);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.lightbox-close:hover {
  background: rgba(220, 60, 60, 0.3);
  border-color: rgba(220, 60, 60, 0.5);
  color: #FF9090;
}

.lightbox-img-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  overflow: auto;
}

.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
  display: block;
}

@media (max-width: 600px) {
  .lightbox-toolbar { padding: 0.6rem 0.85rem; }
  .lightbox-title { font-size: 0.82rem; max-width: 50%; }
  .lightbox-download-btn { display: none; }
}

/* ============================================
   CHARGE INFO LINK
   ============================================ */
.charge-info-link {
  font-size: 0.78rem;
  text-decoration: none;
  color: var(--accent-ev);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: 800;
  transition: var(--transition-fast);
}

.charge-info-link:hover {
  opacity: 0.85;
  text-decoration: underline !important;
  transform: translateX(2px);
}


